Skip to main content

Toolkit - Installation and Configuration

This post if part of a series about the File System Toolkit - a custom content delivery API for SDL Tridion.

The File System Toolkit consists of two parts: a Deployer extension and the Content Delivery API itself. This post describes installing and configuring both.

Toolkit JARs are available under the GitHub repository of the File System Toolkit project, in folder /distributable. Alternatively, you can build your JARs using the sources available on GitHub.

Toolkit Deployer Installation

This deployer extension handles the creation of JSON files on the file system. The Toolkit CD API then reads these JSON files and creates model objects from them.

In order to obtain these JSON files, a deployer extension must be installed on top of a functional Tridion Content Delivery Deployer. The Toolkit deployer extension works for both file system-based or database-based Tridion Deployers.

1. In the Tridion Deployer /lib folder, copy files:
  • toolkit-api.jar
  • toolkit-deployer.jar
  • toolkit-model.jar
2. Also to folder /lib, copy files:
  • ehcache-2.8.3.jar
  • jackson-annotations-2.6.4.jar
  • jackson-core-2.6.4.jar
  • jackson-databind-2.6.4.jar
  • logback-classic.jar
  • logback-core.jar
  • slfj-api.jar
3. Edit or create if it doesn't exist, file toolkit.properties and place it in the class-path of the Deployer (/WEB-INF/classes for an HTTP deployer). The following properties are relevant for deployer extension:
  • cacheEnabled - boolean whether to use cache or not;
  • cacheMaxEntriesLocalHeap - integer the size of the cache;
  • cacheMonitorSeconds - integer the interval in seconds to perform cache stale checks;
  • cacheTimeToLiveSeconds - integer the number of seconds to keep an item in cache;
  • cacheTimeToIdleSeconds - integer the number of seconds to keep an idle item in cache;
  • cleanup - boolean whether to delete empty directories after unpublish;
  • contentRoot - string the path where the published Tridion pages are published (this path is defined in cd_storage_conf.xml);
  • jsonRoot - string the path where the JSON files are stored under;
  • prettyPrintJson - boolean whether to space indent JSON files for better human-reading or not;
4. Edit file cd_deployer_conf.xml. Add the following lines before the end tag </Processors>

<!-- Toolkit JSon Modules -->
<Processor Action="Deploy" Phase="post-transaction" Class="com.tridion.deployer.Processor">
    <Module Type="PageDeploy" Class="com.mitza.toolkit.deployer.JSonPageDeploy"/>
    <Module Type="ComponentDeploy" Class="com.mitza.toolkit.deployer.JSonComponentDeploy"/>
    <Module Type="ComponentPresentationDeploy"
            Class="com.mitza.toolkit.deployer.JSonComponentPresentationDeploy"/>
    <Module Type="BinaryDeploy" Class="com.mitza.toolkit.deployer.JSonBinaryDeploy"/>
</Processor>

<Processor Action="Undeploy" Phase="post-transaction" Class="com.tridion.deployer.Processor">
    <Module Type="PageUndeploy" Class="com.mitza.toolkit.deployer.JSonPageUndeploy"/>
    <Module Type="ComponentPresentationUndeploy"
            Class="com.mitza.toolkit.deployer.JSonComponentPresentationUndeploy"/>
</Processor>
<!-- End of Toolkit JSon Modules -->

5. Edit file cd_storage_conf.xml. Add the following lines after the opening tag <Storages>

<StorageBindings>
    <Bundle src="toolkit_dao_bundle.xml"/>
</StorageBindings>

6. Restart the Deployer

Toolkit API Installation

The Toolkit is an API to be used in your web-application as middle-tier to retrieve content published from SDL Tridion. The installation implies copying the JARs and configuration files to folders available in the class-path of your web-application:

1. In your web-application /lib folder, copy files:
  • toolkit-api.jar
  • toolkit-dynamic.jar
  • toolkit-model.jar
2. Also to folder /lib, copy files:
  • ehcache-2.8.3.jar 
  • jackson-annotations-2.6.4.jar 
  • jackson-core-2.6.4.jar 
  • jackson-databind-2.6.4.jar 
  • logback-classic.jar 
  • logback-core.jar 
  • slfj-api.jar 
