continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r682432 - in /continuum/branches/continuum-refactoring-evenisse: continuum-api/src/main/java/org/apache/continuum/dao/ continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-commons/src/main/java/org/apache/maven/continuum/...
Date Mon, 04 Aug 2008 15:59:16 GMT
Author: evenisse
Date: Mon Aug  4 08:59:15 2008
New Revision: 682432

URL: http://svn.apache.org/viewvc?rev=682432&view=rev
Log:
Split ContinuumStore into few dao classes : extract SystemConfigurationDao and NotifierDao

Added:
    continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/NotifierDao.java
  (with props)
    continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/SystemConfigurationDao.java
  (with props)
    continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/NotifierDaoImpl.java
  (with props)
    continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/SystemConfigurationDaoImpl.java
  (with props)
Modified:
    continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    continuum/branches/continuum-refactoring-evenisse/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
    continuum/branches/continuum-refactoring-evenisse/continuum-commons/src/main/resources/META-INF/spring-context.xml
    continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
    continuum/branches/continuum-refactoring-evenisse/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
    continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/AbstractDao.java
    continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
    continuum/branches/continuum-refactoring-evenisse/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java

Added: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/NotifierDao.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/NotifierDao.java?rev=682432&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/NotifierDao.java
(added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/NotifierDao.java
Mon Aug  4 08:59:15 2008
@@ -0,0 +1,36 @@
+package org.apache.continuum.dao;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  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.
+ */
+
+import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public interface NotifierDao
+{
+    void removeNotifier( ProjectNotifier notifier )
+        throws ContinuumStoreException;
+
+    ProjectNotifier storeNotifier( ProjectNotifier notifier )
+        throws ContinuumStoreException;
+}

Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/NotifierDao.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/NotifierDao.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/SystemConfigurationDao.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/SystemConfigurationDao.java?rev=682432&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/SystemConfigurationDao.java
(added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/SystemConfigurationDao.java
Mon Aug  4 08:59:15 2008
@@ -0,0 +1,38 @@
+package org.apache.continuum.dao;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  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.
+ */
+
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public interface SystemConfigurationDao
+{
+    org.apache.maven.continuum.model.system.SystemConfiguration addSystemConfiguration(
+        org.apache.maven.continuum.model.system.SystemConfiguration systemConf );
+
+    void updateSystemConfiguration( org.apache.maven.continuum.model.system.SystemConfiguration
systemConf )
+        throws ContinuumStoreException;
+
+    org.apache.maven.continuum.model.system.SystemConfiguration getSystemConfiguration()
+        throws ContinuumStoreException;
+}

Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/SystemConfigurationDao.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/SystemConfigurationDao.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?rev=682432&r1=682431&r2=682432&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
Mon Aug  4 08:59:15 2008
@@ -23,9 +23,6 @@
 import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
-import org.apache.maven.continuum.model.project.ProjectNotifier;
-import org.apache.maven.continuum.model.system.Installation;
-import org.apache.maven.continuum.model.system.SystemConfiguration;
 
 import java.util.List;
 import java.util.Map;
@@ -39,12 +36,6 @@
 {
     String ROLE = ContinuumStore.class.getName();
 
-    void removeNotifier( ProjectNotifier notifier )
-        throws ContinuumStoreException;
-
-    ProjectNotifier storeNotifier( ProjectNotifier notifier )
-        throws ContinuumStoreException;
-
     Map getDefaultBuildDefinitions();
 
     /**
@@ -154,14 +145,6 @@
     void updateBuildResult( BuildResult build )
         throws ContinuumStoreException;
 
-    SystemConfiguration addSystemConfiguration( SystemConfiguration systemConf );
-
-    void updateSystemConfiguration( SystemConfiguration systemConf )
-        throws ContinuumStoreException;
-
-    SystemConfiguration getSystemConfiguration()
-        throws ContinuumStoreException;
-
     void closeStore();
 
     void eraseDatabase();

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java?rev=682432&r1=682431&r2=682432&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-commons/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
Mon Aug  4 08:59:15 2008
@@ -23,9 +23,9 @@
 import org.apache.continuum.configuration.ContinuumConfigurationException;
 import org.apache.continuum.configuration.GeneralConfiguration;
 import org.apache.continuum.dao.ScheduleDao;
+import org.apache.continuum.dao.SystemConfigurationDao;
 import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.model.system.SystemConfiguration;
-import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.StringUtils;
@@ -52,14 +52,14 @@
     private File applicationHome;
 
     /**
-     * @plexus.requirement role-hint="jdo"
+     * @plexus.requirement
      */
-    private ContinuumStore store;
+    private ScheduleDao scheduleDao;
 
     /**
      * @plexus.requirement
      */
-    private ScheduleDao scheduleDao;
+    private SystemConfigurationDao systemConfigurationDao;
 
     /**
      * @plexus.requirement
@@ -86,24 +86,24 @@
         loadData();
     }
 
-    public void setStore( ContinuumStore store )
+    public ScheduleDao getScheduleDao()
     {
-        this.store = store;
+        return scheduleDao;
     }
 
-    public ContinuumStore getStore()
+    public void setScheduleDao( ScheduleDao scheduleDao )
     {
-        return store;
+        this.scheduleDao = scheduleDao;
     }
 
-    public ScheduleDao getScheduleDao()
+    public SystemConfigurationDao getSystemConfigurationDao()
     {
-        return scheduleDao;
+        return systemConfigurationDao;
     }
 
-    public void setScheduleDao( ScheduleDao scheduleDao )
+    public void setSystemConfigurationDao( SystemConfigurationDao systemConfigurationDao
)
     {
-        this.scheduleDao = scheduleDao;
+        this.systemConfigurationDao = systemConfigurationDao;
     }
 
     public ContinuumConfiguration getConfiguration()
@@ -335,13 +335,13 @@
 
         try
         {
-            systemConf = getStore().getSystemConfiguration();
+            systemConf = getSystemConfigurationDao().getSystemConfiguration();
 
             if ( systemConf == null )
             {
                 systemConf = new SystemConfiguration();
 
-                systemConf = getStore().addSystemConfiguration( systemConf );
+                systemConf = getSystemConfigurationDao().addSystemConfiguration( systemConf
);
             }
 
             loaded = true;
@@ -366,7 +366,7 @@
         configuration.save();
         try
         {
-            getStore().updateSystemConfiguration( systemConf );
+            getSystemConfigurationDao().updateSystemConfiguration( systemConf );
         }
         catch ( ContinuumStoreException e )
         {

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-commons/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-commons/src/main/resources/META-INF/spring-context.xml?rev=682432&r1=682431&r2=682432&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-commons/src/main/resources/META-INF/spring-context.xml
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-commons/src/main/resources/META-INF/spring-context.xml
Mon Aug  4 08:59:15 2008
@@ -26,8 +26,8 @@
   <bean id="configurationService" class="org.apache.maven.continuum.configuration.DefaultConfigurationService"
         init-method="initialize">
     <property name="applicationHome" value="target"/>
-    <property name="store" ref="continuumStore#jdo"/>
     <property name="scheduleDao" ref="scheduleDao"/>
+    <property name="systemConfigurationDao" ref="systemConfigurationDao"/>
     <property name="configuration" ref="continuumConfiguration"/>
   </bean>
   <bean id="workingDirectoryService" class="org.apache.maven.continuum.utils.DefaultWorkingDirectoryService">

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=682432&r1=682431&r2=682432&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Mon Aug  4 08:59:15 2008
@@ -22,6 +22,7 @@
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.continuum.configuration.ContinuumConfigurationException;
 import org.apache.continuum.dao.BuildDefinitionDao;
+import org.apache.continuum.dao.NotifierDao;
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.continuum.dao.ScheduleDao;
@@ -135,6 +136,11 @@
     /**
      * @plexus.requirement
      */
+    private NotifierDao notifierDao;
+
+    /**
+     * @plexus.requirement
+     */
     private ProjectDao projectDao;
 
     /**
@@ -3053,7 +3059,7 @@
     {
         try
         {
-            store.removeNotifier( notifier );
+            notifierDao.removeNotifier( notifier );
         }
         catch ( ContinuumStoreException ex )
         {
@@ -3066,7 +3072,7 @@
     {
         try
         {
-            return store.storeNotifier( notifier );
+            return notifierDao.storeNotifier( notifier );
         }
         catch ( ContinuumStoreException ex )
         {

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java?rev=682432&r1=682431&r2=682432&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
Mon Aug  4 08:59:15 2008
@@ -20,13 +20,13 @@
  */
 
 import org.apache.continuum.dao.ProjectGroupDao;
+import org.apache.continuum.dao.SystemConfigurationDao;
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionServiceException;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.model.system.SystemConfiguration;
 import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
-import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.jpox.SchemaTool;
@@ -47,14 +47,14 @@
     // ----------------------------------------------------------------------
 
     /**
-     * @plexus.requirement role-hint="jdo"
+     * @plexus.requirement
      */
-    private ContinuumStore store;
+    private ProjectGroupDao projectGroupDao;
 
     /**
      * @plexus.requirement
      */
-    private ProjectGroupDao projectGroupDao;
+    private SystemConfigurationDao systemConfigurationDao;
 
     /**
      * @plexus.requirement
@@ -87,13 +87,13 @@
         try
         {
             // System Configuration
-            SystemConfiguration systemConf = store.getSystemConfiguration();
+            SystemConfiguration systemConf = systemConfigurationDao.getSystemConfiguration();
 
             if ( systemConf == null )
             {
                 systemConf = new SystemConfiguration();
 
-                systemConf = store.addSystemConfiguration( systemConf );
+                systemConf = systemConfigurationDao.addSystemConfiguration( systemConf );
             }
 
             createDefaultProjectGroup();

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java?rev=682432&r1=682431&r2=682432&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
Mon Aug  4 08:59:15 2008
@@ -23,6 +23,7 @@
 import org.apache.continuum.dao.ProfileDao;
 import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.continuum.dao.ScheduleDao;
+import org.apache.continuum.dao.SystemConfigurationDao;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.ContinuumDatabase;
 import org.apache.maven.continuum.model.project.Project;
@@ -90,6 +91,11 @@
      */
     private ScheduleDao scheduleDao;
 
+    /**
+     * @plexus.requirement
+     */
+    private SystemConfigurationDao systemConfigurationDao;
+
     protected static final String BUILDS_XML = "builds.xml";
 
     /**
@@ -103,7 +109,7 @@
         ContinuumDatabase database = new ContinuumDatabase();
         try
         {
-            database.setSystemConfiguration( store.getSystemConfiguration() );
+            database.setSystemConfiguration( systemConfigurationDao.getSystemConfiguration()
);
         }
         catch ( ContinuumStoreException e )
         {

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/AbstractDao.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/AbstractDao.java?rev=682432&r1=682431&r2=682432&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/AbstractDao.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/AbstractDao.java
Mon Aug  4 08:59:15 2008
@@ -136,6 +136,16 @@
         }
     }
 
+    protected List getAllObjectsDetached( Class clazz )
+    {
+        return getAllObjectsDetached( clazz, null );
+    }
+
+    private List getAllObjectsDetached( Class clazz, String fetchGroup )
+    {
+        return getAllObjectsDetached( clazz, null, fetchGroup );
+    }
+
     protected List getAllObjectsDetached( Class clazz, String ordering, String fetchGroup
)
     {
         return getAllObjectsDetached( getPersistenceManager(), clazz, ordering, fetchGroup
);
@@ -151,6 +161,10 @@
         PlexusJdoUtils.rollbackIfActive( tx );
     }
 
+    protected void attachAndDelete( Object object )
+    {
+        PlexusJdoUtils.attachAndDelete( getPersistenceManager(), object );
+    }
 
     protected PersistenceManager getPersistenceManager()
     {

Added: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/NotifierDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/NotifierDaoImpl.java?rev=682432&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/NotifierDaoImpl.java
(added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/NotifierDaoImpl.java
Mon Aug  4 08:59:15 2008
@@ -0,0 +1,47 @@
+package org.apache.continuum.dao;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  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.
+ */
+
+import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @plexus.component role="org.apache.continuum.dao.NotifierDao"
+ */
+public class NotifierDaoImpl
+    extends AbstractDao
+    implements NotifierDao
+{
+    public void removeNotifier( ProjectNotifier notifier )
+        throws ContinuumStoreException
+    {
+        attachAndDelete( notifier );
+    }
+
+    public ProjectNotifier storeNotifier( ProjectNotifier notifier )
+        throws ContinuumStoreException
+    {
+        updateObject( notifier );
+
+        return notifier;
+    }
+}

Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/NotifierDaoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/NotifierDaoImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/SystemConfigurationDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/SystemConfigurationDaoImpl.java?rev=682432&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/SystemConfigurationDaoImpl.java
(added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/SystemConfigurationDaoImpl.java
Mon Aug  4 08:59:15 2008
@@ -0,0 +1,66 @@
+package org.apache.continuum.dao;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  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.
+ */
+
+import org.apache.maven.continuum.model.system.SystemConfiguration;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @plexus.component role="org.apache.continuum.dao.SystemConfigurationDao"
+ */
+public class SystemConfigurationDaoImpl
+    extends AbstractDao
+    implements SystemConfigurationDao
+{
+    public SystemConfiguration addSystemConfiguration( SystemConfiguration systemConf )
+    {
+        return (SystemConfiguration) addObject( systemConf );
+    }
+
+    public void updateSystemConfiguration( SystemConfiguration systemConf )
+        throws ContinuumStoreException
+    {
+        updateObject( systemConf );
+    }
+
+    public SystemConfiguration getSystemConfiguration()
+        throws ContinuumStoreException
+    {
+        List systemConfs = getAllObjectsDetached( SystemConfiguration.class );
+
+        if ( systemConfs == null || systemConfs.isEmpty() )
+        {
+            return null;
+        }
+        else if ( systemConfs.size() > 1 )
+        {
+            throw new ContinuumStoreException(
+                "Database is corrupted. There are more than one systemConfiguration object."
);
+        }
+        else
+        {
+            return (SystemConfiguration) systemConfs.get( 0 );
+        }
+    }
+}

Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/SystemConfigurationDaoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/SystemConfigurationDaoImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=682432&r1=682431&r2=682432&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Mon Aug  4 08:59:15 2008
@@ -574,20 +574,6 @@
         removeObject( buildResult );
     }
 
-    public void removeNotifier( ProjectNotifier notifier )
-        throws ContinuumStoreException
-    {
-        attachAndDelete( notifier );
-    }
-
-    public ProjectNotifier storeNotifier( ProjectNotifier notifier )
-        throws ContinuumStoreException
-    {
-        updateObject( notifier );
-
-        return notifier;
-    }
-
     // ------------------------------------------------------
     //  BuildDefinition
     // ------------------------------------------------------    
@@ -857,11 +843,6 @@
         return PlexusJdoUtils.makePersistent( pm, object, detach );
     }
 
-    private void attachAndDelete( Object object )
-    {
-        PlexusJdoUtils.attachAndDelete( getPersistenceManager(), object );
-    }
-
     public List<BuildResult> getAllBuildsForAProjectByDate( int projectId )
     {
         PersistenceManager pm = getPersistenceManager();
@@ -1207,11 +1188,6 @@
         }
     }
 
-    private List getAllObjectsDetached( Class clazz )
-    {
-        return getAllObjectsDetached( clazz, null );
-    }
-
     private List getAllObjectsDetached( Class clazz, String fetchGroup )
     {
         return getAllObjectsDetached( clazz, null, fetchGroup );
@@ -1223,37 +1199,6 @@
         return (Project) getObjectById( Project.class, projectId, PROJECT_BUILD_DETAILS_FETCH_GROUP
);
     }
 
-    public SystemConfiguration addSystemConfiguration( SystemConfiguration systemConf )
-    {
-        return (SystemConfiguration) addObject( systemConf );
-    }
-
-    public void updateSystemConfiguration( SystemConfiguration systemConf )
-        throws ContinuumStoreException
-    {
-        updateObject( systemConf );
-    }
-
-    public SystemConfiguration getSystemConfiguration()
-        throws ContinuumStoreException
-    {
-        List systemConfs = getAllObjectsDetached( SystemConfiguration.class );
-
-        if ( systemConfs == null || systemConfs.isEmpty() )
-        {
-            return null;
-        }
-        else if ( systemConfs.size() > 1 )
-        {
-            throw new ContinuumStoreException(
-                "Database is corrupted. There are more than one systemConfiguration object."
);
-        }
-        else
-        {
-            return (SystemConfiguration) systemConfs.get( 0 );
-        }
-    }
-
     public void closeStore()
     {
         closePersistenceManagerFactory( getContinuumPersistenceManagerFactory(), 1 );

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java?rev=682432&r1=682431&r2=682432&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
Mon Aug  4 08:59:15 2008
@@ -24,6 +24,7 @@
 import org.apache.continuum.dao.ProjectDao;
 import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.continuum.dao.ScheduleDao;
+import org.apache.continuum.dao.SystemConfigurationDao;
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildResult;
@@ -67,6 +68,8 @@
 
     protected ScheduleDao scheduleDao;
 
+    protected SystemConfigurationDao systemConfigurationDao;
+
     protected ProjectGroup defaultProjectGroup;
 
     protected ProjectGroup testProjectGroup2;
@@ -101,30 +104,6 @@
 
     protected ScmResult testCheckoutResult1;
 
-    private ProjectNotifier testGroupNotifier1;
-
-    private ProjectNotifier testGroupNotifier2;
-
-    private ProjectNotifier testGroupNotifier3;
-
-    private ProjectNotifier testNotifier1;
-
-    private ProjectNotifier testNotifier2;
-
-    private ProjectNotifier testNotifier3;
-
-    private ProjectDeveloper testDeveloper1;
-
-    private ProjectDeveloper testDeveloper2;
-
-    private ProjectDeveloper testDeveloper3;
-
-    private ProjectDependency testDependency1;
-
-    private ProjectDependency testDependency2;
-
-    private ProjectDependency testDependency3;
-
     private SystemConfiguration systemConfiguration;
 
     protected void setUp()
@@ -143,6 +122,8 @@
         projectDao = (ProjectDao) lookup( ProjectDao.class.getName() );
 
         scheduleDao = (ScheduleDao) lookup( ScheduleDao.class.getName() );
+
+        systemConfigurationDao = (SystemConfigurationDao) lookup( SystemConfigurationDao.class.getName()
);
     }
 
     protected void createBuildDatabase()
@@ -178,21 +159,21 @@
         testInstallationMaven20a3 = createTestInstallation( "Maven 2.0 alpha 3", InstallationService.MAVEN2_TYPE,
                                                             "M2_HOME", "/usr/local/maven-2.0-alpha-3"
);
 
-        testGroupNotifier1 = createTestNotifier( 1, true, false, true, "type1" );
-        testGroupNotifier2 = createTestNotifier( 2, false, true, false, "type2" );
-        testGroupNotifier3 = createTestNotifier( 3, true, false, false, "type3" );
-
-        testNotifier1 = createTestNotifier( 11, true, true, false, "type11" );
-        testNotifier2 = createTestNotifier( 12, false, false, true, "type12" );
-        testNotifier3 = createTestNotifier( 13, false, true, false, "type13" );
-
-        testDeveloper1 = createTestDeveloper( 1, "email1", "name1", "scmId1" );
-        testDeveloper2 = createTestDeveloper( 2, "email2", "name2", "scmId2" );
-        testDeveloper3 = createTestDeveloper( 3, "email3", "name3", "scmId3" );
-
-        testDependency1 = createTestDependency( "groupId1", "artifactId1", "version1" );
-        testDependency2 = createTestDependency( "groupId2", "artifactId2", "version2" );
-        testDependency3 = createTestDependency( "groupId3", "artifactId3", "version3" );
+        ProjectNotifier testGroupNotifier1 = createTestNotifier( 1, true, false, true, "type1"
);
+        ProjectNotifier testGroupNotifier2 = createTestNotifier( 2, false, true, false, "type2"
);
+        ProjectNotifier testGroupNotifier3 = createTestNotifier( 3, true, false, false, "type3"
);
+
+        ProjectNotifier testNotifier1 = createTestNotifier( 11, true, true, false, "type11"
);
+        ProjectNotifier testNotifier2 = createTestNotifier( 12, false, false, true, "type12"
);
+        ProjectNotifier testNotifier3 = createTestNotifier( 13, false, true, false, "type13"
);
+
+        ProjectDeveloper testDeveloper1 = createTestDeveloper( 1, "email1", "name1", "scmId1"
);
+        ProjectDeveloper testDeveloper2 = createTestDeveloper( 2, "email2", "name2", "scmId2"
);
+        ProjectDeveloper testDeveloper3 = createTestDeveloper( 3, "email3", "name3", "scmId3"
);
+
+        ProjectDependency testDependency1 = createTestDependency( "groupId1", "artifactId1",
"version1" );
+        ProjectDependency testDependency2 = createTestDependency( "groupId2", "artifactId2",
"version2" );
+        ProjectDependency testDependency3 = createTestDependency( "groupId3", "artifactId3",
"version3" );
 
         // TODO: simplify by deep copying the relationships in createTest... ?
         long baseTime = System.currentTimeMillis();
@@ -475,7 +456,7 @@
 
         if ( addToStore )
         {
-            systemConfiguration = store.addSystemConfiguration( systemConfiguration );
+            systemConfiguration = systemConfigurationDao.addSystemConfiguration( systemConfiguration
);
         }
     }
 
