Refresh Software Support Center

Contact Support
 

Email:
support@refreshsoftware.com

Phone:
508-318-4480


  Link to this page

Home >  Hot Deploy

Hot Deploy

Currently, changes to Assets via Workflow custom triggers require the SR2 system application to be restarted or the SR2 package to be redeployed. For current “builtin” trigger processing, the changes for the builtin trigger are made within the SR2 Enterprise Application Archive (EAR) file. To better support maintainability for custom trigger processing, the trigger custom processing logic can be placed in an external Java file that can then be Hotdeployed to the Content Domain instance. Further changes to the custom processing logic are re-hotdeployable. Additional new triggers can be hotdeployed.

Hotdeploy

Steps to create SR2 Triggers that are Hotdeployable are mentioned in the section below.

Technical Setup

Please download the SR2_Tigger.zip file and follow the instructions below. The example in SR2Trigger.zip is windows specific only but can easily be customized to run on UNIX servers.


SR2_Trigger Sample

The SR2Trigger sample shows how to develop a simple Trigger that shows best practices for Hotdeploy and Creating and Updating Assets when a Workflow Step is executed. The SR2Trigger is a simple Java project that will deploy a SAR into JBoss.

Unzip the SR2_Trigger sample onto your filesystem.

1.    Review the java sample trigger, TestMoreAdvancedUserAction, in the SR2Trigger/src/com/SR2Trigger directory.

•    For creating assets/updating assets from the trigger , the trigger class should extend UpdateUserAction’s  execute method. i.e

         public void execute(String contentDomain, CurrentAsset asset1,
               String user, String triggerPoint, String step,ArrayList assetList)

•    To create/update assets create new instance of AssetData and set values like name of the asset, Assettype that asset belongs to, workflow that should be associated to the asset,  and the content can be assigned using Field class and assigning field to assetData. Finally create AssetCreateOrUpdate instance and set above created assetData to it and set next step . If the name of the asset already exists then it will be updated otherwise a new one will be created.

For example :

         //Set Asset Data like below   
                 AssetData asset = new AssetData();
                 asset.setAssetType("general");
                 asset.setWorkflow("TriggerCreatedAssetWF");
                 asset.setName(“assetName”);
       
//Set Fields like below
        Field flds[] = new Field[2];

Field f1 = new Field();
 f1.setName(“title”);
f1.setData(“title”.getBytes());

Field f2   = new Field();
     f2.setName(“content”);
 f2.setData(“Some Content Here”.getBytes());

flds[0] = f1;
flds[1] = f2;

asset.setField(flds);

//Now create AssetCreate instance and assgn assetData

AssetCreateOrUpdate ac = new AssetCreateOrUpdate();
     ac.setAsset(asset);
ac.setNextStep(1);

//Now add to the arraylist supplied n the argument of execute method

assetList.add(ac);


2.    If user wants to use the current asset from which this trigger is being called, it can be accessed from the CurrentAsset object that is obtained from the execute method argument.

3.    The example provided contains trigger code which gets called from an asset (say English Content Asset) and creates 5 other assets with String of different languages attached to it. To run the example provided following steps need to be followed

Build and Deploy the Trigger into SR2

1.    Go to directory SR2_Trigger
2.    Update the local.properties file to reflect your environment setting
3.    Move sitefresh-api.jar to your {testjar.location}. {testjar.location} is defined in the local.properties file.
4.    Update the jboss-service.xml file in /resources to point to the sr-domain EAR instance. The entry here assumes you have a Content Domain with name “srdomain”.
5.    Build the Trigger by running the ant task from the build.xml provided:
o    ant –f build.xml preparetestjar
6.    Build the SAR archive and deploy:
o    Ant –f build.xml deploytestsar

This will move the SAR archive into the {testjar.location}. The SAR archive contains the Trigger JAR and the META-INF/jboss-service.xml.




Steps in SR2 Console to define the Trigger


1.    Create a Trigger,  sampleUpdatableTrigger and give invocation style as java and command as com.JBossTest.TestMoreAdvancedUserAction

2.    Create a step, sampleUpdatingStep and assign  sampleUpdatableTrigger  as entry trigger.

3.    Create a workflow, SampleWorkflow and assign above created step as one of the steps and assettype as general.

4.    Create a workflow called TriggerCreatedAssetWF(as this is the WF name mentioned in the Trigger code and can be changed accordingly)


Please note the “hardcoded” values:

o    Assettype is taken as "general" in the Trigger   
o    Workflow is hardcoded as "TriggerCreatedAssetWF" and can be changed accordingly

Steps to Run the Trigger from SR2


1.    Select SampleWorkflow  and create asset, say sampleAsset  and enter name,title,content(enter some text here)

2.    Upon click of the step sampleUpdatingStep (or if it is first step in worfkflow then no need to select it), trigger gets fired and creates 5 new assets with "spanish","French","German","Dutch","Indian" attached to the given or currently created asset name(i.e for eg :SpanishsampleAsset,FrenchSampleAsset etc..) . If sampleAsset is updated with new content then same content change will be reflected in other assets also.

Re-HotDeploy the Trigger into SR2

1.    Go to directory SR2_Trigger
2.    Make changes to the Trigger Java class as necessary.
3.    Re-build the Trigger by running the ant task from the build.xml provided:
a.    ant –f build.xml preparetestjar

4.    Now re-build the SAR archive and deploy:
a.    Ant –f build.xml deploytestsar

This will move the updated SAR archive into the {testjar.location}. The SAR archive contains the Trigger JAR and the META-INF/jboss-service.xml.