Build Files for Governance Controls

The build file for governance controls supports a set of targets to create and manage governance controls. The default location of the build files is <TIBCO_HOME>/pd/1.2/samples/common.

project Element

The project element declares the default build target for the build.xml file. taskdef and target are subelements of the project. The optional default attribute is used to specify a default target. You can select any target from the build file to be the default target.

<project default="target">
  <taskdef ... />
  <target name="target" ... />
</project>

import Element

The import element identifies the task definition file, which defines the path to the libraries required by ActiveMatrix Policy Director Governance.

Set the file attribute to ${basic.cli.file} and ${gov.admin.cli.file} . For example:
<import file="${basic.cli.file}"/>
<import file="${gov.admin.cli.file}"/>

target Element

The target element specifies the actions performed for an execution of the command-line interface. In a target you can provide a depends attribute containing a list of targets. Each target will be run in order until one fails or the list completes.

<target name="target">
  <AMXAdminTask ... />
</target>

Add Target

The add target creates new governance controls. The governance control template will be based on the data file specified in the dataFile attribute. The following is a sample code snippet of the add target:
<target name="add"> 
<GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" 
overwrite="true" objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule'; 
rule:StandaloneRule" dataFile="basicAuthentication_GCRule_data.xml" action="add" propsFile="${props.file}" 
remote="true"/> 
</target>

Edit Target

The edit target modifies existing governance controls. The following is a sample code snippet of the edit target:
<target name="edit"> 
<GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" 
overwrite="true" objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule'; 
rule:StandaloneRule" dataFile="basicAuthentication_GCRule_data.xml" action="edit" propsFile="${props.file}" 
remote="true"/> 
</target>

Delete Target

The delete target deletes one or more governance controls. The following is a sample code snippet of the delete target:
<target name="delete"> 
<GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" 
overwrite="true" objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule';
rule:StandaloneRule" dataFile="basicAuthentication_GCRule_data.xml" action="delete" propsFile="${props.file}" 
remote="true"/> 
</target>

Deploy Target

The deploy target deploys the governance control. The following is a sample code snippet of the deploy target:
<target name="deploy"> 
<GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" 
overwrite="true" objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule'; 
rule:StandaloneRule" dataFile="basicAuthentication_GCRule_data.xml" action="deploy" propsFile="${props.file}" 
remote="true"/> </target>

Undeploy Target

The undeploy target undeploys the governance control. The following is a sample code snippet of the undeploy target:
<target name="undeploy"> 
<GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" overwrite="true" 
objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule'; rule:StandaloneRule" 
dataFile="basicAuthentication_GCRule_data.xml" action="undeploy" propsFile="${props.file}" 
remote="true"/> </target>

synch-rule-obj-groups Target

The syncMembers target is a utility to synchronize object groups that deploy the governance control. This utility is used only when the Object Group membership is not synchornized. The following is a sample code snippet of the sync-rule-obj-groups target:
<target name="sync-rule-obj-groups">
 <GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" overwrite="true" 
objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule'; rule:SyncRuleObjGroupRefs" 
dataFile="basicAuthentication_GCRule_data.xml" action="syncObjectGroupRefs" propsFile="${props.file}" 
remote="true"/> </target>

Sample Build File

The following is a sample build file that contains the targets required for managing a governance control:
<?xml version="1.0"?>
<project default="add"> 
 <property file="ogp-cli.properties"/> 
 <property value="rule_export_data.xml" name="exported.data.file"/> 
 <import file="${basic.cli.file}"/> 
 <import file="${gov.admin.cli.file}"/> 
 <target name="add_and_deploy_basicAuth_rule" depends="add, deploy"/> 
 <target name="undeploy_and_delete_basicAuth_rule" depends="undeploy, delete"/> 
 <target name="add"> 
    <GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" 
    overwrite="true" objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule'; 
    rule:StandaloneRule" dataFile="basicAuthentication_GCRule_data.xml" action="add" propsFile="${props.file}" 
    remote="true"/> 
 </target> 
 <target name="edit"> 
    <GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" 
    overwrite="true" objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule'; 
    rule:StandaloneRule" dataFile="basicAuthentication_GCRule_data.xml" action="edit" propsFile="${props.file}" 
    remote="true"/> 
 </target> 
 <target name="deploy"> 
    <GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" 
    overwrite="true" objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule'; 
    rule:StandaloneRule" dataFile="basicAuthentication_GCRule_data.xml" action="deploy" propsFile="${props.file}" 
    remote="true"/> 
 </target> 
 <target name="undeploy"> 
    <GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" 
    overwrite="true" objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule'; 
    rule:StandaloneRule" dataFile="basicAuthentication_GCRule_data.xml" action="undeploy" propsFile="${props.file}" 
    remote="true"/> 
 </target> 
 <target name="delete"> 
    <GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" 
    overwrite="true" objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule'; 
    rule:StandaloneRule" dataFile="basicAuthentication_GCRule_data.xml" action="delete" propsFile="${props.file}" 
    remote="true"/> 
 </target> 
 <target name="sync-rule-obj-groups"> 
    <GovernanceAdminTask failOnError="false" force="true" createIfNotExists="true" merge="true" 
    overwrite="true" objectSelector="declare namespace rule='http://tibco.com/governance/pd/cli/types_rule'; 
    rule:SyncRuleObjGroupRefs" dataFile="basicAuthentication_GCRule_data.xml" action="syncObjectGroupRefs" 
    propsFile="${props.file}" remote="true"/> 
 </target> 
</project>