Create new trigger code

As a first step, you can add your own triggers to the list of pre-configured triggers, and then you can enable them.

The code for custom triggers is loaded through configuration. It does not modify the IXIA CCMS installation. You can return at any time to the standard CCMS behavior by returning to the original configuration.

Note: You can create triggers for all actions except the localization operations.
Important: Make configuration changes in a test environment and confirm they work before copying them to a production environment.

To create new trigger code:

  1. Create a Java class with the trigger code.
    For example, the following code shows a class (AddPrepublishFlagTrigger.java) that adds a flag to content objects that are nearing Published:done status.
    package com.ixiasoft.cms.triggers;
    
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.HashSet;
    import java.util.List;
    import java.util.Set;
    
    import org.apache.log4j.Logger;
    
    import com.ixiasoft.cms.actions.ActionCmsDataObject;
    import com.ixiasoft.cms.cdo.CdoCache;
    import com.ixiasoft.cms.cdo.CmsDataObject;
    import com.ixiasoft.cms.util.DitaReferenceResolver;
    
    public class AddPrepublishFlagTrigger extends StatusTrigger {
    	private static Logger logger = Logger.getLogger(AddPrepublishFlagTrigger.class);
    	public AddPrepublishFlagTrigger(String name, int objType, int schedule, String applyto) {
    		super(name, objType, schedule, applyto);
    	}
    
    	@Override
    	public void statusExecute(ActionCmsDataObject acdo) {
    		
    		logger.debug("Adding Prepublish Flag on MAP " + acdo.getCdo().getTitleAndId() );
    		CmsDataObject map = acdo.getCdo();
    		
    		Collection<CmsDataObject> childrenContentDependencies = DitaReferenceResolver.getChildrenContentDependencies( map, null );
    		Set<String> children = new HashSet<String>();
    		for (CmsDataObject cdo : childrenContentDependencies){
    			children.add(cdo.getFullPath());
    		}
    		//Add current map, so it gets the props.
    		children.add( map.getFullPath() );
    		
    		CdoCache.lockDocuments( new ArrayList<String>( children ) );
    		List<CmsDataObject> documents = new ArrayList<CmsDataObject>( children.size() );
    		for( String reference : children ) {
    			CmsDataObject childcdo = CdoCache.getCmsDataObject( reference );
    			childcdo.addUserProperty( CmsDataObject.PREPUBLISH, map.getFullPath() );
    			documents.add( childcdo );
    		}
    		
    		CdoCache.setDocuments(documents, true );
    		CdoCache.unlockDocuments( documents );
    		
    	}
    }
  2. Create a Java archive (.jar) that includes the new class for the trigger.
  3. In the TEXTML Administration perspective, connect to your server.
  4. Expand the Content Store's Repository node and browse to /system/ext.
  5. Import the .jar file to this directory.
  6. Locate the dita.cms.extensions.xml file in the repository's /system/ext collection.
    Note: If the file is called dita.cms.extensions.xml.orig, rename it to dita.cms.extensions.xml.
  7. Check out the file and open it for editing.
  8. Locate the <libraries> element.
    This element specifies the classes that are added to the standard set of classes. You need to add your trigger classes to this element to make your triggers available.
  9. Add a new <library> element, as follows:
    <library id="library_id">
    	<classpath>
    		<jar>trigger_jar_file_name</jar>
    	</classpath>
    	<classes>
    		<class>trigger_class_name(s)</class>
    	</classes>
    </library>
    OptionDescription
    library_id ID that identifies the library (for logging purposes).
    trigger_jar_file_name Name of the .jar file that contains the trigger classes.
    trigger_class_name Name of the trigger class inside the .jar file. If the .jar file contains more than one trigger classes, enter a <class> element for each trigger class.
    For example:
    <libraries>
    	<!-- every library will become its own classloader -->
    	<library id="com.ixiasoft.service.extensions.new.triggers">
    		<classpath>
    			<jar>com.ixiasoft.service.extensions.new.triggers.jar</jar>
    		</classpath>
    		<!-- list of public classes that dynamic classloading can use -->
    		<classes>
    			<class>com.ixiasoft.service.extensions.new.triggers.MapRelease</class>
    			<class>com.ixiasoft.service.extensions.new.triggers.TopicRelease</class>
    		</classes>
    	</library>
    </libraries>
  10. Inform users of the changes and request that they close and reopen their CCMS Desktop to apply the changes.
The new trigger code is ready for you to enable it.