You can change the default lifecycle model configuration by editing the configurations.xml
file using the information given below.
File Details
- File Name: configurations.xml
- Location:
<ES_HOME>\repository\resources
- Purpose: Allows you to define lifecycles, which are applied for asset types.
XML elements
Click on an element to view its details along with sub element details if any.
- <aspect>
- <configuration>
- <lifecycle>
- <scxml>
- <state>
- <datamodel>
- <data>
- <item>
- <permissions>
- <permission>
- <validations>
- <validation>
- <parameter>
- <js>
- <console>
- <script>
- <server>
- <script>
- <execution>
- <parameter>
- <ui>
- <transition>
<aspect>
XML Syntax | <aspect name="" class=""> |
---|---|
Description | This element defines the various aspects of the lifecycle. |
Mandatory/Optional | Mandatory |
Attributes
Attribute | Description | Type | Default Values | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
name | Defines the name of the lifecycle. As ES does not allow you to create two lifecycles with the same name, the name of the lifecycle should be unique. | N/A | Mandatory | |||
class | Defines the class that is associated with the lifecycle. |
| Mandatory | You can define your own class as shown here, but the default class provided with the ES distribution has the capability to handle any configuration that follows the above template. |
Sample implementations
<aspect name="Test" class="org.wso2.jaggery.scxml.aspects.JaggeryTravellingPermissionLifeCycle">
<configuration>
XML Syntax | <configuration type=""> |
---|---|
Description | This element describes the way in which the lifecycle configurations are setup. |
Mandatory/Optional | Mandatory |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
type | Defines how the lifecycle is configured. | N/A |
| Mandatory |
Sample implementations
<configuration type="resource">
<scxml>
XML Syntax | <scxml xmlns="" version="" initialstate=""> |
---|---|
Description | This is the element that contains the new, SCXML-based configuration. State Chart XML (SCXML) is an open standard that ES supports. Up to this point of the configuration, there can be only one of each of the elements described above. They all provide metadata about the lifecycle (name, class, and other information). The subsequent elements are the actual SCXML configuration. |
Mandatory/Optional | Mandatory |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/Optional | Notes |
---|---|---|---|---|---|---|
xmlns | State Chart XML (SCXML) specification. | http://www.w3.org/2005/07/scxml | Mandatory | |||
version | Version number of the State Chart XML (SCXML). | 1.0 | Optional | |||
initialstate | Defines the initial state of the lifecycle. The initial state does not have to be the first state of the configuration. Furthermore, by changing the value of this attribute, you can easily modify the initial state and the flow of the lifecycle. |
Sample implementations
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="">
<state>
XML Syntax | <state id=""> |
---|---|
Description | Defines the states of the lifecycle. A lifecycle can have multiple states and if needed, you can define more than one state element in the configuration. |
Mandatory/Optional | Mandatory |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
id | Defines the name of the lifecycle state. | N/A | Mandatory |
Sample implementations
<state id="Development"></state>
ES does not support multiple lifecycle states with the same name. Therefore, make sure to have unique names for all the lifecycle state names.
<datamodel>
XML Syntax | <datamodel> |
---|---|
Description | This element contains all the custom elements, which are defined in the lifecycle model. Based on the SCXML specification, you can define a data model to a lifecycle state and you can use this extension to define custom elements. |
Mandatory/Optional | Optional |
This element has no attributes.
<data>
XML Syntax | <data name=""> |
---|---|
Description | Custom |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
name | Defines the extension point (e.g., Transition Validators, Transition Executors, Transition User Interfaces and Transition Scripts) that is used in the lifecycle. You can define only one extension point of a kind, because the underlined implementation ignores multiple elements and takes only one into consideration. For
|
| Mandatory |
Sample implementations
<data name="checkItems"> <item name="Code Completed" forEvent=""> <item name="WSDL, Schema Created" forEvent=""> </data> <data name="transitionValidation"> <validation forEvent="" class=""> <parameter name="" value=""/> </validation> </data> <data name="transitionPermission"> <permission forEvent="" roles=""/> </data> <data name="transitionScripts"> <js forEvent=""> <console function=""> <script type="text/javascript"> </script> </console> <server function=""> <script type="text/javascript"></script> </server> </js> </data> <data name="transitionExecution"> <execution forEvent="Promote" class="org.wso2.jaggery.scxml.generic.GenericExecutor"> </data> <data name="transitionUI"> <ui forEvent="Promote" href="../lifecycles/pre_invoke_aspect_ajaxprocessor.jsp?currentEnvironment=/_system/governance/trunk/"/> </data> <data name="transitionApproval"> <approval forEvent="Promote" roles="" votes="5"/> <approval forEvent="Demote" roles="admin" votes="5"/> </data>
<item>
XML Syntax | <item name="" forEvent=""> |
---|---|
Description | These elements contain the check items for each state. There can be more than one of these elements. |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
name | Defines the name of the check item. ES allows you to define check items for each transition. | N/A | Optional | |||
forEvent | Defines whether the check item is required for a specific transition. A check item can be required for more than one event, in which case, a user can give a comma (",") separated list for the forEvent attribute. | Null : Keeping the forEvent attribute empty means that a specific check item is not required for any transition event. | Optional | The forEvent value is defined under the <transition> element with the event attribute. |
Sample implementations
<data name="checkItems"> <item name="Effective Inspection Completed" forEvent=""></item> <item name="Test Cases Passed" forEvent=""></item> <item name="Smoke Test Passed" forEvent=""></item> </data>
<permissions>
XML Syntax | <permissions> |
---|---|
Description | This element defines permissions for that specified action and holds more than one child element that defines permissions. Under check items, the |
Mandatory/Optional | Optional |
This element doesn't have any attributes.
<permission>
XML Syntax | <permission roles=""/> |
---|---|
Description | This element is a child element of the |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
roles | Defines the name of the user role to do the specified action. | Mandatory | You can define multiple user roles as comma (",") separated. |
Sample Implementations
<permission roles="admin,manager"/>
<validations>
XML Syntax | <validations> |
---|---|
Description | Defines the validations that ES completes for each action. This element can contain one or more |
Mandatory/Optional | Optional |
This element does not have any attributes.
<validation>
XML Syntax | <validation forEvent="" class=""> |
---|---|
Description | This element defines the event and the validation class that is invoked at runtime. |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
forEvent | Defines the event for which this validation should be performed. This gives you the flexibility to define validations for each event. As you have the ability to define validations for check items, it makes it easy to validate different things at different levels. | N/A | Mandatory | The forEvent value is defined under the <transition> element with the event attribute. | ||
class | Defines the class that is executed at runtime to perform the validation. You must give the full, qualified name of a class that implements the CustomValidations interface, as the value for the class attribute. | N/A | Mandatory |
Sample implementations
<validation forEvent="" class=""></validation>
<parameter>
XML Syntax | <parameter name="" value=""/> |
---|---|
Description | The |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
name | Defines the name used to identify the parameter. | N/A | Mandatory | |||
value | Defines the value of the defined parameter. | N/A | Mandatory |
Sample implementations
<parameter name="endpoint.mediatype" value="application/vnd.wso2.endpoint"/>
<js>
XML Syntax | <js forEvent=""> |
---|---|
Description | ES lifecycle configuration has the ability to allow JavaScript functions to execute on both the server-side and the client-side. The |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/Optional | Notes |
---|---|---|---|---|---|---|
forEvent | Defines the respective transition for which the JavaScript function is executed. | Mandatory | The forEvent value is defined under the <transition> element with the event attribute. |
Sample implementations
<js forEvent=""> <console function="">....</console> <server function="">....</server> </js>
<console>
XML Syntax | <console function=""/> |
---|---|
Description | Defines the JavaScript function that ES needs to execute on the client-side. |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/Optional | Notes |
---|---|---|---|---|---|---|
function | Defines the name of the function that is executed when an asset moves from one lifecycle state to another. | Mandatory |
Sample implementations
<console function=""> <script type="text/javascript"> </script> </console>
<script>
XML Syntax | <script type="text/javascript"> |
---|---|
Description | Contains the actual JavaScript code segment. You can use this section to define any code segment. |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
type | The scripting language that is supported by ES. | Set to text/javascript because at the time of this writing, ES only supports JavaScript as a scripting language. | Mandatory |
Sample implementations
<script type="text/javascript"></script>
<server>
XML Syntax | <server function=""> |
---|---|
Description | This is the same as the |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
function | Defines the name of the function that is executed at an asset transition from one state to another. | Mandatory | The function should be a ES supported scripting language. |
Sample implementations
<server function=""> <script type="text/javascript"></script> </server>
<Execution>
XML Syntax | <execution forEvent="" class=""/> |
---|---|
Description | An executor is business logic that is executed once a state transition takes place in a lifecycle. The |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
forEvent | Defines the event for which this execution is performed. This gives you the flexibility to define executions for each event. | Mandatory | The forEvent value is defined under the <transition> element with the event attribute. | |||
class | Defines the class that is executed at runtime. A user must give the full, qualified name of a class that implements the Execution interface, as the value of the class attribute. | Mandatory | This class defines the business logic that is executed when the specified event takes place. This class manipulates the current and target environment of the underlying artifact when the state transition is performed on it. |
Sample implementations
<execution forEvent="Promote" class="org.wso2.carbon.governance.registry.extensions.executors.ServiceVersionExecutor">
<parameter>
XML Syntax | <parameter name="" value=""/> |
---|---|
Description | The |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
name | This attribute defines the name of the parameter. |
| all these parameters are mandatory. | |||
value | This attribute defines the value held by the parameter. |
Sample implementations
<data name="transitionExecution"> <execution forEvent="Promote" class="org.wso2.carbon.governance.registry.extensions.executors.ServiceVersionExecutor"> <parameter name="currentEnvironment" value="/_system/governance/trunk/{@resourcePath}/{@resourceName}"/> <parameter name="targetEnvironment" value="/_system/governance/branches/testing/{@resourcePath}/{@version}/{@resourceName}"/> <parameter name="service.mediatype" value="application/vnd.wso2-service+xml"/> <parameter name="wsdl.mediatype" value="application/wsdl+xml"/> <parameter name="endpoint.mediatype" value="application/vnd.wso2.endpoint"/> </execution> </data>
<ui>
XML Syntax | <ui forEvent="" href=""/> |
---|---|
Description | A UI element is a mechanism to associate a user interface with a particular event during a given transition. This allows you to pass inputs that would be utilized when performing a transition. Note that you can not define an external reference link as the |
Mandatory/Optional | Optional |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
forEvent | Defines the event for which the UI appears. | N/A | Optional | The forEvent value is defined under the <transition> element with the event attribute. | ||
href | Defines the hyperlink that is opened and presented to the user, when a lifecycle transition operation is performed from the ES Management Console. | N/A | Optional |
Sample implementations
<ui forEvent="Promote" href="../lifecycles/pre_invoke_aspect_ajaxprocessor.jsp?currentEnvironment=/_system/governance/branches/testing/"/>
<transition>
XML Syntax | <transition event="" target=""/> |
---|---|
Description | Defines the transitions, by specifying the name of the lifecycle state and the target lifecycle state, instead of using static transitions. Any number of transitions for one lifecycle state are supported. |
Mandatory/Optional | Mandatory |
Attributes
Attribute | Description | Type | Default Value | Fixed Values | Mandatory/ Optional | Notes |
---|---|---|---|---|---|---|
event | Defines the transition event name, e.g., Promote, Demote or any name that the user specifies. | N/A | Mandatory | This event name is used in the forEvent to trigger a specific event, before this transition this going on. | ||
target | Defines the target state of the transition. | N/A | Mandatory |
Sample implementations
<transition event="Promote" target="Tested"/>