This documentation is for WSO2 Governance Registry 5.1.0. View documentation for the latest release.
||
Skip to end of metadata
Go to start of metadata

Users can change the default lifecycle model configuration by editing the .xml files in the <GREG_HOME>/repository/resources/lifecycles directory using the information given below.

EndpointLifeCycle.xml

<aspect name="EndpointLifeCycle" class="org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle">
    <configuration type="literal">
        <lifecycle>
            <scxml xmlns="http://www.w3.org/2005/07/scxml"
                   version="1.0"
                   initialstate="Active">
                <state id="Active">
                    <transition event="Deactivate" target="Off"/>
                </state>
                <state id="Off">
                    <transition event="Activate" target="Active"/>
                </state>
            </scxml>
        </lifecycle>
    </configuration>
</aspect>

<aspect>

XML Syntax<aspect name="" class="">
DescriptionThis element defines lifecycles as aspects.
Mandatory/OptionalMandatory
Attributes of the Element
AttributeDescriptionDefault ValueMandatory/OptionalNotes 
nameContains the name of the lifecycle. Governance Registry does not allow you to create two lifecycles with the same name.
EndpointLifeCycle
Mandatory 
classDefines the class that is associated with the lifecycle.

org.wso2.carbon.governance.

registry.extensions.aspects.

DefaultLifeCycle

MandatoryA user has the ability to define his/her own class as shown here, but the default class provided with the Governance Registry distribution has the capability to handle any configuration that follows the above template.

Back to Top ^

<configuration> 

XML Syntax<configuration type="">
DescriptionThis element describes the way the lifecycle configuration is setup.
Mandatory/OptionalMandatory
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
typeDefine the lifecycle configuration options
literal

literal - If the configuration is setup through the management console

resource - If the configuration is setup through the registry.xml file

Mandatory 

Back to Top ^

<scxml> 

XML Syntax<scxml xmlns="" version="" initialstate=""/>
Description

This is the element that contains the new, SCXML-based configuration. SCXML is one of many standards supported by the WSO2 Governance Registry. Read more on Supported APIs and Standards for a complete list of standards supported by WSO2 Governance Registry.

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 elements that appear after this one contain the actual configuration.

Mandatory/OptionalMandatory
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
xmlnsState Chart XML specification. 
http://www.w3.org/2005/07/scxml
Mandatory 
versionVersion number of the State Chart XML. 1.0Optional 
initialstate

Defines the initial state of the lifecycle. The initial state does not have to be the first state of the configuration.

Also, by changing the value of this attribute, a user can quickly modify the initial state and the flow of the lifecycle.

Active
   

Back to Top ^

<state> 

XML Syntax<state id="">
Description

The state element defines the states of the lifecycle. A lifecycle can have multiple states, and in the configuration, more than one state element can be given.

Mandatory/OptionalMandatory
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
idThe id attribute of the state element defines the name of that state.N/A Mandatory 

Governance Registry does not support multiple states with the same name and, therefore, all the state names of a lifecycle should be unique.

Back to Top ^

ServerLifeCycle.xml

<aspect name="ServerLifeCycle" class="org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle">
    <configuration type="literal">
        <lifecycle>
            <scxml xmlns="http://www.w3.org/2005/07/scxml"
                   version="1.0"
                   initialstate="Live">
                <state id="Live">
                    <transition event="Deactivate" target="Off"/>
                </state>
                <state id="Off">
                    <transition event="Activate" target="Live"/>
                </state>
            </scxml>
        </lifecycle>
    </configuration>
</aspect>

<aspect>

XML Syntax<aspect name="" class="">
DescriptionThis element defines lifecycles as aspects.
Mandatory/OptionalMandatory
Attributes of the Element
AttributeDescriptionDefault ValueMandatory/OptionalNotes 
nameContains the name of the lifecycle. Governance Registry does not allow you to create two lifecycles with the same name.
ServerLifeCycle
Mandatory 
classDefines the class that is associated with the lifecycle.

org.wso2.carbon.governance.

registry.extensions.aspects.

DefaultLifeCycle

MandatoryA user has the ability to define his/her own class as shown here, but the default class provided with the Governance Registry distribution has the capability to handle any configuration that follows the above template.

Back to Top ^

<configuration> 

XML Syntax<configuration type="">
DescriptionThis element describes the way the lifecycle configuration is setup.
Mandatory/OptionalMandatory
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
typeDefine the lifecycle configuration options
literal

literal - If the configuration is setup through the management console

resource - If the configuration is setup through the registry.xml file

Mandatory 

Back to Top ^

<scxml> 

XML Syntax<scxml xmlns="" version="" initialstate=""/>
Description

