The account services development team is building a web application to help better process account management requests. Their project’s source code has been stored in a source control repository. The source depends on re-usable open source libraries stored in their asset management system.
The project is at the point where they would like to schedule a nightly automated build. Through the build system interface they will define their build process. The build system will run this process nightly to build their implementation and publish the result back to the Asset Management system.
Scenario
The account services development team is building a web application to help better process account management requests. Their project’s source code has been stored in a source control repository. The source depends on re-usable open source libraries stored in their asset management system.
The project is at the point where they would like to schedule a nightly automated build. Through the build system interface they will define their build process. The build system will run this process nightly to build their implementation and publish the result back to the Asset Management system.
Request:
GET https://example.com/am/oslc/assets/services
Accept: application/rdf+xml
OSLC-Core-Version:2.0
Response:
Status Code: 200 (OK)
Content-Type: application/rdf+xml
Body:
<?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlnx:oslc=”http://open-services.net/ns/core#” xmlns:dcterms="http://purl.org/dc/terms/"> <oslc:ServiceProviderCatalog rdf:about="https://example.com/am/oslc/assets/services"> <dcterms:title>Asset Management Services</dcterms:title> <dcterms:description>Asset Manager OSLC Service Description</dcterms:description> <dcterms:publisher> <dcterms:title>Asset Manager</dcterms:title> <dcterms:identifier>com.myco.am.assets</dcterms:identifier> <oslc:icon> https://am/images/AssetManager.ico</oslc:icon> </dcterms:publisher> <!--? OAuth config ?--> <oslc:serviceProvider rdf:resource=”https://example.com/am/oslc/assets/serviceProvider”/> </oslc:ServiceProviderCatalog> </rdf:RDF>
Request:
GET https://example.com/am/oslc/assets/serviceProvider
Accept: application/rdf+xml
OSLC-Core-Version:2.0
Response:
Status Code: 200 (OK)
Content-Type: application/rdf+xml
Body:
<?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlnx:oslc=”http://open-services.net/ns/core#” xmlns:dcterms="http://purl.org/dc/terms/"> <oslc:ServiceProvider rdf:about="https://example.com/am/oslc/assets/serviceProvider"> <dcterms:title>Asset Manager REST Services</dcterms:title> <oslc:service> <oslc:domain rdf:resource=”http://open-services.net/ns/core#Asset”/> <oslc:creationFactory> <oslc:creation rdf:resource=”https://example.com/am/oslc/assets”/> <dcterms:title>Default location for creation of assets</dcterms:title> <oslc:resourceShape rdf:resource=”https://example.com/am/oslc/assets/defaultAssetShape”/> <!--oslc resource type??-> </oslc:creationFactory> <oslc:queryCapability> <oslc:queryBase rdf:resource=”https://example.com/am/oslc/simpleQuery”/> <dcterms:title>Asset Queries</dcterms:title> <oslc:resourceShape rdf:resource=”https://example.com/am/oslc/assets/defaultAssetShape”/> <!--oslc resource type??-> </oslc:queryCapability> <oslc:selectionDialog> <dcterms:title>Search for assets</dcterms:title> <oslc:dialog rdf:resource=”https://example.com/am/oslc/searchDialog”/> <!--oslc resource type??-> </oslc:selectionDialog> <oslc:creationDialog> <dcterms:title>Asset creation dialog</dcterms:title> <oslc:dialog rdf:resource=”https://example.com/am/oslc/createDialog”/> <!--oslc resource type??-> </oslc:creationDialog> </oslc:service> <!--?OSLC prefix definition?--> <oslc:ServiceProvider> </rdf:RDF>
While defining the build configuration the user opens a delegated UI with in the build system UI that allows the user to search within the Asset Management system for dependent libraries to be used during the build.
<iframe id=”assetSearchDialog” src=”rdf:resource=”https://example.com/am/oslc/searchDialog”/>
function launchSearchDialog(event) { var frame = document.getElementById(‘assetSearchDialog’); if (event.source == frame.contentWindow && event.data.indexOf('oslc-response:') == 0) { var response = event.data.sub str('oslc-response:'.length); handleResponse(response); } } window.addEventListener('message', launchSearchDialog , false);
value of the response
{ "oslc:results" : [{ "oslc:label": "Account Management Release [2.0]", "rdf:resource": "https://example.com/am/oslc/000-111/20” }] }
function handleResponse(response){ var release = eval(‘(‘ + response + ‘)’); var url = release[‘oslc:results’][0][‘rdf:resource’]; //use it }
window.removeEventListener('message', launchSearchDialog, false);
The user also uses a delegated asset creation UI to create a placeholder asset where the nightly build will be made available on publish.
<iframe id=”assetCreateDialog” src=”rdf:resource=”https://example.com/am/oslc/createDialog”/>
function launchCreateDialog(event) { var frame = document.getElementById(‘assetCreateDialog’); if (event.source == frame.contentWindow && event.data.indexOf('oslc-response:') == 0) { var response = event.data.sub str('oslc-response:'.length); handleCreateResponse(response); } } window.addEventListener('message', launchCreateDialog , false);
value of the response
{ "oslc:results" : [{ "oslc:label": "Account Management Implementation [2.0]", "rdf:resource": "https://example.com/am/oslc/000-112/20” }] }
function handleCreateResponse(response){ var release = eval(‘(‘ + response + ‘)’); var url = release[‘oslc:results’][0][‘rdf:resource’]; //use it }
window.removeEventListener('message', launchCreateDialog, false);
System brings the information form SCM with information about the referenced library. For example it is looking for the an Apache Ant runtime that runs on Red Hat Linux with a version greater than or equal to 1.7.
Request:
GET http://example.com/simpleQuery?oslc.where=dcterms.title="Apache Ant" and oslc_asset.categorization=”/Software/Requirements/Operating System/Linux/Red Hat” and ras:id{ras:version}>="1.7" and oslc.select=ras:id,dcterms:title
Accept: application/rdf+xml
OSLC-Core-Version:2.0
Response:
Status Code: 200 (OK)
Content-Type: application/rdf+xml
ETag: xxx
Content-Length: nnn
Body:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:oslc_asset="http://open-services.net/ns/asset#" xmlns:oslc="http://open-services.net/ns/core#" xmlns:ras="http://www.omg.org/ras/v2.2"> <oslc:ResponseInfo rdf:about="http://example.com/query?oslc.where%3Ddcterms.title%3D%22Apache%20%20Ant%22%20and%20oslc_asset.categorization%3D%E2%80%9D%2FSoftware%2FRequirements%2FOperating%20System%2FLinux%2FRed%20Hat%E2%80%9D%20and%20ras%3Aid%7Bras%3Aversion%7D%3E%3D%221.7%22%20and%20oslc.select%3Dras%3Aid%2Cdcterms%3Atitle"> <dcterms:title>Asset query service</dcterms:title> </oslc:ResponseInfo> <rdf:Description rdf:about="http://example.com/query"> <rdfs:member> <oslc_asset:Asset rdf:about="http://example.com/oslc/assets/813/1.7"> <ras:id> <ras:GUID>813</ras:GUID> <ras:version>1.7</ras:version> </ras:id> <dcterms:title>Apache Ant</dcterms:title> </oslc_asset:Asset> </rdfs:member> </rdf:Description> </rdf:RDF>
System downloads referenced library artifacts (tools from the build configuration and the dependencies defined within the project) to be used during build
The build system downloads the dependent asset Log4j and extracts them in the agreed upon page of ${buildArea}/dependency/guid/version directory.
Request
GET http://example.com/oslc/assets/233/2.1 Accept: application/zip OSLC-Core-Version: 2.0
Response
HTTP/1.0 200 OK OSLC-Core-Version: 2.0 Content-Type: application/zip ETag: xxx Content-Length: nnn Body: Zipped content of the log4j dependent asset
The build system downloads and extracts the Build Specification asset into the ${buildArea}/src directory.
Request
GET http://example.com/assets/4667/1.0 Accept: application/zip OSLC-Core-Version: 2.0
Response
HTTP/1.0 200 OK OSLC-Core-Version: 2.0 Content-Type: application/zip ETag: xxx Content-Length: nnn Body: Zipped content of the build specification
The build system downloads the Implementation Template into ${buildArea}/publish.xml
Request
GET http://example.com/assets/4667/1.0/artifactContents/implTemplate.xml Accept: application/xml OSLC-Core-Version: 2.0
Response
HTTP/1.0 200 OK OSLC-Core-Version: 2.0 Content-Type: application/xml ETag: xxx Content-Length: nnn <?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_asset="http://open-services.net/ns/asset#" xmlns:myco=”http://example.com/oslc/extended/asset” xmlns:ras="http://www.omg.org/ras/v2.2"> <oslc_asset:Asset> <rdf:type rdf:resource="http://open-services.net/ns/asset#Asset" /> <ras:id> <ras:GUID>1945</ras:GUID> <ras:version>1.0.<today's date></ras:version> </ras:id> <dcterms:title>Myco Services Application Websphere Implementation </dcterms:title> <dcterms:type>Implementation</dcterms:type> <oslc:instanceShape rdf:resource="http://example.com/shapes/implementation" /> <dcterms:subject> Websphere Implementation of Myco's web services application </dcterms:subject> <oslc_asset:relation rdf:resource="http://example.com/oslc/assets/813/1.0"> <dc:type>Implementation of</dc:type> <dc:title>Myco Services Release</dc:title> </oslc_asset:relation> </oslc_asset:Asset> </rdf:RDF>
On success the build system uses the publish.xml template to POST the new Implementation to the asset management system.
Request
POST http://example.com/oslc/assets Accept: application/rdf+xml Content-Type: application/rdf+xml OSLC-Core-Version: 2.0 Body: <?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_asset="http://open-services.net/ns/asset#" xmlns:myco=”http://example.com/oslc/extended/asset” xmlns:ras="http://www.omg.org/ras/v2.2"> <oslc_asset:Asset> <rdf:type rdf:resource="http://open-services.net/ns/asset#Asset" /> <ras:id> <ras:GUID>1945</ras:GUID> <ras:version>1.0.10_12_2010</ras:version> </ras:id> <dcterms:title>Myco Services Application Websphere Implementation </dcterms:title> <dcterms:type>Implementation</dcterms:type> <oslc:instanceShape rdf:resource="http://example.com/shapes/implementation" /> <dcterms:subject> Websphere Implementation of Myco's web services application </dcterms:subject> <oslc_asset:relation rdf:resource="http://example.com/oslc/assets/813/1.0"> <dc:type>Implementation of</dc:type> <dc:title>Myco Services Release</dc:title> </oslc_asset:relation> </oslc_asset:Asset> </rdf:RDF>
Response
HTTP/1.0 201 Created OSLC-Core-Version: 2.0 Content-Type: application/xml ETag: xxx Content-Length: nnn Location: http://example.com/oslc/assets/1945/1.0.10_12_2010 <?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_asset="http://open-services.net/ns/asset#" xmlns:myco=”http://example.com/oslc/extended/asset” xmlns:ras="http://www.omg.org/ras/v2.2" > <oslc_asset:Asset rdf:about=”http://example.com/oslc/extended/asset/1945/1.0.10_12_2010”> <rdf:type rdf:resource="http://open-services.net/ns/asset#Asset" /> <ras:id> <ras:GUID>1945</ras:GUID> <ras:version>1.0.10_12_2010</ras:version> </ras:id> <dcterms:title>Myco Services Application Websphere Implementation </dcterms:title> <dcterms:type>Implementation</dcterms:type> <oslc:instanceShape rdf:resource="http://example.com/shapes/implementation" /> <dcterms:subject> Websphere Implementation of Myco's web services application </dcterms:subject> <oslc_asset:relation rdf:resource="http://example.com/oslc/assets/813/1.0"> <dc:type>Implementation of</dc:type> <dc:title>Myco Services Release</dc:title> </oslc_asset:relation> <oslc_asset:artifactContentFactory rdf:about="https://server:9443/am/oslc/assets/1945/1.0.10_12_2010/artifacts"/> </oslc_asset:Asset> </rdf:RDF>
All files placed in ${buildArea}/bin during the build are added as Artifacts to the new asset.
Request
POST https://server:9443/am/oslc/assets/1945/1.0.10_12_2010/artifacts?oslc_asset.name=services.ear Content-Type: application/java-archive OSLC-Core-Version: 2.0
Response
HTTP/1.0 201 Created OSLC-Core-Version: 2.0 Content-Type: application/xml ETag: xxx Content-Length: nnn Location: http://example.com/oslc/assets/1945/1.0.10_12_2010/artifactsContent/services.ear
The build system updates the Build Specifications with the new Last Built Date. OSLC Core Guidance: Partial Update OSLCCorePartialUpdateDRAFT.
Request
POST https://server:9443/am/oslc/assets/1945/1.0.10_12_2010 Content-Type: application/sparql-update X-Method-Override=PATCH OSLC-Core-Version: 2.0 PREFIX myco: <http://example.com/oslc/extended/asset> DELETE DATA { <https://server:9443/am/oslc/assets/1945/1.0.10_12_2010> myco:lastBuilt "2010-10-08T23:00:00.000Z" } } INSERT DATA { <https://server:9443/am/oslc/assets/1945/1.0.10_12_2010> myco:lastBuilt "2010-10-09T23:00:00.000Z" } }
Response
HTTP/1.0 200 OK OSLC-Core-Version: 2.0 ETag: xxx