This wiki is locked. Future workgroup activity and specification development must take place at our new wiki. For more information, see this blog post about the new governance model and this post about changes to the website.

OSLC Automation 2.0 Appendix A: Samples

An appendix of the OSLC Automation 1.0 Specification

(this document is informative)

Overview

This a collection of various Automation resources in a variety of formats to better illustrate their usage. These are samples only and not intended to show every permutation of the various formats.

Example 1

AutomationPlan RDF/XML Sample

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:oslc="http://open-services.net/ns/core#"
  xmlns:oslc_auto="http://open-services.net/ns/auto#">

    <oslc_auto:AutomationPlan
      rdf:about="http://example.org/autoplans/1234">

      <dcterms:title> Build Pet Store Application </dcterms:title>
      <dcterms:description> Build the Pet Store application. </dcterms:description>
      <dcterms:identifier> 1234 </dcterms:identifier>

      <dcterms:subject> samples </dcterms:subject>

      <dcterms:creator rdf:resource="http://myserver/myapp/users/joe" />
      <dcterms:contributor rdf:resource="http://myserver/myapp/users/bob" />

      <dcterms:created> 2012-01-16T08:42:11.265Z </dcterms:created >
      <dcterms:modified> 2012-03-22T12:54:09.577Z </dcterms:modified>

      <oslc_auto:parameterDefinition>
            <oslc:name>BuildType</oslc:name>
            <oslc:occurs>http://open-services.net/ns/core#Exactly-one</oslc:occurs>
            <oslc:propertyDefinition rdf:resource="http://open-services.net/ns/auto#ParameterDefinition" />
            <oslc:valueType rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
            <oslc:allowedValue>production</oslc:allowedValue>
            <oslc:allowedValue>personal</oslc:allowedValue>
            <oslc:allowedValue>test</oslc:allowedValue>
            <oslc:defaultValue>production</oslc:defaultValue>
      </oslc_auto:parameterDefinition>

    </oslc_auto:AutomationPlan>
</rdf:RDF>

AutomationRequest RDF/XML Sample

This example assumes the asynchronous interaction style is used: the client's POST message representations is shown below.

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:oslc="http://open-services.net/ns/core#"
  xmlns:oslc_auto="http://open-services.net/ns/auto#">

    <oslc_auto:AutomationRequest
      rdf:about="http://example.org/autoreqs/2345">

      <dcterms:title> Pet Store Build Request 2345 </dcterms:title>
      <dcterms:identifier> 2345 </dcterms:identifier>

      <dcterms:creator rdf:resource="http://myserver/myapp/users/joe" />
      <dcterms:contributor rdf:resource="http://myserver/myapp/users/builduser1" />

      <dcterms:created> 2012-01-16T08:42:11.265Z </dcterms:created >
      <dcterms:modified> 2012-03-22T12:54:09.577Z </dcterms:modified>

      <oslc_auto:inputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildType</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">production</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:inputParameter>
      
      <oslc_auto:state rdf:resource="http://open-services.net/ns/auto#new"/>
      
      <oslc_auto:executesAutomationPlan rdf:resource="http://example.org/autoplans/1234"/>

    </oslc_auto:AutomationRequest>
</rdf:RDF>

AutomationResult RDF/XML Sample

