Creating Custom Delegates on the Server
In Servigistics InService, a delegate is an interface that enables you to create a custom delegate to implement custom server code by using built-in methods of Servigistics InService delegates. To create a custom delegate, you use a custom Java class file.
Follow these steps to implement custom server code using a custom delegate:
1. Stop all running coreServer, coreCMIserver, and JBoss services.
2. Follow these steps to create a custom Java class file:
a. Create the Java programming language source file (.java file) for the Java class file you want to implement as the custom delegate.
b. Create a directory structure according to the delegate file implementation class in the custom folder. The custom folder is located in the directory <INS_HOME>/InS_SW/SW/Applications/Windchill.ear/codebase.war/delivery.
c. Place the Java programming language source file (.java file) containing the Java class in the folder structure you created in step 2.b.
d. Run the following command to compile the Java programming language source file to create the corresponding Java class file:
javac –g InService/InS_SW/SW/Applications/Windchill.ear/codebase.war/
custom/com/ptc/sc/services/plugins/<FILE_NAME>.java
<FILE_NAME> is the name of the Java programming language source file.
e. Place the Java class file in a directory structure that is the same as the delegate file implementation class. For example, <INS_HOME>/InS_SW/SW/Applications/Windchill.ear/codebase.war/WEB-INF/classes/com/ptc/sc/services/plugins. Create the directory structure, if not already present.
3. Follow these steps to register the custom Java class file as a custom delegate:
a. Open the sc-service.properties.xconf file located in the directory <INS_ HOME>/InS_SW/SW/Applications/Windchill.ear/codebase.war/com/ptc/sc/xconf
b. Add the property for the custom delegate in the sc-service.properties.xconf file to register the custom delegate in Servigistics InService.
c. Run the xconfmanager utility to propagate the new property.
4. Restart the coreServer, coreCMIserver, and JBoss services.
In this example, you create a custom delegate using the CustomPricingDelegate Java class file.
Follow these steps to implement custom server code using the custom delegate CustomPricingDelegate:
1. Stop all running coreServer, coreCMIserver, and JBoss services.
2. Follow these steps to create the custom CustomPricingDelegate Java class file:
a. Create the CustomPricingDelegate.java file for the CustomPricingDelegate Java class file.
b. Create the following directory structure in the custom folder: custom/com/ptc/sc/services/plugins. The custom folder is located in the directory <INS_ HOME>/InS_SW/SW/Applications/Windchill.ear/codebase.war/delivery.
c. Place the CustomPricingDelegate.java file in the plugins folder of the directory structure you created in step 2.b.
d. Run the following command to compile the CustomPricingDelegate.java file and create the CustomPricingDelegate Java class file:
javac –g InService/InS_SW/SW/Applications/Windchill.ear/codebase.war/
custom/com/ptc/sc/services/plugins/CustomPricingDelegate.java
e. Place the CustomPricingDelegate Java class file in the directory <INS_ HOME>/InS_SW/SW/Applications/Windchill.ear/codebase.war/WEB-INF/classes/com/ptc/sc/services/plugins. Create this directory structure, if not already present.
3. Follow these steps to register the CustomPricingDelegate Java class file as the CustomPricingDelegate custom delegate:
a. Open the sc-service.properties.xconf file located in the directory <INS_HOME>/InS_SW/SW/Applications/Windchill.ear/codebase.war/com/ptc/sc/xconf
b. Add the following property in the sc-service.properties.xconf file to register the CustomPricingDelegate custom delegate in Servigistics InService:
<Service context="default" name="com.ptc.sc.services.plugins.
PricingDelegate">
<Option serviceClass="com.ptc.sc.services.plugins.
CustomPricingDelegate" requestor="null"
cardinality="duplicate" />
</Service>
c. Run the xconfmanager utility to propagate the new property.
4. Restart the coreServer, coreCMIserver, and JBoss services.