continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r652204 - /continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Date Wed, 30 Apr 2008 00:41:37 GMT
Author: carlos
Date: Tue Apr 29 17:41:37 2008
New Revision: 652204

URL: http://svn.apache.org/viewvc?rev=652204&view=rev
Log:
initialize on demand, not on startup

Modified:
    continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java

Modified: continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=652204&r1=652203&r2=652204&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Tue Apr 29 17:41:37 2008
@@ -19,6 +19,24 @@
  * under the License.
  */
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.jdo.Extent;
+import javax.jdo.FetchPlan;
+import javax.jdo.JDOHelper;
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
@@ -40,27 +58,8 @@
 import org.codehaus.plexus.jdo.PlexusJdoUtils;
 import org.codehaus.plexus.jdo.PlexusObjectNotFoundException;
 import org.codehaus.plexus.jdo.PlexusStoreException;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.codehaus.plexus.util.StringUtils;
 
-import javax.jdo.Extent;
-import javax.jdo.FetchPlan;
-import javax.jdo.JDOHelper;
-import javax.jdo.JDOUserException;
-import javax.jdo.PersistenceManager;
-import javax.jdo.PersistenceManagerFactory;
-import javax.jdo.Query;
-import javax.jdo.Transaction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
@@ -70,7 +69,7 @@
  */
 public class JdoContinuumStore
     extends AbstractContinuumStore
-    implements ContinuumStore, Initializable
+    implements ContinuumStore
 {
     /**
      * @plexus.requirement role-hint="continuum"
@@ -81,7 +80,7 @@
     //
     // ----------------------------------------------------------------------
 
-    private PersistenceManagerFactory continuumPmf;
+    private PersistenceManagerFactory continuumPersistenceManagerFactory;
 
     // ----------------------------------------------------------------------
     // Fetch Groups
@@ -104,16 +103,6 @@
     private static final String BUILD_TEMPLATE_BUILD_DEFINITIONS = "build-template-build-definitions";
 
     // ----------------------------------------------------------------------
-    // Component Lifecycle
-    // ----------------------------------------------------------------------
-
-    public void initialize()
-        throws InitializationException
-    {
-        continuumPmf = continuumJdoFactory.getPersistenceManagerFactory();
-    }
-
-    // ----------------------------------------------------------------------
     // ContinuumStore Implementation
     // ----------------------------------------------------------------------
 
@@ -2016,7 +2005,7 @@
 
     private PersistenceManager getPersistenceManager()
     {
-        return getPersistenceManager( continuumPmf );
+        return getPersistenceManager( getContinuumPersistenceManagerFactory() );
     }
 
     private PersistenceManager getPersistenceManager( PersistenceManagerFactory pmf )
@@ -2031,7 +2020,7 @@
 
     public void closeStore()
     {
-        closePersistenceManagerFactory( continuumPmf, 1 );
+        closePersistenceManagerFactory( getContinuumPersistenceManagerFactory(), 1 );
     }
 
     public Collection<ProjectGroup> getAllProjectGroupsWithTheLot()
@@ -2105,4 +2094,13 @@
             }
         }
     }
+
+    private PersistenceManagerFactory getContinuumPersistenceManagerFactory()
+    {
+        if ( continuumPersistenceManagerFactory == null )
+        {
+            continuumPersistenceManagerFactory = continuumJdoFactory.getPersistenceManagerFactory();
+        }
+        return continuumPersistenceManagerFactory;
+    }
 }



Mime
View raw message