HistoryViewLinks to this page 2014 October 10 | 04:41 pm

OSLC Automation 2.1 Appendix A: Samples

An appendix of the OSLC Automation Specification Version 2.1.

This document is non-normative, that is its content does not affect compliance.

Contents


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.

Additional examples focusing on concepts introduced in the previous version of Automation are available in the OSLC Automation Version 2.0 Samples document.

Example 1: A service provider that exposes a mixture of immediate and deferred execution dialogs

This example shows how an Automation service provider’s representation might change as the implementation migrates from supporting Automation 2.0 to 2.1, in terms of delegated creation dialog. Analogous changes would occur for creation factories.

  1. One whose representation is unchanged from when the service provider only supported the Automation 2.0 specification; when it is used to create an Automation Request, the request is (by default) immediately eligible for execution.
  2. A clone of the previous one, with usage URIs defined by Automation 2.1 added to help clients discover the behavior that 2.0 took for granted.
  3. A new creation dialog, with the deferred execution behavior defined by Automation 2.1; when it is used to create an Automation Request, the request is not (by default) immediately eligible for execution.

Related specification section: Deferred execution creation dialog

@prefix oslc:      <http://open-services.net/ns/core#> .
@prefix rdf:       <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dcterms:   <http://purl.org/dc/terms/> .
@prefix oslc-automation:    <http://open-services.net/ns/auto#> .

@base <http://example.com/>.

# The service provider at a point in time when the implementation
# supports Automation 2.0

<Automation-2.0-ServiceProvider>
    a oslc:ServiceProvider ; 
    oslc:service [
        oslc:domain            oslc-automation: ;
        oslc:creationDialog    [
            a    oslc:Dialog ;
            dcterms:title    "Automation 2.0";
            oslc:dialog        <dialogs/automation-request/>;
        ];
    ];
.

# The service provider at a point in time when the implementation
# supports Automation 2.1.

# The 2.0 dialog has usage values added; this change is optional.
# - ImmediateExecution renders explicit its 2.0 behavior.
# - default provides a hint to clients (especially 2.0 clients that
#   expect 2.0 behavior) to prefer that dialog

# A 2.1 deferred execution dialog is appended.

<Automation-2.1-ServiceProvider>
    a oslc:ServiceProvider ; 
    oslc:service [
        oslc:domain            oslc-automation: ;
        oslc:creationDialog    [
            a    oslc:Dialog ;
            dcterms:title    "Automation 2.0 aka Automation 2.1 immediate execution dialog";
            oslc:dialog        <dialogs/automation-request/>;
            oslc:usage        oslc-automation:ImmediateExecution , oslc:default ;
        ];
        oslc:creationDialog    [
            # Deferred execution dialog
            a    oslc:Dialog ;
            dcterms:title    "Automation 2.1 deferred execution dialog";
            oslc:dialog        <dialogs/automation-request/deferred/>;
            oslc:usage        oslc-automation:DeferredExecution ;
        ];
    ];

Example 2: An action with both deferred and immediate execution bindings

Related specification section: Deferred execution action bindings

@base <http://example.com/> .
@prefix oslc <http://open-services.net/ns/core#> .
@prefix oslc_auto <http://open-services.net/ns/auto#> .
@prefix dcterms <http://purl.org/dc/terms/> .
@prefix http <http://www.w3.org/2011/http#> .
@prefix http-methods <http://www.w3.org/2011/http-methods#> ;

<actions/1>
    a             oslc:Action ;
    dcterms:title "Perform action X" ;
    oslc:binding  <actions/1/bindings/http> ;
    oslc:binding  <actions/1/bindings/dialog> ;
    oslc:binding  <actions/1/bindings/dialog-deferred> ;
.

<actions/1/bindings/http>
    a                        http:Request ;
    http:httpVersion         "1.1" ;
    http:mthd                http-methods:POST ;
    http:requestURI          <actions/1/bindings/http> ;
    
    # Multi-valued http:body predicate allows either of the following interaction patterns:
    # HTTP request with empty body, or HTTP request with fixed body.
    http:body                rdf:nil ;
    http:body                [
        a         oslc_auto:ParameterInstance ;
        rdf:value <actions/1/bindings/http/body.txt> ; # Some opaque body contents
    ] ;
    oslc:finalStatusLocation http:StatusCode ;
.

<actions/1/bindings/dialog>
    a                        oslc:Dialog ;
    oslc:usage               oslc:ActionDialog;
    oslc:usage               oslc_auto:ImmediateExecution ;
    dcterms:title            "Perform action X..." ;
    oslc:dialog              <actions/1/bindings/dialog.html> ;
    oslc:finalStatusLocation oslc:ActionDialog ;
.

<actions/1/bindings/dialog-deferred>
    a                        oslc:Dialog ;
    oslc:usage               oslc_auto:DeferredExecution ;
    dcterms:title            "Configure action X for later execution..." ;
    oslc:dialog              <actions/1/bindings/dialog-deferred.html> ;  # Used in configuration phase
    
    # Bindings used during the execution phase
    # - This dialog re-uses the immediate-execution bindings from the action above.  
    # - The deferred-execution binding (actions/1/bindings/dialog-deferred) is not re-used.
    oslc:binding             <actions/1/bindings/dialog> ; # A dialog in case the user is present and wants to tweak the values
    oslc:binding             <actions/1/bindings/http> ; # For the consumer to replace the fixed body with the result of this dialog
.

Example 3: Execution environment tear-down and re-use

Related specification section: Future actions

Fully worked example