This example assumes the asynchronous interaction style is used: the provider's POST response was either 201 (Created) or 204 (No Content) and the URL of the AutomationRequest? was returned in the HTTP Location header. The client later searches the AutomationResult? collection for the instance whose oslc_auto:producedByAutomationRequest predicate matches the AutomationRequest? URL, finding a result whose representation looks like the following:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:oslc="http://open-services.net/ns/core#"
  xmlns:oslc_auto="http://open-services.net/ns/auto#"
  xmlns:my_ns="http://example.org/ns/my_ns#">

    <oslc_auto:AutomationResult
      rdf:about="http://example.org/autoresults/3456">

      <dcterms:title> Pet Store Build Result 3456 </dcterms:title>
      <dcterms:identifier> 2345 </dcterms:identifier>
      <dcterms:subject>milestone 1</dcterms:subject>
      <dcterms:subject>translations included</dcterms:subject>
      

      <dcterms:creator rdf:resource="http://myserver/myapp/users/builduser1" />
      <dcterms:contributor rdf:resource="http://myserver/myapp/users/builduser1" />

      <dcterms:created> 2012-01-16T08:42:11.265Z </dcterms:created >
      <dcterms:modified> 2012-03-22T12:54:09.577Z </dcterms:modified>

      <oslc_auto:inputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildType</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">production</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:inputParameter>
      
      <oslc_auto:outputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildMachine</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">buildengine1</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:outputParameter>
      
      <oslc_auto:state rdf:resource="http://open-services.net/ns/auto#complete"/>
      <oslc_auto:verdict rdf:resource="http://open-services.net/ns/auto#pass"/>
      
      <oslc_auto:reportsOnAutomationPlan rdf:resource="http://example.org/autoplans/1234"/>
      <oslc_auto:producedByAutomationRequest rdf:resource="http://example.org/autoreqs/2345"/>
      
      <oslc_auto:hasContribution>
         <rdf:Description>
         <dcterms:title>logfile.txt</dcterms:title>
            <dcterms:description>Logfile for build result 3456</dcterms:description>
            <rdf:type rdf:resource="http://example.org/ns/my_ns#Logfile"/>
            <my_ns:status_page>http://buildserver1/builds/3456/status.html</my_ns:status_page>
            <my_ns:logfile>http://buildserver1/builds/3456/logfile.txt</my_ns:logfile>
            <my_ns:build_location>ftp://anonymous@fileserver1/home/builds/3456/build_output_20120322a.zip</my_ns:build_location>
      </rdf:Description>
      </oslc_auto:hasContribution>
      
      <oslc_auto:hasContribution>
         <rdf:Description>
            <dcterms:title>Approval Record 3456</dcterms:title>
            <dcterms:description>The approval record for build result 3456</dcterms:description>
            <dcterms:type rdf:resource="http://example.org/ns/my_ns#Approval"/>
            <my_ns:approver>John Smith</my_ns:approver>
            <my_ns:approval_status>Approved</my_ns:approval_status>
      </rdf:Description>
      </oslc_auto:hasContribution>

    </oslc_auto:AutomationResult>
</rdf:RDF>

Example 2

Same as Example 1, but illustrating the synchronous interaction style. In this example, the 200 (OK) response contains only an AutomationResult? ; no AutomationRequest? is ever exposed by the provider.

AutomationPlan RDF/XML Sample

Exactly the same as the asynchronous interaction style's Automation Plan from Example 1.

AutomationRequest RDF/XML Sample

Since the provider processes the request using the synchronous interaction style, the client POSTs an AutomationRequest? to the provider, but it is not returned in the 200 (OK) response body. The corresponding AutomationRequest? exists only in the client's initial Create request. Its representation is identical to the AutomationResult? in Example 1 except for the addition of the oslc_auto:clientSupportsSynchInteractionStyle triple.

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:oslc="http://open-services.net/ns/core#"
  xmlns:oslc_auto="http://open-services.net/ns/auto#">

    <oslc_auto:AutomationRequest
      rdf:about="http://example.org/autoreqs/2345">

      <dcterms:title> Pet Store Build Request 2345 </dcterms:title>
      <dcterms:identifier> 2345 </dcterms:identifier>

      <dcterms:creator rdf:resource="http://myserver/myapp/users/joe" />
      <dcterms:contributor rdf:resource="http://myserver/myapp/users/builduser1" />

      <dcterms:created> 2012-01-16T08:42:11.265Z </dcterms:created >
      <dcterms:modified> 2012-03-22T12:54:09.577Z </dcterms:modified>

      <oslc_auto:clientSupportsSynchInteractionStyle >true</oslc_auto:clientSupportsSynchInteractionStyle >

      <oslc_auto:inputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildType</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">production</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:inputParameter>
      
      <oslc_auto:state rdf:resource="http://open-services.net/ns/auto#new"/>
      
      <oslc_auto:executesAutomationPlan rdf:resource="http://example.org/autoplans/1234"/>

    </oslc_auto:AutomationRequest>
</rdf:RDF>

AutomationResult RDF/XML Sample

Since the provider processes the request using the synchronous interaction style, its response would be 200 (OK); since this provider does not include a copy of the AutomationRequest? in the HTTP response body, its representation is identical to the AutomationResult? in Example 1.

