Skip to main content

Posts

Showing posts from August, 2016

Toolkit - Custom Tags Execution while Assembling

This post if part of a series about the  File System Toolkit  - a custom content delivery API for SDL Tridion. This post presents the TagFactory in charge with execution of custom tags for the Toolkit Component Presentations. The content of Dynamic Component Presentations can contain custom tags in the form of <mytag>some body</mytag> . These XML-like nodes are backed by a Java class that is executed when the tag is rendered. The configuration of tag names and Java class name is done in file toolkit.properties. More information is available in post Installation and Configuration . The custom tag support uses the following concepts: TagFactory -- the entry point into execution of tags for a piece of content; TagSupport -- class that associates a tag name with a tag implementation class; TagRenderer -- interface that a tag implementation class must implement; TagRenderer Interface This is the interface that any tag class must implement. It contains only one me

Toolkit - Component Presentation Assembler

This post if part of a series about the  File System Toolkit  - a custom content delivery API for SDL Tridion. This post describes a Component Presentation Assembler factory. Its role is to retrieve a Dynamic Component Presentation and to trigger the execution of its content. Then the resolved content is returned. The only method the assembler has is getContent(int, int, int), which takes parameters Publication id, Component id and Component Template id. It uses the ComponentPresentationFactory to retrieve the DCP. Next, it triggers the execution of any custom tags might be in the DCP's content. The content can contain XML-like tags (e.g. <mytag>some body</mytag> ). The tag support engine will execute all custom tags it finds in the content. Finally, the resolved content is returned by the assembler and it is ready to be displayed on the response. public String getContent ( int publicationId , int componentId , int templateId ) { ComponentPresenta

Tookit - Component Presentation Factory

This post if part of a series about the  File System Toolkit  - a custom content delivery API for SDL Tridion. This post presents the Component Presentation Factory in the Toolkit. Its role is to retrieve a Dynamic ComponentPresentationMeta models based on several criteria. The factory implements lookup methods by ids - Publication id, Component id, Component Template id and another one for getting a DCP based on the highest linking priority. Method getComponentPresentation(int, int, int) The three parameters, Publication id, Component id and Component Template id identify uniquely a Dynamic Component Presentation. If such a DCP is exists (i.e. is published), it id returned. This method retrieves the Component model and then iterates over its DCP collection, returning the DCP with the given Component Template id, if available. public ComponentPresentationMeta getComponentPresentation ( int publicationId , int componentId , int templateId ) { TcmUri componentUri

Toolkit - Dynamic Linking

This post if part of a series about the  File System Toolkit  - a custom content delivery API for SDL Tridion. In this post I describe the dynamic link resolving logic as part of the Link Factory. There are three types of links: Component, Page and Binary links. Each of these links can be resolved using the Link Factory. Component Link Resolving a Component link implies finding the URL of the Page the target Component appears on. Using the current Toolkit models, it is quite straight forward to retrieve the URL, because the link information is contained within the Component model. However, there might be several potential links available when performing Component link resolving. Namely, there can be several cases possible: there is no linking information available in the Component model -- this means the link cannot be resolved (i.e. there is no Page published that contains the given Component); there is exactly one Page available that contains the Component -- this means

Toolkit - Cache Invalidation

This post if part of a series about the  File System Toolkit  - a custom content delivery API for SDL Tridion. In previous post, I explained the use of a  Cache Factory . This post describes a very simple cache invalidation mechanism the Toolkit uses in order to make sure it does not serve stale values (for a long time). Given the nature of the Toolkit storage, i.e. files on a file-system, it is very easy to check when they were last published. By simply looking at the JSON model file last modified attribute, one can see the very moment that model was created/updated. This is the last publish time-stamp as well. When a CacheElement is placed in cache, it is also given a last-check timestamp, which initially is set to now. This last-check will be greater than the JSON file last-modified attribute. The moment the JSON model is republished, the file last-modified file attribute will be greater than the last-check . When this happens, we know the CacheElement is stale and we remov