- From: Jo Rabin <jrabin@mtld.mobi>
- Date: Tue, 26 Feb 2008 18:15:43 -0000
- To: <public-ddwg@w3.org>
Thanks Rotan
In the course of responding to Jose's comment I noticed that the naming
of the parameters was inconsistent in the SimpleService interface and
have renamed them consistently.
So if you wish to review and comment please refer to
http://www.w3.org/2005/MWI/DDWG/drafts/api/simple/java/org/w3c/ddr/simpl
e/
Jo
Copied as text below
import java.util.Map;
import java.util.Properties;
import org.w3c.ddr.simple.exception.NameException;
import org.w3c.ddr.simple.exception.SystemException;
public interface SimpleService {
/**
* Called by {@link SimpleServiceFactory} to initialize the API
following construction
*
* @param defaultVocabularyIRI the IRI of the default vocabulary
namespace
* @param props Implementation dependent properties
* @throws SystemException
*/
public void initialize(String defaultVocabularyIRI, Properties
props)
throws SystemException;
/**
*
* @return A string indicating the revision level of the API
*/
public String getAPIVersion();
/**
*
* @return A String indicating the revision level of the data
*/
public String getDataVersion();
/**
* List all the PropertyRefs the API knows about
* @return
* @throws SystemException
*/
public SimplePropertyRef[] listSimplePropertyRefs() throws
SystemException;
public SimplePropertyValue getSimplePropertyValue(SimpleEvidence
evidence,
SimplePropertyRef simplePropertyRef) throws
NameException,
SystemException;
public SimplePropertyValue getSimplePropertyValue(SimpleEvidence
evidence,
String localPropertyName) throws NameException,
SystemException;
public SimplePropertyValue getSimplePropertyValue(SimpleEvidence
evidence,
String localAspectName, String
localPropertyName) throws NameException,
SystemException;
public SimplePropertyValue getSimplePropertyValue
(SimpleEvidence evidence,
SimplePropertyName simplePropertyName) throws
NameException,
SystemException;
public SimplePropertyValues
getSimplePropertyValues(SimpleEvidence evidence)
throws SystemException;
public SimplePropertyValues
getSimplePropertyValues(SimpleEvidence evidence,
SimplePropertyRef[] simplePropertyRefs) throws
NameException,
SystemException;
public SimplePropertyValues
getSimplePropertyValues(SimpleEvidence evidence,
String localAspectName) throws NameException,
SystemException;
public SimplePropertyValues
getSimplePropertyValues(SimpleEvidence evidence,
String aspectIRI, String localAspectName) throws
NameException,
SystemException;
public SimplePropertyRef newSimplePropertyRef(String
localPropertyName)
throws NameException, SystemException;
public SimplePropertyRef newSimplePropertyRef(String
localAspectName,
String localPropertyName) throws NameException,
SystemException;
public SimplePropertyRef newSimplePropertyRef(String
vocabularyIRI,
String localAspectName, String
localPropertyName)
throws NameException, SystemException;
public SimplePropertyRef newSimplePropertyRef(String
localAspectName,
SimplePropertyName simplePropertyName)
throws NameException, SystemException;
/**
* Create a SimpleEvidence using the Map consisting of HTTP
Header Names and Values
* @param map
* @return
*/
public SimpleEvidence newHTTPEvidence(Map map);
}
---
Jo Rabin
mTLD (http://dotmobi.mobi)
mTLD Top Level Domain Limited is a private limited company incorporated
and registered in the Republic of Ireland with registered number 398040
and registered office at Arthur Cox Building, Earlsfort Terrace, Dublin
2.
> -----Original Message-----
> From: public-ddwg-request@w3.org [mailto:public-ddwg-request@w3.org]
On
> Behalf Of Rotan Hanrahan
> Sent: 26 February 2008 16:27
> To: public-ddwg@w3.org
> Subject: RE: Preview of full latest Java Interface
>
>
> Thanks Jo. For convenience, the text of all the code minus, the
> exceptions, as it looks at this moment in time is pasted below.
>
> ---Rotan
>
>
>
>
>
>
> package org.w3c.ddr.simple;
>
> /**
> * An interface representing evidence that is to be supplied to
> getSimplePropertyValue
> * or getSimplePropertyValues methods of {@link SimpleService}
> *
> * @author jo
> *
> */
>
> public interface SimpleEvidence {
> /**
> * Add a key / value pair
> * @param key The key
> * @param value The value
> */
> public void put(String key, String value);
>
> /**
> * True if a key exists
> * @param key
> * @return
> */
> public Boolean exists(String key);
>
> /**
> * Get the value corresponding to the key
> * @param key
> * @return
> */
> public String getValue(String key);
> }
>
>
>
> package org.w3c.ddr.simple;
>
> public interface SimplePropertyName {
> /**
> * The name of the property
> *
> * @return
> */
> public String getPropertyName();
>
> /**
> * The namespace of the property
> *
> * @return
> *
> */
> //TODO Worry about whether an IRI class is needed
>
> public String getNamespace();
>
> /**
> * Factory to create a SimplePropertyRef with the specified
> aspect referring to this property
> *
> * @param aspect
> * @return
> */
> public SimplePropertyRef newSimplePropertyRef (String aspect);
> }
>
>
>
> package org.w3c.ddr.simple;
>
> /**
> * Represents a property / aspect combination
> *
> * @author jo
> *
> *
> */
> public interface SimplePropertyRef {
>
> public static final String NULL_ASPECT = "__NULL";
>
> /**
> * The name of the property
> *
> * @return
> */
> public String getPropertyName();
>
> /**
> * The name of the aspect
> *
> * @return
> */
> public String getAspectName();
>
> /**
> * The namespace of the property and aspect
> *
> * @return
> *
> */
> //TODO Worry about whether an IRI class is needed
> public String getNamespace();
>
> /**
> * Factory to create a SimplePropertyName referring to the
> Property encapsulated
> * by this SimplePropertyRef
> *
> * @return
> */
> public SimplePropertyName newSimplePropertyName ();
> }
>
>
>
> package org.w3c.ddr.simple;
>
> import org.w3c.ddr.simple.exception.ValueException;
>
> /**
> * Represents the value of a property
> *
> * @author jmcf
> *
> */
> public interface SimplePropertyValue {
>
> /**
> *
> * Returns the value as double in the default units of the
> property
> *
> * If the value cannot be represented as a double an exception
> will be
> * thrown
> *
> *
> */
> public double getDouble() throws ValueException;
>
> /**
> *
> * Returns the value as a long in the default units of the
> property
> *
> * An exception will be thrown if the value cannot be
> represented as a long
> *
> * @return
> * @throws ValueException
> */
> public long getLong() throws ValueException;
>
> /**
> *
> * Returns the value of the property as a String
> *
> * This method will return
> *
> * @return
> */
> public String getString() throws ValueException;
>
> /**
> * Returns the actual value as a boolean
> *
> * If the value cannot be represented as a boolean an exception
> will be
> * thrown
> *
> * @return
> * @throws SimpleException
> */
> public boolean getBoolean() throws ValueException;
>
> /**
> *
> * Returns the value as an integer in the default units of the
> property
> *
> * An exception will be thrown if the value cannot be
> represented as an
> * Integer
> *
> * @return
> * @throws SimpleException
> */
> public int getInteger() throws ValueException;
>
> /**
> *
> * Returns the value as an enumeration
> *
> * If the value cannot be represented as an enumeration an
> exception will be
> * thrown
> *
> *
> * @return
> * @throws SimpleException
> */
> public String[] getEnumeration() throws ValueException;
>
> /**
> *
> * Returns the value in the specified unit as a float
> *
> * If the value cannot be represented as a float an exception
> will be thrown
> *
> *
> *
> */
> public float getFloat() throws ValueException;
>
> /**
> * @return
> */
> public SimplePropertyRef getPropertyRef();
>
> /**
> * @return
> */
> public boolean exists();
> }
>
>
>
> package org.w3c.ddr.simple;
>
> import org.w3c.ddr.simple.exception.NameException;
> import org.w3c.ddr.simple.exception.SystemException;
>
> public interface SimplePropertyValues {
>
> public SimplePropertyValue[] getAll() throws SystemException;
>
> public SimplePropertyValue getValue(SimplePropertyRef prop)
> throws SystemException, NameException;
> }
>
>
>
> package org.w3c.ddr.simple;
>
> import java.util.Map;
> import java.util.Properties;
>
> import org.w3c.ddr.simple.exception.NameException;
> import org.w3c.ddr.simple.exception.SystemException;
>
> public interface SimpleService {
> /**
> * Called by {@link SimpleServiceFactory} to initialize the API
> following construction
> *
> * @param defaultVocabularyIRI the IRI of the default vocabulary
> namespace
> * @param props Implementation dependent properties
> * @throws SystemException
> */
> public void initialize(String defaultVocabularyIRI, Properties
> props)
> throws SystemException;
>
> /**
> *
> * @return A string indicating the revision level of the API
> */
> public String getAPIVersion();
>
> /**
> *
> * @return A String indicating the revision level of the data
> */
> public String getDataVersion();
>
> /**
> * List all the PropertyRefs the API knows about
> * @return
> * @throws SystemException
> */
> public SimplePropertyRef[] listSimplePropertyRefs() throws
> SystemException;
>
>
>
> public SimplePropertyValue getSimplePropertyValue(SimpleEvidence
> evidence,
> SimplePropertyRef propertyRef) throws
> NameException,
> SystemException;
>
> public SimplePropertyValue getSimplePropertyValue(SimpleEvidence
> evidence,
> String propertyName) throws NameException,
> SystemException;
>
> public SimplePropertyValue getSimplePropertyValue(SimpleEvidence
> evidence,
> String aspect, String propertyName) throws
> NameException,
> SystemException;
>
> public SimplePropertyValue getSimplePropertyValue
> (SimpleEvidence evidence,
> SimplePropertyName simplePropertyName) throws
> NameException,
> SystemException;
>
>
> public SimplePropertyValues
> getSimplePropertyValues(SimpleEvidence evidence)
> throws SystemException;
>
> public SimplePropertyValues
> getSimplePropertyValues(SimpleEvidence evidence,
> SimplePropertyRef[] properties) throws
> NameException,
> SystemException;
>
> public SimplePropertyValues
> getSimplePropertyValues(SimpleEvidence evidence,
> String aspectName) throws NameException,
> SystemException;
>
> public SimplePropertyValues
> getSimplePropertyValues(SimpleEvidence evidence,
> String aspectIRI, String aspectName) throws
> NameException,
> SystemException;
>
>
> public SimplePropertyRef newSimplePropertyRef(String
> localPropertyName)
> throws NameException, SystemException;
>
> public SimplePropertyRef newSimplePropertyRef(String
> localAspectName,
> String localPropertyName) throws NameException,
> SystemException;
>
> public SimplePropertyRef newSimplePropertyRef(String
> vocabularyIRI,
> String localAspectName, String
> localPropertyName)
> throws NameException, SystemException;
>
> public SimplePropertyRef newSimplePropertyRef(String
> localAspectName,
> SimplePropertyName simplePropertyName)
> throws NameException, SystemException;
>
> /**
> * Create a SimpleEvidence using the Map consisting of HTTP
> Header Names and Values
> * @param map
> * @return
> */
> public SimpleEvidence newHTTPEvidence(Map map);
>
> }
>
>
>
>
> package org.w3c.ddr.simple;
>
> import java.util.Properties;
>
> import org.w3c.ddr.simple.exception.NameException;
> import org.w3c.ddr.simple.exception.SystemException;
>
> public class SimpleServiceFactory {
> public static SimpleService newSimpleService(String clazz,
> String defaultVocabulary, Properties
> configuration)
> throws SystemException, NameException {
> SimpleService theService = null;
> try {
> // Instantiation
> theService = (SimpleService)
> Class.forName(clazz).newInstance();
>
> // Initialization
> theService.initialize(defaultVocabulary,
> configuration);
> } catch (Throwable thr) {
> // TODO: Capture the exceptions properly
> throw new
> SystemException(SystemException.INITIALIZATION, thr);
> }
>
> return theService;
> }
>
> public static SimpleService newSimpleService(String
> defaultVocabulary,
> Properties configuration) throws
> SystemException, NameException {
>
> return null;
> }
> }
>
>
>
Received on Tuesday, 26 February 2008 18:16:23 UTC