Mercurial > dive4elements > framework
changeset 55:9a29899b31e5
describe() in REST interface is also handled as POST to pass
optional parameters.
artifacts/trunk@283 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 04 Nov 2009 14:38:37 +0000 |
parents | c2fc85e55f9f |
children | f027204baf5d |
files | ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifact.java artifact-database/src/main/java/de/intevation/artifactdatabase/rest/ArtifactResource.java artifacts/src/main/java/de/intevation/artifacts/Artifact.java artifacts/src/main/java/de/intevation/artifacts/ArtifactDatabase.java |
diffstat | 6 files changed, 34 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Oct 21 11:06:23 2009 +0000 +++ b/ChangeLog Wed Nov 04 14:38:37 2009 +0000 @@ -1,8 +1,26 @@ +2009-11-04 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * artifacts/src/main/java/de/intevation/artifacts/Artifact.java: describe() now may + given an input XML document (which can be null to indicate that no input is given). + + * artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifact.java: + Adjusted to implemented the Artifact interface. + + * artifacts/src/main/java/de/intevation/artifacts/ArtifactDatabase.java: Pass through + the optional XML input document to describe(). + + * artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java: + Implements the adjusted ArtifactDatabase interface. + + * artifact-database/src/main/java/de/intevation/artifactdatabase/rest/ArtifactResource.java: + Now its also possible to send describe() as a POST request. The request body is handled as + XML. + 2009-10-21 Tim Englich <tim.englich@intevation.de> - * src/main/java/de/intevation/artifactdatabase/Config.java (replaceConfigDir): - Applied patch from slt to set the Configuration Folder into the AbsoluteFileName issue59 - + * src/main/java/de/intevation/artifactdatabase/Config.java (replaceConfigDir): + Applied patch from slt to set the Configuration Folder into the AbsoluteFileName issue59 + 2009-10-07 Sascha L. Teichmann <sascha.teichmann@intevation.de> RELEASE 0.1
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java Wed Oct 21 11:06:23 2009 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java Wed Nov 04 14:38:37 2009 +0000 @@ -278,14 +278,14 @@ persistentArtifact, CallContext.NOTHING, callMeta); try { - return artifact.describe(cc); + return artifact.describe(null, cc); } finally { cc.postCall(); } } - public Document describe(String identifier, CallMeta callMeta) + public Document describe(String identifier, Document data, CallMeta callMeta) throws ArtifactDatabaseException { // TODO: Handle background tasks @@ -299,7 +299,7 @@ artifact, CallContext.TOUCH, callMeta); try { - return artifact.getArtifact().describe(cc); + return artifact.getArtifact().describe(data, cc); } finally { cc.postCall();
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifact.java Wed Oct 21 11:06:23 2009 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifact.java Wed Nov 04 14:38:37 2009 +0000 @@ -40,7 +40,7 @@ return hash; } - public Document describe(CallContext context) { + public Document describe(Document data, CallContext context) { if (logger.isDebugEnabled()) { logger.debug("DefaultArtifact.describe: " + identifier); }
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/ArtifactResource.java Wed Oct 21 11:06:23 2009 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/rest/ArtifactResource.java Wed Nov 04 14:38:37 2009 +0000 @@ -42,8 +42,9 @@ public static final String NO_ARTIFACT_FOUND = "Artifact not found"; - public static final String ADVANCE = "advance"; - public static final String FEED = "feed"; + public static final String ADVANCE = "advance"; + public static final String FEED = "feed"; + public static final String DESCRIBE = "describe"; protected Representation innerGet() throws ResourceException @@ -62,7 +63,7 @@ try { return new DomRepresentation( MediaType.APPLICATION_XML, - db.describe(identifier, getCallMeta())); + db.describe(identifier, null, getCallMeta())); } catch (ArtifactDatabaseException adbe) { logger.warn(adbe.getLocalizedMessage(), adbe); @@ -88,6 +89,9 @@ else if (action.equals(ADVANCE)) { out = db.advance(identifier, source, getCallMeta()); } + else if (action.equals(DESCRIBE)) { + out = db.describe(identifier, source, getCallMeta()); + } else { throw new ArtifactDatabaseException(NO_SUCH_ACTION_MESSAGE); }
--- a/artifacts/src/main/java/de/intevation/artifacts/Artifact.java Wed Oct 21 11:06:23 2009 +0000 +++ b/artifacts/src/main/java/de/intevation/artifacts/Artifact.java Wed Nov 04 14:38:37 2009 +0000 @@ -56,7 +56,7 @@ * @param context The global context of the runtime system. * @return An XML representation of the current state of the artifact. */ - Document describe(CallContext context); + Document describe(Document data, CallContext context); /** * Change the internal state of the artifact.
--- a/artifacts/src/main/java/de/intevation/artifacts/ArtifactDatabase.java Wed Oct 21 11:06:23 2009 +0000 +++ b/artifacts/src/main/java/de/intevation/artifacts/ArtifactDatabase.java Wed Nov 04 14:38:37 2009 +0000 @@ -27,7 +27,7 @@ Document createArtifactWithFactory(String factory, CallMeta callMeta) throws ArtifactDatabaseException; - Document describe(String artifact, CallMeta callMeta) + Document describe(String artifact, Document data, CallMeta callMeta) throws ArtifactDatabaseException; Document advance(String artifact, Document target, CallMeta callMeta)