build.xml

<project name="Adfiles-Stack-build" 
default="release" basedir="." xmlns:sf="antlib:com.datasynapse.fabric.ant">

    <property file="build.properties" />
    <property file="fabric-cli.properties" />

    <sf:connection-props brokerurl="${DSPrimaryDirector}" username="${DSUserName}" 
    password="${DSPassword}" 
    clientssltrustfile="${DSSSLTrustFile}" />

    <target name="release" depends="create-all-components, release-Adfiles-Compt-component,release-stack" />

    <target name="clean" depends="clean-stack, clean-Adfiles-Compt-component" />

    <target name="create-all-components">
        <sf:component action="create" name="${Adfiles-Compt.component.name}" 
        description="${Adfiles-Compt.component.description}" type="${Adfiles-Compt.component.type}"
        enablername="${Adfiles-Compt.enabler.name}" enablerversion="${Adfiles-Compt.enabler.version}" 
        utility="${Adfiles-Compt.utility}" />
    </target>


<target name="release-Adfiles-Compt-component">        
 <echo message="Building ${Adfiles-Compt.component.name}" />        
 <sf:option name="${Adfiles-Compt.component.name}" action="replace">   
 <sf:property name="Engine Blacklisting" value="${Adfiles-Compt.blacklisting}"/>       
 <sf:property name="Failures Per Day Before Blacklist" value="${Adfiles-Compt.blacklist.failures}"/>            
  <sf:property name="Archive Scale Up Timeout" value="${Adfiles-Compt.archive.scale.up.timeout}"/>
  <sf:property name="Archive Scale Down Timeout" value="${Adfiles-Compt.archive.scale.down.timeout}" />          
  <sf:property name="Maximum Deactivation Time" value="${Adfiles-Compt.deactivation.timeout}" />        
  <sf:property name="Maximum Activation Time" value="${Adfiles-Compt.activation.timeout}"/>
  <sf:property name="Maximum Capture Time"value="${Adfiles-Compt.maximum.capture.time}"/>            
  <sf:property name="Maximum Instances Per Host" value="${Adfiles-Compt.max.instances.per.host}" />           
  <sf:property name="Statistics Collection Frequency" value="${Adfiles-Compt.stats.collection.frequency}" />            
  <sf:property name="Activation Delay" value="${Adfiles-Compt.activation.delay}" />          
  <sf:property name="Engine Reservation Expiration" 
                value="${Adfiles-Compt.engine.reservation.expiration}" />           
   <sf:property name="Middleware Versions" value="${middleware.versions}"/>            
   <sf:property name="Optional Middlware Versions" value="${optional.middlware.versions}"/>       
 </sf:option>


<sf:default-settings name="${Adfiles-Compt.component.name}" action="update">   
  <sf:property name="Default Min Engines" value="${Adfiles-Compt.min}" />
  <sf:property name="Default Max Engines" value="${Adfiles-Compt.max}"/> 
  <sf:property name="Default Priority" value="${Adfiles-Compt.priority}"/>        
</sf:default-settings>     

  
<sf:feature name="${Adfiles-Compt.component.name}" action="add" feature="HTTP Support"/>        
<sf:feature name="${Adfiles-Compt.component.name}"action="update" feature="HTTP Support">           
    <sf:property name="Relative Url" value="${Adfiles-Compt.relative.url}" />        
    <sf:property name="Routing Prefix" value="${Adfiles-Compt.routing.prefix}" />           
    <sf:property name="HTTPS Enabled" value="${Adfiles-Compt.https.enabled}" />            
    <sf:property name="HTTP Enabled" value="${Adfiles-Compt.http.enabled}" />           
    <sf:property name="Route Directly To Endpoints" value="${Adfiles-Compt.route.directly.to.endpoints}"/>
    </sf:feature>  
    

<sf:feature name="${Adfiles-Compt.component.name}" action="add" feature="Archive Management Support" />
<sf:feature name="${Adfiles-Compt.component.name}" action="update" feature="Archive Management Support">         
     <sf:property name="Archive" value="${Adfiles-Compt.archive}" />          
     <sf:property name="Start Archives On Activation" value="${Adfiles-Compt.start.archives.on.activation}" />        </sf:feature>


<sf:feature name="${Adfiles-Compt.component.name}" action="add" feature="Application Logging Support" />      
<sf:feature name="${Adfiles-Compt.component.name}" action="update" feature="Application Logging Support">      
      <sf:property name="Checkpoint Frequency In Seconds" value="${Adfiles-Compt.checkpoint.frequency.in.seconds}" />     
      <sf:property name="Archive Application Logs" value="${Adfiles-Compt.archive.application.logs}" />        
      <sf:property name="Log File Pattern" value="${Adfiles-Compt.log.file.pattern}"/>     
   </sf:feature>        

<sf:content-file type="component" name="${Adfiles-Compt.component.name}" action="add"> 
    <sf:contentset dir="${Adfiles-Compt.content.dir}">                
     <include name="**/*.*" />            
     </sf:contentset>       
