Mercurial > dive4elements > framework
changeset 299:a8d62eb93cd4
Services now take GlobalContext on setup and process.
artifacts/trunk@2386 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 21 Jul 2011 14:39:45 +0000 |
parents | a5e6d1923c95 |
children | 0035e2511342 |
files | ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultService.java artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultServiceFactory.java artifacts/src/main/java/de/intevation/artifacts/Service.java artifacts/src/main/java/de/intevation/artifacts/ServiceFactory.java |
diffstat | 5 files changed, 28 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Jul 21 08:32:34 2011 +0000 +++ b/ChangeLog Thu Jul 21 14:39:45 2011 +0000 @@ -1,3 +1,13 @@ +2011-07-21 Sascha L. Teichmann <teichmann@intevation.de> + + * artifacts/src/main/java/de/intevation/artifacts/Service.java, + artifacts/src/main/java/de/intevation/artifacts/ServiceFactory.java: + Services now take GlobalContext on setup and process. + + * artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultService.java, + artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultServiceFactory.java: + Adusted and added Override annotations. + 2011-07-21 Sascha L. Teichmann <teichmann@intevation.de> * artifacts/src/main/java/de/intevation/artifacts/ArtifactNamespaceContext.java:
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultService.java Thu Jul 21 08:32:34 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultService.java Thu Jul 21 14:39:45 2011 +0000 @@ -12,6 +12,7 @@ import de.intevation.artifacts.CallMeta; import de.intevation.artifacts.Service; +import de.intevation.artifacts.GlobalContext; import de.intevation.artifacts.ServiceFactory; import org.apache.log4j.Logger; @@ -29,21 +30,19 @@ { private static Logger logger = Logger.getLogger(DefaultService.class); + @Override public Document process( - Document data, - Object globalContext, - CallMeta callMeta + Document data, + GlobalContext globalContext, + CallMeta callMeta ) { - if (logger.isDebugEnabled()) { - logger.debug("Service.process"); - } + logger.debug("Service.process"); return XMLUtils.newDocument(); } - public void setup(ServiceFactory factory, Object globalContext) { - if (logger.isDebugEnabled()) { - logger.debug("Service.setup"); - } + @Override + public void setup(ServiceFactory factory, GlobalContext globalContext) { + logger.debug("Service.setup"); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultServiceFactory.java Thu Jul 21 08:32:34 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultServiceFactory.java Thu Jul 21 14:39:45 2011 +0000 @@ -11,6 +11,7 @@ import de.intevation.artifacts.common.utils.Config; import de.intevation.artifacts.Service; +import de.intevation.artifacts.GlobalContext; import de.intevation.artifacts.ServiceFactory; import org.apache.log4j.Logger; @@ -80,15 +81,18 @@ public DefaultServiceFactory() { } + @Override public String getName() { return name; } + @Override public String getDescription() { return description; } - public Service createService(Object globalContext) { + @Override + public Service createService(GlobalContext globalContext) { try { Service service = (Service)serviceClass.newInstance(); @@ -109,6 +113,7 @@ return null; } + @Override public void setup(Document config, Node factoryNode) { description = Config.getStringXPath(
--- a/artifacts/src/main/java/de/intevation/artifacts/Service.java Thu Jul 21 08:32:34 2011 +0000 +++ b/artifacts/src/main/java/de/intevation/artifacts/Service.java Thu Jul 21 14:39:45 2011 +0000 @@ -27,7 +27,7 @@ * @param callMeta The call meta contex, e.g. preferred languages. * @return The result output XML document. */ - Document process(Document data, Object globalContext, CallMeta callMeta); + Document process(Document data, GlobalContext globalContext, CallMeta callMeta); /** * Setup the concrete processing service. This is done at startup time @@ -35,6 +35,6 @@ * @param factory The service factory which created this service. * @param globalContext The global context of the artifact database. */ - void setup(ServiceFactory factory, Object globalContext); + void setup(ServiceFactory factory, GlobalContext globalContext); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/de/intevation/artifacts/ServiceFactory.java Thu Jul 21 08:32:34 2011 +0000 +++ b/artifacts/src/main/java/de/intevation/artifacts/ServiceFactory.java Thu Jul 21 14:39:45 2011 +0000 @@ -39,7 +39,7 @@ * @param globalContext The global context of the artifact database. * @return The created service. */ - Service createService(Object globalContext); + Service createService(GlobalContext globalContext); /** * Configures this factory. This is called before