AtcToolkit

Here is a collection of a few extensions I’ve found useful over the past couple of years.

Download link: AtcToolkitDistribution.zip

$user.debug
This extension allows you to inspect and/or manipulate any java object, or invoke any method that an object has. This is mainly for speeding up development of new templates since I find myself doing just this with long convoluted VTL code while developing new templates. Debug extension calls will probably not make it into final templates.

$user.regex
This extension exposes the java.util.regex.Pattern class to velocity, making it easier to use complex regular-expression-based algorithms.

$user.datasourceTools
This extension allows database templates to fill in origin and other information based on information stored in the main sys_datasourceResolver Bean (set up in the server administration app). It allows you to use a site/context variable to indicate which database to publish to and then use that database’s credentials from the datasource definition.

$user.asmTools
This extension will allow the assembly of any arbitrary content item as a clone of a passed in parent assembly item. It will be useful when loading content from manual links.

Item Filter Rule atc_filterByFolderPrecedence
This extension is a somewhat more complicated version of sys_filterBySiteFolder. It essentially allows you to define a set of folders that are used to define a hierarchy of precedence within your Site folder. The intent with this extension is to prevent the flash of production data in the development (or QA or Staging) environment between when your production data is published to that environment and overriding content overwrites it. The kicker here is that you now don’t have to keep a full set of data specific to your dev and test environments - now, you only need to have items that you’re specifically working on. In conjunction with Promotable Versions, this should allow you to have multiple versions of a content item in flux at any time.

The usage of the atc_filterByFolderPrecedence item filter rule is somewhat complicated and I can explain it further if anyone needs clarification.

Minor update:

Added $user.asmTools.lookupPublishPath(id) - This method looks up the publish path of a folder or content item to the nearest Site root folder. This is useful when you have several related sites with mirrored folder hierarchies. In my case, it was Dev, QA and Prod environment sites which publish content from all 3 CX folder hierarchies to all 3 output locations.

Added $user.asmTools.createAssemblyItem(params) - This method creates a new assembly item with no parent item using the given parameters (expressed as either a Map or a Query String). This can be especially useful in location scheme generation when no parent assembly item is available.

Download link: AtcToolkitDistribution-1.1.zip

This is my customzied install.sh

-bash-3.2$ cat install.sh
RHYTHMYX_HOME=/apps/percussion/Rhythmyx
export RHYTHMYX_HOME
JAVA_HOME=/apps/percussion/Rhythmyx/JRE
export JAVA_HOME
ANT_HOME=/apps/percussion/Rhythmyx/Patch/InstallToolkit
export ANT_HOME
CLASSPATH=
export CLASSPATH

chmod u+x $ANT_HOME/bin/ant
exec $ANT_HOME/bin/ant --noconfig -buildfile deploy.xml dist

I do NOT think the install is successful since there is exception at the end of installExtensions

-bash-3.2$ ./install.sh
Unable to locate tools.jar. Expected to find it in /apps/percussion/Rhythmyx/lib/tools.jar
Buildfile: deploy.xml

dist:
[echo] Installing AtcToolkit to /apps/percussion/Rhythmyx

jarcopy:
[copy] Copying 1 file to /apps/percussion/Rhythmyx/AppServer/server/rx/deploy/rxapp.ear/rxapp.war/WEB-INF/lib
[copy] Copying /home/lanh/AtcToolkit Distribution/lib/AtcToolkit.jar to /apps/percussion/Rhythmyx/AppServer/server/rx/deploy/rxapp.ear/rxapp.war/WEB-INF/lib/AtcToolkit.jar

installExtensions:
[java] Jul 27, 2011 5:29:45 PM com.percussion.extension.PSExtensionManager init
[java] INFO: Initializing extension manager.
[java] Jul 27, 2011 5:29:45 PM com.percussion.extension.PSExtensionManager init
[java] INFO: Initialization successful.
[java] Exception installing extensions: com.percussion.extension.PSExtensionException: ExtensionHandler; Java; java.lang.NoClassDefFoundError: com/percussion/rx/delivery/IPSDeliveryItem
[java] com.percussion.extension.PSExtensionException: ExtensionHandler; Java; java.lang.NoClassDefFoundError: com/percussion/rx/delivery/IPSDeliveryItem
[java] at com.percussion.extension.PSJavaExtensionHandler.loadExtension(Unknown Source)
[java] at com.percussion.extension.PSExtensionHandler.prepare(Unknown Source)
[java] at com.percussion.extension.PSExtensionManager.exists(Unknown Source)
[java] at com.percussion.util.PSExtensionInstallTool.installExtension(Unknown Source)
[java] at com.percussion.util.PSExtensionInstallTool.installExtension(Unknown Source)
[java] at com.percussion.util.PSExtensionInstallTool.installExtensions(Unknown Source)
[java] at com.percussion.util.PSExtensionInstallTool.InstallExtensions(Unknown Source)
[java] at com.percussion.util.PSExtensionInstallTool.main(Unknown Source)
[java] Java Result: 1

BUILD SUCCESSFUL
Total time: 1 second

looks like the file copy worked, but the extension install didn’t… copy the <Extension> entries from the extensions.xml (everything between <PSXExtensionHandlerConfig> and </PSXExtensionHandlerConfig>), and paste them into the extensions.xml file at Rhythmyx\Extensions\Handlers\Java\1\Extensions.xml