aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjad2014-04-02 09:34:57 (EDT)
committerjad2014-04-02 09:34:57 (EDT)
commit6a4dd277be5a3dceb74f859eb25614d77ea2a106 (patch)
treecb187c361f67092558a7dcb8355d3d8429a939d6
parentf01155c91fb1b5e33f0699fe860c9c53eeab790e (diff)
downloadorg.eclipse.lyo.core-6a4dd277be5a3dceb74f859eb25614d77ea2a106.zip
org.eclipse.lyo.core-6a4dd277be5a3dceb74f859eb25614d77ea2a106.tar.gz
org.eclipse.lyo.core-6a4dd277be5a3dceb74f859eb25614d77ea2a106.tar.bz2
Bug 431692 - Implemented the missing feature of generating code to POSTrefs/changes/44/24344/1
resources. The existing generated code to handle POST request simply returned null. ie. it was not implemented. The core specifications needed also to be updated since most domain namespace uris were not exactly correct. Change-Id: I31cabcd7df7e66c7aacc14379937fb6770584fbd Signed-off-by: jad <jad@kth.se>
-rw-r--r--org.eclipse.lyo.oslc4j.adaptormodel/model/OSLCChangeManagementSpecification.xmi281
-rw-r--r--org.eclipse.lyo.oslc4j.adaptormodel/model/OSLCCoreSpecificationsSet.xmi194
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl2
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorManager.mtl8
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCreatorJsp.mtl2
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceService.mtl14
6 files changed, 400 insertions, 101 deletions
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/model/OSLCChangeManagementSpecification.xmi b/org.eclipse.lyo.oslc4j.adaptormodel/model/OSLCChangeManagementSpecification.xmi
index 39c3622..e88765f 100644
--- a/org.eclipse.lyo.oslc4j.adaptormodel/model/OSLCChangeManagementSpecification.xmi
+++ b/org.eclipse.lyo.oslc4j.adaptormodel/model/OSLCChangeManagementSpecification.xmi
@@ -1,66 +1,223 @@
<?xml version="1.0" encoding="ASCII"?>
-<oslc4j_ai:Specification xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oslc4j_ai="http://org.eclipse.lyo/oslc4j/adaptorInterface" xsi:schemaLocation="http://org.eclipse.lyo/oslc4j/adaptorInterface adaptorInterface.ecore">
- <domainSpecifications name="Change_Management" namespaceURI="http://open-services.net/ns/cm" namespacePrefix="//@domainPrefixes.0">
- <resources name="ChangeRequest">
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.0"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.1"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.2"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.3"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.4"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.0"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.1"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.2"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.5"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.6"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.7"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.8"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.9"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.10"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.3"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.11"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.12"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.13"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.3/@resourceProperties.0"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.14"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.15"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.16"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.4"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.5"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.0/@resourceProperties.0"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.17"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.6"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.18"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.0/@resourceProperties.1"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.7"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.19"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.0/@resourceProperties.2"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.0/@resourceProperties.3"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.20"/>
- <resourceProperties href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.8"/>
- <resourceProperties href="#//@domainSpecifications.0/@resourceProperties.21"/>
+<oslc4j_ai:Specification
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:oslc4j_ai="http://org.eclipse.lyo/oslc4j/adaptorInterface"
+ xsi:schemaLocation="http://org.eclipse.lyo/oslc4j/adaptorInterface adaptorInterface.ecore">
+ <domainSpecifications
+ name="Change_Management"
+ namespaceURI="http://open-services.net/ns/cm#"
+ namespacePrefix="//@domainPrefixes.0">
+ <resources
+ name="ChangeRequest">
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.0"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.1"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.2"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.3"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.4"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.0"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.1"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.2"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.5"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.6"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.7"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.8"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.9"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.10"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.3"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.11"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.12"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.13"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.3/@resourceProperties.0"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.14"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.15"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.16"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.4"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.5"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.0/@resourceProperties.0"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.17"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.6"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.18"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.0/@resourceProperties.1"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.7"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.19"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.0/@resourceProperties.2"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.0/@resourceProperties.3"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.20"/>
+ <resourceProperties
+ href="OSLCCoreSpecificationsSet.xmi#//@domainSpecifications.2/@resourceProperties.8"/>
+ <resourceProperties
+ href="#//@domainSpecifications.0/@resourceProperties.21"/>
</resources>
- <resourceProperties title="" name="affectedByDefect" occurs="zeroOrMany" valueType="Resource" description="Change request is affected by a reported defect. It is likely that the target resource will be an oslc_cm:ChangeRequest but that is not necessarily the case."/>
- <resourceProperties title="" name="affectsPlanItem" occurs="zeroOrMany" valueType="Resource" description="Change request affects a plan item. It is likely that the target resource will be an oslc_cm:ChangeRequest but that is not necessarily the case."/>
- <resourceProperties title="" name="affectsRequirement" occurs="zeroOrMany" valueType="Resource" description="Change request affecting a Requirement. It is likely that the target resource will be an oslc_rm:Requirement but that is not necessarily the case."/>
- <resourceProperties title="" name="affectsTestResult" occurs="zeroOrMany" valueType="Resource" description="Associated QM resource that is affected by this Change Request. It is likely that the target resource will be an oslc_qm:TestResult but that is not necessarily the case."/>
- <resourceProperties title="" name="blocksTestExecutionRecord" occurs="zeroOrMany" valueType="Resource" description="Associated QM resource that is blocked by this Change Request. It is likely that the target resource will be an oslc_qm:TestExecutionRecord but that is not necessarily the case."/>
- <resourceProperties title="" name="implementsRequirement" occurs="zeroOrMany" valueType="Resource" description="Implements associated Requirement. It is likely that the target resource will be an oslc_rm:Requirement but that is not necessarily the case."/>
- <resourceProperties title="" name="relatedChangeRequest" occurs="zeroOrMany" valueType="Resource" description="This relationship is loosely coupled and has no specific meaning. It is likely that the target resource will be an oslc_cm:ChangeRequest but that is not necessarily the case."/>
- <resourceProperties title="" name="relatedTestCase" occurs="zeroOrMany" valueType="Resource" description="Related QM test case resource. It is likely that the target resource will be an oslc_qm:TestCase but that is not necessarily the case."/>
- <resourceProperties title="" name="relatedTestExecutionRecord" occurs="zeroOrMany" valueType="Resource" description="Related to a QM test execution resource. It is likely that the target resource will be an oslc_qm:TestExecutionRecord but that is not necessarily the case."/>
- <resourceProperties title="" name="relatedTestPlan" occurs="zeroOrMany" valueType="Resource" description="Related QM test plan resource. It is likely that the target resource will be an oslc_qm:TestPlan but that is not necessarily the case."/>
- <resourceProperties title="" name="relatedTestScript" occurs="zeroOrMany" valueType="Resource" description="Related QM test script resource. It is likely that the target resource will be an oslc_qm:TestScript but that is not necessarily the case."/>
- <resourceProperties title="" name="testedByTestCase" occurs="zeroOrMany" valueType="Resource" description="Test case by which this change request is tested. It is likely that the target resource will be an oslc_qm:TestCase but that is not necessarily the case."/>
- <resourceProperties title="" name="tracksChangeSet" occurs="zeroOrMany" valueType="Resource" description="Tracks SCM change set resource. It is likely that the target resource will be an oslc_scm:ChangeSet but that is not necessarily the case."/>
- <resourceProperties title="" name="tracksRequirement" occurs="zeroOrMany" valueType="Resource" description="Tracks the associated Requirement or Requirement ChangeSet resources. It is likely that the target resource will be an oslc_rm:Requirement but that is not necessarily the case."/>
- <resourceProperties title="" name="approved" occurs="zeroOrOne" readOnly="true" description="Whether or not the Change Request has been approved."/>
- <resourceProperties title="" name="closed" occurs="zeroOrOne" readOnly="true" description="Whether or not the Change Request is completely done, no further fixes or fix verification is needed."/>
- <resourceProperties title="" name="closeDate" occurs="zeroOrOne" readOnly="true" valueType="DateTime" description="The date at which no further activity or work is intended to be conducted."/>
- <resourceProperties title="" name="fixed" occurs="zeroOrOne" readOnly="true" description="Whether or not the Change Request has been fixed."/>
- <resourceProperties title="" name="inprogress" occurs="zeroOrOne" readOnly="true" description="Whether or not the Change Request in a state indicating that active work is occurring. If oslc_cm:inprogress is true, then oslc_cm:fixed and oslc_cm:closed must also be false"/>
- <resourceProperties title="" name="reviewed" occurs="zeroOrOne" readOnly="true" description="Whether or not the Change Request has been reviewed."/>
- <resourceProperties title="" name="status" occurs="zeroOrOne" valueType="String" description="Used to indicate the status of the change request based on values defined by the service provider. Most often a read-only property. Some possible values may include: 'Submitted', 'Done', 'InProgress', etc."/>
- <resourceProperties title="" name="verified" occurs="zeroOrOne" readOnly="true" description="Whether or not the resolution or fix of the Change Request has been verified."/>
+ <resourceProperties
+ title=""
+ name="affectedByDefect"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Change request is affected by a reported defect. It is likely that the target resource will be an oslc_cm:ChangeRequest but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="affectsPlanItem"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Change request affects a plan item. It is likely that the target resource will be an oslc_cm:ChangeRequest but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="affectsRequirement"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Change request affecting a Requirement. It is likely that the target resource will be an oslc_rm:Requirement but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="affectsTestResult"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Associated QM resource that is affected by this Change Request. It is likely that the target resource will be an oslc_qm:TestResult but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="blocksTestExecutionRecord"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Associated QM resource that is blocked by this Change Request. It is likely that the target resource will be an oslc_qm:TestExecutionRecord but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="implementsRequirement"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Implements associated Requirement. It is likely that the target resource will be an oslc_rm:Requirement but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="relatedChangeRequest"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="This relationship is loosely coupled and has no specific meaning. It is likely that the target resource will be an oslc_cm:ChangeRequest but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="relatedTestCase"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Related QM test case resource. It is likely that the target resource will be an oslc_qm:TestCase but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="relatedTestExecutionRecord"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Related to a QM test execution resource. It is likely that the target resource will be an oslc_qm:TestExecutionRecord but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="relatedTestPlan"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Related QM test plan resource. It is likely that the target resource will be an oslc_qm:TestPlan but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="relatedTestScript"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Related QM test script resource. It is likely that the target resource will be an oslc_qm:TestScript but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="testedByTestCase"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Test case by which this change request is tested. It is likely that the target resource will be an oslc_qm:TestCase but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="tracksChangeSet"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Tracks SCM change set resource. It is likely that the target resource will be an oslc_scm:ChangeSet but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="tracksRequirement"
+ occurs="zeroOrMany"
+ valueType="Resource"
+ description="Tracks the associated Requirement or Requirement ChangeSet resources. It is likely that the target resource will be an oslc_rm:Requirement but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="approved"
+ occurs="zeroOrOne"
+ readOnly="true"
+ description="Whether or not the Change Request has been approved."/>
+ <resourceProperties
+ title=""
+ name="closed"
+ occurs="zeroOrOne"
+ readOnly="true"
+ description="Whether or not the Change Request is completely done, no further fixes or fix verification is needed."/>
+ <resourceProperties
+ title=""
+ name="closeDate"
+ occurs="zeroOrOne"
+ readOnly="true"
+ valueType="DateTime"
+ description="The date at which no further activity or work is intended to be conducted."/>
+ <resourceProperties
+ title=""
+ name="fixed"
+ occurs="zeroOrOne"
+ readOnly="true"
+ description="Whether or not the Change Request has been fixed."/>
+ <resourceProperties
+ title=""
+ name="inprogress"
+ occurs="zeroOrOne"
+ readOnly="true"
+ description="Whether or not the Change Request in a state indicating that active work is occurring. If oslc_cm:inprogress is true, then oslc_cm:fixed and oslc_cm:closed must also be false"/>
+ <resourceProperties
+ title=""
+ name="reviewed"
+ occurs="zeroOrOne"
+ readOnly="true"
+ description="Whether or not the Change Request has been reviewed."/>
+ <resourceProperties
+ title=""
+ name="status"
+ occurs="zeroOrOne"
+ valueType="String"
+ description="Used to indicate the status of the change request based on values defined by the service provider. Most often a read-only property. Some possible values may include: 'Submitted', 'Done', 'InProgress', etc."/>
+ <resourceProperties
+ title=""
+ name="verified"
+ occurs="zeroOrOne"
+ readOnly="true"
+ description="Whether or not the resolution or fix of the Change Request has been verified."/>
</domainSpecifications>
- <domainPrefixes name="oslc_cm"/>
+ <domainPrefixes
+ name="oslc_cm"/>
</oslc4j_ai:Specification>
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/model/OSLCCoreSpecificationsSet.xmi b/org.eclipse.lyo.oslc4j.adaptormodel/model/OSLCCoreSpecificationsSet.xmi
index 642324b..88eb04b 100644
--- a/org.eclipse.lyo.oslc4j.adaptormodel/model/OSLCCoreSpecificationsSet.xmi
+++ b/org.eclipse.lyo.oslc4j.adaptormodel/model/OSLCCoreSpecificationsSet.xmi
@@ -1,39 +1,167 @@
<?xml version="1.0" encoding="ASCII"?>
-<oslc4j_ai:Specification xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oslc4j_ai="http://org.eclipse.lyo/oslc4j/adaptorInterface" xsi:schemaLocation="http://org.eclipse.lyo/oslc4j/adaptorInterface adaptorInterface.ecore">
- <domainSpecifications name="OSLC_CORE" namespaceURI="http://open-services.net/ns/core" namespacePrefix="//@domainPrefixes.0">
- <resourceProperties title="" name="discussedBy" occurs="zeroOrOne" valueType="Resource" representation="either" description="A series of notes and comments about this resource."/>
- <resourceProperties title="" name="instanceShape" occurs="zeroOrOne" valueType="Resource" description="The URI of a Resource Shape that describes the possible properties, occurrence, value types, allowed values and labels. This shape information is useful in displaying the subject resource as well as guiding clients in performing modifications. Instance shapes may be specific to the authenticated user associated with the request that retrieved the resource, the current state of the resource and other factors and thus should not be cached."/>
- <resourceProperties title="" name="serviceProvider" valueType="URI" description="A link to the resource's OSLC Service Provider. There may be cases when the subject resource is available from a service provider that implements multiple domain specifications, which could result in multiple values for this property. "/>
- <resourceProperties title="" name="shortTitle" occurs="zeroOrOne" valueType="XMLLiteral" description="Shorter form of dcterms:title for the resource represented as rich text in XHTML content. SHOULD include only content that is valid inside an XHTML &lt;span> element."/>
+<oslc4j_ai:Specification
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:oslc4j_ai="http://org.eclipse.lyo/oslc4j/adaptorInterface"
+ xsi:schemaLocation="http://org.eclipse.lyo/oslc4j/adaptorInterface adaptorInterface.ecore">
+ <domainSpecifications
+ name="OSLC_CORE"
+ namespaceURI="http://open-services.net/ns/core#"
+ namespacePrefix="//@domainPrefixes.0">
+ <resourceProperties
+ title=""
+ name="discussedBy"
+ occurs="zeroOrOne"
+ valueType="Resource"
+ representation="either"
+ description="A series of notes and comments about this resource."/>
+ <resourceProperties
+ title=""
+ name="instanceShape"
+ occurs="zeroOrOne"
+ valueType="Resource"
+ description="The URI of a Resource Shape that describes the possible properties, occurrence, value types, allowed values and labels. This shape information is useful in displaying the subject resource as well as guiding clients in performing modifications. Instance shapes may be specific to the authenticated user associated with the request that retrieved the resource, the current state of the resource and other factors and thus should not be cached."/>
+ <resourceProperties
+ title=""
+ name="serviceProvider"
+ valueType="URI"
+ description="A link to the resource's OSLC Service Provider. There may be cases when the subject resource is available from a service provider that implements multiple domain specifications, which could result in multiple values for this property. "/>
+ <resourceProperties
+ title=""
+ name="shortTitle"
+ occurs="zeroOrOne"
+ valueType="XMLLiteral"
+ description="Shorter form of dcterms:title for the resource represented as rich text in XHTML content. SHOULD include only content that is valid inside an XHTML &lt;span> element."/>
</domainSpecifications>
- <domainSpecifications name="FOAF" namespaceURI="http://xmlns.com/foaf/0.1" namespacePrefix="//@domainPrefixes.1">
- <resources name="Person" resourceProperties="//@domainSpecifications.1/@resourceProperties.0 //@domainSpecifications.1/@resourceProperties.1 //@domainSpecifications.1/@resourceProperties.2"/>
- <resourceProperties title="" name="name" valueType="String" description="The full name of a person expressed as simple text string."/>
- <resourceProperties name="givenName" valueType="String" description="Given name of person expressed as simple text string."/>
- <resourceProperties name="familyName" valueType="String" description="Family name of person expressed as simple text string."/>
+ <domainSpecifications
+ name="FOAF"
+ namespaceURI="http://xmlns.com/foaf/0.1/"
+ namespacePrefix="//@domainPrefixes.1">
+ <resources
+ name="Person"
+ resourceProperties="//@domainSpecifications.1/@resourceProperties.0 //@domainSpecifications.1/@resourceProperties.1 //@domainSpecifications.1/@resourceProperties.2"/>
+ <resourceProperties
+ title=""
+ name="name"
+ valueType="String"
+ description="The full name of a person expressed as simple text string."/>
+ <resourceProperties
+ name="givenName"
+ valueType="String"
+ description="Given name of person expressed as simple text string."/>
+ <resourceProperties
+ name="familyName"
+ valueType="String"
+ description="Family name of person expressed as simple text string."/>
</domainSpecifications>
- <domainSpecifications name="Dublin Core" namespaceURI="http://purl.org/dc/terms" namespacePrefix="//@domainPrefixes.2">
- <resources name="Type"/>
- <resourceProperties title="" name="contributor" occurs="zeroOrMany" valueType="LocalResource" representation="either" range="//@domainSpecifications.1/@resources.0" description="Contributor or contributors to the resource. It is likely that the target resource will be a foaf:Person but that is not necessarily the case. "/>
- <resourceProperties title="" name="creator" occurs="zeroOrMany" valueType="LocalResource" representation="either" range="//@domainSpecifications.1/@resources.0" description="Creator or creators of resource (reference: Dublin Core). It is likely that the target resource will be a foaf:Person but that is not necessarily the case."/>
- <resourceProperties title="" name="type" occurs="zeroOrMany" valueType="LocalResource" range="//@domainSpecifications.2/@resources.0" description="A short string representation for the type, example 'Defect'."/>
- <resourceProperties title="" name="subject" occurs="zeroOrMany" valueType="String" description="Tag or keyword for a resource. Each occurrence of a dcterms:subject property denotes an additional tag for the resource."/>
- <resourceProperties title="" name="created" occurs="zeroOrOne" readOnly="true" valueType="DateTime" description="Timestamp of resource creation"/>
- <resourceProperties title="" name="description" occurs="zeroOrOne" valueType="XMLLiteral" description="Descriptive text about resource represented as rich text in XHTML content. SHOULD include only content that is valid and suitable inside an XHTML &lt;div> element. "/>
- <resourceProperties title="" name="identifier" readOnly="true" valueType="String" description="A unique identifier for a resource. Typically read-only and assigned by the service provider when a resource is created. Not typically intended for end-user display."/>
- <resourceProperties title="" name="modified" occurs="zeroOrOne" readOnly="true" valueType="DateTime" description="Timestamp last latest resource modification"/>
- <resourceProperties title="" name="title" valueType="XMLLiteral" description="Title of the resource represented as rich text in XHTML content. SHOULD include only content that is valid inside an XHTML &lt;span> element. "/>
- <resourceProperties title="" name="source" occurs="zeroOrOne" valueType="Resource" representation="reference" description="A related resource from which the described resource is derived. "/>
+ <domainSpecifications
+ name="Dublin Core"
+ namespaceURI="http://purl.org/dc/terms/"
+ namespacePrefix="//@domainPrefixes.2">
+ <resources
+ name="Type"/>
+ <resourceProperties
+ title=""
+ name="contributor"
+ occurs="zeroOrMany"
+ valueType="LocalResource"
+ representation="either"
+ range="//@domainSpecifications.1/@resources.0"
+ description="Contributor or contributors to the resource. It is likely that the target resource will be a foaf:Person but that is not necessarily the case. "/>
+ <resourceProperties
+ title=""
+ name="creator"
+ occurs="zeroOrMany"
+ valueType="LocalResource"
+ representation="either"
+ range="//@domainSpecifications.1/@resources.0"
+ description="Creator or creators of resource (reference: Dublin Core). It is likely that the target resource will be a foaf:Person but that is not necessarily the case."/>
+ <resourceProperties
+ title=""
+ name="type"
+ occurs="zeroOrMany"
+ valueType="LocalResource"
+ range="//@domainSpecifications.2/@resources.0"
+ description="A short string representation for the type, example 'Defect'."/>
+ <resourceProperties
+ title=""
+ name="subject"
+ occurs="zeroOrMany"
+ valueType="String"
+ description="Tag or keyword for a resource. Each occurrence of a dcterms:subject property denotes an additional tag for the resource."/>
+ <resourceProperties
+ title=""
+ name="created"
+ occurs="zeroOrOne"
+ readOnly="true"
+ valueType="DateTime"
+ description="Timestamp of resource creation"/>
+ <resourceProperties
+ title=""
+ name="description"
+ occurs="zeroOrOne"
+ valueType="XMLLiteral"
+ description="Descriptive text about resource represented as rich text in XHTML content. SHOULD include only content that is valid and suitable inside an XHTML &lt;div> element. "/>
+ <resourceProperties
+ title=""
+ name="identifier"
+ readOnly="true"
+ valueType="String"
+ description="A unique identifier for a resource. Typically read-only and assigned by the service provider when a resource is created. Not typically intended for end-user display."/>
+ <resourceProperties
+ title=""
+ name="modified"
+ occurs="zeroOrOne"
+ readOnly="true"
+ valueType="DateTime"
+ description="Timestamp last latest resource modification"/>
+ <resourceProperties
+ title=""
+ name="title"
+ valueType="XMLLiteral"
+ description="Title of the resource represented as rich text in XHTML content. SHOULD include only content that is valid inside an XHTML &lt;span> element. "/>
+ <resourceProperties
+ title=""
+ name="source"
+ occurs="zeroOrOne"
+ valueType="Resource"
+ representation="reference"
+ description="A related resource from which the described resource is derived. "/>
</domainSpecifications>
- <domainSpecifications name="RDF" namespaceURI="http://www.w3.org/1999/02/22-rdf-syntax-ns" namespacePrefix="//@domainPrefixes.3">
- <resourceProperties title="" name="type" occurs="zeroOrMany" valueType="URI" description="The resource type URIs."/>
- <resourceProperties title="" name="label" valueType="String" description=" Is an instance of rdf:Property that may be used to provide a human-readable version of a resource's name"/>
- <resourceProperties name="comment" occurs="zeroOrOne" valueType="String" description="A description of the subject resource"/>
+ <domainSpecifications
+ name="RDF"
+ namespaceURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ namespacePrefix="//@domainPrefixes.3">
+ <resourceProperties
+ title=""
+ name="type"
+ occurs="zeroOrMany"
+ valueType="URI"
+ description="The resource type URIs."/>
+ <resourceProperties
+ title=""
+ name="label"
+ valueType="String"
+ description=" Is an instance of rdf:Property that may be used to provide a human-readable version of a resource's name"/>
+ <resourceProperties
+ name="comment"
+ occurs="zeroOrOne"
+ valueType="String"
+ description="A description of the subject resource"/>
</domainSpecifications>
- <domainSpecifications name="RDFS" namespaceURI="http://www.w3.org/2000/01/rdf-schema" namespacePrefix="//@domainPrefixes.4"/>
- <domainPrefixes name="oslc"/>
- <domainPrefixes name="foaf"/>
- <domainPrefixes name="dcterms"/>
- <domainPrefixes name="rdf"/>
- <domainPrefixes name="rdfs"/>
+ <domainSpecifications
+ name="RDFS"
+ namespaceURI="http://www.w3.org/2000/01/rdf-schema#"
+ namespacePrefix="//@domainPrefixes.4"/>
+ <domainPrefixes
+ name="oslc"/>
+ <domainPrefixes
+ name="foaf"/>
+ <domainPrefixes
+ name="dcterms"/>
+ <domainPrefixes
+ name="rdf"/>
+ <domainPrefixes
+ name="rdfs"/>
</oslc4j_ai:Specification>
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl
index df1e189..ebc24ff 100644
--- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl
@@ -30,7 +30,7 @@
[import org::eclipse::lyo::oslc4j::codegenerator::services::domainSpecificationServices/]
[query public generateDomainSpecificationConstants(aDomainSpecification : DomainSpecification) : String =
-'public static String '.concat(domainSpecificationConstantName(aDomainSpecification)).concat(' = "').concat(aDomainSpecification.namespaceURI).concat('#";').concat(lineSeparator()).concat('public static String ').concat(domainSpecificationNamespaceConstantName(aDomainSpecification)).concat(' = "').concat(aDomainSpecification.namespaceURI).concat('#";').concat(lineSeparator()).concat('public static String ').concat(domainSpecificationNamespacePrefixConstantName(aDomainSpecification)).concat(' = "').concat(aDomainSpecification.namespacePrefix.name).concat('";').concat(lineSeparator())
+'public static String '.concat(domainSpecificationConstantName(aDomainSpecification)).concat(' = "').concat(aDomainSpecification.namespaceURI).concat('";').concat(lineSeparator()).concat('public static String ').concat(domainSpecificationNamespaceConstantName(aDomainSpecification)).concat(' = "').concat(aDomainSpecification.namespaceURI).concat('";').concat(lineSeparator()).concat('public static String ').concat(domainSpecificationNamespacePrefixConstantName(aDomainSpecification)).concat(' = "').concat(aDomainSpecification.namespacePrefix.name).concat('";').concat(lineSeparator())
/]
[query public generateResourceConstants(aResource : Resource) : String =
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorManager.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorManager.mtl
index d7aa9fa..c67b940 100644
--- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorManager.mtl
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorManager.mtl
@@ -147,6 +147,14 @@ public class [javaClassNameForAdaptorManager(anAdaptorInterface) /] {
// [/protected]
return new[aResource.name.toUpperFirst() /];
}
+
+ public static String getETagFrom[aResource.name.toUpperFirst() /](final [javaClassName(aResource) /] a[aResource.name.toUpperFirst() /])
+ {
+ String eTag = null;
+ // [protected ('(MUST_FILL_IN) getETagFromResource userCode')]
+ // [/protected]
+ return eTag;
+ }
[/for]
}
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCreatorJsp.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCreatorJsp.mtl
index 8b7fdc3..6864001 100644
--- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCreatorJsp.mtl
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCreatorJsp.mtl
@@ -98,7 +98,7 @@
best possibility to modify the generated stuff. (hiding fields, changing the format, removing fields, etc.)/]
[for (aProperty: ResourceProperty | allProperties(aResource))]
<tr>
- <td><%= [javaClassName(aResource)/].[javaAttributeName(aProperty, aResource) /]AsHtmlForCreation(request, serviceProvider.getIdentifier())%></td>
+ <td><%= [javaClassName(aResource)/].[javaAttributeName(aProperty, aResource) /]ToHtmlForCreation(request, serviceProvider.getIdentifier())%></td>
</tr>
[/for]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceService.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceService.mtl
index ad0c57f..bc33aa9 100644
--- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceService.mtl
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceService.mtl
@@ -441,7 +441,7 @@ public class [javaClassNameForService(aResource, anAdaptorInterface) /]
@POST
@Path("creator")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED})
- public void create[aResource.name.toUpperFirst() /](@PathParam("serviceProviderId") final String serviceProviderId)
+ public void create[aResource.name.toUpperFirst() /]FromHtml(@PathParam("serviceProviderId") final String serviceProviderId)
{
try {
[javaClassName(aResource) /] a[aResource.name.toUpperFirst() /] = new [javaClassName(aResource) /]();
@@ -528,10 +528,16 @@ public class [javaClassNameForService(aResource, anAdaptorInterface) /]
@POST
@Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
@Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
- public Response addChangeRequest(@PathParam("productId") final String productId,
- final [javaClassName(aResource) /] a[aResource.name.toUpperFirst() /]) throws IOException, ServletException
+ public Response create[aResource.name.toUpperFirst() /](@PathParam("serviceProviderId") final String serviceProviderId, final [javaClassName(aResource) /] a[aResource.name.toUpperFirst() /]) throws IOException, ServletException
{
- return null; // See LAB 5 of the Lyo workshop for implementation
+ try {
+ [javaClassName(aResource) /] new[aResource.name.toUpperFirst() /] = [javaClassNameForAdaptorManager(anAdaptorInterface) /].create[aResource.name.toUpperFirst() /](httpServletRequest, a[aResource.name.toUpperFirst() /], serviceProviderId);
+ httpServletResponse.setHeader("ETag", [javaClassNameForAdaptorManager(anAdaptorInterface) /].getETagFrom[aResource.name.toUpperFirst() /](new[aResource.name.toUpperFirst() /]));
+ return Response.created(new[aResource.name.toUpperFirst() /].getAbout()).entity(a[aResource.name.toUpperFirst() /]).build();
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new WebApplicationException(e);
+ }
}
// [protected ('(RECOMMENDED) functions')]