# HG changeset patch # User Ingo Weinzierl # Date 1300897676 0 # Node ID 09a84c6e263a92b63aa9803a4c81980e522eddd1 # Parent 7917c21fad01d8252d8d9457ba9c887fab671895 Enhanced the HttpClient with a method sto trigger a collection specific action. http-client/trunk@1552 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 7917c21fad01 -r 09a84c6e263a ChangeLog --- a/ChangeLog Tue Mar 08 18:23:45 2011 +0000 +++ b/ChangeLog Wed Mar 23 16:27:56 2011 +0000 @@ -1,3 +1,9 @@ +2011-03-23 Ingo Weinzierl + + * src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java, + src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java: + Added a method to trigger a collection specific action. + 2011-03-08 Ingo Weinzierl * src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java, diff -r 7917c21fad01 -r 09a84c6e263a src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java --- a/src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java Tue Mar 08 18:23:45 2011 +0000 +++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java Wed Mar 23 16:27:56 2011 +0000 @@ -69,6 +69,12 @@ ResponseHandler handler) throws ConnectionException; + Object doCollectionAction( + Document actionDocument, + String uuid, + ResponseHandler handler) + throws ConnectionException; + /******************************* * Users API diff -r 7917c21fad01 -r 09a84c6e263a src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java --- a/src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java Tue Mar 08 18:23:45 2011 +0000 +++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java Wed Mar 23 16:27:56 2011 +0000 @@ -51,6 +51,9 @@ /** The URL path of the resource to create new artifact collections.*/ public static final String PATH_CREATE_COLLECTION = "/create-collection"; + /** The URL path of the resource to work with an artifact collections.*/ + public static final String PATH_ACTION_COLLECTION = "/collection"; + private String serverUrl; @@ -110,33 +113,6 @@ } - /** - * This method triggers the artifact servers resource to create a new - * artifact collection. - * - * @param create The CREATE document for the collection. - * @param ownerId The uuid of the creator. - * @param handler The handler that is used to create the result object. - * - * @return a result object created by handler. - */ - public Object createCollection( - Document create, - String ownerId, - ResponseHandler handler) - throws ConnectionException - { - String url = serverUrl + PATH_CREATE_COLLECTION + "/" + ownerId; - - try { - return handler.handle(doPost(url, create)); - } - catch (IOException ioe) { - throw new ConnectionException(ioe.getMessage(), ioe); - } - } - - @Override public Object describe( Artifact artifact, @@ -262,6 +238,64 @@ } + //============================== + // Collection API + //============================== + + /** + * This method triggers the artifact servers resource to create a new + * artifact collection. + * + * @param create The CREATE document for the collection. + * @param ownerId The uuid of the creator. + * @param handler The handler that is used to create the result object. + * + * @return a result object created by handler. + */ + public Object createCollection( + Document create, + String ownerId, + ResponseHandler handler) + throws ConnectionException + { + String url = serverUrl + PATH_CREATE_COLLECTION + "/" + ownerId; + + try { + return handler.handle(doPost(url, create)); + } + catch (IOException ioe) { + throw new ConnectionException(ioe.getMessage(), ioe); + } + } + + + /** + * This method might be used to trigger a collection specific action. The + * action that is executed depends on the document actionDoc. + * + * @param actionDoc The document that describes the action to be executed. + * @param uuid The uuid of the collection. + * @param handler The handler that is used to create the result object. + * + * @return a result object created by handler. + */ + public Object doCollectionAction( + Document actionDoc, + String uuid, + ResponseHandler handler) + throws ConnectionException + { + String url = serverUrl + PATH_ACTION_COLLECTION + "/" + uuid; + + try { + return handler.handle(doPost(url, actionDoc)); + } + catch (IOException ioe) { + throw new ConnectionException(ioe.getMessage(), ioe); + } + } + + /******************************* * Service API *******************************/