Example 3

Same as Example 1, but illustrating the synchronous interaction style. In this example, the 200 (OK) response contains both an AutomationResult? ? and the original AutomationRequest? ?.

AutomationPlan RDF/XML Sample

Exactly the same as the asynchronous interaction style's Automation Plan from Example 1.

AutomationRequest and AutomationResult RDF/XML Sample

Since this provider processed the request using the synchronous interaction style, its response was 200 (OK); since this provider includes a copy of the AutomationRequest? in the response, the HTTP response body consists of the representation below. It consists of the AutomationRequest? from Example 2 smushed together with the AutomationResult? from Example 1.

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:oslc="http://open-services.net/ns/core#"
  xmlns:oslc_auto="http://open-services.net/ns/auto#"
  xmlns:my_ns="http://example.org/ns/my_ns#">

    <oslc_auto:AutomationRequest
      rdf:about="http://example.org/autoreqsresults/2345">
     <rdf:type rdf:resource="oslc_auto:AutomationResult" />

      <dcterms:title> Pet Store Build Request/Result 2345 </dcterms:title>
      <dcterms:identifier> 2345 </dcterms:identifier>
      <dcterms:subject>milestone 1</dcterms:subject>
      <dcterms:subject>translations included</dcterms:subject>

      <dcterms:creator rdf:resource="http://myserver/myapp/users/joe" />
      <dcterms:contributor rdf:resource="http://myserver/myapp/users/builduser1" />

      <dcterms:created> 2012-01-16T08:42:11.265Z </dcterms:created >
      <dcterms:modified> 2012-01-16T08:42:11.268Z </dcterms:modified>

      <oslc_auto:clientSupportsSynchInteractionStyle >true</oslc_auto:clientSupportsSynchInteractionStyle >
      
      <oslc_auto:inputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildType</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">production</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:inputParameter>
      
      <oslc_auto:outputParameter>
         <oslc_auto:ParameterInstance>
            <oslc:name>BuildMachine</oslc:name>
            <rdf:value rdf:datatype="http://www.w3.org/2001/XMLSchema#string">buildengine1</rdf:value>
         </oslc_auto:ParameterInstance>
      </oslc_auto:outputParameter>
      
      <oslc_auto:state rdf:resource="http://open-services.net/ns/auto#complete"/>
      <oslc_auto:verdict rdf:resource="http://open-services.net/ns/auto#pass"/>
      
      <oslc_auto:reportsOnAutomationPlan rdf:resource="http://example.org/autoplans/1234"/>
      <oslc_auto:producedByAutomationRequest rdf:resource="http://example.org/autoreqs/2345"/>
      
      <oslc_auto:executesAutomationPlan rdf:resource="http://example.org/autoplans/1234"/>

      <oslc_auto:hasContribution>
         <rdf:Description>
         <dcterms:title>logfile.txt</dcterms:title>
            <dcterms:description>Logfile for build result 3456</dcterms:description>
            <rdf:type rdf:resource="http://example.org/ns/my_ns#Logfile"/>
            <my_ns:status_page>http://buildserver1/builds/3456/status.html</my_ns:status_page>
            <my_ns:logfile>http://buildserver1/builds/3456/logfile.txt</my_ns:logfile>
            <my_ns:build_location>ftp://anonymous@fileserver1/home/builds/3456/build_output_20120322a.zip</my_ns:build_location>
         </rdf:Description>
      </oslc_auto:hasContribution>
      
      <oslc_auto:hasContribution>
         <rdf:Description>
            <dcterms:title>Approval Record 3456</dcterms:title>
            <dcterms:description>The approval record for build result 3456</dcterms:description>
            <dcterms:type rdf:resource="http://example.org/ns/my_ns#Approval"/>
            <my_ns:approver>John Smith</my_ns:approver>
            <my_ns:approval_status>Approved</my_ns:approval_status>
         </rdf:Description>
      </oslc_auto:hasContribution>

   </oslc_auto:AutomationRequest>
</rdf:RDF>
Edit | Attach | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r6 - 07 Jun 2012 - 03:01:10 - XinPengLiu
 
This site is powered by the TWiki collaboration platform Copyright � by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Contributions are governed by our Terms of Use
Ideas, requests, problems regarding this site? Send feedback