skip to main content
Corticon Server: Integration & Deployment Guide : Packaging and deploying Decision Services : Using Deployment Descriptors to deploy Decision Services : Setting deployment properties in a CDD file through APIs
 

Try Corticon Now
Setting deployment properties in a CDD file through APIs
To deploy a Decision Service using APIs, at a minimum you have to supply a Decision Service Name and a Rule Asset Path. The Properties object can contain additional options related to that Decision Service. Any properties you do not specify will assume default values.
You define the properties to set using the ICcServer API's deployDecisionService(...) method in the form:
void deployDecisionService(String astrDecisionServiceName, String astrRuleAssetPath, Properties apropDeploymentOptions)
which then uses the ICcServer API's addDecisionService(...) method in the form:
void addDecisionService(String astrDecisionServiceName, String astrRuleAssetPath, Properties apropDeploymentOptions)

Valid properties for a Decision Service

The Corticon Server API Javadoc for ICcServer has constants defined for each property. It is a good practice to use those constants instead of literal values, as will be demonstrated.
The following list of properties (all are public static final String) can be set for this method:
*PROPERTY_AUTO_RELOAD = "PROPERTY_AUTO_RELOAD";
*PROPERTY_MAX_POOL_SIZE = "PROPERTY_MAX_POOL_SIZE";
*PROPERTY_MESSAGE_STRUCTURE_TYPE = "PROPERTY_MESSAGE_STRUCTURE_TYPE";
*PROPERTY_DATABASE_ACCESS_MODE = "PROPERTY_DATABASE_ACCESS_MODE";
*PROPERTY_DATABASE_ACCESS_RETURN_ENTITIES_MODE = "PROPERTY_DATABASE_ACCESS_RETURN_ENTITIES_MODE";
*PROPERTY_DATABASE_ACCESS_PROPERTIES_PATH = "PROPERTY_DATABASE_ACCESS_PROPERTIES_PATH";
*PROPERTY_DATABASE_ACCESS_CACHING_ENABLED = "PROPERTY_DATABASE_ACCESS_CACHING_ENABLED";
*PROPERTY_EXECUTION_RESTRICT_RULEMESSAGES_INFO = "PROPERTY_EXECUTION_RESTRICT_RULEMESSAGES_INFO";
*PROPERTY_EXECUTION_RESTRICT_RULEMESSAGES_WARNING = "PROPERTY_EXECUTION_RESTRICT_RULEMESSAGES_WARNING";
*PROPERTY_EXECUTION_RESTRICT_RULEMESSAGES_VIOLATION = "PROPERTY_EXECUTION_RESTRICT_RULEMESSAGES_VIOLATION";
*PROPERTY_EXECUTION_RESTRICT_RESPONSE_TO_RULEMESSAGES_ONLY = "PROPERTY_EXECUTION_RESTRICT_RESPONSE_TO_RULEMESSAGES_ONLY";

Example

The following example use these methods to deploy a Decision Service using the generic API on ICcServer:
public void deployDecisionService() throws Exception
{
String lstrDecisionService = "TestDeploy";
String lstrEdsFilePath = "c:/Temp/MyDS.eds";

Properties lpropOptions = new Properties();

lpropOptions.put(ICcServer.PROPERTY_
AUTO_RELOAD,
Boolean.TRUE);
lpropOptions.put(ICcServer.PROPERTY_
MAX_POOL_SIZE,
2);
lpropOptions.put(ICcServer.PROPERTY_
MESSAGE_STRUCTURE_TYPE,
ICcServer.XML_STYLE_AUTODETECT);
lpropOptions.put(ICcServer.PROPERTY_
DATABASE_ACCESS_MODE,
ICcServer.DATABASE_ACCESS_READ_WRITE);
lpropOptions.put(ICcServer.PROPERTY_
DATABASE_ACCESS_RETURN_ENTITIES_MODE,
ICcServer.DATABASE_ACCESS_RETURN_ALL_ENTITY_INSTANCES);
lpropOptions.put(ICcServer.PROPERTY_
DATABASE_ACCESS_PROPERTIES_PATH,
"c:/Temp/dbconnect.properties");
lpropOptions.put(ICcServer.PROPERTY_
DATABASE_ACCESS_CACHING_ENABLED,
Boolean.TRUE);
lpropOptions.put(ICcServer.PROPERTY_
EXECUTION_RESTRICT_RULEMESSAGES_INFO,
Boolean.FALSE);
lpropOptions.put(ICcServer.PROPERTY_
EXECUTION_RESTRICT_RULEMESSAGES_WARNING,
Boolean.FALSE);
lpropOptions.put(ICcServer.PROPERTY_
EXECUTION_RESTRICT_RULEMESSAGES_VIOLATION,
Boolean.FALSE);
lpropOptions.put(ICcServer.PROPERTY_
EXECUTION_RESTRICT_RESPONSE_TO_RULEMESSAGES_ONLY,
Boolean.FALSE);

ICcServer lICcServer = CcServerFactory.getCcServer();

// Add Decision Service to ICcServer
lICcServer.addDecisionService(lstrDecisionService,
lstrEdsFilePath,
lpropOptions);
}

Compiling a CDD using APIs

The API methods loadFromCdd() and loadFromCddDir() compile one or several Deployment Descriptors. The simplest, loadFromCdd(), requires you to provide the complete path to the specific Deployment Descriptor file you want to load. The other, loadFromCddDir(), requires the path to the directory where Corticon Server will look and load all Deployment Descriptor files it finds there.
These methods are summarized in the Java API Summary in Corticon API reference and described fully in the Corticon Server Javadoc.