Type-v10.xml

From ControlTier

Jump to: navigation, search

This document describes the XML tags used to define a ControlTier type. See the Core Type Guide for existing types. Use ProjectBuilder or the Graphical type editor to create and manage a type definition.


Contents

types

The root (aka "top-level") element of the type.xml file. Contains a set of #type elements. Any kind of type can be specified in any order.

<?xml version="1.0" encoding="UTF-8"?>
 
<types xmlns:cmd="http://open.controltier.com/base/Modules/Commands#" 
       xmlns:module="http://open.controltier.com/base/Modules#" 
       xmlns:type="http://open.controltier.com/base/Types#">     
 
       <type ...>
          ...
        </type>
  </types>

type

The type element defines a Type and command module. If the "order" attribute is "Setting" or "Assembly", then the elements required to define the command Module are not required.

attributes
attributedescriptionvalues
nameName of the type
roleSpecifies the role of the type. Concrete means it can be instatiated as objects. Abstract specifies it cannot be instantiated."concrete" or "abstract"
orderName of a well known base type.Setting, Assembly, Deployment, Service, Mediator
uniqueInstancesA boolean signifying if each instance of the type must have a unique name. "false" is default.true or false

 

nested elements
elementdescription
descriptionText content describing the type
#supertypeReference to the parent type
#command-settingsProperties of the command module
<type
        name="TypeName"
        role="concrete"
        order="TypeName"
        uniqueInstances="true">
 
        <description>describe the type</description>
 
        <supertype>
            <typereference name="TypeName"/>
        </supertype>
 
	...
   </type>

doc

A documentation block. Can contain any valid Apache Forrest xdoc tag. The doc tags can be used just about anywhere in the type.xml. When ProjectBuilder's generate-forrest-docs command is run, the doc tags are expanded into the generated forrest xdocs.

See Generating Forrest Sites for more information.

supertype

A sub-element of #type, supertype specifies the parent type of this type. A typereference tag is used to specify the supertype by name.

nested elements
elementdescription
#typereferenceText content describing the type
  <supertype>
            <typereference name="TypeName"/>
  </supertype>

typereference

Specifies a type.

attributes
attributedescriptionvalues
nameName of the typeAny existing type.

command-settings

Properties of the command module

nested elements
elementsdescriptionvalues
notificationAdvisory setting stating if notofications are enabled. Specify the notify attribute with a boolean value."true" or "false"
template-directorypath to template directoryAny valid path. By convention it is ${module.dir}/templates
#dependency-viewParamaters to used when retrieving resource model viewSee #dependency-view
loggerName used by log callsBy convention, the type name
<command-settings>
         <notification notify="false"/>
         <template-directory></template-directory>
         <dependency-view parents="false" children="true" proximity="1"/>
         <logger name="TypeName"/>
     </command-settings>

dependency-view

Paramaters used as defaults for the Get-Properties command options

attributes
attributedescriptionvalues
parentsInclude parent dependency info"true" or "false"
childrenInclude children dependency info"true" or "false"
proximityNumber of levels away from the source object1, 2, 3, 4

attributes

define attributes of the Type here. type-property values are the names of properties in the depo: namespace

nested elements
elementsdescription
#attributeAttribute declaration
#attribute-defaultThese will be generated into type.properties
 <attributes>
       <attribute name="attr_name" type-property="property-name"/>
       <attribute-default name="attr_name" value="VALUE"/>
    </attributes>

attribute

Declares an attribute.

attributes
attributedescriptionvalues
nameAttribute's nameAny name. (avoid whitespace)
type-propertyAssociated RDF propertySee #RDF-props for a list

attribute-default

Defines a default value for a declared attribute via the #attribute element.

attributes
attributedescriptionvalues
nameAttribute's nameName of declared attribute
valueAttribute's default value.Any string value

constraints

A sub-element of #type. Type constraints are used to control the allowed kinds of dependencies (both parent and child). Also controls the allowed values for its RDF properties.

nested elements
elementsdescription
#allowedvalue-constraintContains any number of #allowedvalue elements
#dependency-constraint"Specifies #allowedtypes and #singletontypes