3. Edit or create if it doesn't exist, file toolkit.properties and place it in folder /WEB-INF/classes. The following properties are relevant:
  • cacheEnabled - boolean whether to use cache or not;
  • cacheMaxEntriesLocalHeap - integer the size of the cache;
  • cacheMonitorSeconds - integer the interval in seconds to perform cache stale checks;
  • cacheTimeToLiveSeconds - integer the number of seconds to keep an item in cache;
  • cacheTimeToIdleSeconds - integer the number of seconds to keep an idle item in cache;
  • contentRoot - string the path where the published Tridion pages are published (this path is defined in cd_storage_conf.xml);
  • jsonRoot - string the path where the JSON files are stored under;
In case dynamic tags are used, they can be configured using properties tag.name.X and tag.class.X. These tags define the tag name and tag fully qualified class name to be executed when the given tag name is encountered in the Component Presentation content. The X stands for a 1-based counter that allows us to define several tags by simply incrementing the counter.

Example:
The following definition of tags defines 2 tags. First with name mytag backed by class com.mitza.toolkit.tag.MyTag and the second with name yourtag and backed by class com.mitza.toolkit.tag.SecondTag:

tag.name.1=mytag
tag.class.1=com.mitza.toolkit.tag.MyTag
tag.name.2=yourtag
tag.class.2=com.mitza.toolkit.tag.SecondTag

At this moment, the Toolkit API can be executed in the web-application.

Logging

The Toolkit uses logback API. This can be configured in a logback.xml file in the web-application class-path (typically in WEB-INF/classes folder).

Add a logger on classes under com.mitza package and the logging will be output.

Sample logback.xml that outputs to console:

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
    <property name="log.pattern" value="%date [%thread] %5p %c{1} - %m%n"/>
    <property name="log.level" value="info"/>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
    </appender>

    <logger name="com.mitza" level="${log.level}"/>

    <root level="OFF">
        <appender-ref ref="STDOUT"/>
    </root>
</configuration>



Comments

Popular posts from this blog

Running sp_updatestats on AWS RDS database

Part of the maintenance tasks that I perform on a MSSQL Content Manager database is to run stored procedure sp_updatestats . exec sp_updatestats However, that is not supported on an AWS RDS instance. The error message below indicates that only the sa  account can perform this: Msg 15247 , Level 16 , State 1 , Procedure sp_updatestats, Line 15 [Batch Start Line 0 ] User does not have permission to perform this action. Instead there are several posts that suggest using UPDATE STATISTICS instead: https://dba.stackexchange.com/questions/145982/sp-updatestats-vs-update-statistics I stumbled upon the following post from 2008 (!!!), https://social.msdn.microsoft.com/Forums/sqlserver/en-US/186e3db0-fe37-4c31-b017-8e7c24d19697/spupdatestats-fails-to-run-with-permission-error-under-dbopriveleged-user , which describes a way to wrap the call to sp_updatestats and execute it under a different user: create procedure dbo.sp_updstats with execute as 'dbo' as...

I Have Gone Dark

Maybe it's the Holidays, but my mood has gone pretty dark. That is, regarding the look and feel of my computer and Tridion CME, of course. What I did was to dim the lights on the operating system, so I installed Placebo themes for Windows 7 . I went for the Ashtray look -- great name :) My VM looks now like this: But, once you change the theme on Windows, you should 'match' the theme of your applications. Some skin easily, some not. The Office suite has an in-built scheme, which can be set to Black , but it doesn't actually dim the ribbon tool bars -- it looks quite weird. Yahoo Messenger is skinnable, but you can't change the big white panels where you actually 'chat'. Skype is not skinnable at all. For Chrome, there are plenty of grey themes. Now i'm using Pro Grey . But then I got into changing the theme of websites. While very few offer skinnable interfaces (as GMail does), I had to find a way to darken the websites... Enter Stylish -- a pl...

REL Standard Tag Library

The RSTL is a library of REL tags providing standard functionality such as iterating collections, conditionals, imports, assignments, XML XSLT transformations, formatting dates, etc. RSTL distributable is available on my Google Code page under  REL Standard Tag Library . Always use the latest JAR . This post describes each RSTL tag in the library explaining its functionality, attributes and providing examples. For understanding the way expressions are evaluated, please read my post about the  Expression Language used by REL Standard Tag Library . <c:choose> / <c:when> / <c:otherwise> Syntax:     <c:choose>         <c:when test="expr1">             Do something         </c:when>         <c:when test="expr2">             Do something else         </c:when...