You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devicemap.apache.org by wk...@apache.org on 2014/06/09 15:50:11 UTC
svn commit: r1601384 - in /incubator/devicemap/trunk/contrib/w3c/ddr-simple:
./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/w3c/
src/main/java/org/w3c/ddr/ src/main/java/org/w3c/ddr/simple/
src/main/java/org/w3c/ddr/simple/except...
Author: wkeil
Date: Mon Jun 9 13:50:10 2014
New Revision: 1601384
URL: http://svn.apache.org/r1601384
Log:
Initial import.
Added:
incubator/devicemap/trunk/contrib/w3c/ddr-simple/.gitignore
incubator/devicemap/trunk/contrib/w3c/ddr-simple/README.md
incubator/devicemap/trunk/contrib/w3c/ddr-simple/pom.xml
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/Evidence.java
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyName.java
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyRef.java
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyValue.java
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyValues.java
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/Service.java
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/ServiceFactory.java
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/DDRException.java
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/InitializationException.java
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/NameException.java
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/SystemException.java
incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/ValueException.java
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/.gitignore
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/.gitignore?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/.gitignore (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/.gitignore Mon Jun 9 13:50:10 2014
@@ -0,0 +1,58 @@
+# -- OSX --
+.DS_Store
+.AppleDouble
+.LSOverride
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear on external disk
+.Spotlight-V100
+.Trashes
+
+
+# -- Maven --
+target/
+
+# -- Netbeans --
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+nbactions.xml
+nb-configuration.xml
+
+# -- IDEA --
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# -- Eclipse --
+.project
+.metadata
+bin/**
+tmp/**
+tmp/**/*
+*.tmp
+*.bak
+*.swp
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/README.md
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/README.md?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/README.md (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/README.md Mon Jun 9 13:50:10 2014
@@ -0,0 +1,19 @@
+## Device Description Repository Simple API
+W3C Recommendation 05 December 2008
+
+More Info: [http://www.w3.org/TR/DDR-Simple-API/](http://www.w3.org/TR/DDR-Simple-API/)
+
+This is a mavenized version of the Java representation of the API available at [http://www.w3.org/TR/DDR-Simple-API/DDRSimpleAPI.jar](http://www.w3.org/TR/DDR-Simple-API/DDRSimpleAPI.jar)
+
+Clone and deploy to your own repository or get the build from here:
+
+ <repository>
+ <id>com-andreasfink-repository</id>
+ <url>http://andreasfink.com/repository/releases</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
\ No newline at end of file
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/pom.xml
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/pom.xml?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/pom.xml (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/pom.xml Mon Jun 9 13:50:10 2014
@@ -0,0 +1,68 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>ddr-simple</artifactId>
+ <groupId>org.w3c</groupId>
+ <version>20081205</version>
+ <packaging>jar</packaging>
+ <name>DDR-Simple-API</name>
+ <url>http://www.w3.org/TR/DDR-Simple-API/</url>
+ <description>Device Description Repository Simple API.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <distributionManagement>
+ <repository>
+ <id>andreasfink-release-repository</id>
+ <name>Release Repository</name>
+ <url>scp://andreasfink.com:34712/home/andi/andreasfink.com/htdocs/repository/releases</url>
+ </repository>
+ <snapshotRepository>
+ <id>andreasfink-snapshot-repository</id>
+ <name>Snapshot Repository</name>
+ <url>scp://andreasfink.com:34712/home/andi/andreasfink.com/htdocs/repository/snapshots</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <optimize>true</optimize>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-javadoc</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/Evidence.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/Evidence.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/Evidence.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/Evidence.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,54 @@
+package org.w3c.ddr.simple;
+
+/**
+ * An interface representing evidence that is to be supplied to getPropertyValue
+ * or getPropertyValues methods of {@link Service}.
+ * The purpose of Evidence is to represent available information with which to identify the delivery context.
+ * In accordance with the minimum requirements of the DDR Simple API, this interface can support the
+ * representation of evidence as HTTP headers.
+ * Consumers of HTTP evidence must support case-insensitive field names as per RFC 2616 section 4.2.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/>
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
+ * (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
+ * <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
+ * <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+ *
+ * @see Service#newHTTPEvidence()
+ */
+
+public interface Evidence {
+ /**
+ * Add a key / value pair to the collection of evidence.
+ * Any value put into evidence via this method can be retrieved via a corresponding call to get(key).
+ *
+ * @param key The key that identifies an element of the evidence.
+ * @param value The value of the identified element.
+ */
+ public void put(String key, String value);
+
+ /**
+ * True if a value for the specified key exists.
+ *
+ * @param key The unique key that identifies an element of the evidence.
+ * @return The value 'true' if the identified element has a value that can be retrieved, and 'false' otherwise.
+ */
+ public boolean exists(String key);
+
+ /**
+ * Get the value corresponding to the key.
+ * For a particular key K, if there was a previous call to put(K,value) then
+ * the value returned by get(K) will be the most recent value used in put(K,value).
+ *
+ * @param key The key that identifies an element of the evidence.
+ * @return The value of the element identified by the key.
+ */
+ public String get(String key);
+}
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyName.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyName.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyName.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyName.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,41 @@
+package org.w3c.ddr.simple;
+
+/**
+ * This class represents the name of a property, drawn from a particular vocabulary (which is identified by a unique namespace).
+ * Refer to the vocabulary definition for the list of terms, their formal names (IDs) and their semantics.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/>
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
+ * (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
+ * <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
+ * <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+ *
+ * @see PropertyRef
+ * @see Service#newPropertyName(java.lang.String)
+ */
+public interface PropertyName {
+ /**
+ * The formal name (ID) of the property term from a vocabulary of property terms.
+ * The names are locally unique within their vocabulary.
+ *
+ * @return The formal name of the term from its vocabulary.
+ */
+ public String getLocalPropertyName();
+
+ /**
+ * The namespace of the vocabulary containing the property term.
+ * It is not a requirement that a namespace IRI can be dereferenced,
+ * nor is it a requirement that any content obtained by dereferencing a namespace IRI can be machine-interpreted.
+ *
+ * @return An IRI.
+ */
+ public String getNamespace();
+
+}
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyRef.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyRef.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyRef.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyRef.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,56 @@
+package org.w3c.ddr.simple;
+
+/**
+ * Represents a Property / Aspect combination.
+ * The Property is as defined by the PropertyName class, comprising a term from a vocabulary and a namespace for that vocabulary.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/>
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
+ * (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
+ * <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
+ * <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+ *
+ * @see Service#newPropertyRef(org.w3c.ddr.simple.PropertyName)
+ * @see Service#newPropertyRef(org.w3c.ddr.simple.PropertyName, String localAspectName)
+ * @see PropertyName
+ */
+public interface PropertyRef {
+
+ /**
+ * This constant value is used to support Vocabularies that do not distinguish Aspects.
+ *
+ * <br/><br/>The value of this constant shall be "__NULL".
+ */
+ public static final String NULL_ASPECT = "__NULL";
+
+ /**
+ * The name of the property, according to a vocabulary of property terms.
+ *
+ * @return A term from a vocabulary (for use as a property identifier).
+ */
+ public String getLocalPropertyName();
+
+ /**
+ * The name of the aspect, according to a vocabulary of aspect terms.
+ *
+ * @return A term from a vocabulary (for use as an Aspect identifier).
+ */
+ public String getAspectName();
+
+ /**
+ * The namespace of the property and aspect terms.
+ * In the Simple API, the namespace of the Aspect is determined by the namespace of the Property.
+ * Future APIs are expected to relax this relationship to permit Aspects from other namespaces.
+ *
+ * @return An IRI.
+ */
+ public String getNamespace();
+
+}
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyValue.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyValue.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyValue.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyValue.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,114 @@
+package org.w3c.ddr.simple;
+
+import org.w3c.ddr.simple.exception.ValueException;
+
+/**
+ * Represents the value of a property.<br/><br/>
+ *
+ * <b>NOTE</b>:
+ * The underlying data type of a property is determined by its vocabulary.
+ * The programmatic determination of a property type from a vocabulary is out of scope for this API.
+ * Therefore, the only practical way to determine the appropriate getX() method for an arbitrary instance supporting this interface
+ * is to obtain the name details via the getPropertyRef() method and compare the property information against
+ * externally available vocabulary information.
+ * Under the normal use cases for this API, the usage of an instance supporting this interface will be such that
+ * the data type is already known, and the developer will take steps to use the appropriate getX() method.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/>
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
+ * (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
+ * <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
+ * <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+ *
+ */
+public interface PropertyValue {
+
+ /**
+ *
+ * Returns the double value of the property, in the default units specified in its vocabulary.
+ *
+ * @return the double value of the property
+ * @throws ValueException MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not a double according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.
+ */
+ public double getDouble() throws ValueException; // double-precision 64-bit IEEE 754 floating point
+
+ /**
+ *
+ * Returns the long value of the property, in the default units specified in its vocabulary.
+ *
+ * @return the long value of the property
+ * @throws ValueException MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not a long according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.
+ */
+ public long getLong() throws ValueException; // 64-bit signed two's complement integer
+
+ /**
+ * Returns the Boolean value of the property.
+ *
+ * @return the Boolean value of the property
+ * @throws ValueException MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not a Boolean according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.
+ */
+ public boolean getBoolean() throws ValueException;
+
+ /**
+ *
+ * Returns the integer value of the property, in the default units specified in its vocabulary.
+ *
+ * @return the integer value of the property
+ * @throws ValueException MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not an integer according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.
+ */
+ public int getInteger() throws ValueException; // 32-bit signed two's complement integer
+
+ /**
+ *
+ * Returns the value of the property as a list of strings.
+ *
+ * @return the value of the property as a list of strings
+ * @throws ValueException MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not an enumeration according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.
+ */
+ public String[] getEnumeration() throws ValueException;
+
+ /**
+ *
+ * Returns the float value of the property, in the default units specified in its vocabulary.
+ *
+ * @return the float value of the property
+ * @throws ValueException MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not a float according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.
+ */
+ public float getFloat() throws ValueException; // single-precision 32-bit IEEE 754 floating point
+
+ /**
+ * Returns the PropertyRef that identifies the property to which this PropertyValue instance applies.
+ *
+ * @return The corresponding PropertyRef instance.
+ */
+ public PropertyRef getPropertyRef();
+
+ /**
+ *
+ * Returns the string value of the property, or a string <i>version</i> of the property.
+ *
+ * @return The string value of the property or an implementation-specific string version of the property if the underlying data type is not a string.
+ * @throws ValueException MUST be thrown (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.
+ */
+ public String getString() throws ValueException; // UTF-16 format, Basic Multilingual Plane code points, including surrogates
+
+ /**
+ * Returns 'true' only if a value is available from the repository.<br/>
+ * Returns 'false' if a value is not available from the repository.<br/><br/>
+ * If this method returns 'true', then the getX() methods will return valid
+ * data if type X is appropriate to the data stored in the repository.
+ * If this method returns 'false', an attempt to retrieve a value via a getX()
+ * method (other than getString) will cause a ValueException
+ * (with code ValueException.NOT_KNOWN) to be thrown.
+ *
+ * @return The value 'true' if a value for the property is known in the repository, or 'false' otherwise.
+ */
+ public boolean exists();
+}
\ No newline at end of file
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyValues.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyValues.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyValues.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/PropertyValues.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,42 @@
+package org.w3c.ddr.simple;
+
+import org.w3c.ddr.simple.exception.NameException;
+
+/**
+ * Represents a collection of PropertyValue instances.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/>
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
+ * (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
+ * <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
+ * <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+ *
+ */
+public interface PropertyValues {
+
+ /**
+ * Obtain all of the PropertyValue instances as an array.
+ * The order of the array is implementation-specific.
+ *
+ * @return An array of PropertyValue instances, some of which may not have values.
+ */
+ public PropertyValue[] getAll();
+
+ /**
+ * Obtain an identified PropertyValue instance from the collection, using a PropertyRef as the identifier.
+ * It is not guaranteed that the returned PropertyValue will have a usable value associated with it.
+ * To test if a usable value is available, use the exists() method of {@link PropertyValue}.
+ *
+ * @param prop A non-null identifier of the PropertyValue to be returned.
+ * @return The identified PropertyValue.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown if the prop parameter is null, or if the name data in the prop instance is invalid.
+ */
+ public PropertyValue getValue(PropertyRef prop) throws NameException;
+}
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/Service.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/Service.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/Service.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/Service.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,278 @@
+package org.w3c.ddr.simple;
+
+import java.util.Map;
+import java.util.Properties;
+
+import org.w3c.ddr.simple.exception.InitializationException;
+import org.w3c.ddr.simple.exception.NameException;
+
+/**
+ * This is the 'simple' interface to a DDR service, via which you retrieve properties of the delivery context based on available (HTTP) evidence.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/>
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
+ * (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
+ * <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
+ * <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+ *
+ */
+public interface Service {
+ /**
+ * Called to initialize the API following construction.
+ *
+ * @param defaultVocabularyIRI The IRI of the default vocabulary namespace
+ * @param props Implementation dependent properties
+ * @throws NameException MUST be thrown if the implementation cannot apply the parameter data.
+ * @throws InitializationException MUST be thrown in any situation that implies a failure while initializing the DDR (including the case of not being able to instantiate the class).
+ */
+ public void initialize(String defaultVocabularyIRI, Properties props)
+ throws NameException,InitializationException;
+
+ /**
+ * A informative implementation-specific method to determine the version of the implementation of the API.
+ * This is for use in cases where the service has been constructed via a factory,
+ * or similarly determined at run-time, and supports diagnostic use-cases.
+ *
+ * @return A human-readable string containing information about the implementation of the API including the current version
+ */
+ public String getImplementationVersion();
+
+ /**
+ * An informative implementation-specific method to indicate the revision level of the underlying data, if known.
+ * The information provided by this method, where information is returned, shall not be required
+ * to reveal any details of the nature of the underlying data, including any source(s).
+ * Whether or not the underlying implementation combines more than one source of data is opaque to
+ * the user of the API which makes no assumptions about the number of sources of data
+ *
+ * @return A String indicating the revision level of the data,
+ * which will be different to any previously returned value if the
+ * underlying implementation cannot guarantee that the data has not
+ * changed since the last time this method was called.
+ * <br/>Note: the NOT_SUPPORTED constant is returned if the implementation does not support data versioning.
+ */
+ public String getDataVersion();
+
+ /**
+ * List all the PropertyRefs the implementation knows about.
+ *
+ * @return A list of all the PropertyRefs that are known to the implementation.
+ */
+ public PropertyRef[] listPropertyRefs();
+
+ /**
+ * Use the evidence provided to get the PropertyValue of the property
+ * named by the propertyRef,
+ * in the property vocabulary given by the propertyRef and
+ * in the aspect also given by the propertyRef.
+ * The aspect IRI is determined by the propertyRef
+ * (which means it is the same as the property vocabulary IRI).
+ * If no aspect term is defined by the propertyRef,
+ * use the default aspect term for the property as defined in the property vocabulary.
+ *
+ * @param evidence Evidence with which to identify the delivery context.
+ * @param propertyRef Identification of the property whose value is being queried.
+ * @return the PropertyValue of the identified property.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with codes NameException.VOCABULARY_NOT_RECOGNIZED or NameException.PROPERTY_NOT_RECOGNIZED) if the name data in the propertyRef parameter is invalid.
+ */
+ public PropertyValue getPropertyValue(Evidence evidence, PropertyRef propertyRef)
+ throws NameException;
+
+ /**
+ * Use the evidence provided to get the PropertyValue of the property
+ * named by the propertyName
+ * in the vocabulary given by the propertyName and
+ * in the default aspect of the property according to the property's vocabulary.
+ *
+ * @param evidence Evidence with which to identify the delivery context.
+ * @param propertyName Identification of the property whose value is being queried.
+ * @return the PropertyValue of the identified property.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with codes NameException.VOCABULARY_NOT_RECOGNIZED or NameException.PROPERTY_NOT_RECOGNIZED) if the name data in the propertyName parameter is invalid.
+ */
+ public PropertyValue getPropertyValue(Evidence evidence, PropertyName propertyName)
+ throws NameException;
+
+ /**
+ * Use the evidence provided to get the value of the property
+ * named by the localPropertyName, which is a term
+ * in the default property vocabulary defined during initialization and
+ * in the default aspect for the property as defined in the default property vocabulary.
+ * The namespace IRI of the aspect is the same as the IRI for the default vocabulary og properties.
+ *
+ * @param evidence Evidence with which to identify the delivery context.
+ * @param localPropertyName The local name (identifier) of the property as per the default vocabulary of properties.
+ * @return the PropertyValue of the identified property.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with code NameException.PROPERTY_NOT_RECOGNIZED) if the localPropertyName parameter is invalid.
+ */
+ public PropertyValue getPropertyValue(Evidence evidence, String localPropertyName)
+ throws NameException;
+
+ /**
+ * Use the evidence provided to get the value of the property
+ * named by the localPropertyName, which is a term
+ * in the given vocabulary of properties identified by a namespace IRI and
+ * in the given aspect for the property.
+ * The namespace IRI of the aspect is the same as the namespace for the given vocabulary of properties.
+ *
+ * @param evidence Evidence with which to identify the delivery context.
+ * @param localPropertyName The local name (identifier) of the property as per the vocabulary of properties whose namespace is given.
+ * @param localAspectName The local name (identifier) of the aspect, whose namespace is the same as that of the vocabulary of properties.
+ * @param vocabularyIRI The namesapce IRI for the vocabulary of properties.
+ * @return the PropertyValue of the identified property.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with codes NameException.VOCABULARY_NOT_RECOGNIZED or NameException.PROPERTY_NOT_RECOGNIZED or NameException.ASPECT_NOT_RECOGNIZED) if any of the name data in the String parameters is invalid.
+ */
+ public PropertyValue getPropertyValue(Evidence evidence, String localPropertyName, String localAspectName, String vocabularyIRI)
+ throws NameException;
+
+ /**
+ * Use the evidence provided to get all of the available values
+ * of properties in the default property vocabulary.
+ * This includes all property terms from all supported vocabularies,
+ * and in each of the aspects supported by the property vocabularies,
+ * and for every aspect IRI that is supported.
+ * Combinations of property/aspect that are not supported are not returned in the PropertyValues collections.
+ *
+ * @param evidence Evidence with which to identify the delivery context.
+ * @return an instance of PropertyValues containing PropertyValue objects representing all available values for the evidence supplied.
+ * @throws org.w3c.ddr.simple.exception.NameException for consistency with other versions of this method, but if this method does throw a NameException then it should be treated as an implementation error because there are no circumstances when this method could actually throw a NameException
+ */
+ public PropertyValues getPropertyValues(Evidence evidence)
+ throws NameException;
+
+ /**
+ * Use the evidence provided to get the value of each property in the array of PropertyRef instances.
+ * The aspect term is determined by the individual PropertyRef instances.
+ * Where the aspect term is undefined, use the default aspect term in the property's vocabulary.
+ * As the order of elements obtained via {@link PropertyValues#getAll()} is implementation-specific
+ * it is not correct to assume that the order of elements in propertyRefs will influence the order of
+ * the array returned by {@link PropertyValues#getAll()}.
+ * The {@link PropertyValues#getValue(PropertyRef)} method provides a more direct and interoperable
+ * means of inspecting the return value.
+ *
+ * @param evidence Evidence with which to identify the delivery context.
+ * @param propertyRefs Identification of the properties whose values are being queried.
+ * @return an instance of PropertyValues containing PropertyValue objects identified by the supplied evidence.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with codes NameException.VOCABULARY_NOT_RECOGNIZED or NameException.PROPERTY_NOT_RECOGNIZED or NameException.ASPECT_NOT_RECOGNIZED) if any name data in the propertyRefs parameter is invalid.
+ */
+ public PropertyValues getPropertyValues(Evidence evidence, PropertyRef[] propertyRefs)
+ throws NameException;
+
+ /**
+ * Use the evidence provided to get all of the available values for all properties
+ * in the default vocabulary whose aspect is the localAspectName.
+ * The namespace of the aspect is the same as the default vocabulary IRI.
+ *
+ * @param evidence Evidence with which to identify the delivery context.
+ * @param localAspectName The name of the aspect, whose namespace is the same as the default vocabulary of properties.
+ * @return an instance of PropertyValues containing PropertyValue objects identified by the supplied evidence in the given aspect.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with code NameException.ASPECT_NOT_RECOGNIZED) if the localAspectName parameter is invalid.
+ */
+ public PropertyValues getPropertyValues(Evidence evidence, String localAspectName)
+ throws NameException;
+
+ /**
+ * Use the evidence provided to get all of the available values for all properties
+ * in the given vocabulary whose aspect is the localAspectName.
+ * The namespace of the aspect is the same as the given vocabulary IRI.
+ *
+ * @param evidence Evidence with which to identify the delivery context.
+ * @param localAspectName The name of the aspect, whose namespace is the same as the vocabulary of properties.
+ * @param vocabularyIRI The namespace of the vocabulary of properties.
+ * @return an instance of PropertyValues containing PropertyValue objects in the given vocabulary and aspect, identified by the supplied evidence.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with codes NameException.VOCABULARY_NOT_RECOGNIZED or NameException.ASPECT_NOT_RECOGNIZED) if any name data in the String parameters is invalid.
+ */
+ public PropertyValues getPropertyValues(Evidence evidence, String localAspectName, String vocabularyIRI)
+ throws NameException;
+
+ /**
+ * Factory method to create a new PropertyName instance in the default property vocabulary.
+ *
+ * @param localPropertyName The local name (identifier) of the property as given in the default vocabulary.
+ * @return a new PropertyName instance.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with code NameException.PROPERTY_NOT_RECOGNIZED ) if the localPropertyName parameter is invalid.
+ */
+ public PropertyName newPropertyName(String localPropertyName)
+ throws NameException;
+
+ /**
+ * Factory method to create a new PropertyName instance in the given property vocabulary.
+ *
+ * @param localPropertyName The local name (identifier) of the property as given in its vocabulary.
+ * @param vocabularyIRI The namespace of the property.
+ * @return a new PropertyName instance.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with codes NameException.VOCABULARY_NOT_RECOGNIZED or NameException.PROPERTY_NOT_RECOGNIZED) if any of the parameters is invalid.
+ */
+ public PropertyName newPropertyName(String localPropertyName, String vocabularyIRI)
+ throws NameException;
+
+ /**
+ * Factory method to create a PropertyRef instance in the default vocabulary.
+ * The aspect is determined by the default aspect according to the vocabulary of the property.
+ * If the property has no default aspect defined in the vocabulary, the PropertyRef.NULL_ASPECT is used.
+ * @param localPropertyName The name of the property as given in the default vocabulary.
+ * @return a new PropertyRef instance.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with code NameException.PROPERTY_NOT_RECOGNIZED) if the localPropertyName parameter is invalid.
+ */
+ public PropertyRef newPropertyRef(String localPropertyName)
+ throws NameException;
+
+ /**
+ * Factory method to create a PropertyRef instance using the name and vocabulary of the PropertyName parameter.
+ * The aspect is determined by the default aspect according to the vocabulary of the property.
+ * If the property has no default aspect defined in the vocabulary, the PropertyRef.NULL_ASPECT is used.
+ *
+ * @param propertyName A property belonging to a specific vocabulary.
+ * @return a new PropertyRef instance.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with codes NameException.VOCABULARY_NOT_RECOGNIZED or NameException.PROPERTY_NOT_RECOGNIZED) if the name data in the propertyName parameter is invalid.
+ */
+ public PropertyRef newPropertyRef(PropertyName propertyName)
+ throws NameException;
+
+ /**
+ * Factory method to create a PropertyRef instance using the name and vocabulary of the PropertyName parameter.
+ * The aspect name is given, and the namespace IRI of the aspect is the same as the IRI of the vocabulary of the PropertyName parameter.
+ *
+ * @param propertyName A property belonging to a specific vocabulary.
+ * @param localAspectName The name of the aspect as given in the default vocabulary.
+ * @return a new PropertyRef instance.
+ * @throws org.w3c.ddr.simple.exception.NameException MUST be thrown (with codes NameException.VOCABULARY_NOT_RECOGNIZED or NameException.PROPERTY_NOT_RECOGNIZED or NameException.ASPECT_NOT_RECOGNIZED) if any name data in the parameters is invalid.
+ */
+ public PropertyRef newPropertyRef(PropertyName propertyName, String localAspectName)
+ throws NameException;
+
+ /**
+ * Factory method to create an object supporting the Evidence interface, intended to represent HTTP headers.
+ * The object constructed by this factory is assumed to be aware of the case-insensitivity of HTTP headers.
+ *
+ * @return an empty Evidence instance, suitable for population with HTTP headers.
+ */
+ public Evidence newHTTPEvidence();
+
+ /**
+ * Factory method to create an object supporting the Evidence interface, using name/value pairs from the Map parameter, representing evidence from HTTP headers.
+ * The object constructed by this factory is assumed to be aware of the case-insensitivity of HTTP headers.
+ * <br/><br/>
+ *
+ * <b>NOTE</b>:
+ * Versions of this interface pre-Java1.5 replace <i>java.util.Map<String,String></i> with <i>java.util.Map</i>
+ * <br/><br/>
+ *
+ * @param map Mapping of names to values, assumed to represent HTTP headers.
+ * @return an Evidence instance populated with HTTP headers.
+ */
+ public Evidence newHTTPEvidence(Map<String,String> map);
+
+ /**
+ * This constant value is used to indicate that a feature is not supported, when returned by a String method.
+ *
+ * <br/><br/>The value of this constant shall be "__NOT_SUPPORTED".
+ */
+ public static final String NOT_SUPPORTED = "__NOT_SUPPORTED";
+
+}
\ No newline at end of file
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/ServiceFactory.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/ServiceFactory.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/ServiceFactory.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/ServiceFactory.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,84 @@
+package org.w3c.ddr.simple;
+
+import java.util.Properties;
+
+import org.w3c.ddr.simple.exception.InitializationException;
+import org.w3c.ddr.simple.exception.NameException;
+import org.w3c.ddr.simple.exception.SystemException;
+
+/**
+ * This factory creates a DDR Service instance.
+ *
+ * <br/><br/> <b>NOTE</b>: This class is provided as part of the Java binding
+ * of the API, and is <b>not</b> part of the API definition itself.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/> <a
+ * href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide
+ * Web Consortium">W3C</acronym></a><sup>®</sup> (<a
+ * href="http://www.csail.mit.edu/"><acronym title="Massachusetts
+ * Institute of Technology">MIT</acronym></a>, <a
+ * href="http://www.ercim.org/"><acronym title="European Research
+ * Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+ * href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a
+ * href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a
+ * href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a
+ * href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+ * use</a> rules apply.
+ *
+ */
+public class ServiceFactory {
+
+ /**
+ *
+ * Factory method for creating a new Service instance.
+ *
+ * @param clazz
+ * Class identifier
+ * @param defaultVocabulary
+ * Passed to the Service.initialize method.
+ * @param configuration
+ * Passed to the Service.initialize method.
+ * @return A service instance with which to access a Device Description Repository.
+ * @throws InitializationException
+ * @throws NameException
+ */
+ public static Service newService(String clazz, String defaultVocabulary,
+ Properties configuration) throws InitializationException,
+ NameException {
+
+ Service theService = null;
+
+ if (clazz == null) {
+ throw new SystemException(SystemException.ILLEGAL_ARGUMENT,
+ "Service class cannot be null");
+ }
+
+ if (defaultVocabulary == null) {
+ throw new SystemException(SystemException.ILLEGAL_ARGUMENT,
+ "Default vocabulary cannot be null");
+ }
+
+ try {
+ // Instantiation
+ theService = (Service) Class.forName(clazz).newInstance();
+ } catch (IllegalAccessException e) {
+ throw new InitializationException(InitializationException.INITIALIZATION_ERROR, e);
+ } catch (ClassNotFoundException e) {
+ throw new InitializationException(InitializationException.INITIALIZATION_ERROR, e);
+ } catch (Throwable thr) {
+ throw new SystemException(SystemException.CANNOT_PROCEED, thr);
+ }
+
+ // Initialization
+ theService.initialize(defaultVocabulary, configuration);
+
+ return theService;
+ }
+}
\ No newline at end of file
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/DDRException.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/DDRException.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/DDRException.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/DDRException.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,85 @@
+package org.w3c.ddr.simple.exception;
+
+/**
+ * Represents a DDR Exception.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/>
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
+ * (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
+ * <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
+ * <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+ *
+ */
+public class DDRException extends Exception {
+
+ /**
+ * Implementation specific error codes must be greater than this
+ */
+ public static int IMPLEMENTATION_ERROR = 65536;
+
+ /**
+ * Constructs a DDRException instance with an undefined exception code.
+ */
+ public DDRException() {
+ super();
+ }
+
+ /**
+ * Constructs a DDRException instance with a code and human-readable message.
+ *
+ * @param code This should be a constant from this exception class.
+ * @param message Diagnostic message intended for human reading.
+ */
+ public DDRException(int code, String message) {
+ super(message);
+ this.code = code;
+ }
+
+ /**
+ * Constructs a DDRException instance with a code and Throwable object that
+ * may indicate further details of the cause of the exception.
+ *
+ * @param code This should be a constant from this exception class.
+ * @param thr A Throwable object that may contain further details on the exception.
+ */
+ public DDRException(int code, Throwable thr) {
+ super(thr);
+ this.code = code;
+ }
+
+ /**
+ * This is a Java-specific version management feature to deal with serialisation and deserialisation of class instances.
+ */
+ static final long serialVersionUID = 2618094065573111548L; // Generated by serialver.exe
+
+ /**
+ * Retrieves the exception code, which determines the nature/cause of the exception.
+ *
+ * @return Explanatory code.
+ */
+ public int getCode() {
+ return code;
+ }
+
+ /**
+ * Retrieves a human-readable diagnostic message, intended for error messages.
+ *
+ * @return Human-readable diagnostic message.
+ */
+ @Override
+ public String getMessage() {
+ return super.getMessage();
+ }
+
+ /**
+ * An exception code, which represents the nature/cause of the exception.
+ */
+ protected int code;
+}
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/InitializationException.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/InitializationException.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/InitializationException.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/InitializationException.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,71 @@
+package org.w3c.ddr.simple.exception;
+
+/**
+ * This exception represents a failure of the DDR system.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/> <a
+ * href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide
+ * Web Consortium">W3C</acronym></a><sup>®</sup> (<a
+ * href="http://www.csail.mit.edu/"><acronym title="Massachusetts
+ * Institute of Technology">MIT</acronym></a>, <a
+ * href="http://www.ercim.org/"><acronym title="European Research
+ * Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a
+ * href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a
+ * href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a
+ * href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a
+ * href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+ * use</a> rules apply.
+ */
+public class InitializationException extends DDRException {
+
+ /**
+ * Code for 'General Initialization Error'. This exception code indicates
+ * that there was a problem during initialization.
+ */
+ public static int INITIALIZATION_ERROR = 300;
+
+ /**
+ * Constructs an InitializationException instance with a default exception
+ * code.
+ */
+ public InitializationException() {
+ super();
+ }
+
+ /**
+ * Constructs an InitializationException instance with a code and
+ * human-readable diagnostic message.
+ *
+ * @param code
+ * This should be an implementation-specific code identifying the
+ * cause of the exception.
+ * @param message
+ * Diagnostic message intended for human reading.
+ */
+ public InitializationException(int code, String message) {
+ super(code, message);
+ }
+
+ /**
+ * Constructs an InitializationException instance with a code and Throwable
+ * object that may indicate further details of the cause of the exception.
+ *
+ * @param code
+ * This should be an implementation-specific code identifying the
+ * cause of the exception.
+ * @param thr
+ * A Throwable object that may contain further details on the
+ * exception.
+ */
+ public InitializationException(int code, Throwable thr) {
+ super(code, thr);
+ }
+
+}
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/NameException.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/NameException.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/NameException.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/NameException.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,70 @@
+package org.w3c.ddr.simple.exception;
+
+/**
+ * This exception is thrown when an attempt is made to access a Property or Aspect when the
+ * name or vocabulary IRI is in error.
+ * The exception code, when set, indicates the nature of the error.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/>
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
+ * (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
+ * <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
+ * <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+ */
+public class NameException extends DDRException {
+
+ /**
+ * Code for 'Property not recognized'.
+ * This exception code indicates that a given Property does not exist in the given vocabulary or is not syntactically correct.
+ */
+ public static int PROPERTY_NOT_RECOGNIZED = 100;
+
+ /**
+ * Code for 'Vocabulary not recognized'.
+ * This exception code indicates that the vocabulary of a given Property is not known or is not syntactically correct.
+ */
+ public static int VOCABULARY_NOT_RECOGNIZED = 200;
+
+ /**
+ * Code for 'Aspect not recognized'.
+ * This exception code indicates that the Aspect is not known or is not syntactically correct.
+ * It is assumed in the Simple DDR API that the vocabulary of an Aspect derives
+ * from the vocabulary of the Property to which it is applied.
+ */
+ public static int ASPECT_NOT_RECOGNIZED = 800;
+
+ /**
+ * Constructs a NameException instance with default exception code.
+ */
+ public NameException() {
+ super();
+ }
+
+ /**
+ * Constructs a NameException instance with a code and human-readable message.
+ *
+ * @param code This should be a constant from this exception class.
+ * @param message Diagnostic message intended for human reading.
+ */
+ public NameException(int code, String message) {
+ super(code, message);
+ }
+
+ /**
+ * Constructs a NameException instance with a code and an instance of Throwable,
+ * which may contain additional information pertaining to the cause of the exception.
+ *
+ * @param code This should be a constant from this exception class.
+ * @param thr A Throwable object that may contain further details on the exception.
+ */
+ public NameException(int code, Throwable thr) {
+ super(code, thr);
+ }
+}
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/SystemException.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/SystemException.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/SystemException.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/SystemException.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,67 @@
+package org.w3c.ddr.simple.exception;
+
+/**
+ * This exception represents a failure of the DDR system.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/>
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
+ * (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
+ * <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
+ * <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+ */
+public class SystemException extends java.lang.RuntimeException {
+
+ /**
+ * Code for 'illegal argument'.
+ * This exception code indicates that a method has been passed an illegal or inappropriate argument (for example a null Evidence).
+ */
+ public static int ILLEGAL_ARGUMENT = 400;
+
+ /**
+ * Code for 'Cannot proceed'.
+ * This exception code indicates that the implementation cannot continue with the processing of the current request due to an unexpected failure.
+ */
+ public static int CANNOT_PROCEED = 500;
+
+ /**
+ * Constructs a SystemException instance with a default exception code.
+ */
+ public SystemException() {
+ super();
+ }
+
+ /**
+ * Constructs a SystemException instance with a code and human-readable diagnostic message.
+ *
+ * @param code This should be a constant from this exception class.
+ * @param message Diagnostic message intended for human reading.
+ */
+ public SystemException(int code, String message) {
+ super(message);
+ this.code = code;
+ }
+
+ /**
+ * Constructs a SystemException instance with a code and Throwable object that
+ * may indicate further details of the cause of the exception.
+ *
+ * @param code This should be a constant from this exception class.
+ * @param thr A Throwable object that may contain further details on the exception.
+ */
+ public SystemException(int code, Throwable thr) {
+ super(thr);
+ this.code = code;
+ }
+
+ /**
+ * Represents a machine-understandable code to refine/identify the cause of the exception.
+ */
+ protected int code;
+}
Added: incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/ValueException.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/ValueException.java?rev=1601384&view=auto
==============================================================================
--- incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/ValueException.java (added)
+++ incubator/devicemap/trunk/contrib/w3c/ddr-simple/src/main/java/org/w3c/ddr/simple/exception/ValueException.java Mon Jun 9 13:50:10 2014
@@ -0,0 +1,77 @@
+package org.w3c.ddr.simple.exception;
+
+/**
+ * This exception represents an error with a value associated with a Property and
+ * would most likely be thrown when an error is detected during an attempt to retrieve the
+ * value of a Property.
+ *
+ * @author Jo Rabin (dotMobi)
+ * @author <br/>Jose Manuel Cantera Fonseca (Telefonica I+D)
+ * @author <br/>Rotan Hanrahan (MobileAware)
+ * @author <br/>Ignacio Marin (Fundacion CTIC) <br/>
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
+ * © 2008 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
+ * (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
+ * <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
+ * <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.<br/>
+ * W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+ * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+ * and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+ */
+public class ValueException extends DDRException {
+
+ /**
+ * Code for 'Incompatible type'.
+ * This code indicates that an attempt was made to represent the value in
+ * a type that was incompatible with the semantics of the property.
+ * For example, an attempt to use an enumeration value as an integer.
+ */
+ public static int INCOMPATIBLE_TYPES = 600;
+
+ /**
+ * Code for 'Not known'.
+ * This code indicates that a value for a legitimate property could not be
+ * retrieved from the repository because a value for the property is
+ * not known to the repository.
+ * For a PropertyValue instance, this exception can be anticipated via the exists() method
+ * which would return False to indicate that the value is not known.
+ */
+ public static int NOT_KNOWN = 900;
+
+ /**
+ * Code for 'Multiple values'.
+ * This code indicates that there are more than one possible value for the Property instance.
+ * Such a situation may arise when a value is being obtained from the repository
+ * but multiple values are available in the repository and more than one of these values
+ * are applicable in the identified delivery context.
+ */
+ public static int MULTIPLE_VALUES = 10000;
+
+ /**
+ * Constructs a ValueException instance with a default exception code.
+ */
+ public ValueException() {
+ super();
+ }
+
+ /**
+ * Constructs a ValueException instance with a code and human-readable diagnostic message.
+ *
+ * @param code This should be a constant from this exception class.
+ * @param message Diagnostic message intended for human reading.
+ */
+ public ValueException(int code, String message) {
+ super(code, message);
+ }
+
+ /**
+ * Constructs a ValueException instance with a code and Throwable object that
+ * may indicate further details of the cause of the exception.
+ *
+ * @param code This should be a constant from this exception class.
+ * @param thr A Throwable object that may contain further details on the exception.
+ */
+ public ValueException(int code, Throwable thr) {
+ super(code, thr);
+ }
+}