Several examples of constraints: allowed-value, dependency-constraint:

<constraints>
            <allowedvalue-constraint
                enforced="true/false"
                type-property="depo-property-name">
                <allowedvalue value="<SOME VALUE>" default="true/false"/>
                <allowedvalue value="<SOME VALUE>" default="true/false"/>
            </allowedvalue-constraint>
 
            <dependency-constraint kind="parent/child" enforced="true/false">
                <allowedtypes>
                    <typereference name="<TYPE NAME>"/>
                    <typereference name="<TYPE NAME>"/>
                </allowedtypes>
                <singletontypes>
                    <typereference name="<TYPE NAME>"/>
                    <typereference name="<TYPE NAME>"/>
                </singletontypes>
            </dependency-constraint>
</constraints>

allowedvalue-constraint

Contains any number of allowed values.

attributes
attributedescriptionvalues
enforcedSpecifies if the constraint should be enforced"true" or "false"
type-propertyName of RDF property. See #RDF-props for a listing.
nested elements
elementsdescription
#allowedvalueAn allowedvalue element
<allowedvalue-constraint
                enforced="false"
                type-property="package-install-root">
     <allowedvalue value="/opt/foo"/>
     <allowedvalue value="/usr/local/foo"/>
     <allowedvalue value="/usr/share/foo" default="true"/>
</allowedvalue-constraint>

allowedvalue

An allowed value.

attributes
attributedescriptionvalues
valueAn allowed valueAny string
defaultSpecifies if it should be the default value."true" or "false"

dependency-constraint

Defines relationship constraints for the type.

attributes
attributedescriptionvalues
kindKind of dependency."parent" or "child"
enforcedSpecifies if the constraint should be enforced"true" or "false"
 <dependency-constraint kind="child" enforced="true">
                <allowedtypes>
                    <typereference name="TypeA"/>
                    <typereference name="TypeB"/>
                </allowedtypes>
</dependency-constraint>
nested elements
elementsdescription
#allowedtypesSet of allowable types
#singletontypesSet of allowable singleton types

allowedtypes

Specifies which types are allowed to have a dependency relationship.

nested elements
elementsdescription
#typereference

singletontypes

Specifies which types are allowed to have a singleton dependency relationship (i.e., cardinality is 0 or 1).

nested elements
elementsdescription
#typereference


commands

A sub-element of type, the commands element contains the command definitions for this type. See the Workflow Development Guide for more information about developing commands for types.

<commands>
       <command name="<COMMAND NAME>"
                description="<COMMAND DESCRIPTION>"
                 command-type="{Command|AntCommand|BsfCommand|WorkflowCommand|DispatchCommand}">
             <opts>
                <opt parameter="<OPT NAME>"
                     description="<OPT DESCRIPTION>"
                     required="{true|false}"
                     property="opts.<OPT NAME>"
                     type="{string|boolean}"
                     default="<DEFAULT STRING VALUE>"/>
               </opts>
           </command>
	 </commands>

command

Defines a command for the type.

attributes
attributedescriptionvalues
nameThe command's nameAny string
descriptionBreifly describe the command purpose.Any string
command-typeThe type of command implementationSee #command-type for a list of known command types
is-staticA static command is one that can run outsidef of an object context"true" or "false"
daemonizedShould the executable be launched in daemon mode?"true" or "false"
is-privateA private command is not inherited by sub types (since ControlTier 3.4.7)"true" or "false"
nested elements
elementsdescription
#optsSpecifies the commands options
#execution-stringSpecifies the file to execute for a "Command" command-type
#argument-stringSpecifies the arguments for a "Command" command-type
#implementationSpecifies the implementation for an "AntCommand" command-type
#scriptSpecifies the implementation for a "BsfCommand" command-type
#workflowSpecifies command sequence for a "WorkflowCommand" command-type
#error-handlerSpecifies an error handler. Only "WorkflowCommand" and "DispatchCommand" command-type.
#success-handlerSpecifies a success handler. Only "WorkflowCommand" and "DispatchCommand" command-type