This is the element that contains the new, SCXML-based configuration. SCXML is one of many standards supported by the WSO2 Governance Registry. Read more on Supported APIs and Standards for a complete list of standards supported by WSO2 Governance Registry.

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 elements that appear after this one contain the actual configuration.

Mandatory/OptionalMandatory
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
xmlnsState Chart XML specification. 
http://www.w3.org/2005/07/scxml
Mandatory 
versionVersion number of the State Chart XML. 1.0Optional 
initialstate

Defines the initial state of the lifecycle. The initial state does not have to be the first state of the configuration.

Also, by changing the value of this attribute, a user can quickly modify the initial state and the flow of the lifecycle.

Active
   

Back to Top ^

<state> 

XML Syntax<state id="">
Description

The state element defines the states of the lifecycle. A lifecycle can have multiple states, and in the configuration, more than one state element can be given.

Mandatory/OptionalMandatory
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
idThe id attribute of the state element defines the name of that state.N/A Mandatory 

Governance Registry does not support multiple states with the same name and, therefore, all the state names of a lifecycle should be unique.

Back to Top ^

ServiceLifeCycle.xml

<aspect name="ServiceLifeCycle" class="org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle">
    <configuration type="literal">
        <lifecycle>
            <scxml xmlns="http://www.w3.org/2005/07/scxml"
                   version="1.0"
                   initialstate="Development">
                <state id="Development">
                    <datamodel>
                        <data name="checkItems">
                            <item name="Code Completed" forEvent="">
                                <!--<permissions>
                                    <permission roles=""/>
                                </permissions>
                                <validations>
                                    <validation forEvent="" class="">
                                        <parameter name="" value=""/>
                                    </validation>
                                </validations>-->
                            </item>
                            <item name="WSDL, Schema Created" forEvent="">
                            </item>
                            <item name="QoS Created" forEvent="">
                            </item>
                        </data>
                        <data name="transitionExecution">
                            <execution forEvent="Promote" class="org.wso2.carbon.governance.registry.extensions.executors.ServiceVersionExecutor">
                                <parameter name="currentEnvironment" value="/_system/governance/trunk/{@resourcePath}/{@version}/{@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>
                        <data name="transitionUI">
                            <ui forEvent="Promote" href="../lifecycles/pre_invoke_aspect_ajaxprocessor.jsp?currentEnvironment=/_system/governance/trunk/"/>
                        </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="transitionApproval">
                            <approval forEvent="Promote" roles="" votes="2"/>
                        </data>-->
                        <data name="transitionScripts">
                            <js forEvent="Promote">
                                <console function="showServiceList">
                                    <script type="text/javascript">
                                        showServiceList = function() { var element = document.getElementById('hidden_media_type'); var mediaType = ""; if (element) { mediaType = element.value;} if (mediaType == "application/vnd.wso2-service+xml") { location.href = unescape("../generic/list.jsp?region=region3%26item=governance_list_service_menu%26key=service%26breadcrumb=Services%26singularLabel=Service%26pluralLabel=Services"); } }
                                    </script>
                                </console>
                            </js>
                        </data>
                    </datamodel>
                    <transition event="Promote" target="Testing"/>
                </state>
                <state id="Testing">
                    <datamodel>
                        <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>
                        <data name="transitionExecution">
                            <execution forEvent="Promote" class="org.wso2.carbon.governance.registry.extensions.executors.ServiceVersionExecutor">
                                <parameter name="currentEnvironment" value="/_system/governance/branches/testing/{@resourcePath}/{@version}/{@resourceName}"/>
                                <parameter name="targetEnvironment" value="/_system/governance/branches/production/{@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>
                            <execution forEvent="Demote" class="org.wso2.carbon.governance.registry.extensions.executors.DemoteActionExecutor">
                            </execution>
                        </data>
                        <data name="transitionUI">
                            <ui forEvent="Promote" href="../lifecycles/pre_invoke_aspect_ajaxprocessor.jsp?currentEnvironment=/_system/governance/branches/testing/"/>
                        </data>
                        <data name="transitionScripts">
                            <js forEvent="Promote">
                                <console function="showServiceList">
                                    <script type="text/javascript">
                                        showServiceList = function() { var element = document.getElementById('hidden_media_type'); var mediaType = ""; if (element) { mediaType = element.value;} if (mediaType == "application/vnd.wso2-service+xml") { location.href = unescape("../generic/list.jsp?region=region3%26item=governance_list_service_menu%26key=service%26breadcrumb=Services%26singularLabel=Service%26pluralLabel=Services"); } }
                                    </script>
                                </console>
                            </js>
                        </data>
                    </datamodel>
                    <transition event="Promote" target="Production"/>
                    <transition event="Demote" target="Development"/>
                </state>
                <state id="Production">
                    <datamodel>
                        <data name="transitionExecution">
                            <execution forEvent="Demote" class="org.wso2.carbon.governance.registry.extensions.executors.DemoteActionExecutor">
                            </execution>
                            <execution forEvent="Publish" class="org.wso2.carbon.governance.registry.extensions.executors.apistore.ApiStoreExecutor">
                            </execution>
                        </data>
                    </datamodel>
                    <transition event="Publish" target="Published.to.APIStore"/>
                    <transition event="Demote" target="Testing"/>
                </state>
                <state id="Published.to.APIStore">
                </state>
            </scxml>
        </lifecycle>
    </configuration>