</sf:content-file> 
      

 <sf:config-file type="component" name="${Adfiles-Compt.component.name}" 
                       action="update" configfile="${Adfiles-Compt.config.dir}/configure.xml"/>        
    <sf:archive-file name="${Adfiles-Compt.component.name}" action="add" > 
      <path>             
         <pathelement path="${Adfiles-Compt.archive.0.path}"/>         
      </path>        
   </sf:archive-file>  

     
 <sf:context-variable type="component" name="${Adfiles-Compt.component.name}" action="update">
    <sf:contextvar name="NB_HAWK_RESTART_BEFORE_RESTART_ENGINE" type="string" 
               value="${Adfiles-Compt.contextvar.nb.hawk.restart.before.restart.engine}" 
               export="false" autoincrement="none" description="null"/>          
    <sf:contextvar name="HAWK_POLLPERIOD" type="string" 
                   value="${Adfiles-Compt.contextvar.hawk.pollperiod}"
                   export="false" autoincrement="none" description="null"/>           
    <sf:contextvar name="IS_PREPAND" type="environment" 
                   value="${Adfiles-Compt.contextvar.is.prepand}" export="false" 
                   autoincrement="none" description="null" />            
    <sf:contextvar name="JDBC_DRIVER_FILE" type="environment" 
                   value="${Adfiles-Compt.contextvar.jdbc.driver.file}" 
                   export="false" autoincrement="none" 
                   description="Only if the Domain is stored in a database"/>
    <sf:contextvar name="EXTERNAL_JAR_FILE" 
                   type="environment" 
                   value="${Adfiles-Compt.contextvar.external.jar.file}" 
                   export="false" 
                   autoincrement="none" 
                   description="null"/>   
    <sf:contextvar name="PLUGIN_CONFIG_FILE" type="environment"
                 value="${Adfiles-Compt.contextvar.plugin.config.file}" 
                export="false" autoincrement="none" description="null"/>            
    <sf:contextvar name="LOGICAL_MACHINE_NAME" 
                   type="environment" 
                   value="${Adfiles-Compt.contextvar.logical.machine.name}" 
                   export="false"
                   autoincrement="none" 
                   description="Machine name. If empty the value will be the Component Name"/> 
    <sf:contextvar name="DOMAINDATA_DIR" 
                   type="environment" 
                   value="${Adfiles-Compt.contextvar.domaindata.dir}" 
                   export="false" autoincrement="none" 
                   description="Share drive where deployment configuration will be created"/>      
    <sf:contextvar name="TIBCO_SERVICES_STATE_AFTER_TLM_MOVED" 
                   type="environment" 
                   value="${Adfiles-Compt.contextvar.tibco.services.state.after.tlm.moved}" 
                   export="false" autoincrement="none" 
                   description="On logical machine restart, all services are either started or stopped"/>          
    <sf:contextvar name="USE_FULL_ARCHIVE_NAME" 
                   type="environment" 
                   value="${Adfiles-Compt.contextvar.use.full.archive.name}" 
                   export="false" 
                   autoincrement="none" 
                   description="null"/>           
   <sf:contextvar name="AMI_HAWK_SERVICE" type="environment"
                  value="${Adfiles-Compt.contextvar.ami.hawk.service}" 
                  export="false" 
                  autoincrement="none" 
                  description="null"/>            
  <sf:contextvar name="AMI_HAWK_DAEMON" 
                 type="environment" 
                 value="${Adfiles-Compt.contextvar.ami.hawk.daemon}" 
                 export="false" autoincrement="none" description="null"/>        
  <sf:contextvar name="AMI_HAWK_NETWORK" 
                  type="environment" 
                  value="${Adfiles-Compt.contextvar.ami.hawk.network}" 
                  export="false" autoincrement="none" description="null"/>         
  <sf:contextvar name="HAWK_PLUGIN_CONFIG_FILE" 
                 type="environment" 
                 value="${Adfiles-Compt.contextvar.hawk.plugin.config.file}" 
                 export="false" autoincrement="none" description="null"/>          
  <sf:contextvar name="ACTION_TO_PERFORM_FOR_HAWK_FILE" 
                 type="environment" value="${Adfiles-Compt.contextvar.action.to.perform.for.hawk.file}" 
                 export="false" autoincrement="none" description="null"/>            
  <sf:contextvar name="DELETE_APPLICATION_CONF_AT_SHUTDOWN" 
              type="environment" value="${Adfiles-Compt.contextvar.delete.application.conf.at.shutdown}" 
              export="false" autoincrement="none" description="null"/>           

   <sf:contextvar name="DO_NOT_REDEPLOY_EAR_FILE_AT_STARTUP" 
                type="environment" 
                value="${Adfiles-Compt.contextvar.do.not.redeploy.ear.file.at.startup}" 
                export="false" autoincrement="none" description="null"/>           
   <sf:contextvar name="MANAGED_PROCESS_HAWK_AGENT_ENABLED" 
                  type="environment" 
                  value="${Adfiles-Compt.contextvar.managed.process.hawk.agent.enabled}" 
                  export="false" autoincrement="none" 
                  description="If the regular stop is not succesfull"/>            
   <sf:contextvar name="MANAGED_PROCESS_SERVICE_ENABLED" 
                  type="environment" 
                  value="${Adfiles-Compt.contextvar.managed.process.service.enabled}" 
                  export="false" autoincrement="none" 
                  description="If the regular stop is not succesfull"/>   
   <sf:contextvar name="SAVE_DELETE_APPLICATION_CONF_AT_SHUTDOWN" 
                  type="environment" 
                  value="${Adfiles-Compt.contextvar.save.delete.application.conf.at.shutdown}" 
                  export="false" autoincrement="none" 
                description="null"/>            
   <sf:contextvar name="SAVE_DO_NOT_REDEPLOY_EAR_FILE_AT_STARTUP" type="environment" 
                 value="${Adfiles-Compt.contextvar.save.do.not.redeploy.ear.file.at.startup}" 
                 export="false" autoincrement="none" 
                 description="null"/>            
   <sf:contextvar name="SAVE_IS_PREPAND" 
                  type="environment" 
                  value="${Adfiles-Compt.contextvar.save.is.prepand}" 
                  export="false" 
                  autoincrement="none" 
                  description="null"/>            
  <sf:contextvar name="SAVE_MANAGED_PROCESS_SERVICE_ENABLED" type="environment" 
                  value="${Adfiles-Compt.contextvar.save.managed.process.service.enabled}" 
                  export="false" autoincrement="none" 
                  description="If the regular stop is not succesfull"/>   
    </sf:context-variable>        
    <sf:publish type="component" name="${Adfiles-Compt.component.name}"/>   
 </target>    