command-type

An attribute for the #command element that specifies the type of command implementation.

execution-string

File to execute. Used by command-type Command. See: Shell command in the Workflow Development Guide.

argument-string

Arguments to pass to executable. If the execution-string specifies an interpreter that can read script from stdin, the value of argument-string can be script code. See: Shell command in the Workflow Development Guide.

implementation

Ant tasks to execute. See: Ant command in the Workflow Development Guide.

script

BSF script to execute. See: BSF command in the Workflow Development Guide.

workflow

Command sequence to execute. Takes one more more command elements. See: Workflow command in the Workflow Development Guide.

attributes
attributedescriptionvalues
threadcountNumber of threads to execute the workflowAny integer greater than 0
error-handler-type Type of error handler to invoke when a subcommand fails One of: "IGNORE", "HANDLER", or "FAIL"

 

nested elements
elementsdescription
commandName of the command. Command must be in the same module.
 <command name="<WORKFLOW COMMAND NAME>"
                  description="<WORKFLOW COMMAND DESCRIPTION>"
                  command-type="WorkflowCommand"
                  error-handler-type="HANDLER | IGNORE | FAIL"
                  >
           <error-handler quiet="true/false">
             <prompt>PROMPT MESSAGE</prompt>
             <command name="<ERROR HANDLER COMMAND NAME>"/>
             <notify email="NAME@HOST">
               <subject>SUBJECT</subject>
               <message-file>PATH</message-file>
             </notify>
             <report>REPORT MESSAGE</report>
           </error-handler>
           <success-handler notify-email="NAME@HOST">
             <notify-subject>SUBJECT</notify-subject>
             <notify-message-file>PATH</notify-message-file>
           </success-handler>
           <workflow threadcount="<INTEGER>">
             <command name="<COMMAND NAME>"/>
             <command name="<COMMAND NAME>"/>
           </workflow>
         </command>

dispatch-command

Dispatch commands to the selected contexts. Takes one more more command elements. See: Dispatch command in the Workflow Development Guide.

attributes
attributedescriptionvalues
nameWorkflow namedefaults to command.name
requirematchRequires one or more matchestrue (default)
strategyExecution strategy"localdispatch" or "nodedispatch"
threadcountNumber of threads to execute the workflowAny integer greater than 0
error-handler-type Type of error handler to invoke when a subcommand fails One of: "IGNORE", "HANDLER", or "FAIL"

 

nested elements
elementsdescription
#argThe argument line.
#commandThe command to dispatch.
#contextsThe object contexts to execute the command. Can contain one of #select-dependencies, #select-deployments, #select-resources
 <command name="name"
                  description="description"
                  command-type="DispatchCommand"
                  error-handler-type="HANDLER"
                  >
           <error-handler quiet="false">
             ...
           </error-handler>
 
           <dispatch-command threadcount="1" 
	                     requirematch="true"
             >
             <command name="dispatchedCommand"/>
             <arg line="argLine"/>
             <contexts>
	       <select-deployments sortkey="name" sortorder="ascending" depot="${context.depot}">
	         <include name=".*" type="[^\.]*"/>
	       </select-deployments>
             </contexts>
           </dispatch-command>
         </command>

include

Object include filter

attributes
attributedescriptionvalues
nameObject nameregex
typeObject typeregex

select-dependencies

Object include filter based on object dependencies declared in properties. Accepts one #include nested element.

attributes
attributedescriptionvalues
relationtypeObject's base typeregex
sortkeyObject property used as sort key
sortorderSort order "descending" or "ascending" (default)
sourceData source to read property data"file" or "context" (default)
<select-dependencies sortkey="startup-rank"
 			     sortorder="descending"
 			     relationtype="deployment" source="context">
 	  <include name="me[12]" type="Managed-.*"/>
 	</select-dependencies>

select-deployments

Looks up dispatch targets from the resources.properties file. Accepts one #include nested element.

