Mercurial > dive4elements > river
changeset 5868:35b2d86c3fb5
River artifacts: Renamed FLYSService to D4EService.
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/CrossSectionKMService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/CrossSectionKMService.java Sun Apr 28 15:26:59 2013 +0200 @@ -57,7 +57,7 @@ * result in [4,5,7,8,9]). */ public class CrossSectionKMService -extends FLYSService +extends D4EService { private static Logger logger = Logger.getLogger(CrossSectionKMService.class);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/D4EService.java Sun Apr 28 15:26:59 2013 +0200 @@ -0,0 +1,67 @@ +/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ + +package org.dive4elements.river.artifacts.services; + +import org.w3c.dom.Document; + +import org.apache.log4j.Logger; + +import org.hibernate.Session; + +import org.dive4elements.artifacts.CallMeta; +import org.dive4elements.artifacts.GlobalContext; + +import org.dive4elements.artifactdatabase.XMLService; + +import org.dive4elements.river.backend.SessionHolder; + + +public abstract class D4EService extends XMLService { + + private static final Logger logger = Logger.getLogger(D4EService.class); + + + @Override + public Document processXML( + Document data, + GlobalContext globalContext, + CallMeta callMeta + ) { + init(); + + try { + return doProcess(data, globalContext, callMeta); + } + finally { + shutdown(); + } + } + + + protected abstract Document doProcess( + Document data, + GlobalContext globalContext, + CallMeta callMeta); + + + protected void init() { + logger.debug("init"); + SessionHolder.acquire(); + } + + + protected void shutdown() { + logger.debug("shutdown"); + Session session = SessionHolder.HOLDER.get(); + session.close(); + + SessionHolder.release(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/DischargeInfoService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/DischargeInfoService.java Sun Apr 28 15:26:59 2013 +0200 @@ -33,7 +33,7 @@ * * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> */ -public class DischargeInfoService extends FLYSService { +public class DischargeInfoService extends D4EService { /** The logger used in this service. */ private static Logger logger = Logger.getLogger(DischargeInfoService.class);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/DistanceInfoService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/DistanceInfoService.java Sun Apr 28 15:26:59 2013 +0200 @@ -31,7 +31,7 @@ * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ -public class DistanceInfoService extends FLYSService { +public class DistanceInfoService extends D4EService { /** The logger used in this service. */ private static Logger logger = Logger.getLogger(DistanceInfoService.class);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/FLYSService.java Sun Apr 28 15:23:01 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde - * Software engineering by Intevation GmbH - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ - -package org.dive4elements.river.artifacts.services; - -import org.w3c.dom.Document; - -import org.apache.log4j.Logger; - -import org.hibernate.Session; - -import org.dive4elements.artifacts.CallMeta; -import org.dive4elements.artifacts.GlobalContext; - -import org.dive4elements.artifactdatabase.XMLService; - -import org.dive4elements.river.backend.SessionHolder; - - -public abstract class FLYSService extends XMLService { - - private static final Logger logger = Logger.getLogger(FLYSService.class); - - - @Override - public Document processXML( - Document data, - GlobalContext globalContext, - CallMeta callMeta - ) { - init(); - - try { - return doProcess(data, globalContext, callMeta); - } - finally { - shutdown(); - } - } - - - protected abstract Document doProcess( - Document data, - GlobalContext globalContext, - CallMeta callMeta); - - - protected void init() { - logger.debug("init"); - SessionHolder.acquire(); - } - - - protected void shutdown() { - logger.debug("shutdown"); - Session session = SessionHolder.HOLDER.get(); - session.close(); - - SessionHolder.release(); - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/FileUploadService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/FileUploadService.java Sun Apr 28 15:26:59 2013 +0200 @@ -29,7 +29,7 @@ * Service that receives XML-packed Shapefile bundles from the client. * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> */ -public class FileUploadService extends FLYSService { +public class FileUploadService extends D4EService { /** The logger used in this service.*/ private static Logger logger = Logger.getLogger(FileUploadService.class);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/FixingsOverviewService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/FixingsOverviewService.java Sun Apr 28 15:26:59 2013 +0200 @@ -29,7 +29,7 @@ import org.w3c.dom.NodeList; public class FixingsOverviewService -extends FLYSService +extends D4EService { private static Logger log = Logger.getLogger(FixingsOverviewService.class);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/GaugeInfoService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/GaugeInfoService.java Sun Apr 28 15:26:59 2013 +0200 @@ -33,7 +33,7 @@ /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ -public class GaugeInfoService extends FLYSService { +public class GaugeInfoService extends D4EService { interface Filter { boolean apply(Gauge gauge);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/MainValuesService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/MainValuesService.java Sun Apr 28 15:26:59 2013 +0200 @@ -38,7 +38,7 @@ * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ -public class MainValuesService extends FLYSService { +public class MainValuesService extends D4EService { /** The logger that is used by this service.*/ private static Logger logger = Logger.getLogger(MainValuesService.class);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/MetaDataService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/MetaDataService.java Sun Apr 28 15:26:59 2013 +0200 @@ -44,7 +44,7 @@ * filters to the templating, as "key:value;key2:value2" */ public class MetaDataService -extends FLYSService +extends D4EService { private static Logger log = Logger.getLogger(MetaDataService.class);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/ModuleService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/ModuleService.java Sun Apr 28 15:26:59 2013 +0200 @@ -24,7 +24,7 @@ import org.dive4elements.river.artifacts.context.RiverContext; import org.dive4elements.river.artifacts.resources.Resources; -public class ModuleService extends FLYSService { +public class ModuleService extends D4EService { private static final String MODULE = "module";
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/RiverInfoService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/RiverInfoService.java Sun Apr 28 15:26:59 2013 +0200 @@ -26,7 +26,7 @@ /** * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> */ -public class RiverInfoService extends FLYSService { +public class RiverInfoService extends D4EService { private static final Logger logger = Logger.getLogger( RiverInfoService.class);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/RiverService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/RiverService.java Sun Apr 28 15:26:59 2013 +0200 @@ -32,7 +32,7 @@ * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ -public class RiverService extends FLYSService { +public class RiverService extends D4EService { /** The logger used in this service.*/ private static Logger logger = Logger.getLogger(RiverService.class);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/SedimentLoadInfoService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/SedimentLoadInfoService.java Sun Apr 28 15:26:59 2013 +0200 @@ -23,7 +23,7 @@ public class SedimentLoadInfoService -extends FLYSService +extends D4EService { /** The logger used in this service. */ private static Logger logger = Logger.getLogger(SedimentLoadInfoService.class);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/ThemeListingService.java Sun Apr 28 15:23:01 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/ThemeListingService.java Sun Apr 28 15:26:59 2013 +0200 @@ -32,7 +32,7 @@ * * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> */ -public class ThemeListingService extends FLYSService { +public class ThemeListingService extends D4EService { /** The logger used in this service.*/ private static Logger logger = Logger.getLogger(ThemeListingService.class);