roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r508048 - in /incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business: ./ hibernate/
Date Thu, 15 Feb 2007 17:54:59 GMT
Author: agilliland
Date: Thu Feb 15 09:54:58 2007
New Revision: 508048

URL: http://svn.apache.org/viewvc?view=rev&rev=508048
Log:
cleanup the shutdown/release process a bit.


Added:
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/AbstractManagerImpl.java
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/Manager.java
Modified:
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PropertiesManager.java
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePropertiesManagerImpl.java

Added: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/AbstractManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/AbstractManagerImpl.java?view=auto&rev=508048
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/AbstractManagerImpl.java
(added)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/AbstractManagerImpl.java
Thu Feb 15 09:54:58 2007
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.planet.business;
+
+
+/**
+ * Provides base implementations for release() and shutdown() so that manager
+ * implemenations can just override them if needed.
+ */
+public abstract class AbstractManagerImpl implements Manager {
+    
+    public void release() {
+        // no-op
+    }
+    
+    
+    public void shutdown() {
+        // no-op
+    }
+    
+}

Added: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/Manager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/Manager.java?view=auto&rev=508048
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/Manager.java
(added)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/Manager.java
Thu Feb 15 09:54:58 2007
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.planet.business;
+
+
+/**
+ * Some things common to all XXXManager interfaces.
+ *
+ * TODO: there should probably be a startup() method.
+ */
+public interface Manager {
+    
+    /**
+     * Release all resources associated with session.
+     */
+    public void release();
+    
+    
+    /**
+     * Cleanup for application shutdown.
+     */
+    public void shutdown();
+    
+}

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java?view=diff&rev=508048&r1=508047&r2=508048
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java
Thu Feb 15 09:54:58 2007
@@ -32,7 +32,7 @@
  * Manages groups and subscriptions, can return aggregation for any group.
  * @author David M Johnson
  */
-public interface PlanetManager extends Serializable {
+public interface PlanetManager extends Manager {
     
     //------------------------------------------------------------------ create
     

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PropertiesManager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PropertiesManager.java?view=diff&rev=508048&r1=508047&r2=508048
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PropertiesManager.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PropertiesManager.java
Thu Feb 15 09:54:58 2007
@@ -26,7 +26,7 @@
 /**
  * Manages global runtime properties.
  */
-public interface PropertiesManager {
+public interface PropertiesManager extends Manager {
     
     /** 
      * Save a single property 
@@ -50,11 +50,5 @@
      * Retrieve a list of all properties 
      */
     public Map getProperties() throws RollerException;
-    
-    
-    /**
-     * Release all resources associated with session.
-     */
-    public void release();
     
 }

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java?view=diff&rev=508048&r1=508047&r2=508048
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java
Thu Feb 15 09:54:58 2007
@@ -124,15 +124,31 @@
     
     
     public void release() {
-                
-        // tell Hibernate to close down
+        // allow managers to do any session cleanup
+        if(this.propertiesManager != null) {
+            this.propertiesManager.release();
+        }
+        
+        if(this.planetManager != null) {
+            this.planetManager.release();
+        }
+        
+        // close down the session
         this.strategy.release();
     }
     
     
     public void shutdown() {
+        // allow managers to do any shutdown needed
+        if(this.propertiesManager != null) {
+            this.propertiesManager.shutdown();
+        }
+        
+        if(this.planetManager != null) {
+            this.planetManager.shutdown();
+        }
         
-        // do our own shutdown first
+        // trigger the final release()
         this.release();
     }
     

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java?view=diff&rev=508048&r1=508047&r2=508048
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java
Thu Feb 15 09:54:58 2007
@@ -44,6 +44,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
+import org.apache.roller.planet.business.AbstractManagerImpl;
 import org.apache.roller.planet.business.PlanetManager;
 import org.apache.roller.planet.config.PlanetRuntimeConfig;
 import org.apache.roller.planet.pojos.PlanetData;
@@ -52,10 +53,12 @@
 import org.apache.roller.planet.pojos.PlanetSubscriptionData;
 import org.apache.roller.planet.util.rome.DiskFeedInfoCache;
 
+
 /**
  * Hibernate implementation of the PlanetManager.
  */
-public class HibernatePlanetManagerImpl implements PlanetManager {
+public class HibernatePlanetManagerImpl extends AbstractManagerImpl
+        implements PlanetManager {
     
     private static Log log = LogFactory.getLog(HibernatePlanetManagerImpl.class);
     

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePropertiesManagerImpl.java?view=diff&rev=508048&r1=508047&r2=508048
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePropertiesManagerImpl.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePropertiesManagerImpl.java
Thu Feb 15 09:54:58 2007
@@ -28,6 +28,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
+import org.apache.roller.planet.business.AbstractManagerImpl;
 import org.apache.roller.planet.business.PropertiesManager;
 import org.apache.roller.planet.config.PlanetRuntimeConfig;
 import org.apache.roller.planet.config.runtime.ConfigDef;
@@ -40,7 +41,8 @@
 /**
  * Hibernate implementation of the PropertiesManager.
  */
-public class HibernatePropertiesManagerImpl implements PropertiesManager {
+public class HibernatePropertiesManagerImpl extends AbstractManagerImpl
+        implements PropertiesManager {
     
     private static Log log = LogFactory.getLog(HibernatePropertiesManagerImpl.class);
     
@@ -203,8 +205,5 @@
         
         return props;
     }
-    
-    
-    public void release() {}
     
 }



Mime
View raw message