attributes
attributedescriptionvalues
depotproject name namean existing project
sortkeyObject property used as sort key
sortorderSort order "descending" or "ascending" (default)
<select-deployments sortkey="startup-rank"
 			     sortorder="descending"
 			     depot="${context.depot}">
 	  <include name="me[12]" type="Managed-.*"/>
 	</select-deployments>

select-resources

Looks up dispatch targets from the specified project. Accepts one #include nested element.

attributes
attributedescriptionvalues
depotproject name namean existing project
sortkeyObject property used as sort key
sortorderSort order "descending" or "ascending" (default)
sourceData source to read property data"file" or "context" (default)
<select-resources sortkey="startup-rank"
 			     sortorder="descending"
 			     depot="${context.depot}">
 	  <include name="me[12]" type="Managed-.*"/>
 	</select-resources>

error-handler

Handles an error if one occurs

attributes
attributedescriptionvalues
quietLog a message if an error is caught?"true" or "false"
errorpropertyName of property to set error messagestring

 

nested elements
elementsdescription
promptPrompt user if an error occurs
commandRun the specified command. Must be in the same module.
notifySend an email.
reportCall the report task with the error message.

Example

 <error-handler quiet="true">
             <prompt>PROMPT MESSAGE</prompt>
             <command name="aCommand"/>
             <notify email="NAME@HOST">
               <subject>SUBJECT</subject>
               <message-file>PATH</message-file>
             </notify>
             <report>REPORT MESSAGE</report>
 </error-handler>

opts

Specifies the commands options

nested elements
elementsdescription
#optDefines one option for the command
                <opt parameter="<OPT NAME>"
                     description="<OPT DESCRIPTION>"
                     required="{true|false}"
                     property="opts.<OPT NAME>"
                     type="{string|boolean}"
                     default="<DEFAULT STRING VALUE>"
                     defaultproperty="<PROPERTY NAME>"
                  />

opt

Specifies one command option.

attributes
attributedescriptionvalues
parameterThe option's nameAny string
descriptionBreifly describe the option's purpose.Any string
requiredBreifly describe the option's purpose."true" or "false"
propertyName to set the option valueBy convention it is opts.parameter
typeType of parameter. A string option is one that takes an argument. A boolean option does not."string" or "boolean"
defaultLiteral value to use if the option is not specified.Any string
defaultpropertyProperty name to use if the option is not specified.Any property that may exist at execution time.

RDF-props

Attribute constraints can control the allowed values and defaults for the RDF properties of base types. The following is a listing of ones that can have constraints applied.

namedescriptiondomain
deployment-basedir Deployment base directoryDeployment
deployment-install-rootDeployment installation root directory Deployment
deployment-startup-rankDeployment startup rank Deployment
os-archOperating system architecture Node
os-familyOperating system family (windows, unix) Node
os-nameOperating system name Node
os-versionOperating system version Node
package-archPackage architecture Package
package-basePackage base name Package
package-buildtimePackage build time Package
package-filenamePackage file name Package
package-filetypePackage file type Package
package-install-rankPackage install rankPackage
package-install-rootPackage install directory Package
package-releasePackage release identifier Package
package-release-tag Package release tagPackage
package-repo-urlURL to the package in the repo Package
package-restartBoolean flag specifying if a restart is required (true,false) Package
package-versionPackage versionPackage
settingValueHolds the setting valueSetting
settingTypeUser defined type definition of the setting valueSetting


Set the allowedvalue-constraints for the RDF properties package-restart and package-install-root:

<constraints>
       <allowedvalue-constraint
                enforced="true"
                type-property="package-restart">
                <allowedvalue value="true"/>
                <allowedvalue value="false" default="true"/>
        </allowedvalue-constraint>
       <allowedvalue-constraint
                enforced="false"
                type-property="package-install-root">
                <allowedvalue value="/opt/foo"/>
                <allowedvalue value="/usr/local/foo"/>
                <allowedvalue value="/usr/share/foo" default="true"/>
        </allowedvalue-constraint>
</constraints>
Personal tools
Namespaces
Variants
Actions
Navigation
Communication
Development
Toolbox
Print/export