comparison artifact-database/src/main/java/de/intevation/artifactdatabase/rest/ArtifactResource.java @ 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 41c225c8bd41
children 8b72676698b5
comparison
equal deleted inserted replaced
54:c2fc85e55f9f 55:9a29899b31e5
40 public static final String NO_ACTION_MESSAGE = "no action given"; 40 public static final String NO_ACTION_MESSAGE = "no action given";
41 public static final String NO_SUCH_ACTION_MESSAGE = "no such action"; 41 public static final String NO_SUCH_ACTION_MESSAGE = "no such action";
42 42
43 public static final String NO_ARTIFACT_FOUND = "Artifact not found"; 43 public static final String NO_ARTIFACT_FOUND = "Artifact not found";
44 44
45 public static final String ADVANCE = "advance"; 45 public static final String ADVANCE = "advance";
46 public static final String FEED = "feed"; 46 public static final String FEED = "feed";
47 public static final String DESCRIBE = "describe";
47 48
48 protected Representation innerGet() 49 protected Representation innerGet()
49 throws ResourceException 50 throws ResourceException
50 { 51 {
51 Request request = getRequest(); 52 Request request = getRequest();
60 .getAttributes().get("database"); 61 .getAttributes().get("database");
61 62
62 try { 63 try {
63 return new DomRepresentation( 64 return new DomRepresentation(
64 MediaType.APPLICATION_XML, 65 MediaType.APPLICATION_XML,
65 db.describe(identifier, getCallMeta())); 66 db.describe(identifier, null, getCallMeta()));
66 } 67 }
67 catch (ArtifactDatabaseException adbe) { 68 catch (ArtifactDatabaseException adbe) {
68 logger.warn(adbe.getLocalizedMessage(), adbe); 69 logger.warn(adbe.getLocalizedMessage(), adbe);
69 Response response = getResponse(); 70 Response response = getResponse();
70 response.setStatus( 71 response.setStatus(
85 if (action.equals(FEED)) { 86 if (action.equals(FEED)) {
86 out = db.feed(identifier, source, getCallMeta()); 87 out = db.feed(identifier, source, getCallMeta());
87 } 88 }
88 else if (action.equals(ADVANCE)) { 89 else if (action.equals(ADVANCE)) {
89 out = db.advance(identifier, source, getCallMeta()); 90 out = db.advance(identifier, source, getCallMeta());
91 }
92 else if (action.equals(DESCRIBE)) {
93 out = db.describe(identifier, source, getCallMeta());
90 } 94 }
91 else { 95 else {
92 throw new ArtifactDatabaseException(NO_SUCH_ACTION_MESSAGE); 96 throw new ArtifactDatabaseException(NO_SUCH_ACTION_MESSAGE);
93 } 97 }
94 } 98 }

http://dive4elements.wald.intevation.org