aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpmcmahan2012-09-28 10:32:17 (EDT)
committerpmcmahan2012-09-28 10:32:17 (EDT)
commit8ad7db9ca8ce30c54c8138554a64f572200d45e0 (patch)
treeed8fc55b1db251132572b189571918341cf63b12
parent8866e9d919f475e531daf3acf8f3b7f8b60e969a (diff)
downloadorg.eclipse.lyo.client-8ad7db9ca8ce30c54c8138554a64f572200d45e0.zip
org.eclipse.lyo.client-8ad7db9ca8ce30c54c8138554a64f572200d45e0.tar.gz
org.eclipse.lyo.client-8ad7db9ca8ce30c54c8138554a64f572200d45e0.tar.bz2
Bug 390350 - OSLC Automation support in OSLC clientrefs/changes/76/7976/1
-rw-r--r--org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/OSLCConstants.java1
-rw-r--r--org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/jazz/JazzRootServicesConstants.java1
-rw-r--r--org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/jazz/JazzRootServicesHelper.java10
-rw-r--r--org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationConstants.java43
-rw-r--r--org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationPlan.java305
-rw-r--r--org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationRequest.java363
-rw-r--r--org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationResult.java443
-rw-r--r--org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/ParameterInstance.java169
8 files changed, 1333 insertions, 2 deletions
diff --git a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/OSLCConstants.java b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/OSLCConstants.java
index 23e1fae..a9309b8 100644
--- a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/OSLCConstants.java
+++ b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/OSLCConstants.java
@@ -35,6 +35,7 @@ public interface OSLCConstants {
static String OSLC_ASSET_V2 = "http://open-services.net/ns/asset#";
static String OSLC_QM_V2 = "http://open-services.net/ns/qm#";
static String OSLC_RM_V2 = "http://open-services.net/ns/rm#";
+ static String OSLC_AUTO = "http://open-services.net/ns/auto#";
// Version 1.0 namespace definitions
static String OSLC_DISC = "http://open-services.net/xmlns/discovery/1.0/";
diff --git a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/jazz/JazzRootServicesConstants.java b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/jazz/JazzRootServicesConstants.java
index 22415f9..ab4148a 100644
--- a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/jazz/JazzRootServicesConstants.java
+++ b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/jazz/JazzRootServicesConstants.java
@@ -28,6 +28,7 @@ public interface JazzRootServicesConstants {
static String CM_ROOTSERVICES_CATALOG_PROP = "cmServiceProviders";
static String QM_ROOTSERVICES_CATALOG_PROP = "qmServiceProviders";
static String RM_ROOTSERVICES_CATALOG_PROP = "rmServiceProviders";
+ static String AUTO_ROOTSERVICES_CATALOG_PROP = "autoServiceProviders";
//OAuth entries
static String OAUTH_REQUEST_TOKEN_URL = "oauthRequestTokenUrl";
diff --git a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/jazz/JazzRootServicesHelper.java b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/jazz/JazzRootServicesHelper.java
index cbbd87f..dd7e701 100644
--- a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/jazz/JazzRootServicesHelper.java
+++ b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/jazz/JazzRootServicesHelper.java
@@ -96,8 +96,14 @@ public class JazzRootServicesHelper {
this.catalogNamespace = OSLCConstants.OSLC_RM;
this.catalogProperty = JazzRootServicesConstants.RM_ROOTSERVICES_CATALOG_PROP;
- } else {
- logger.severe("Jazz rootservices only supports CM, RM and QM catalogs");
+ } else if (this.catalogDomain.equalsIgnoreCase(OSLCConstants.OSLC_AUTO)) {
+
+ this.catalogNamespace = OSLCConstants.OSLC_AUTO;
+ this.catalogProperty = JazzRootServicesConstants.AUTO_ROOTSERVICES_CATALOG_PROP;
+
+ }
+ else {
+ logger.severe("Jazz rootservices only supports CM, RM, QM, and Automation catalogs");
}
processRootServices();
diff --git a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationConstants.java b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationConstants.java
new file mode 100644
index 0000000..9ae7ee2
--- /dev/null
+++ b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationConstants.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Paul McMahan <pmcmahan@us.ibm.com> - initial implementation
+ *******************************************************************************/
+package org.eclipse.lyo.client.oslc.resources;
+
+
+public interface AutomationConstants
+{
+ String AUTOMATION_DOMAIN = "http://open-services.net/ns/auto#";
+ String AUTOMATION_NAMESPACE = "http://open-services.net/ns/auto#";
+ String AUTOMATION_PREFIX = "oslc_auto";
+
+ String TYPE_AUTOMATION_PLAN = AUTOMATION_NAMESPACE + "AutomationPlan";
+ String TYPE_AUTOMATION_REQUEST = AUTOMATION_NAMESPACE + "AutomationRequest";
+ String TYPE_AUTOMATION_RESULT = AUTOMATION_NAMESPACE + "AutomationResult";
+ String TYPE_PARAMETER_INSTANCE = AUTOMATION_NAMESPACE + "ParameterInstance";
+
+ String STATE_NEW = AUTOMATION_NAMESPACE + "new";
+ String STATE_QUEUED = AUTOMATION_NAMESPACE + "queued";
+ String STATE_IN_PROGRESS = AUTOMATION_NAMESPACE + "inProgress";
+ String STATE_CANCELING = AUTOMATION_NAMESPACE + "canceling";
+ String STATE_CANCELED = AUTOMATION_NAMESPACE + "canceled";
+ String STATE_COMPLETE = AUTOMATION_NAMESPACE + "complete";
+
+ String VERDICT_UNAVAILABLE = AUTOMATION_NAMESPACE + "unavailable";
+ String VERDICT_PASSED = AUTOMATION_NAMESPACE + "passed";
+ String VERDICT_WARNING = AUTOMATION_NAMESPACE + "warning";
+ String VERDICT_FAILED = AUTOMATION_NAMESPACE + "failed";
+ String VERDICT_ERROR = AUTOMATION_NAMESPACE + "error";
+
+}
diff --git a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationPlan.java b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationPlan.java
new file mode 100644
index 0000000..b566f27
--- /dev/null
+++ b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationPlan.java
@@ -0,0 +1,305 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Paul McMahan <pmcmahan@us.ibm.com> - initial implementation
+ *******************************************************************************/
+package org.eclipse.lyo.client.oslc.resources;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcRange;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType;
+import org.eclipse.lyo.oslc4j.core.model.AbstractResource;
+import org.eclipse.lyo.oslc4j.core.model.Occurs;
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+import org.eclipse.lyo.oslc4j.core.model.Property;
+import org.eclipse.lyo.oslc4j.core.model.ValueType;
+
+@OslcResourceShape(title = "Automation Plan Resource Shape", describes = AutomationConstants.TYPE_AUTOMATION_PLAN)
+@OslcNamespace(AutomationConstants.AUTOMATION_NAMESPACE)
+/**
+ * @see http://open-services.net/wiki/automation/OSLC-Automation-Specification-Version-2.0/#Resource_AutomationPlan
+ */
+public final class AutomationPlan
+extends AbstractResource
+{
+ private final Set<URI> contributors = new TreeSet<URI>();
+ private final Set<URI> creators = new TreeSet<URI>();
+ private final Set<URI> rdfTypes = new TreeSet<URI>();
+ private final Set<String> subjects = new TreeSet<String>();
+ private final Set<Property> parameterDefinitions = new TreeSet<Property>();
+
+ private Date created;
+ private String description;
+ private String identifier;
+ private URI instanceShape;
+ private Date modified;
+ private URI serviceProvider;
+ private String title;
+
+ public AutomationPlan()
+ {
+ super();
+
+ rdfTypes.add(URI.create(AutomationConstants.TYPE_AUTOMATION_PLAN));
+ }
+
+ public AutomationPlan(final URI about)
+ {
+ super(about);
+
+ rdfTypes.add(URI.create(AutomationConstants.TYPE_AUTOMATION_PLAN));
+ }
+
+ protected URI getRdfType() {
+ return URI.create(AutomationConstants.TYPE_AUTOMATION_PLAN);
+ }
+
+ public void addContributor(final URI contributor)
+ {
+ this.contributors.add(contributor);
+ }
+
+ public void addCreator(final URI creator)
+ {
+ this.creators.add(creator);
+ }
+
+ public void addRdfType(final URI rdfType)
+ {
+ this.rdfTypes.add(rdfType);
+ }
+
+ public void addSubject(final String subject)
+ {
+ this.subjects.add(subject);
+ }
+
+ public void addParameterDefinition(final Property parameter)
+ {
+ this.parameterDefinitions.add(parameter);
+ }
+
+ @OslcDescription("The person(s) who are responsible for the work needed to complete the automation plan.")
+ @OslcName("contributor")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "contributor")
+ @OslcRange(QmConstants.TYPE_PERSON)
+ @OslcTitle("Contributors")
+ public URI[] getContributors()
+ {
+ return contributors.toArray(new URI[contributors.size()]);
+ }
+
+ @OslcDescription("Timestamp of resource creation.")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "created")
+ @OslcReadOnly
+ @OslcTitle("Created")
+ public Date getCreated()
+ {
+ return created;
+ }
+
+ @OslcDescription("Creator or creators of resource.")
+ @OslcName("creator")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "creator")
+ @OslcRange(QmConstants.TYPE_PERSON)
+ @OslcTitle("Creators")
+ public URI[] getCreators()
+ {
+ return creators.toArray(new URI[creators.size()]);
+ }
+
+ @OslcDescription("Descriptive text (reference: Dublin Core) about resource represented as rich text in XHTML content.")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "description")
+ @OslcTitle("Description")
+ @OslcValueType(ValueType.XMLLiteral)
+ public String getDescription()
+ {
+ return description;
+ }
+
+ @OslcDescription("A unique identifier for a resource. Assigned by the service provider when a resource is created. Not intended for end-user display.")
+ @OslcOccurs(Occurs.ExactlyOne)
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "identifier")
+ @OslcReadOnly
+ @OslcTitle("Identifier")
+ public String getIdentifier()
+ {
+ return identifier;
+ }
+
+ @OslcDescription("Resource Shape that provides hints as to resource property value-types and allowed values. ")
+ @OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "instanceShape")
+ @OslcRange(OslcConstants.TYPE_RESOURCE_SHAPE)
+ @OslcTitle("Instance Shape")
+ public URI getInstanceShape()
+ {
+ return instanceShape;
+ }
+
+ @OslcDescription("Timestamp last latest resource modification.")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "modified")
+ @OslcReadOnly
+ @OslcTitle("Modified")
+ public Date getModified()
+ {
+ return modified;
+ }
+
+ @OslcDescription("The resource type URIs.")
+ @OslcName("type")
+ @OslcPropertyDefinition(OslcConstants.RDF_NAMESPACE + "type")
+ @OslcTitle("Types")
+ public URI[] getRdfTypes()
+ {
+ return rdfTypes.toArray(new URI[rdfTypes.size()]);
+ }
+
+ @OslcDescription("The scope of a resource is a URI for the resource's OSLC Service Provider.")
+ @OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "serviceProvider")
+ @OslcRange(OslcConstants.TYPE_SERVICE_PROVIDER)
+ @OslcTitle("Service Provider")
+ public URI getServiceProvider()
+ {
+ return serviceProvider;
+ }
+
+ @OslcDescription("Tag or keyword for a resource. Each occurrence of a dcterms:subject property denotes an additional tag for the resource.")
+ @OslcName("subject")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "subject")
+ @OslcReadOnly(false)
+ @OslcTitle("Subjects")
+ public String[] getSubjects()
+ {
+ return subjects.toArray(new String[subjects.size()]);
+ }
+
+ @OslcDescription("Title (reference: Dublin Core) or often a single line summary of the resource represented as rich text in XHTML content.")
+ @OslcOccurs(Occurs.ExactlyOne)
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "title")
+ @OslcTitle("Title")
+ @OslcValueType(ValueType.XMLLiteral)
+ public String getTitle()
+ {
+ return title;
+ }
+
+ @OslcDescription("The parameter definitions for the automation plan.")
+ @OslcOccurs(Occurs.ZeroOrMany)
+ @OslcName("parameterDefinition")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "parameterDefinition")
+ @OslcTitle("Parameter Definitions")
+ public Property[] getParameterDefinitions()
+ {
+ return parameterDefinitions.toArray(new Property[parameterDefinitions.size()]);
+ }
+
+
+ public void setContributors(final URI[] contributors)
+ {
+ this.contributors.clear();
+
+ if (contributors != null)
+ {
+ this.contributors.addAll(Arrays.asList(contributors));
+ }
+ }
+
+ public void setCreated(final Date created)
+ {
+ this.created = created;
+ }
+
+ public void setCreators(final URI[] creators)
+ {
+ this.creators.clear();
+
+ if (creators != null)
+ {
+ this.creators.addAll(Arrays.asList(creators));
+ }
+ }
+
+ public void setDescription(final String description)
+ {
+ this.description = description;
+ }
+
+ public void setIdentifier(final String identifier)
+ {
+ this.identifier = identifier;
+ }
+
+ public void setInstanceShape(final URI instanceShape)
+ {
+ this.instanceShape = instanceShape;
+ }
+
+ public void setModified(final Date modified)
+ {
+ this.modified = modified;
+ }
+
+ public void setRdfTypes(final URI[] rdfTypes)
+ {
+ this.rdfTypes.clear();
+
+ if (rdfTypes != null)
+ {
+ this.rdfTypes.addAll(Arrays.asList(rdfTypes));
+ }
+ }
+
+ public void setServiceProvider(final URI serviceProvider)
+ {
+ this.serviceProvider = serviceProvider;
+ }
+
+ public void setSubjects(final String[] subjects)
+ {
+ this.subjects.clear();
+
+ if (subjects != null)
+ {
+ this.subjects.addAll(Arrays.asList(subjects));
+ }
+ }
+
+ public void setTitle(final String title)
+ {
+ this.title = title;
+ }
+
+ public void setParameterDefinitions(final Property[] parameterDefinitions)
+ {
+ this.parameterDefinitions.clear();
+
+ if (parameterDefinitions != null)
+ {
+ this.parameterDefinitions.addAll(Arrays.asList(parameterDefinitions));
+ }
+ }
+
+}
diff --git a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationRequest.java b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationRequest.java
new file mode 100644
index 0000000..aa38f89
--- /dev/null
+++ b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationRequest.java
@@ -0,0 +1,363 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Paul McMahan <pmcmahan@us.ibm.com> - initial implementation
+ *******************************************************************************/
+package org.eclipse.lyo.client.oslc.resources;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcRange;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType;
+import org.eclipse.lyo.oslc4j.core.model.AbstractResource;
+import org.eclipse.lyo.oslc4j.core.model.Occurs;
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+import org.eclipse.lyo.oslc4j.core.model.ValueType;
+
+@OslcResourceShape(title = "Automation Request Resource Shape", describes = AutomationConstants.TYPE_AUTOMATION_REQUEST)
+@OslcNamespace(AutomationConstants.AUTOMATION_NAMESPACE)
+/**
+ * @see http://open-services.net/wiki/automation/OSLC-Automation-Specification-Version-2.0/#Resource_AutomationRequest
+ */
+public final class AutomationRequest
+extends AbstractResource
+{
+ private final Set<URI> contributors = new TreeSet<URI>();
+ private final Set<URI> creators = new TreeSet<URI>();
+ private final Set<URI> rdfTypes = new TreeSet<URI>();
+ private final Set<String> subjects = new TreeSet<String>();
+ private final Set<URI> states = new TreeSet<URI>();
+ private final Set<ParameterInstance> inputParameters = new TreeSet<ParameterInstance>();
+
+ private Date created;
+ private String description;
+ private String identifier;
+ private URI instanceShape;
+ private Date modified;
+ private URI serviceProvider;
+ private String title;
+ private URI desiredState;
+ private URI executesAutomationPlan;
+
+ public AutomationRequest()
+ {
+ super();
+
+ rdfTypes.add(URI.create(AutomationConstants.TYPE_AUTOMATION_REQUEST));
+ }
+
+ public AutomationRequest(final URI about)
+ {
+ super(about);
+
+ rdfTypes.add(URI.create(AutomationConstants.TYPE_AUTOMATION_REQUEST));
+ }
+
+ protected URI getRdfType() {
+ return URI.create(AutomationConstants.TYPE_AUTOMATION_REQUEST);
+ }
+
+ public void addContributor(final URI contributor)
+ {
+ this.contributors.add(contributor);
+ }
+
+ public void addCreator(final URI creator)
+ {
+ this.creators.add(creator);
+ }
+
+ public void addRdfType(final URI rdfType)
+ {
+ this.rdfTypes.add(rdfType);
+ }
+
+ public void addSubject(final String subject)
+ {
+ this.subjects.add(subject);
+ }
+
+ public void addState(final URI state)
+ {
+ this.states.add(state);
+ }
+
+ public void addInputParameter(final ParameterInstance parameter)
+ {
+ this.inputParameters.add(parameter);
+ }
+
+ @OslcDescription("The person(s) who are responsible for the work needed to complete the automation request.")
+ @OslcName("contributor")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "contributor")
+ @OslcRange(QmConstants.TYPE_PERSON)
+ @OslcTitle("Contributors")
+ public URI[] getContributors()
+ {
+ return contributors.toArray(new URI[contributors.size()]);
+ }
+
+ @OslcDescription("Timestamp of resource creation.")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "created")
+ @OslcReadOnly
+ @OslcTitle("Created")
+ public Date getCreated()
+ {
+ return created;
+ }
+
+ @OslcDescription("Creator or creators of resource.")
+ @OslcName("creator")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "creator")
+ @OslcRange(QmConstants.TYPE_PERSON)
+ @OslcTitle("Creators")
+ public URI[] getCreators()
+ {
+ return creators.toArray(new URI[creators.size()]);
+ }
+
+ @OslcDescription("Descriptive text (reference: Dublin Core) about resource represented as rich text in XHTML content.")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "description")
+ @OslcTitle("Description")
+ @OslcValueType(ValueType.XMLLiteral)
+ public String getDescription()
+ {
+ return description;
+ }
+
+ @OslcDescription("A unique identifier for a resource. Assigned by the service provider when a resource is created. Not intended for end-user display.")
+ @OslcOccurs(Occurs.ExactlyOne)
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "identifier")
+ @OslcReadOnly
+ @OslcTitle("Identifier")
+ public String getIdentifier()
+ {
+ return identifier;
+ }
+
+ @OslcDescription("Resource Shape that provides hints as to resource property value-types and allowed values. ")
+ @OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "instanceShape")
+ @OslcRange(OslcConstants.TYPE_RESOURCE_SHAPE)
+ @OslcTitle("Instance Shape")
+ public URI getInstanceShape()
+ {
+ return instanceShape;
+ }
+
+ @OslcDescription("Timestamp last latest resource modification.")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "modified")
+ @OslcReadOnly
+ @OslcTitle("Modified")
+ public Date getModified()
+ {
+ return modified;
+ }
+
+ @OslcDescription("The resource type URIs.")
+ @OslcName("type")
+ @OslcPropertyDefinition(OslcConstants.RDF_NAMESPACE + "type")
+ @OslcTitle("Types")
+ public URI[] getRdfTypes()
+ {
+ return rdfTypes.toArray(new URI[rdfTypes.size()]);
+ }
+
+ @OslcDescription("The scope of a resource is a URI for the resource's OSLC Service Provider.")
+ @OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "serviceProvider")
+ @OslcTitle("Service Provider")
+ public URI getServiceProvider()
+ {
+ return serviceProvider;
+ }
+
+ @OslcDescription("Used to indicate the desired state of the Automation Request based on values defined by the service provider.")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "desiredState")
+ @OslcName("desiredState")
+ @OslcOccurs(Occurs.ZeroOrOne)
+ @OslcTitle("Desired State")
+ public URI getDesiredState()
+ {
+ return desiredState;
+ }
+
+ @OslcDescription("Automation Plan run by the Automation Request.")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "executesAutomationPlan")
+ @OslcName("executesAutomationPlan")
+ @OslcOccurs(Occurs.ExactlyOne)
+ @OslcTitle("Executes Automation Plan")
+ public URI getExecutesAutomationPlan()
+ {
+ return executesAutomationPlan;
+ }
+
+ @OslcDescription("Tag or keyword for a resource. Each occurrence of a dcterms:subject property denotes an additional tag for the resource.")
+ @OslcName("subject")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "subject")
+ @OslcReadOnly(false)
+ @OslcTitle("Subjects")
+ public String[] getSubjects()
+ {
+ return subjects.toArray(new String[subjects.size()]);
+ }
+
+ @OslcDescription("Title (reference: Dublin Core) or often a single line summary of the resource represented as rich text in XHTML content.")
+ @OslcOccurs(Occurs.ExactlyOne)
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "title")
+ @OslcTitle("Title")
+ @OslcValueType(ValueType.XMLLiteral)
+ public String getTitle()
+ {
+ return title;
+ }
+
+ @OslcDescription("Used to indicate the state of the automation request based on values defined by the service provider.")
+ @OslcOccurs(Occurs.OneOrMany)
+ @OslcReadOnly(true)
+ @OslcName("state")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "state")
+ @OslcTitle("States")
+ public URI[] getStates()
+ {
+ return states.toArray(new URI[states.size()]);
+ }
+
+
+ @OslcDescription("Parameters provided when Automation Requests are created.")
+ @OslcOccurs(Occurs.ZeroOrMany)
+ @OslcName("inputParameter")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "inputParameter")
+ @OslcReadOnly(false)
+ @OslcTitle("Input Parameter")
+ public ParameterInstance[] getInputParameters()
+ {
+ return inputParameters.toArray(new ParameterInstance[inputParameters.size()]);
+ }
+
+ public void setContributors(final URI[] contributors)
+ {
+ this.contributors.clear();
+
+ if (contributors != null)
+ {
+ this.contributors.addAll(Arrays.asList(contributors));
+ }
+ }
+
+ public void setCreated(final Date created)
+ {
+ this.created = created;
+ }
+
+ public void setCreators(final URI[] creators)
+ {
+ this.creators.clear();
+
+ if (creators != null)
+ {
+ this.creators.addAll(Arrays.asList(creators));
+ }
+ }
+
+ public void setDescription(final String description)
+ {
+ this.description = description;
+ }
+
+ public void setIdentifier(final String identifier)
+ {
+ this.identifier = identifier;
+ }
+
+ public void setInstanceShape(final URI instanceShape)
+ {
+ this.instanceShape = instanceShape;
+ }
+
+ public void setModified(final Date modified)
+ {
+ this.modified = modified;
+ }
+
+ public void setRdfTypes(final URI[] rdfTypes)
+ {
+ this.rdfTypes.clear();
+
+ if (rdfTypes != null)
+ {
+ this.rdfTypes.addAll(Arrays.asList(rdfTypes));
+ }
+ }
+
+ public void setServiceProvider(final URI serviceProvider)
+ {
+ this.serviceProvider = serviceProvider;
+ }
+
+ public void setDesiredState(final URI desiredState)
+ {
+ this.desiredState = desiredState;
+ }
+
+ public void setExecutesAutomationPlan(final URI executesAutomationPlan)
+ {
+ this.executesAutomationPlan = executesAutomationPlan;
+ }
+
+ public void setSubjects(final String[] subjects)
+ {
+ this.subjects.clear();
+
+ if (subjects != null)
+ {
+ this.subjects.addAll(Arrays.asList(subjects));
+ }
+ }
+
+ public void setTitle(final String title)
+ {
+ this.title = title;
+ }
+
+ public void setStates(final URI[] states)
+ {
+ this.states.clear();
+
+ if (states != null)
+ {
+ this.states.addAll(Arrays.asList(states));
+ }
+ }
+
+ public void setInputParameters(final ParameterInstance[] parameters)
+ {
+ this.inputParameters.clear();
+
+ if (parameters != null)
+ {
+ this.inputParameters.addAll(Arrays.asList(parameters));
+ }
+ }
+
+}
diff --git a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationResult.java b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationResult.java
new file mode 100644
index 0000000..b9866f1
--- /dev/null
+++ b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/AutomationResult.java
@@ -0,0 +1,443 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Paul McMahan <pmcmahan@us.ibm.com> - initial implementation
+ *******************************************************************************/
+package org.eclipse.lyo.client.oslc.resources;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcRange;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType;
+import org.eclipse.lyo.oslc4j.core.model.AbstractResource;
+import org.eclipse.lyo.oslc4j.core.model.Occurs;
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+import org.eclipse.lyo.oslc4j.core.model.ValueType;
+
+@OslcResourceShape(title = "Automation Result Resource Shape", describes = AutomationConstants.TYPE_AUTOMATION_RESULT)
+@OslcNamespace(AutomationConstants.AUTOMATION_NAMESPACE)
+/**
+ * @see http://open-services.net/wiki/automation/OSLC-Automation-Specification-Version-2.0/#Resource_AutomationResult
+ */
+public final class AutomationResult
+extends AbstractResource
+{
+ private final Set<URI> contributors = new TreeSet<URI>();
+ private final Set<URI> creators = new TreeSet<URI>();
+ private final Set<URI> rdfTypes = new TreeSet<URI>();
+ private final Set<String> subjects = new TreeSet<String>();
+ private final Set<URI> states = new TreeSet<URI>();
+ private final Set<URI> verdicts = new TreeSet<URI>();
+ private final Set<URI> contributions = new TreeSet<URI>();
+ private final Set<ParameterInstance> inputParameters = new TreeSet<ParameterInstance>();
+ private final Set<ParameterInstance> outputParameters = new TreeSet<ParameterInstance>();
+
+ private Date created;
+ private String identifier;
+ private URI instanceShape;
+ private Date modified;
+ private URI serviceProvider;
+ private String title;
+ private URI desiredState;
+ private URI producedByAutomationRequest;
+ private URI reportsOnAutomationPlan;
+
+ public AutomationResult()
+ {
+ super();
+
+ rdfTypes.add(URI.create(AutomationConstants.TYPE_AUTOMATION_RESULT));
+ }
+
+ public AutomationResult(final URI about)
+ {
+ super(about);
+
+ rdfTypes.add(URI.create(AutomationConstants.TYPE_AUTOMATION_RESULT));
+ }
+
+ protected URI getRdfType() {
+ return URI.create(AutomationConstants.TYPE_AUTOMATION_RESULT);
+ }
+
+ public void addContributor(final URI contributor)
+ {
+ this.contributors.add(contributor);
+ }
+
+ public void addCreator(final URI creator)
+ {
+ this.creators.add(creator);
+ }
+
+ public void addRdfType(final URI rdfType)
+ {
+ this.rdfTypes.add(rdfType);
+ }
+
+ public void addSubject(final String subject)
+ {
+ this.subjects.add(subject);
+ }
+
+ public void addState(final URI state)
+ {
+ this.states.add(state);
+ }
+
+ public void addVerdict(final URI verdict)
+ {
+ this.verdicts.add(verdict);
+ }
+
+ public void addContribution(final URI contribution)
+ {
+ this.contributions.add(contribution);
+ }
+
+ public void addInputParameter(final ParameterInstance parameter)
+ {
+ this.inputParameters.add(parameter);
+ }
+
+ public void addOutputParameter(final ParameterInstance parameter)
+ {
+ this.outputParameters.add(parameter);
+ }
+
+ @OslcDescription("The person(s) who are responsible for the work needed to complete the automation result.")
+ @OslcName("contributor")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "contributor")
+ @OslcRange(QmConstants.TYPE_PERSON)
+ @OslcTitle("Contributors")
+ public URI[] getContributors()
+ {
+ return contributors.toArray(new URI[contributors.size()]);
+ }
+
+ @OslcDescription("Timestamp of resource creation.")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "created")
+ @OslcReadOnly
+ @OslcTitle("Created")
+ public Date getCreated()
+ {
+ return created;
+ }
+
+ @OslcDescription("Creator or creators of resource.")
+ @OslcName("creator")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "creator")
+ @OslcRange(QmConstants.TYPE_PERSON)
+ @OslcTitle("Creators")
+ public URI[] getCreators()
+ {
+ return creators.toArray(new URI[creators.size()]);
+ }
+
+ @OslcDescription("A unique identifier for a resource. Assigned by the service provider when a resource is created. Not intended for end-user display.")
+ @OslcOccurs(Occurs.ExactlyOne)
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "identifier")
+ @OslcReadOnly
+ @OslcTitle("Identifier")
+ public String getIdentifier()
+ {
+ return identifier;
+ }
+
+ @OslcDescription("Resource Shape that provides hints as to resource property value-types and allowed values. ")
+ @OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "instanceShape")
+ @OslcRange(OslcConstants.TYPE_RESOURCE_SHAPE)
+ @OslcTitle("Instance Shape")
+ public URI getInstanceShape()
+ {
+ return instanceShape;
+ }
+
+ @OslcDescription("Timestamp last latest resource modification.")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "modified")
+ @OslcReadOnly
+ @OslcTitle("Modified")
+ public Date getModified()
+ {
+ return modified;
+ }
+
+ @OslcDescription("The resource type URIs.")
+ @OslcName("type")
+ @OslcPropertyDefinition(OslcConstants.RDF_NAMESPACE + "type")
+ @OslcTitle("Types")
+ public URI[] getRdfTypes()
+ {
+ return rdfTypes.toArray(new URI[rdfTypes.size()]);
+ }
+
+ @OslcDescription("The scope of a resource is a URI for the resource's OSLC Service Provider.")
+ @OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "serviceProvider")
+ @OslcRange(OslcConstants.TYPE_SERVICE_PROVIDER)
+ @OslcTitle("Service Provider")
+ public URI getServiceProvider()
+ {
+ return serviceProvider;
+ }
+
+ @OslcDescription("Tag or keyword for a resource. Each occurrence of a dcterms:subject property denotes an additional tag for the resource.")
+ @OslcName("subject")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "subject")
+ @OslcReadOnly(false)
+ @OslcTitle("Subjects")
+ public String[] getSubjects()
+ {
+ return subjects.toArray(new String[subjects.size()]);
+ }
+
+ @OslcDescription("Title (reference: Dublin Core) or often a single line summary of the resource represented as rich text in XHTML content.")
+ @OslcOccurs(Occurs.ExactlyOne)
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "title")
+ @OslcTitle("Title")
+ @OslcValueType(ValueType.XMLLiteral)
+ public String getTitle()
+ {
+ return title;
+ }
+
+ @OslcDescription("Used to indicate the state of the automation result based on values defined by the service provider.")
+ @OslcOccurs(Occurs.OneOrMany)
+ @OslcReadOnly(true)
+ @OslcName("state")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "state")
+ @OslcTitle("State")
+ public URI[] getStates()
+ {
+ return states.toArray(new URI[states.size()]);
+ }
+
+ @OslcDescription("A result contribution associated with this automation result.")
+ @OslcOccurs(Occurs.ZeroOrMany)
+ @OslcName("contribution")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "contribution")
+ @OslcTitle("Contribution")
+ public URI[] getContributions()
+ {
+ return contributions.toArray(new URI[contributions.size()]);
+ }
+
+ @OslcDescription("Used to indicate the verdict of the automation result based on values defined by the service provider.")
+ @OslcOccurs(Occurs.OneOrMany)
+ @OslcName("verdict")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "verdict")
+ @OslcTitle("Verdict")
+ public URI[] getVerdicts()
+ {
+ return verdicts.toArray(new URI[verdicts.size()]);
+ }
+
+ @OslcDescription("Used to indicate the desired state of the Automation Request based on values defined by the service provider.")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "desiredState")
+ @OslcName("desiredState")
+ @OslcOccurs(Occurs.ZeroOrOne)
+ @OslcTitle("Desired State")
+ public URI getDesiredState()
+ {
+ return desiredState;
+ }
+
+ @OslcDescription("Automation Request which produced the Automation Result.")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "producedByAutomationRequest")
+ @OslcName("producedByAutomationRequest")
+ @OslcOccurs(Occurs.ZeroOrOne)
+ @OslcTitle("Produced By Automation Request")
+ public URI getProducedByAutomationRequest()
+ {
+ return producedByAutomationRequest;
+ }
+
+ @OslcDescription("Automation Plan which the Automation Result reports on.")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "reportsOnAutomationPlan")
+ @OslcName("reportsOnAutomationPlan")
+ @OslcOccurs(Occurs.ExactlyOne)
+ @OslcTitle("Reports On Automation Plan")
+ public URI getReportsOnAutomationPlan()
+ {
+ return reportsOnAutomationPlan;
+ }
+
+ @OslcDescription("A copy of the parameters provided during creation of the Automation Request which produced this Automation Result.")
+ @OslcOccurs(Occurs.ZeroOrMany)
+ @OslcName("inputParameter")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "inputParameter")
+ @OslcReadOnly(true)
+ @OslcTitle("Input Parameter")
+ public ParameterInstance[] getInputParameters()
+ {
+ return inputParameters.toArray(new ParameterInstance[inputParameters.size()]);
+ }
+
+ @OslcDescription("Automation Result output parameters are parameters associated with the automation execution which produced this Result. This includes the final value of all parameters used to initiate the execution and any additional parameters which may have been created during automation execution by the service provider or external agents.")
+ @OslcOccurs(Occurs.ZeroOrMany)
+ @OslcName("outputParameter")
+ @OslcPropertyDefinition(AutomationConstants.AUTOMATION_NAMESPACE + "outputParameter")
+ @OslcTitle("Output Parameter")
+ public ParameterInstance[] getOutputParameters()
+ {
+ return outputParameters.toArray(new ParameterInstance[outputParameters.size()]);
+ }
+
+ public void setContributors(final URI[] contributors)
+ {
+ this.contributors.clear();
+
+ if (contributors != null)
+ {
+ this.contributors.addAll(Arrays.asList(contributors));
+ }
+ }
+
+ public void setCreated(final Date created)
+ {
+ this.created = created;
+ }
+
+ public void setCreators(final URI[] creators)
+ {
+ this.creators.clear();
+
+ if (creators != null)
+ {
+ this.creators.addAll(Arrays.asList(creators));
+ }
+ }
+
+ public void setIdentifier(final String identifier)
+ {
+ this.identifier = identifier;
+ }
+
+ public void setInstanceShape(final URI instanceShape)
+ {
+ this.instanceShape = instanceShape;
+ }
+
+ public void setModified(final Date modified)
+ {
+ this.modified = modified;
+ }
+
+ public void setRdfTypes(final URI[] rdfTypes)
+ {
+ this.rdfTypes.clear();
+
+ if (rdfTypes != null)
+ {
+ this.rdfTypes.addAll(Arrays.asList(rdfTypes));
+ }
+ }
+
+ public void setServiceProvider(final URI serviceProvider)
+ {
+ this.serviceProvider = serviceProvider;
+ }
+
+ public void setSubjects(final String[] subjects)
+ {
+ this.subjects.clear();
+
+ if (subjects != null)
+ {
+ this.subjects.addAll(Arrays.asList(subjects));
+ }
+ }
+
+ public void setTitle(final String title)
+ {
+ this.title = title;
+ }
+
+ public void setStates(final URI[] states)
+ {
+ this.states.clear();
+
+ if (states != null)
+ {
+ this.states.addAll(Arrays.asList(states));
+ }
+ }
+
+ public void setVerdicts(final URI[] verdicts)
+ {
+ this.verdicts.clear();
+
+ if (verdicts != null)
+ {
+ this.verdicts.addAll(Arrays.asList(verdicts));
+ }
+ }
+
+ public void setContributions(final URI[] contributions)
+ {
+ this.contributions.clear();
+
+ if (contributions != null)
+ {
+ this.contributions.addAll(Arrays.asList(contributions));
+ }
+ }
+
+ public void setDesiredState(final URI desiredState)
+ {
+ this.desiredState = desiredState;
+ }
+
+ public void setProducedByAutomationRequest(final URI producedByAutomationRequest)
+ {
+ this.producedByAutomationRequest = producedByAutomationRequest;
+ }
+
+ public void setReportsOnAutomationPlan(final URI reportsOnAutomationPlan)
+ {
+ this.reportsOnAutomationPlan = reportsOnAutomationPlan;
+ }
+
+ public void setInputParameters(final ParameterInstance[] parameters)
+ {
+ this.inputParameters.clear();
+
+ if (parameters != null)
+ {
+ this.inputParameters.addAll(Arrays.asList(parameters));
+ }
+ }
+
+ public void setOutputParameters(final ParameterInstance[] parameters)
+ {
+ this.outputParameters.clear();
+
+ if (parameters != null)
+ {
+ this.outputParameters.addAll(Arrays.asList(parameters));
+ }
+ }
+
+
+}
diff --git a/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/ParameterInstance.java b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/ParameterInstance.java
new file mode 100644
index 0000000..bb42320
--- /dev/null
+++ b/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/ParameterInstance.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Paul McMahan <pmcmahan@us.ibm.com> - initial implementation
+ *******************************************************************************/
+package org.eclipse.lyo.client.oslc.resources;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcRange;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType;
+import org.eclipse.lyo.oslc4j.core.model.AbstractResource;
+import org.eclipse.lyo.oslc4j.core.model.Occurs;
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+import org.eclipse.lyo.oslc4j.core.model.ValueType;
+
+@OslcResourceShape(title = "Parameter Instance Resource Shape", describes = AutomationConstants.TYPE_PARAMETER_INSTANCE)
+@OslcNamespace(AutomationConstants.AUTOMATION_NAMESPACE)
+/**
+ * @see http://open-services.net/wiki/automation/OSLC-Automation-Specification-Version-2.0/#Resource_ParameterInstance
+ */
+public final class ParameterInstance
+extends AbstractResource implements Comparable<ParameterInstance>
+{
+ private final Set<URI> rdfTypes = new TreeSet<URI>();
+
+ private String name;
+ private String value;
+ private String description;
+ private URI instanceShape;
+ private URI serviceProvider;
+
+ public ParameterInstance()
+ {
+ super();
+
+ rdfTypes.add(URI.create(AutomationConstants.TYPE_AUTOMATION_PLAN));
+ }
+
+ public ParameterInstance(final URI about)
+ {
+ super(about);
+
+ rdfTypes.add(URI.create(AutomationConstants.TYPE_AUTOMATION_PLAN));
+ }
+
+ protected URI getRdfType() {
+ return URI.create(AutomationConstants.TYPE_AUTOMATION_PLAN);
+ }
+
+ public void addRdfType(final URI rdfType)
+ {
+ this.rdfTypes.add(rdfType);
+ }
+
+ @OslcDescription("Descriptive text (reference: Dublin Core) about resource represented as rich text in XHTML content.")
+ @OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "description")
+ @OslcTitle("Description")
+ @OslcValueType(ValueType.XMLLiteral)
+ public String getDescription()
+ {
+ return description;
+ }
+
+ @OslcDescription("The name of the parameter instance.")
+ @OslcOccurs(Occurs.ExactlyOne)
+ @OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "name")
+ @OslcTitle("Name")
+ public String getName()
+ {
+ return name;
+ }
+
+ @OslcDescription("The value of the parameter.")
+ @OslcOccurs(Occurs.ZeroOrOne)
+ @OslcPropertyDefinition(OslcConstants.RDF_NAMESPACE + "value")
+ @OslcTitle("Value")
+ public String getValue()
+ {
+ return value;
+ }
+
+ @OslcDescription("Resource Shape that provides hints as to resource property value-types and allowed values. ")
+ @OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "instanceShape")
+ @OslcRange(OslcConstants.TYPE_RESOURCE_SHAPE)
+ @OslcTitle("Instance Shape")
+ public URI getInstanceShape()
+ {
+ return instanceShape;
+ }
+
+ @OslcDescription("The resource type URIs.")
+ @OslcName("type")
+ @OslcPropertyDefinition(OslcConstants.RDF_NAMESPACE + "type")
+ @OslcTitle("Types")
+ public URI[] getRdfTypes()
+ {
+ return rdfTypes.toArray(new URI[rdfTypes.size()]);
+ }
+
+ @OslcDescription("The scope of a resource is a URI for the resource's OSLC Service Provider.")
+ @OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "serviceProvider")
+ @OslcRange(OslcConstants.TYPE_SERVICE_PROVIDER)
+ @OslcTitle("Service Provider")
+ public URI getServiceProvider()
+ {
+ return serviceProvider;
+ }
+
+ public void setDescription(final String description)
+ {
+ this.description = description;
+ }
+
+ public void setName(final String name)
+ {
+ this.name = name;
+ }
+
+ public void setValue(final String value)
+ {
+ this.value = value;
+ }
+
+ public void setInstanceShape(final URI instanceShape)
+ {
+ this.instanceShape = instanceShape;
+ }
+
+ public void setRdfTypes(final URI[] rdfTypes)
+ {
+ this.rdfTypes.clear();
+
+ if (rdfTypes != null)
+ {
+ this.rdfTypes.addAll(Arrays.asList(rdfTypes));
+ }
+ }
+
+ public void setServiceProvider(final URI serviceProvider)
+ {
+ this.serviceProvider = serviceProvider;
+ }
+
+ public int compareTo(ParameterInstance o) {
+ return o.getName().compareTo(name);
+ }
+
+}