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
.
TWiki
>
Main Web
>
AssetHome
>
OSLCAssetManagement20Example
(22 Apr 2011,
SheehanAnderson
)
(raw view)
---+ Asset Management 2.0 Specification Example ---++ <a name="Contents"></a> Contents %TOC% ---++ Scenario <a name="scenario" title="scenario"></a> Copied from the Use Case document -> https://docs.google.com/document/d/1jdKioqtZ-ZvrRc63DVzR8WXcxue4o6eGu4_cdE3XRvw/edit#?hl=en 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. ---++ Service Discovery <a name="serviceDiscovery" title="serviceDiscovery"></a> Prior to working with any OSLC REST services is the Service Provider Catalog. This location of this catalog is provided by the asset management product. More information of the Service Provider Catalog can be found in the [[http://open-services.net/bin/view/Main/OslcCoreSpecification?sortcol=table;up=#Service_Provider_Resources][core]]. ---+++ Get the service provder catalog <a name="getServiceProvderCatalog" title="getServiceProvderCatalog"></a> *Request:* <br /> GET https://example.com/oslc/assets/services <br /> Accept: application/rdf+xml <br /> OSLC-Core-Version:2.0 *Response:* <br /> Status Code: 200 (OK) <br /> Content-Type: application/rdf+xml <br /> Body: <verbatim> <?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/oslc/assets/services"> <dcterms:title>Asset Management Services</dcterms:title> <dcterms:description>Asset Manager OSLC Services</dcterms:description> <dcterms:publisher> <dcterms:title>Asset Manager</dcterms:title> <dcterms:identifier>com.myco.assets</dcterms:identifier> <oslc:icon> https://example.com/assets/images/AssetManager.ico</oslc:icon> </dcterms:publisher> <!--? OAuth config ?--> <oslc:serviceProvider rdf:resource=”https://example.com/oslc/assets/serviceProvider”/> </oslc:ServiceProviderCatalog> </rdf:RDF> </verbatim> ---+++ GET Service Provider <a name="getServiceProvder" title="getServiceProvder"></a> In the Service Provider four services are found: 1 A [[http://open-services.net/bin/view/Main/OslcCoreSpecification#Creation_Factories][creation factory]] to programtically create new assets on the system. 1 A [[http://open-services.net/bin/view/Main/OslcCoreSpecification#Query_Capabilities][query capability]] used to programtically search for assets in the system. 1 A [[http://open-services.net/bin/view/Main/OslcCoreSpecification#Resource_Selection][selection dialog]] used to provide a delegated UI to interactivlly search for assets. 1 A [[http://open-services.net/bin/view/Main/OslcCoreSpecification#Resource_Creation][creation dialog]] used to provide a deledgated UI to interactivlly create asssets. *Request:* <br /> GET https://example.com/oslc/assets/serviceProvider<br /> Accept: application/rdf+xml <br /> OSLC-Core-Version:2.0 *Response:* <br /> Status Code: 200 (OK) <br /> Content-Type: application/rdf+xml <br /> Body: <verbatim><?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/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/oslc/assets”/> <dcterms:title>Default location for creation of assets</dcterms:title> <oslc:resourceShape rdf:resource=”https://example.com/oslc/assets/defaultAssetShape”/> <rdf:type rdf:resource="http://open-services.net/ns/asset#Asset" /> </oslc:creationFactory> <oslc:queryCapability> <oslc:queryBase rdf:resource=”https://example.com/oslc/simpleQuery”/> <dcterms:title>Asset Queries</dcterms:title> <oslc:resourceShape rdf:resource=”https://example.com/oslc/assets/defaultAssetShape”/> <rdf:type rdf:resource="http://open-services.net/ns/asset#Asset" /> </oslc:queryCapability> <oslc:selectionDialog> <dcterms:title>Search for assets</dcterms:title> <oslc:dialog rdf:resource=”https://example.com/oslc/searchDialog”/> <rdf:type rdf:resource="http://open-services.net/ns/asset#Asset" /> </oslc:selectionDialog> <oslc:creationDialog> <dcterms:title>Asset creation dialog</dcterms:title> <oslc:dialog rdf:resource=”https://example.com/oslc/createDialog”/> <rdf:type rdf:resource="http://open-services.net/ns/asset#Asset" /> </oslc:creationDialog> </oslc:service> <!--?OSLC prefix definition?--> <oslc:ServiceProvider> </rdf:RDF> </verbatim> ---++ Delegated Asset Search <a name="delegatedAssetSearch" title="delegatedAssetSearch"></a> While defining the build configuration, the user opens a delegated UI within the build system UI that allows the build engineer to search within the Asset Management system for versions of dependent tools (compilers, libraries, code generators, etc) to be used during the build. ---+++ Define search dialog <a name="defineSearchDialog" title="defineSearchDialog"></a> The build system embeds an iFrame that points to the selection dialog URL found in Service Provider and javascript methods to launch the dialog. <verbatim> <iframe id=”assetSearchDialog” src=”rdf:resource=”https://example.com/oslc/searchDialog”/> <script> //Listen for response window.addEventListener('message', launchSearchDialog , false); 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); } } </script> </verbatim> ---+++ Handle Search Response <a name="handleSearchResponse" title="handleSearchResponse"></a> Once launched the user interacts with the dialog from the asset management system. The result for the dialog is passed back to the handleResponse() method. The result comes back as a [[http://open-services.net/bin/view/Main/OslcCoreSpecification#Resource_Selection][results]] resource in JSON. The results resource contains a set of links selected in the delegated selection dialog. *value of the response* <verbatim> { "oslc:results" : [{ "oslc:label": "Account Management Release [2.0]", "rdf:resource": "https://example.com/oslc/assets/000-111/20” }] } </verbatim> Use the javascript eval method to easily hydrate the resulting JSON into a javascript object to store the selected resource URLs in the build specification. <verbatim> function handleResponse(response){ var release = eval(‘(‘ + response + ‘)’); var url = release[‘oslc:results’][0][‘rdf:resource’]; //store the resulting resource URLs } </verbatim> ---++ Delegated Asset Creation <a name="delegatedAssetCreate" title="delegatedAssetCreate"></a> The build engineer uses a delegated asset creation UI to create a placeholder asset (with links to the required tools found from the search) where the candidate build will be made available on publish. ---+++ Define create dialog <a name="defineCreateDialog" title="defineCreateDialog"></a> The build system embeds an iFrame that points to the creation dialog URL found in Service Provider and javascript methods to launch the dialog. <verbatim> //Listen for response <iframe id=”assetCreateDialog” src=”rdf:resource=”https://example.com/oslc/createDialog”/> <script> window.addEventListener('message', launchCreateDialog , false); 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); } } </script> </verbatim> ---+++ Handle Creation Response <a name="handleCreateResponse" title="handleCreateResponse"></a> Once launched the user interacts with the dialog from the asset management system. The result for the dialog is passed back to the handleResponse() method. The result comes back as a [[http://open-services.net/bin/view/Main/OslcCoreSpecification#Resource_Creation][results]] resource in JSON. The results resource contains a set of links created in the delegated creation dialog. *value of the response* <verbatim> { "oslc:results" : [{ "oslc:label": "Account Management Implementation [2.0]", "rdf:resource": "https://example.com/oslc/assets/000-112/2.0” }] } </verbatim> Use the javascript eval method to easily hydrate the resulting JSON into a javascript object to store the selected resource URLs in the build specification. <verbatim> function handleCreateResponse(response){ var release = eval(‘(‘ + response + ‘)’); var url = release[‘oslc:results’][0][‘rdf:resource’]; //use it } </verbatim> ---++ Query Samples ---+++ !Query Result as XML System brings the information from SCM with information about the referenced library. From the source, the build process discovers a dependency on the latest Approved Log4j with a version greater than or equal to 1.2 and less than 1.3. *Request:* <br /> GET http://example.com/simpleQuery?oslc.where=dcterms.title="Apache Log4j" and oslc_asset.categorization=”/Software/Requirements/Operating System/Linux/Red Hat” and ras:id{ras:version}>="1.2" and ras:id{ras:version}<"1.3"&oslc.select=ras:id,dcterms:title<br /> Accept: application/rdf+xml <br /> OSLC-Core-Version:2.0 *Response:* <br /> Status Code: 200 (OK) <br /> Content-Type: application/rdf+xml <br /> ETag: xxx<br /> Content-Length: nnn<br /> Body: <verbatim> <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%20Log4j%22%20and%20oslc_asset.categorization%3D%26rdquo%3B%2FSoftware%2FRequirements%2FOperating%20System%2FLinux%2FRed%20Hat%26rdquo%3B%20and%20ras%3Aid%7Bras%3Aversion%7D%26gt%3B%3D%221.2%22%20and%20ras%3Aid%7Bras%3Aversion%7D%26lt%3B%221.3%22&oslc.select%3Dras%3Aid%2Cdcterms%3Atitl"> <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.2.1"> <ras:id> <ras:GUID>813</ras:GUID> <ras:version>1.2.1</ras:version> </ras:id> <dcterms:title>Apache Log4j</dcterms:title> </oslc_asset:Asset> </rdfs:member> </rdf:Description> </rdf:RDF> </verbatim> ---++ Retrieve Samples ---+++ !Download Log4j Asset As Zip 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* <verbatim> GET http://example.com/oslc/assets/813/1.2.1 Accept: application/zip OSLC-Core-Version: 2.0 </verbatim> *Response* <verbatim> 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 asset </verbatim> ---+++ !Download Placeholder Asset as XML The build system downloads the placeholder asset in order to publish the build implementation bits. *Request* <verbatim> GET https://example.com/oslc/assets/000-112/2.0 Accept: application/xml OSLC-Core-Version: 2.0 </verbatim> *Response* <verbatim> 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>000-112</ras:GUID> <ras:version>2.0</ras:version> </ras:id> <dcterms:title>Account Management 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.2.1"> <dc:type>Implementation of</dc:type> <dc:title>Myco Services Release</dc:title> </oslc_asset:relation> </oslc_asset:Asset> </rdf:RDF> </verbatim> ---++ Publish Samples ---+++ !Publish Implementation Asset On success the build system uses the publish.xml template to POST the new Implementation to the asset management system. *Request* <verbatim> PUT https://example.com/oslc/assets/000-112/2.0 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:about="https://example.com/oslc/assets/000-112/2.0"> <rdf:type rdf:resource="http://open-services.net/ns/asset#Asset" /> <ras:id> <ras:GUID>000-112</ras:GUID> <ras:version>2.0</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.2.1"> <dc:type>Implementation of</dc:type> <dc:title>Myco Services Release</dc:title> </oslc_asset:relation> </oslc_asset:Asset> </rdf:RDF> </verbatim> *Response* <verbatim> HTTP/1.0 200 OK OSLC-Core-Version: 2.0 Content-Type: application/rdf+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=”https://example.com/oslc/assets/000-112/2.0”> <rdf:type rdf:resource="http://open-services.net/ns/asset#Asset" /> <ras:id> <ras:GUID>000-112</ras:GUID> <ras:version>2.0</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.2.1"> <dc:type>Implementation of</dc:type> <dc:title>Myco Services Release</dc:title> </oslc_asset:relation> <oslc_asset:artifactContentFactory rdf:about="https://example.com/oslc/assets/000-112/2.0/artifacts"/> </oslc_asset:Asset> </rdf:RDF> </verbatim> ---+++ !Publish Built EAR All files created during the build the build are added as Artifacts to the new asset. *Request* <verbatim> POST https://example.com/oslc/assets/000-112/2.0/artifacts oslc_asset.name=services.ear Content-Type: application/java-archive OSLC-Core-Version: 2.0 </verbatim> *Response* <verbatim> HTTP/1.0 201 Created OSLC-Core-Version: 2.0 ETag: xxx Content-Length: nnn Location: http://example.com/oslc/assets/000-112/2.0/artifactsContents/services.ear </verbatim> ---+++ !Update Asset The build system updates the implementation asset with the new Last Built Date. OSLC Core Guidance: Partial Update OSLCCorePartialUpdateDRAFT. *Request* <verbatim> POST https://example.com/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://example.com/oslc/assets/1945/1.0.10_12_2010> myco:lastBuilt "2010-10-08T23:00:00.000Z" } } INSERT DATA { <https://example.com/oslc/assets/1945/1.0.10_12_2010> myco:lastBuilt "2010-10-09T23:00:00.000Z" } } </verbatim> *Response* <verbatim> HTTP/1.0 200 OK OSLC-Core-Version: 2.0 ETag: xxx </verbatim>
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r7
<
r6
<
r5
<
r4
<
r3
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r7 - 22 Apr 2011 - 20:32:40 -
SheehanAnderson
Main
Main Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
Webs
Main
Sandbox
TWiki
Български
Cesky
Dansk
Deutsch
English
Español
Français
Italiano
日本語
Nederlands
Polski
Português
Русский
Svenska
简体中文
簡體中文
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