Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultService.java @ 380:9798e4d83681
Services are now able to return more than just XML documents.
artifacts/trunk@4188 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 03 Apr 2012 11:15:10 +0000 |
parents | a8d62eb93cd4 |
children |
comparison
equal
deleted
inserted
replaced
379:95ff5a25a339 | 380:9798e4d83681 |
---|---|
5 * Read the file LGPL.txt coming with the software for details | 5 * Read the file LGPL.txt coming with the software for details |
6 * or visit http://www.gnu.org/licenses/ if it does not exist. | 6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
7 */ | 7 */ |
8 | 8 |
9 package de.intevation.artifactdatabase; | 9 package de.intevation.artifactdatabase; |
10 | |
11 import de.intevation.artifacts.common.utils.XMLUtils; | |
12 | 10 |
13 import de.intevation.artifacts.CallMeta; | 11 import de.intevation.artifacts.CallMeta; |
14 import de.intevation.artifacts.Service; | 12 import de.intevation.artifacts.Service; |
15 import de.intevation.artifacts.GlobalContext; | 13 import de.intevation.artifacts.GlobalContext; |
16 import de.intevation.artifacts.ServiceFactory; | 14 import de.intevation.artifacts.ServiceFactory; |
28 public class DefaultService | 26 public class DefaultService |
29 implements Service | 27 implements Service |
30 { | 28 { |
31 private static Logger logger = Logger.getLogger(DefaultService.class); | 29 private static Logger logger = Logger.getLogger(DefaultService.class); |
32 | 30 |
31 public static class Output implements Service.Output { | |
32 | |
33 protected Object data; | |
34 protected String mimeType; | |
35 | |
36 public Output() { | |
37 } | |
38 | |
39 public Output(Object data, String mimeType) { | |
40 this.data = data; | |
41 this.mimeType = mimeType; | |
42 } | |
43 | |
44 @Override | |
45 public Object getData() { | |
46 return data; | |
47 } | |
48 | |
49 @Override | |
50 public String getMIMEType() { | |
51 return mimeType; | |
52 } | |
53 } // class Output | |
54 | |
33 @Override | 55 @Override |
34 public Document process( | 56 public Service.Output process( |
35 Document data, | 57 Document data, |
36 GlobalContext globalContext, | 58 GlobalContext globalContext, |
37 CallMeta callMeta | 59 CallMeta callMeta |
38 ) { | 60 ) { |
39 logger.debug("Service.process"); | 61 logger.debug("Service.process"); |
40 return XMLUtils.newDocument(); | 62 return new Output(new byte[0], "application/octet-stream"); |
41 } | 63 } |
42 | 64 |
43 @Override | 65 @Override |
44 public void setup(ServiceFactory factory, GlobalContext globalContext) { | 66 public void setup(ServiceFactory factory, GlobalContext globalContext) { |
45 logger.debug("Service.setup"); | 67 logger.debug("Service.setup"); |