@@ -503,9 +484,9 @@
         assertScheduleEquals( testSchedule3, scheduleDao.getSchedule( testSchedule3.getId()
) );
 
         Iterator<Installation> iterator = installationDao.getAllInstallations().iterator();
-        assertInstallationEquals( testInstallationJava13, (Installation) iterator.next()
);
-        assertInstallationEquals( testInstallationJava14, (Installation) iterator.next()
);
-        assertInstallationEquals( testInstallationMaven20a3, (Installation) iterator.next()
);
+        assertInstallationEquals( testInstallationJava13, iterator.next() );
+        assertInstallationEquals( testInstallationJava14, iterator.next() );
+        assertInstallationEquals( testInstallationMaven20a3, iterator.next() );
 
 /*
         // TODO!!! -- definitely need to test the changeset stuff since it uses modello.refid
@@ -659,7 +640,7 @@
         testProjectGroup2.setId( group.getId() );
 */
 
-        assertSystemConfiguration( systemConfiguration, store.getSystemConfiguration() );
+        assertSystemConfiguration( systemConfiguration, systemConfigurationDao.getSystemConfiguration()
);
     }
 
     private void assertSystemConfiguration( SystemConfiguration expected, SystemConfiguration
actual )
@@ -682,7 +663,7 @@
         assertEquals( 0, profileDao.getAllProfilesByName().size() );
         assertEquals( 0, projectGroupDao.getAllProjectGroups().size() );
         assertEquals( 0, projectDao.getAllProjectsByName().size() );
