# HG changeset patch # User Sascha L. Teichmann # Date 1367155619 -7200 # Node ID 35b2d86c3fb58d825cfbf850f6fc581ed0b190d8 # Parent 59ff03ff48f1c8f0659e7f551e2efb54df336135 River artifacts: Renamed FLYSService to D4EService. diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/CrossSectionKMService.java --- 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); diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/D4EService.java --- /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 : diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/DischargeInfoService.java --- 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 Raimund Renkert */ -public class DischargeInfoService extends FLYSService { +public class DischargeInfoService extends D4EService { /** The logger used in this service. */ private static Logger logger = Logger.getLogger(DischargeInfoService.class); diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/DistanceInfoService.java --- 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 Ingo Weinzierl */ -public class DistanceInfoService extends FLYSService { +public class DistanceInfoService extends D4EService { /** The logger used in this service. */ private static Logger logger = Logger.getLogger(DistanceInfoService.class); diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/FLYSService.java --- 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 : diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/FileUploadService.java --- 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 Raimund Renkert */ -public class FileUploadService extends FLYSService { +public class FileUploadService extends D4EService { /** The logger used in this service.*/ private static Logger logger = Logger.getLogger(FileUploadService.class); diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/FixingsOverviewService.java --- 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); diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/GaugeInfoService.java --- 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 Ingo Weinzierl */ -public class GaugeInfoService extends FLYSService { +public class GaugeInfoService extends D4EService { interface Filter { boolean apply(Gauge gauge); diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/MainValuesService.java --- 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 Ingo Weinzierl */ -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); diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/MetaDataService.java --- 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); diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/ModuleService.java --- 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"; diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/RiverInfoService.java --- 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 Björn Ricks */ -public class RiverInfoService extends FLYSService { +public class RiverInfoService extends D4EService { private static final Logger logger = Logger.getLogger( RiverInfoService.class); diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/RiverService.java --- 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 Ingo Weinzierl */ -public class RiverService extends FLYSService { +public class RiverService extends D4EService { /** The logger used in this service.*/ private static Logger logger = Logger.getLogger(RiverService.class); diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/SedimentLoadInfoService.java --- 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); diff -r 59ff03ff48f1 -r 35b2d86c3fb5 artifacts/src/main/java/org/dive4elements/river/artifacts/services/ThemeListingService.java --- 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 Raimund Renkert */ -public class ThemeListingService extends FLYSService { +public class ThemeListingService extends D4EService { /** The logger used in this service.*/ private static Logger logger = Logger.getLogger(ThemeListingService.class);