</aspect>

<datamodel> 

XML Syntax<datamodel>
Description

This element contains all the custom elements which are defined in the lifecycles model. The SCXML specification allows users to define a data model to a state and this extension is used to define custom elements.

Mandatory/OptionalOptional

This element has no attributes.

Back to Top ^

<data> 

XML Syntax<data name=""/>
Description

Custom data elements (according to the SCXML specification) serve to define check items, transition permission, transition validations, transition scripts, transition executions, and transition UIs. This element describes the data of its child elements.

Mandatory/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
name

Transition Validators, Transition Executors, Transition User Interfaces and Transition Scripts are one of many well-defined extension points supported by the WSO2 Governance Registry. Read more on Supported Extension Points for a complete list of extension points supported by WSO2 Governance Registry.

The user can define only one such element of each kind, since the underline implementation will ignore multiple elements and take only one into consideration.

For transitionApproval, the following rules apply regarding roles and votes:

    • roles="" - Any user can vote
    • roles="admin" - Only users with an admin role can vote
    • votes="2" - Two votes are required for approval.
 
  • checkItems - If the user is defining check items as its child elements.
  • transitionValidations - If the data element defines transition validations.
  • transitionPermission - If the data element defines transition permissions.
  • transitionScripts - If the data element describes the transition scripts.
  • transitionExecution - If the data element defines programmable executions for transitions.
  • transitionUI - If the data element defines custom UIs accepting user input for transitions.
  • transitionApproval - If the data element defines lifecycle transition need user approvals.
Mandatory 

Back to Top ^

<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/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
nameDefines the name of the check item.

Governance Registry allows to define check items for each transition.

N/A Optional 
forEventDefines 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. OptionalThe forEvent value is defined under the <transition> element with the "event"  attribute.

Back to Top ^

<permissions> 

XML Syntax<permissions>
Description

The permissions element defines permissions for that specified action and hold more than one child element which defines permissions. Under check items, the permissions element defines the users that have the capability of checking (check/uncheck) that check item. If a user does not have permissions to check a check item, then the management console will display that specific item in disabled mode. The idea behind this is to let the user know that there are some more check items in that state, but that he or she does not have permission to check them (so as to avoid user confusion).

Mandatory/OptionalOptional

This element doesn't have any attributes.

Back to Top ^

<permission> 

XML Syntax<permission roles=""/>
Description

This element is a child element of the permissions element and will define the roles that have permissions to do the specified action. Here, the attribute roles accepts a comma (",") separated list and these roles should be present in Governance Registry.

Mandatory/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
rolesDefines the name of the user role to do the specified action.  MandatoryMultiple user roles can be define here with comma (",") separated

Back to Top ^

<validations> 

XML Syntax 
Description

Defines the validations that need to be completed for each action. This element can contain one or more validation elements. Check Item Validators are one of many well-defined extension points supported by the WSO2 Governance Registry. Read more on Supported Extension Points for a complete list of extension points supported by WSO2 Governance Registry.

Mandatory/OptionalOptional

This element doesn't have any attributes.

Back to Top ^

<validation> 

XML Syntax<validation forEvent="" class=""/>
Description

Validations are an important part of lifecycles. The validation element defines the event and the validation class that has to be invoked at runtime.

Mandatory/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
forEvent

Defines the event for which this validation should be performed. This gives user the flexibility to define validations for each event. The user has the ability to define validations for check items, which makes it easy to validate different things at different levels.

N/A MandatoryThe forEvent value is defined under the <transition> element with the "event"  attribute.
classDefines the class that needs to be executed at runtime to perform the validation. A user must give the full, qualified name of a class that implements the CustomValidations interface, as the value of the attribute class.N/A Mandatory 

Back to Top ^

<parameter>

XML Syntax<parameter name="" value=""/>
Description

The parameter elements are used to give parameters to the validation and execution classes. It is up to the user to define the name value pairs, and the parameter element has attributes to define these values. A validation element or an execution element can have more than one parameter element and it is up to the user code to handle this. The underline implementation of the DefaultLifeCycle class will pass all the parameters in a map object.

Mandatory/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
name

