This documentation is for WSO2 App Factory 2.0.0. View documentation for the latest release.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Following sample code explains how to add a life cycle stage called Testing between existing Development and Production  life life cycle stages. Assume the Testing stage has two checklists as 'Smoke Test Passed*' and 'Test Cases Passed*'.   These checklists ensure that certain standards and policies are satisfied before moving the application to the next stage. This stage also has Demote and Promote as possible transition states.

Code Block
languagehtml/xml
<lifecycle>
	<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="Development">     
		<!-- Development life cycle -->
		<state id="Development">
		.
		.
		</state>
		
		<!-- Testing life cycle -->
		<state id="Testing">
			<datamodel>
				<data name="checkItems">
					<item name="Smoke Tests Passed*" forEvent="Promote"></item>
					<item name="Test Cases Passed*" forEvent="Promote"></item>
				</data>
				<data name="transitionExecution">
					<execution forEvent="Promote" class="org.wso2.carbon.appfactory.core.governance.lifecycle.AppFactoryLCExecutor"></execution>
					<execution forEvent="Demote" class="org.wso2.carbon.appfactory.core.governance.lifecycle.AppFactoryLCExecutor"></execution>			    
				</data>	
		
				<data name="transitionScripts">
					<js forEvent="Promote">
						<console function="doPromote">
							<script type="text/javascript">
						    	doPromote = function() {
								window.location = unescape("../resources/resource.jsp?region=region3%26item=resource_browser_menu%26path=/_system/governance/repository/applications");
						    	}
							</script>
						</console>                          
					</js>
					<js forEvent="Demote">
						<console function="doDemote">
							<script type="text/javascript">
						    	doPromote = function() {
								window.location = unescape("../resources/resource.jsp?region=region3%26item=resource_browser_menu%26path=/_system/governance/repository/applications");
						    	}
							</script>
						</console>
					</js>
				</data>			
			</datamodel>
			<transition event="Promote" target="Production"/>
			<transition event="Demote" target="Development"/>
		</state>
   
		<!-- Production life cycle -->
		<state id="Production">
		.
		.
		</state>

	</scxml>
</lifecycle>

...

Property NameDescriptionTypeDefault ValueFixed ValuesMandatory/Optional
< scxml xmlns = "" version = "" initialstate = "" >     
<state id="">

state - New life cycle is stated using <state> tag.

  id - Defines the name of the state.

    
<datamodel>

Datamodel specifies logics for given life cycle. It contains 3 data elements that defines:

  • Check items.
  • Transition permissions.
  • Transition scripts.
    
          <
          data name
          =
          ""
          >  
     
 
          
        

Define data model.

  

checkItems: defines that this element contains the set of check items. It is required to be set to 'checkItems'

transitionExecution: Specify transition states for a given lifecycle.

transitionScripts: Currently App Factory is not using above code block. Therefore keep as it is during new lifecycle.

 
 < item name = "" forEvent = "" >

name - Defines the check item name
forEvent - Defines the set of transitions that this check item is required. Accepts a ',' separated list.

    
 < execution forEvent = "" class = "" ><execution> defines, which life cycle executor class has to execute when a specific transition state has clicked.     
 < js forEvent = "" >     
 < console function = "" >     
 

< script type = " text/javascript " >

This attribute specifies the scripting language of the element's contents and overrides the default scripting language.    
          <
          transition event
          =
          "" target
          =
          ""
          />
        
event
Event specify which life cycle stage has to move when a given transition state has clicked.    
 targetDefine target life cycle.