changeset 315:94c176fdcb89

Removed the SessionHolder and adapted imports. flys-artifacts/trunk@1701 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 15 Apr 2011 09:52:37 +0000
parents aeeb9054b7cf
children 4aa078e28cfd
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/SessionCallContextListener.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugesFactory.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/RiverFactory.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/SessionHolder.java
diffstat 7 files changed, 18 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Apr 14 13:45:50 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Apr 15 09:52:37 2011 +0000
@@ -1,3 +1,15 @@
+2011-04-15  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/SessionHolder.java:
+	  Moved this class to flys-backend.
+
+	* src/main/java/de/intevation/flys/artifacts/model/RiverFactory.java,
+	  src/main/java/de/intevation/flys/artifacts/model/GaugesFactory.java,
+	  src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java,
+	  src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java,
+	  src/main/java/de/intevation/flys/artifacts/context/SessionCallContextListener.java:
+	  Adapted imports of the SessionHolder.
+
 2011-04-14	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* trunk/src/main/java/de/intevation/flys/artifacts/services/DistanceInfoService.java,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/SessionCallContextListener.java	Thu Apr 14 13:45:50 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/context/SessionCallContextListener.java	Fri Apr 15 09:52:37 2011 +0000
@@ -7,11 +7,11 @@
 
 import org.hibernate.Session;
 
+import de.intevation.flys.backend.SessionHolder;
+
 import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallContext.Listener;
 
-import de.intevation.flys.artifacts.model.SessionHolder;
-
 
 /**
  * This CallContextListener is used to initialize a ThreadLocal variable in
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java	Thu Apr 14 13:45:50 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java	Fri Apr 15 09:52:37 2011 +0000
@@ -2,6 +2,7 @@
 
 import java.util.List;
 
+import de.intevation.flys.backend.SessionHolder;
 import de.intevation.flys.model.Annotation;
 import de.intevation.flys.model.Range;
 import de.intevation.flys.model.River;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java	Thu Apr 14 13:45:50 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java	Fri Apr 15 09:52:37 2011 +0000
@@ -12,6 +12,7 @@
 
 import org.apache.log4j.Logger;
 
+import de.intevation.flys.backend.SessionHolder;
 import de.intevation.flys.model.Gauge;
 import de.intevation.flys.model.DischargeTable;
 import de.intevation.flys.model.DischargeTableValue;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugesFactory.java	Thu Apr 14 13:45:50 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugesFactory.java	Fri Apr 15 09:52:37 2011 +0000
@@ -3,6 +3,7 @@
 import java.util.List;
 import java.util.ArrayList;
 
+import de.intevation.flys.backend.SessionHolder;
 import de.intevation.flys.model.River;
 import de.intevation.flys.model.Gauge;
 import de.intevation.flys.model.Range;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/RiverFactory.java	Thu Apr 14 13:45:50 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/RiverFactory.java	Fri Apr 15 09:52:37 2011 +0000
@@ -1,11 +1,10 @@
 package de.intevation.flys.artifacts.model;
 
-
 import java.util.List;
 
+import de.intevation.flys.backend.SessionHolder;
 import de.intevation.flys.model.River;
 
-
 import org.hibernate.Query;
 import org.hibernate.Session;
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/SessionHolder.java	Thu Apr 14 13:45:50 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-package de.intevation.flys.artifacts.model;
-
-import org.apache.log4j.Logger;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-
-import de.intevation.flys.backend.SessionFactoryProvider;
-
-public class SessionHolder
-{
-    private static Logger logger =
-        Logger.getLogger(SessionHolder.class);
-    
-    public static final ThreadLocal<Session> HOLDER =
-        new ThreadLocal<Session>() {
-            protected Session initialValue() {
-                return create();
-            }
-        };
-
-    private SessionHolder() {
-    }
-
-    public synchronized static Session create() {
-        logger.debug("create");
-        SessionFactory sessionFactory =
-            SessionFactoryProvider.getSessionFactory();
-        return sessionFactory.openSession();
-    }
-
-    public static Session acquire() {
-        logger.debug("acquire");
-        Session session = create();
-        HOLDER.set(session);
-        return session;
-    }
-
-    public static void release() {
-        logger.debug("release");
-        HOLDER.remove();
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org