-        assertNull( store.getSystemConfiguration() );
+        assertNull( systemConfigurationDao.getSystemConfiguration() );
     }
 
     protected static BuildDefinition createTestBuildDefinition( BuildDefinition buildDefinition
)
@@ -1067,7 +1048,7 @@
     {
         for ( int i = 0; i < actualDevelopers.size(); i++ )
         {
-            assertDeveloperEquals( (ProjectDeveloper) expectedDevelopers.get( i ), (ProjectDeveloper)
actualDevelopers
+            assertDeveloperEquals( expectedDevelopers.get( i ), actualDevelopers
                 .get( i ) );
         }
     }
@@ -1086,8 +1067,7 @@
     {
         for ( int i = 0; i < actualDependencies.size(); i++ )
         {
-            assertDependencyEquals( (ProjectDependency) expectedDependencies.get( i ),
-                                    (ProjectDependency) actualDependencies.get( i ) );
+            assertDependencyEquals( expectedDependencies.get( i ), actualDependencies.get(
i ) );
         }
     }
 

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?rev=682432&r1=682431&r2=682432&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Mon Aug  4 08:59:15 2008
@@ -19,14 +19,9 @@
  * under the License.
  */
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
 import net.sf.dozer.util.mapping.DozerBeanMapperSingletonWrapper;
 import net.sf.dozer.util.mapping.MapperIF;
-
+import org.apache.continuum.dao.SystemConfigurationDao;
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
@@ -34,7 +29,6 @@
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
-import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.xmlrpc.project.AddingResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
@@ -55,6 +49,11 @@
 import org.codehaus.plexus.redback.role.RoleManagerException;
 import org.codehaus.plexus.util.StringUtils;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @version $Id$
@@ -71,9 +70,9 @@
     private Continuum continuum;
 
     /**
-     * @plexus.requirement role-hint="jdo"
+     * @plexus.requirement
      */
-    private ContinuumStore store;
+    private SystemConfigurationDao systemConfigurationDao;
 
     /**
      * @plexus.requirement role-hint="default"
@@ -223,7 +222,8 @@
     protected String getProjectGroupName( int projectGroupId )
         throws ContinuumException
     {
-        org.apache.maven.continuum.model.project.ProjectGroup projectGroup = continuum.getProjectGroup(
projectGroupId );
+        org.apache.maven.continuum.model.project.ProjectGroup projectGroup =
+            continuum.getProjectGroup( projectGroupId );
         return projectGroup == null ? null : projectGroup.getName();
     }
 
@@ -765,7 +765,7 @@
     }
 
     // ----------------------------------------------------------------------
-    // SystemConfiguration
+    // SystemConfigurationDao
     // ----------------------------------------------------------------------
 
     public SystemConfiguration getSystemConfiguration()
@@ -774,12 +774,13 @@
         checkManageConfigurationAuthorization();
         try
         {
-            org.apache.maven.continuum.model.system.SystemConfiguration sysConf = store.getSystemConfiguration();
+            org.apache.maven.continuum.model.system.SystemConfiguration sysConf =
+                systemConfigurationDao.getSystemConfiguration();
             return populateSystemConfiguration( sysConf );
         }
         catch ( ContinuumStoreException e )
         {
-            throw new ContinuumException( "Can't get SystemConfiguration.", e );
+            throw new ContinuumException( "Can't get SystemConfigurationDao.", e );
         }
     }
 
@@ -805,7 +806,7 @@
     // ----------------------------------------------------------------------
 
     private List<BuildProjectTask> populateBuildProjectTaskList(
-                                               List<org.apache.maven.continuum.buildqueue.BuildProjectTask>
buildProjectTasks )
+        List<org.apache.maven.continuum.buildqueue.BuildProjectTask> buildProjectTasks
)
     {
         List<BuildProjectTask> responses = new ArrayList<BuildProjectTask>();
         for ( org.apache.maven.continuum.buildqueue.BuildProjectTask buildProjectTask : buildProjectTasks
)
@@ -815,7 +816,7 @@
         }
         return responses;
     }
-    
+
     private ProjectSummary populateProjectSummary( org.apache.maven.continuum.model.project.Project
project )
     {
         return (ProjectSummary) mapper.map( project, ProjectSummary.class );



Mime
View raw message