* @version $Revision:$
*/
-public class CollectionObjectClient implements CollectionSpaceClient {
+public class CollectionObjectClient extends CollectionSpaceClient {
/**
private CollectionObjectClient() {
ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
RegisterBuiltin.register(factory);
- collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class, HOST + URI);
+ collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class, getURL());
}
/**
package org.collectionspace.hello.client;\r
\r
-public interface CollectionSpaceClient {\r
- static final String HOST = "http://localhost:8080";\r
- static final String URI = "/helloworld/cspace-nuxeo";\r
+import java.util.*;\r
+\r
+public abstract class CollectionSpaceClient {\r
+ static final String URL_PROPERTY = "org.collectionspace.url";\r
+ /*\r
+ static final String URL_PROPERTY_SCHEME = "org.collectionspace.url.schme";\r
+ static final String URL_PROPERTY_HOST = "org.collectionspace.url.host";\r
+ static final String URL_PROPERTY_PORT = "org.collectionspace.url.port";\r
+ static final String URL_PROPERTY_CONTEXT = "org.collectionspace.url.context";\r
+ */\r
+ \r
+ private static final String SCHEME = "http";\r
+ private static final String HOST = "localhost";\r
+ private static final String PORT = "8080";\r
+ private static final String URI = "/helloworld/cspace-nuxeo";\r
+ private static final String URL = SCHEME + "://" +\r
+ HOST + ":" +\r
+ PORT +\r
+ URI;\r
+ private String collectionSpaceURL = null;\r
+ \r
+ \r
+ String getURL() {\r
+ String result = collectionSpaceURL;\r
+ \r
+ if (collectionSpaceURL == null) {\r
+ result = collectionSpaceURL = System.getProperty(URL_PROPERTY, URL);\r
+ }\r
+ \r
+ return result;\r
+ }\r
}\r
* @version $Revision:$
*/
-public class DomainIdentifierClient implements CollectionSpaceClient {
+public class DomainIdentifierClient extends CollectionSpaceClient {
/**
private DomainIdentifierClient() {
ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
RegisterBuiltin.register(factory);
- identifierProxy = ProxyFactory.create(DomainIdentifierProxy.class, HOST + URI);
+ identifierProxy = ProxyFactory.create(DomainIdentifierProxy.class, getURL());
}
/**
* @version $Revision:$
*/
-public class IdentifierClient implements CollectionSpaceClient {
+public class IdentifierClient {
/**
*
private IdentifierClient() {
ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
RegisterBuiltin.register(factory);
- identifierProxy = ProxyFactory.create(IdentifierProxy.class, HOST + URI);
+ identifierProxy = ProxyFactory.create(IdentifierProxy.class, "http://localhost:8080/helloworld/cspace");
}
/**
* @version $Revision:$
*/
-public class PersonNuxeoClient implements CollectionSpaceClient {
+public class PersonNuxeoClient extends CollectionSpaceClient {
/**
*
private PersonNuxeoClient() {
ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
RegisterBuiltin.register(factory);
- personProxy = ProxyFactory.create(PersonNuxeoProxy.class, HOST + URI);
+ personProxy = ProxyFactory.create(PersonNuxeoProxy.class, getURL());
}
/**