<target name="clean-Adfiles-Compt-component">       
   <echo message="Cleaning ${Adfiles-Compt.component.name}"/>        
   <sf:unpublish type="component" name="${Adfiles-Compt.component.name}" onerror="ignore"/>     
   <sf:remove type="component" name="${Adfiles-Compt.component.name}" onerror="ignore"/>    
</target>    

<target name="release-stack">        
   <echo message="Building ${stack.name}" />      
   <sf:stack action="create" name="${stack.name}" description="${stack.description}"/>        
   <sf:stack-component action="add" name="${stack.name}" components="${Adfiles-Compt.component.name}"/>

<!--  uncomment this section to create schedules
-->        
<sf:stack-policy action="update" name="${stack.name}" >            
   <sf:policy manualpolicy="true">                
    <sf:compalloc component="${Adfiles-Compt.component.name}" 
                  min="${Adfiles-Stack.policy.0Adfiles-Compt.min}" 
                  max="${Adfiles-Stack.policy.0Adfiles-Compt.max}" 
                  priority="${Adfiles-Stack.policy.0Adfiles-Compt.priority}">                    
        <sf:allocationrule type="Component Dependency" >                        
        <sf:property name="component" 
                value="${Adfiles-Stack.policy.0.Adfiles-Compt.rule.0.component.name}"/>

        <sf:property name="shutdown" 
                value="${Adfiles-Stack.policy.0.Adfiles-Compt.rule.0.shutdown}"/>                       
        <sf:property name="packByProperty" 
                 value="${Adfiles-Stack.policy.0.Adfiles-Compt.rule.0.pack.by.property}"/>                  
   </sf:allocationrule>                     
      <sf:allocationrule type="Resource Preference" >                       
      <sf:property name="propertyName" 
                   value="${Adfiles-Stack.policy.0.Adfiles-Compt.rule.1.property.name}"/>                       

    <sf:property name="operator" value="${Adfiles-Stack.policy.0.Adfiles-Compt.rule.1.operator}"/>                        
      <sf:property name="propertyValue" 
       value="${Adfiles-Stack.policy.0.Adfiles-Compt.rule.1.property.value}"/>                       

      <sf:property name="affinityPos" 
              value="${Adfiles-Stack.policy.0.Adfiles-Compt.rule.1.affinity.pos}"/>                   
   </sf:allocationrule>                     

     <sf:allocationrule type="Resource Preference" >                        
     <sf:property name="propertyName" 
         value="${Adfiles-Stack.policy.0.Adfiles-Compt.rule.2.property.name}"/>                        
     <sf:property name="operator" 
         value="${Adfiles-Stack.policy.0.Adfiles-Compt.rule.2.operator}"/>                

     <sf:property name="propertyValue" 
                  value="${Adfiles-Stack.policy.0.Adfiles-Compt.rule.2.property.value}"/>                        
      <sf:property name="affinityPos" 
          value="${Adfiles-Stack.policy.0.Adfiles-Compt.rule.2.affinity.pos}"/>  
    </sf:allocationrule>                 
   </sf:compalloc>           
 </sf:policy>       
 
 </sf:stack-policy>        
 <sf:publish type="stack" name="${stack.name}"/>        
 <sf:stack-mode name="${stack.name}" action="run" mode="${stack.mode}"/>   
</target>    

  <target name="clean-stack">        
    <echo message="Cleaning ${stack.name}"/>       
    <sf:unpublish type="stack" name="${stack.name}" onerror="ignore"/>        
    <sf:remove type="stack" name="${stack.name}" onerror="ignore"/>

<!--  uncomment this section to remove schedules on clean-->    
  </target>

</project>