User defined value to identify the parameter.

N/A Mandatory 
valueDefines the value of user defined parameter.N/A Mandatory 

Back to Top ^

<js>

XML Syntax 
Description

Governance Registry lifeCycle configuration has the ability to allow JavaScript functions to execute on both the server side and the client side. The js element defines the scripts that need to be executed for different events.

Mandatory/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
forEvent

 Defines the transition action where this JavaScript function needs to be executed.

  MandatoryThe forEvent value is defined under the <transition> element with the "event"  attribute.

Back to Top ^

<console>

XML Syntax<console function=""/>
Description

Defines the JavaScript function that needs to be executed on the client side.

Type 
Mandatory/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
function

Defines the name of the function which will be executed at a transition from one state to another.

  Mandatory 

Back to Top ^

<script>

XML Syntax<script type="text/javascript"/>
Description

Contains the actual JavaScript code segment. A user has the ability to define any code segment here.

Mandatory/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
type

Governance Registry supports scripting language.

 Set to text/javascript because, at the time of this writing, Governance Registry only supports JavaScript as a scripting language.Mandatory 

Back to Top ^

<server>

XML Syntax<server function=""/>
Description

This is the same as the console function and the only difference is that this element defines the scripts that need to be executed on the server side.

Mandatory/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
function

Defines the name of the function which will be executed at a transition from one state to another.

  MandatoryFunction should be Governance Registry supports scripting language.

Back to Top ^

<Execution>

XML Syntax<execution forEvent="" class=""/>
Description

An executor is business logic that is executed once a state transition happens in a lifecycle. The execution element defines the event and the execution class that will be invoked at runtime.

Mandatory/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
forEvent

Defines the event for which this execution should be performed. This gives user the flexibility to define executions for each event.

  MandatoryThe forEvent value is defined under the <transition> element with the "event"  attribute.
classDefines the class that needs to be executed at runtime. A user must give the full, qualified name of a class that implements the Execution interface, as the value of the attribute class.  MandatoryThis class defines the business logic that is executed when the specified event is taken place. This class manipulates the current and target environment of the underlying artifact when the state transition is performed on it.

Back to Top ^

<parameter>

 

XML Syntax<parameter name="" value=""/>
Description

The name attribute defines the name of the parameter and value attribute defines that the value hold by the parameter. This parameter element defined under the <execution> element.

Mandatory/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
name

The name attribute defines the name of the parameter.  This parameter element defined under the <execution> element.

 
  • currentEnvironment - This defines the  fully qualified path of the underlying resource at its current state(before the transition is taken place)
  • targetEnvironment - This parameter defines the fully qualified path to which the particular resource is transitted when the particular state transition is taken place which is defined in the "forevent" attribute of the <execution> element. 
     
  • service.mediatype - This parameter denotes the MIME mediatype of the given service under the state transition.
  • wsdl.mediatype - This parameter denotes the MIME mediatype of the wsdl file for the corresponding service under the state transition.
  • endpoint.mediatype - This parameter denotes the MIME mediatype of the endpoint for the given artifact(service) when the particular state transition is taken.
all these parameters are mandatory. 
valuevalue attribute defines that the value hold by the parameter. This parameter element defined under the <execution> element.    

Back to Top ^

<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 provides a convenient way for a user to pass input that would be utilized when performing a transition. Note that, for the value of href, it will not accept any external reference link for the value. It is required to provide a relative path in the carbon server as the value of href.

Mandatory/OptionalOptional
Attributes of the Element
AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
forEvent

Defines the event for which this UI will be presented.

N/A OptionalThe forEvent value is defined under the <transition> element with the "event"  attribute.
hrefDefines the hyperlink that will be opened and presented to the user, when a lifecycle transition operation is performed from the Management Console.N/A Optional 

See the Transition UI Sample.

Back to Top ^

<transition>

XML Syntax<transition event="" target=""/>
Description

Defines the transitions of a state. From Governance Registry 4.1.1 onwards, users are allowed to define the transitions (the name and the target state) instead of using static transitions.

Previously, the configuration did not have a direct method of defining the transition event names or, most importantly, the target of the transition. There were only two transitions that were supported by default.

With the new, SCXML-based configuration model, any number of transitions from one state are supported. Also, this model has the capacity to define the target state of the transition and the name of the event as well.

Mandatory/OptionalMandatory

Attributes of the Element

AttributeDescriptionDefault ValueFixed ValuesMandatory/OptionalNotes
event

Defines the transition event name, for example, to "Promote" or "Demote" or any name that the user specifies.

N/A MandatoryThis event name is used in forEvent to trigger a specific event, before this transition this going on.
targetDefines the target state of the transition.N/A Mandatory 

Back to Top ^

  • No labels