You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ev...@apache.org on 2008/08/04 14:21:59 UTC
svn commit: r682358 [1/2] - 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/cont...
Author: evenisse
Date: Mon Aug 4 05:21:59 2008
New Revision: 682358
URL: http://svn.apache.org/viewvc?rev=682358&view=rev
Log:
Split ContinuumStore into few dao classes : extract ScheduleDao, ProfileDao and InstallationDao
Added:
continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java (with props)
continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ProfileDao.java (with props)
continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ScheduleDao.java (with props)
continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java (with props)
continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ProfileDaoImpl.java (with props)
continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ScheduleDaoImpl.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/build/settings/DefaultSchedulesActivator.java
continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractBuildDefinitionContinuumAction.java
continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/installation/DefaultInstallationService.java
continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/profile/DefaultProfileService.java
continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
continuum/branches/continuum-refactoring-evenisse/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
continuum/branches/continuum-refactoring-evenisse/continuum-core/src/test/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializerTest.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/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-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
continuum/branches/continuum-refactoring-evenisse/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
Added: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java?rev=682358&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java (added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java Mon Aug 4 05:21:59 2008
@@ -0,0 +1,48 @@
+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.Installation;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public interface InstallationDao
+{
+ Installation addInstallation( Installation installation )
+ throws ContinuumStoreException;
+
+ List<Installation> getAllInstallations()
+ throws ContinuumStoreException;
+
+ void removeInstallation( Installation installation )
+ throws ContinuumStoreException;
+
+ void updateInstallation( Installation installation )
+ throws ContinuumStoreException;
+
+ Installation getInstallation( int installationId )
+ throws ContinuumStoreException;
+
+}
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ProfileDao.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ProfileDao.java?rev=682358&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ProfileDao.java (added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ProfileDao.java Mon Aug 4 05:21:59 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.system.Profile;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public interface ProfileDao
+{
+ Profile getProfileByName( String profileName )
+ throws ContinuumStoreException;
+
+ List<Profile> getAllProfilesByName();
+
+ Profile addProfile( Profile profile );
+
+ Profile getProfile( int profileId )
+ throws ContinuumStoreException;
+
+ void updateProfile( Profile profile )
+ throws ContinuumStoreException;
+
+ void removeProfile( Profile profile );
+}
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ProfileDao.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ProfileDao.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ScheduleDao.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ScheduleDao.java?rev=682358&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ScheduleDao.java (added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ScheduleDao.java Mon Aug 4 05:21:59 2008
@@ -0,0 +1,51 @@
+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.Schedule;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public interface ScheduleDao
+{
+ List<Schedule> getAllSchedulesByName();
+
+ Schedule addSchedule( Schedule schedule );
+
+ Schedule getScheduleByName( String name )
+ throws ContinuumStoreException;
+
+ Schedule storeSchedule( Schedule schedule )
+ throws ContinuumStoreException;
+
+ void updateSchedule( Schedule schedule )
+ throws ContinuumStoreException;
+
+ void removeSchedule( Schedule schedule );
+
+ Schedule getSchedule( int scheduleId )
+ throws ContinuumStoreException;
+
+}
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ScheduleDao.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-api/src/main/java/org/apache/continuum/dao/ScheduleDao.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=682358&r1=682357&r2=682358&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 05:21:59 2008
@@ -23,14 +23,10 @@
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.ProjectGroup;
import org.apache.maven.continuum.model.project.ProjectNotifier;
-import org.apache.maven.continuum.model.project.Schedule;
import org.apache.maven.continuum.model.system.Installation;
-import org.apache.maven.continuum.model.system.Profile;
import org.apache.maven.continuum.model.system.SystemConfiguration;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -107,60 +103,6 @@
List<BuildDefinitionTemplate> getContinuumDefaultdDefinitions()
throws ContinuumStoreException;
- // ------------------------------------------------------
- // Project Group
- // ------------------------------------------------------
-
- List<Project> getAllProjectsByName();
-
- List<Project> getAllProjectsByNameWithDependencies();
-
- List<Project> getAllProjectsByNameWithBuildDetails();
-
- List<Schedule> getAllSchedulesByName();
-
- Schedule addSchedule( Schedule schedule );
-
- Schedule getScheduleByName( String name )
- throws ContinuumStoreException;
-
- Schedule storeSchedule( Schedule schedule )
- throws ContinuumStoreException;
-
- // ----------------------------------------------------------------
- // Profile
- // ----------------------------------------------------------------
- List<Profile> getAllProfilesByName();
-
- Profile addProfile( Profile profile );
-
- Installation addInstallation( Installation installation )
- throws ContinuumStoreException;
-
- Profile getProfile( int profileId )
- throws ContinuumObjectNotFoundException, ContinuumStoreException;
-
- void updateProfile( Profile profile )
- throws ContinuumStoreException;
-
- void removeProfile( Profile profile );
-
- // ----------------------------------------------------------------
- // Installation
- // ----------------------------------------------------------------
-
- List<Installation> getAllInstallations()
- throws ContinuumStoreException;
-
- void removeInstallation( Installation installation )
- throws ContinuumStoreException, ContinuumObjectNotFoundException;
-
- void updateInstallation( Installation installation )
- throws ContinuumStoreException, ContinuumObjectNotFoundException;
-
- Installation getInstallation( int installationId )
- throws ContinuumStoreException, ContinuumObjectNotFoundException;
-
List<BuildResult> getAllBuildsForAProjectByDate( int projectId );
Map getProjectIdsAndBuildDefinitionsIdsBySchedule( int scheduleId )
@@ -172,19 +114,11 @@
public Map getAggregatedProjectIdsAndBuildDefinitionIdsBySchedule( int scheduleId )
throws ContinuumStoreException;
- void updateSchedule( Schedule schedule )
- throws ContinuumStoreException;
-
- void removeSchedule( Schedule schedule );
-
BuildResult getBuildResult( int buildId )
throws ContinuumObjectNotFoundException, ContinuumStoreException;
void removeBuildResult( BuildResult buildResult );
- Schedule getSchedule( int scheduleId )
- throws ContinuumObjectNotFoundException, ContinuumStoreException;
-
BuildResult getLatestBuildResultForProject( int projectId );
BuildResult getLatestBuildResultForBuildDefinition( int projectId, int buildDefinitionId );
@@ -230,7 +164,5 @@
void closeStore();
- Collection<ProjectGroup> getAllProjectGroupsWithTheLot();
-
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=682358&r1=682357&r2=682358&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 05:21:59 2008
@@ -22,6 +22,7 @@
import org.apache.continuum.configuration.ContinuumConfiguration;
import org.apache.continuum.configuration.ContinuumConfigurationException;
import org.apache.continuum.configuration.GeneralConfiguration;
+import org.apache.continuum.dao.ScheduleDao;
import org.apache.maven.continuum.model.project.Schedule;
import org.apache.maven.continuum.model.system.SystemConfiguration;
import org.apache.maven.continuum.store.ContinuumStore;
@@ -58,6 +59,11 @@
/**
* @plexus.requirement
*/
+ private ScheduleDao scheduleDao;
+
+ /**
+ * @plexus.requirement
+ */
private ContinuumConfiguration configuration;
private GeneralConfiguration generalConfiguration;
@@ -90,6 +96,16 @@
return store;
}
+ public ScheduleDao getScheduleDao()
+ {
+ return scheduleDao;
+ }
+
+ public void setScheduleDao( ScheduleDao scheduleDao )
+ {
+ this.scheduleDao = scheduleDao;
+ }
+
public ContinuumConfiguration getConfiguration()
{
return configuration;
@@ -362,13 +378,13 @@
throws ContinuumStoreException, ConfigurationLoadingException, ContinuumConfigurationException
{
// Schedule
- Schedule defaultSchedule = getStore().getScheduleByName( DEFAULT_SCHEDULE_NAME );
+ Schedule defaultSchedule = scheduleDao.getScheduleByName( DEFAULT_SCHEDULE_NAME );
if ( defaultSchedule == null )
{
defaultSchedule = createDefaultSchedule();
- defaultSchedule = getStore().addSchedule( defaultSchedule );
+ defaultSchedule = scheduleDao.addSchedule( defaultSchedule );
}
return defaultSchedule;
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=682358&r1=682357&r2=682358&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 05:21:59 2008
@@ -27,6 +27,7 @@
init-method="initialize">
<property name="applicationHome" value="target"/>
<property name="store" ref="continuumStore#jdo"/>
+ <property name="scheduleDao" ref="scheduleDao"/>
<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=682358&r1=682357&r2=682358&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 05:21:59 2008
@@ -24,6 +24,7 @@
import org.apache.continuum.dao.BuildDefinitionDao;
import org.apache.continuum.dao.ProjectDao;
import org.apache.continuum.dao.ProjectGroupDao;
+import org.apache.continuum.dao.ScheduleDao;
import org.apache.maven.continuum.build.settings.SchedulesActivationException;
import org.apache.maven.continuum.build.settings.SchedulesActivator;
import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
@@ -144,6 +145,11 @@
/**
* @plexus.requirement
*/
+ private ScheduleDao scheduleDao;
+
+ /**
+ * @plexus.requirement
+ */
private ContinuumInitializer initializer;
/**
@@ -410,13 +416,13 @@
public Collection<Project> getProjects()
throws ContinuumException
{
- return store.getAllProjectsByName();
+ return projectDao.getAllProjectsByName();
}
public Collection<Project> getProjectsWithDependencies()
throws ContinuumException
{
- return store.getAllProjectsByNameWithDependencies();
+ return projectDao.getAllProjectsByNameWithDependencies();
}
public Map<Integer, BuildResult> getLatestBuildResults( int projectGroupId )
@@ -851,7 +857,7 @@
public Collection<Project> getAllProjects( int start, int end )
throws ContinuumException
{
- return store.getAllProjectsByName();
+ return projectDao.getAllProjectsByName();
}
// ----------------------------------------------------------------------
@@ -2405,7 +2411,7 @@
{
try
{
- return store.getSchedule( scheduleId );
+ return scheduleDao.getSchedule( scheduleId );
}
catch ( Exception ex )
{
@@ -2418,7 +2424,7 @@
{
try
{
- return store.getScheduleByName( scheduleName );
+ return scheduleDao.getScheduleByName( scheduleName );
}
catch ( ContinuumStoreException e )
{
@@ -2429,7 +2435,7 @@
public Collection<Schedule> getSchedules()
throws ContinuumException
{
- return store.getAllSchedulesByName();
+ return scheduleDao.getAllSchedulesByName();
}
public void addSchedule( Schedule schedule )
@@ -2444,7 +2450,7 @@
throw logAndCreateException( "Can't create schedule. A schedule with the same name already exists.", null );
}
- s = store.addSchedule( schedule );
+ s = scheduleDao.addSchedule( schedule );
try
{
@@ -2524,7 +2530,7 @@
try
{
- store.removeSchedule( schedule );
+ scheduleDao.removeSchedule( schedule );
}
catch ( Exception e )
{
@@ -2547,7 +2553,7 @@
{
try
{
- return store.storeSchedule( schedule );
+ return scheduleDao.storeSchedule( schedule );
}
catch ( ContinuumStoreException ex )
{
@@ -2757,7 +2763,7 @@
getLogger().info( "Showing all projects: " );
- for ( Project project : store.getAllProjectsByNameWithBuildDetails() )
+ for ( Project project : projectDao.getAllProjectsByNameWithBuildDetails() )
{
for ( ProjectNotifier notifier : (List<ProjectNotifier>) project.getNotifiers() )
{
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java?rev=682358&r1=682357&r2=682358&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java Mon Aug 4 05:21:59 2008
@@ -19,11 +19,11 @@
* under the License.
*/
+import org.apache.continuum.dao.ScheduleDao;
import org.apache.maven.continuum.Continuum;
import org.apache.maven.continuum.model.project.Schedule;
import org.apache.maven.continuum.scheduler.ContinuumBuildJob;
import org.apache.maven.continuum.scheduler.ContinuumSchedulerConstants;
-import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.scheduler.AbstractJob;
@@ -48,9 +48,9 @@
implements SchedulesActivator
{
/**
- * @plexus.requirement role-hint="jdo"
+ * @plexus.requirement
*/
- private ContinuumStore store;
+ private ScheduleDao scheduleDao;
/**
* @plexus.requirement role-hint="default"
@@ -65,7 +65,7 @@
{
getLogger().info( "Activating schedules ..." );
- Collection<Schedule> schedules = store.getAllSchedulesByName();
+ Collection<Schedule> schedules = scheduleDao.getAllSchedulesByName();
for ( Schedule schedule : schedules )
{
@@ -90,7 +90,7 @@
try
{
- store.storeSchedule( schedule );
+ scheduleDao.storeSchedule( schedule );
}
catch ( ContinuumStoreException e1 )
{
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractBuildDefinitionContinuumAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractBuildDefinitionContinuumAction.java?rev=682358&r1=682357&r2=682358&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractBuildDefinitionContinuumAction.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractBuildDefinitionContinuumAction.java Mon Aug 4 05:21:59 2008
@@ -20,6 +20,7 @@
*/
import org.apache.continuum.dao.BuildDefinitionDao;
+import org.apache.continuum.dao.ScheduleDao;
import org.apache.maven.continuum.ContinuumException;
import org.apache.maven.continuum.configuration.ConfigurationService;
import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -42,14 +43,14 @@
extends AbstractContinuumAction
{
/**
- * @plexus.requirement role-hint="jdo"
+ * @plexus.requirement
*/
- protected ContinuumStore store;
+ private BuildDefinitionDao buildDefinitionDao;
/**
* @plexus.requirement
*/
- private BuildDefinitionDao buildDefinitionDao;
+ private ScheduleDao scheduleDao;
protected void resolveDefaultBuildDefinitionsForProject( BuildDefinition buildDefinition, Project project )
throws ContinuumException
@@ -179,7 +180,7 @@
{
try
{
- schedule = store.getScheduleByName( ConfigurationService.DEFAULT_SCHEDULE_NAME );
+ schedule = scheduleDao.getScheduleByName( ConfigurationService.DEFAULT_SCHEDULE_NAME );
}
catch ( ContinuumStoreException e )
{
@@ -188,7 +189,7 @@
}
else
{
- schedule = store.getSchedule( buildDefinition.getSchedule().getId() );
+ schedule = scheduleDao.getSchedule( buildDefinition.getSchedule().getId() );
}
storedDefinition.setSchedule( schedule );
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java?rev=682358&r1=682357&r2=682358&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java Mon Aug 4 05:21:59 2008
@@ -19,10 +19,10 @@
* under the License.
*/
+import org.apache.continuum.dao.ProjectDao;
import org.apache.maven.continuum.ContinuumException;
import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
import org.apache.maven.continuum.model.project.Project;
-import org.apache.maven.continuum.store.ContinuumStore;
import org.codehaus.plexus.util.StringUtils;
import java.util.List;
@@ -43,9 +43,9 @@
private BuildExecutorManager buildExecutorManager;
/**
- * @plexus.requirement role-hint="jdo"
+ * @plexus.requirement
*/
- private ContinuumStore store;
+ private ProjectDao projectDao;
public void execute( Map context )
throws Exception
@@ -61,15 +61,15 @@
{
throw new ContinuumException( "No such executor with id '" + project.getExecutorId() + "'." );
}
-
- List<Project> projects = store.getAllProjectsByName();
-
- for (Project storedProject : projects)
+
+ List<Project> projects = projectDao.getAllProjectsByName();
+
+ for ( Project storedProject : projects )
{
// CONTINUUM-1445
- if ( StringUtils.equalsIgnoreCase( project.getName(), storedProject.getName() )
- && StringUtils.equalsIgnoreCase( project.getVersion(), storedProject.getVersion() )
- && StringUtils.equalsIgnoreCase( project.getScmUrl(), storedProject.getScmUrl() ) )
+ if ( StringUtils.equalsIgnoreCase( project.getName(), storedProject.getName() ) &&
+ StringUtils.equalsIgnoreCase( project.getVersion(), storedProject.getVersion() ) &&
+ StringUtils.equalsIgnoreCase( project.getScmUrl(), storedProject.getScmUrl() ) )
{
throw new ContinuumException( "A duplicate project already exist '" + storedProject.getName() + "'." );
}
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/installation/DefaultInstallationService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/installation/DefaultInstallationService.java?rev=682358&r1=682357&r2=682358&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/installation/DefaultInstallationService.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/installation/DefaultInstallationService.java Mon Aug 4 05:21:59 2008
@@ -19,13 +19,13 @@
* under the License.
*/
+import org.apache.continuum.dao.InstallationDao;
import org.apache.maven.continuum.execution.ExecutorConfigurator;
import org.apache.maven.continuum.model.system.Installation;
import org.apache.maven.continuum.model.system.Profile;
import org.apache.maven.continuum.profile.AlreadyExistsProfileException;
import org.apache.maven.continuum.profile.ProfileException;
import org.apache.maven.continuum.profile.ProfileService;
-import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
@@ -58,9 +58,9 @@
implements InstallationService, Initializable
{
/**
- * @plexus.requirement role-hint="jdo"
+ * @plexus.requirement
*/
- private ContinuumStore store;
+ private InstallationDao installationDao;
/**
* @plexus.requirement role-hint="default"
@@ -111,8 +111,8 @@
{
if ( alreadyExistInstallationName( installation ) )
{
- throw new AlreadyExistsInstallationException( "Installation with name " + installation.getName()
- + " already exists" );
+ throw new AlreadyExistsInstallationException(
+ "Installation with name " + installation.getName() + " already exists" );
}
// TODO must be done in the same transaction
Installation storedOne = null;
@@ -124,7 +124,7 @@
{
installation.setVarName( envVarName );
}
- storedOne = store.addInstallation( installation );
+ storedOne = installationDao.addInstallation( installation );
}
catch ( ContinuumStoreException e )
{
@@ -155,7 +155,7 @@
{
try
{
- store.removeInstallation( installation );
+ installationDao.removeInstallation( installation );
}
catch ( ContinuumStoreException e )
{
@@ -173,7 +173,7 @@
{
try
{
- List installations = store.getAllInstallations();
+ List installations = installationDao.getAllInstallations();
return installations == null ? Collections.EMPTY_LIST : installations;
}
catch ( ContinuumStoreException e )
@@ -190,7 +190,7 @@
{
try
{
- return store.getInstallation( installationId );
+ return installationDao.getInstallation( installationId );
}
catch ( ContinuumStoreException e )
{
@@ -225,7 +225,7 @@
stored.setVarName( installation.getVarName() );
}
stored.setVarValue( installation.getVarValue() );
- store.updateInstallation( stored );
+ installationDao.updateInstallation( stored );
}
catch ( ContinuumStoreException e )
{
@@ -365,7 +365,7 @@
}
if ( profile.getEnvironmentVariables() != null )
{
- for ( Installation installation: (List<Installation>)profile.getEnvironmentVariables() )
+ for ( Installation installation : (List<Installation>) profile.getEnvironmentVariables() )
{
environnments.put( installation.getVarName(), installation.getVarValue() );
}
@@ -441,7 +441,7 @@
throw new InstallationException( e.getMessage(), e );
}
}
-
+
private boolean alreadyExistInstallationName( Installation installation )
throws InstallationException
{
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/profile/DefaultProfileService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/profile/DefaultProfileService.java?rev=682358&r1=682357&r2=682358&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/profile/DefaultProfileService.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/profile/DefaultProfileService.java Mon Aug 4 05:21:59 2008
@@ -19,17 +19,17 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.commons.lang.StringUtils;
+import org.apache.continuum.dao.ProfileDao;
import org.apache.maven.continuum.installation.InstallationService;
import org.apache.maven.continuum.model.system.Installation;
import org.apache.maven.continuum.model.system.Profile;
import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
-import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author <a href="mailto:olamy@codehaus.org">olamy</a>
* @version $Id$
@@ -40,11 +40,10 @@
public class DefaultProfileService
implements ProfileService
{
-
/**
- * @plexus.requirement role-hint="jdo"
+ * @plexus.requirement
*/
- private ContinuumStore store;
+ private ProfileDao profileDao;
/**
* @see org.apache.maven.continuum.profile.ProfileService#updateProfile(org.apache.maven.continuum.model.system.Profile)
@@ -52,14 +51,14 @@
public void updateProfile( Profile profile )
throws ProfileException, AlreadyExistsProfileException
{
-
+
// already exists check should be done in the same transaction
// but we assume we don't have a huge load and a lot of concurrent access ;-)
if ( alreadyExistsProfileName( profile ) )
{
throw new AlreadyExistsProfileException( "profile with name " + profile.getName() + " already exists" );
- }
-
+ }
+
try
{
Profile stored = getProfile( profile.getId() );
@@ -70,14 +69,14 @@
stored.setJdk( profile.getJdk() );
stored.setName( profile.getName() );
stored.setEnvironmentVariables( profile.getEnvironmentVariables() );
- store.updateProfile( stored );
+ profileDao.updateProfile( stored );
}
catch ( ContinuumStoreException e )
{
throw new ProfileException( e.getMessage(), e );
}
}
-
+
public void updateProfileCheckDuplicateName( Profile profile, boolean checkDuplicateName )
throws ProfileException, AlreadyExistsProfileException
{
@@ -100,13 +99,13 @@
stored.setJdk( profile.getJdk() );
stored.setName( profile.getName() );
stored.setEnvironmentVariables( profile.getEnvironmentVariables() );
- store.updateProfile( stored );
+ profileDao.updateProfile( stored );
}
catch ( ContinuumStoreException e )
{
throw new ProfileException( e.getMessage(), e );
}
- }
+ }
/**
* @see org.apache.maven.continuum.profile.ProfileService#addProfile(org.apache.maven.continuum.model.system.Profile)
@@ -123,16 +122,16 @@
profile.setBuilder( null );
profile.setJdk( null );
profile.setEnvironmentVariables( null );
- return store.addProfile( profile );
+ return profileDao.addProfile( profile );
}
-
+
/**
* @see org.apache.maven.continuum.profile.ProfileService#deleteProfile(int)
*/
public void deleteProfile( int profileId )
throws ProfileException
{
- store.removeProfile( getProfile( profileId ) );
+ profileDao.removeProfile( getProfile( profileId ) );
}
/**
@@ -141,7 +140,7 @@
public List<Profile> getAllProfiles()
throws ProfileException
{
- return store.getAllProfilesByName();
+ return profileDao.getAllProfilesByName();
}
/**
@@ -152,7 +151,7 @@
{
try
{
- return store.getProfile( profileId );
+ return profileDao.getProfile( profileId );
}
catch ( ContinuumObjectNotFoundException e )
{
@@ -175,7 +174,7 @@
stored.setBuilder( builder );
try
{
- store.updateProfile( stored );
+ profileDao.updateProfile( stored );
}
catch ( ContinuumStoreException e )
{
@@ -193,7 +192,7 @@
stored.setJdk( jdk );
try
{
- store.updateProfile( stored );
+ profileDao.updateProfile( stored );
}
catch ( ContinuumStoreException e )
{
@@ -211,7 +210,7 @@
stored.addEnvironmentVariable( envVar );
try
{
- store.updateProfile( stored );
+ profileDao.updateProfile( stored );
}
catch ( ContinuumStoreException e )
{
@@ -226,9 +225,9 @@
{
setJdkInProfile( profile, installation );
}
- else if ( InstallationService.MAVEN1_TYPE.equals( installation.getType() )
- || InstallationService.MAVEN2_TYPE.equals( installation.getType() )
- || InstallationService.ANT_TYPE.equals( installation.getType() ) )
+ else if ( InstallationService.MAVEN1_TYPE.equals( installation.getType() ) ||
+ InstallationService.MAVEN2_TYPE.equals( installation.getType() ) ||
+ InstallationService.ANT_TYPE.equals( installation.getType() ) )
{
setBuilderInProfile( profile, installation );
}
@@ -275,7 +274,7 @@
{
// normally cannot happend here but anyway we throw the exception
throw new ProfileException( e.getMessage(), e );
- }
+ }
}
@@ -302,6 +301,6 @@
throws ProfileException
{
return getProfileWithName( profile.getName() ) != null;
- }
-
+ }
+
}
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?rev=682358&r1=682357&r2=682358&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java Mon Aug 4 05:21:59 2008
@@ -19,6 +19,7 @@
* under the License.
*/
+import org.apache.continuum.dao.ScheduleDao;
import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
import org.apache.maven.continuum.builddefinition.BuildDefinitionServiceException;
import org.apache.maven.continuum.configuration.ConfigurationService;
@@ -33,10 +34,8 @@
import org.apache.maven.continuum.project.builder.ContinuumProjectBuilder;
import org.apache.maven.continuum.project.builder.ContinuumProjectBuilderException;
import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
-import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
@@ -67,9 +66,9 @@
private MavenBuilderHelper builderHelper;
/**
- * @plexus.requirement role-hint="jdo"
+ * @plexus.requirement
*/
- private ContinuumStore store;
+ private ScheduleDao scheduleDao;
/**
* @plexus.requirement
@@ -140,7 +139,7 @@
MavenProject mavenProject;
File pomFile = null;
-
+
try
{
pomFile = createMetadataFile( url, username, password );
@@ -223,7 +222,8 @@
{
try
{
- Schedule schedule = store.getScheduleByName( ConfigurationService.DEFAULT_SCHEDULE_NAME );
+ Schedule schedule =
+ scheduleDao.getScheduleByName( ConfigurationService.DEFAULT_SCHEDULE_NAME );
buildDefinition.setSchedule( schedule );
}
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=682358&r1=682357&r2=682358&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java Mon Aug 4 05:21:59 2008
@@ -67,7 +67,7 @@
{
Continuum continuum = (Continuum) lookup( Continuum.ROLE );
- int projectCount = getStore().getAllProjectsByName().size();
+ int projectCount = getProjectDao().getAllProjectsByName().size();
int projectGroupCount = getProjectGroupDao().getAllProjectGroupsWithProjects().size();
@@ -83,19 +83,19 @@
assertEquals( "result.projectGroups.size", 1, result.getProjectGroups().size() );
- System.err.println( "number of projects: " + getStore().getAllProjectsByName().size() );
+ System.err.println( "number of projects: " + getProjectDao().getAllProjectsByName().size() );
System.err.println(
"number of project groups: " + getProjectGroupDao().getAllProjectGroupsWithProjects().size() );
- assertEquals( "Total project count", projectCount + 3, getStore().getAllProjectsByName().size() );
+ assertEquals( "Total project count", projectCount + 3, getProjectDao().getAllProjectsByName().size() );
assertEquals( "Total project group count.", projectGroupCount + 1,
getProjectGroupDao().getAllProjectGroupsWithProjects().size() );
Map projects = new HashMap();
- for ( Iterator i = getStore().getAllProjectsByName().iterator(); i.hasNext(); )
+ for ( Iterator i = getProjectDao().getAllProjectsByName().iterator(); i.hasNext(); )
{
Project project = (Project) i.next();
@@ -197,7 +197,7 @@
nbd.setGoals( "clean" );
nbd.setArguments( "" );
nbd.setDefaultForProject( true );
- nbd.setSchedule( getStore().getScheduleByName( ConfigurationService.DEFAULT_SCHEDULE_NAME ) );
+ nbd.setSchedule( getScheduleDao().getScheduleByName( ConfigurationService.DEFAULT_SCHEDULE_NAME ) );
continuum.addBuildDefinitionToProject( project.getId(), nbd );
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-core/src/test/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializerTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-core/src/test/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializerTest.java?rev=682358&r1=682357&r2=682358&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-core/src/test/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializerTest.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-core/src/test/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializerTest.java Mon Aug 4 05:21:59 2008
@@ -52,7 +52,7 @@
public void testDefaultSchedule()
throws Exception
{
- Schedule schedule = getContinuumStore().getScheduleByName( ConfigurationService.DEFAULT_SCHEDULE_NAME );
+ Schedule schedule = getScheduleDao().getScheduleByName( ConfigurationService.DEFAULT_SCHEDULE_NAME );
assertNotNull( schedule );
}
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=682358&r1=682357&r2=682358&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 05:21:59 2008
@@ -19,6 +19,10 @@
* under the License.
*/
+import org.apache.continuum.dao.InstallationDao;
+import org.apache.continuum.dao.ProfileDao;
+import org.apache.continuum.dao.ProjectGroupDao;
+import org.apache.continuum.dao.ScheduleDao;
import org.apache.maven.continuum.model.project.BuildDefinition;
import org.apache.maven.continuum.model.project.ContinuumDatabase;
import org.apache.maven.continuum.model.project.Project;
@@ -66,6 +70,26 @@
*/
private ContinuumStore store;
+ /**
+ * @plexus.requirement
+ */
+ private InstallationDao installationDao;
+
+ /**
+ * @plexus.requirement
+ */
+ private ProfileDao profileDao;
+
+ /**
+ * @plexus.requirement
+ */
+ private ProjectGroupDao projectGroupDao;
+
+ /**
+ * @plexus.requirement
+ */
+ private ScheduleDao scheduleDao;
+
protected static final String BUILDS_XML = "builds.xml";
/**
@@ -87,18 +111,18 @@
}
// TODO: need these to lazy load to conserve memory while we stream out the model
- Collection projectGroups = store.getAllProjectGroupsWithTheLot();
+ Collection projectGroups = projectGroupDao.getAllProjectGroupsWithTheLot();
database.setProjectGroups( new ArrayList( projectGroups ) );
try
{
- database.setInstallations( store.getAllInstallations() );
+ database.setInstallations( installationDao.getAllInstallations() );
}
catch ( ContinuumStoreException e )
{
throw new DataManagementException( e );
}
- database.setSchedules( store.getAllSchedulesByName() );
- database.setProfiles( store.getAllProfilesByName() );
+ database.setSchedules( scheduleDao.getAllSchedulesByName() );
+ database.setProfiles( profileDao.getAllProfilesByName() );
ContinuumStaxWriter writer = new ContinuumStaxWriter();
Added: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java?rev=682358&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java (added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java Mon Aug 4 05:21:59 2008
@@ -0,0 +1,205 @@
+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.Installation;
+import org.apache.maven.continuum.model.system.Profile;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.codehaus.plexus.util.StringUtils;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+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$
+ * @plexus.component role="org.apache.continuum.dao.InstallationDao"
+ */
+public class InstallationDaoImpl
+ extends AbstractDao
+ implements InstallationDao
+{
+ public Installation addInstallation( Installation installation )
+ {
+ return (Installation) addObject( installation );
+ }
+
+ public List<Installation> getAllInstallations()
+ {
+ return getAllObjectsDetached( Installation.class, "name ascending", null );
+ }
+
+ public void removeInstallation( Installation installation )
+ throws ContinuumStoreException
+ {
+ // first delete link beetwen profile and this installation
+ // then removing this
+ //attachAndDelete( installation );
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ // this must be done in the same transaction
+ tx.begin();
+
+ // first removing linked jdk
+
+ Extent extent = pm.getExtent( Profile.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareImports( "import java.lang.String" );
+
+ query.declareParameters( "String name" );
+
+ query.setFilter( "this.jdk.name == name" );
+
+ Collection<Profile> result = (Collection) query.execute( installation.getName() );
+
+ if ( result.size() != 0 )
+ {
+ for ( Iterator<Profile> iterator = result.iterator(); iterator.hasNext(); )
+ {
+ Profile profile = iterator.next();
+ profile.setJdk( null );
+ pm.makePersistent( profile );
+ }
+ }
+
+ // removing linked builder
+ query = pm.newQuery( extent );
+
+ query.declareImports( "import java.lang.String" );
+
+ query.declareParameters( "String name" );
+
+ query.setFilter( "this.builder.name == name" );
+
+ result = (Collection) query.execute( installation.getName() );
+
+ if ( result.size() != 0 )
+ {
+ for ( Iterator<Profile> iterator = result.iterator(); iterator.hasNext(); )
+ {
+ Profile profile = iterator.next();
+ profile.setBuilder( null );
+ pm.makePersistent( profile );
+ }
+ }
+
+ // removing linked env Var
+ query = pm.newQuery( extent );
+
+ query.declareImports( "import java.lang.String" );
+ query.declareImports( "import " + Installation.class.getName() );
+
+ query.declareParameters( "Installation installation" );
+
+ query.setFilter( "environmentVariables.contains(installation)" );
+
+ //query = pm
+ // .newQuery( "SELECT FROM profile WHERE environmentVariables.contains(installation) && installation.name == name" );
+
+ result = (Collection) query.execute( installation );
+
+ if ( result.size() != 0 )
+ {
+ for ( Profile profile : result )
+ {
+ List<Installation> newEnvironmentVariables = new ArrayList<Installation>();
+ for ( Installation current : (Iterable<Installation>) profile.getEnvironmentVariables() )
+ {
+ if ( !StringUtils.equals( current.getName(), installation.getName() ) )
+ {
+ newEnvironmentVariables.add( current );
+ }
+ }
+ profile.setEnvironmentVariables( newEnvironmentVariables );
+ pm.makePersistent( profile );
+ }
+ }
+
+ pm.deletePersistent( installation );
+
+ tx.commit();
+
+ }
+ finally
+ {
+ rollback( tx );
+ }
+ }
+
+ public void updateInstallation( Installation installation )
+ throws ContinuumStoreException
+ {
+ updateObject( installation );
+ }
+
+ public Installation getInstallation( int installationId )
+ throws ContinuumStoreException
+ {
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ tx.begin();
+
+ Extent extent = pm.getExtent( Installation.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareImports( "import java.lang.String" );
+
+ query.declareParameters( "int installationId" );
+
+ query.setFilter( "this.installationId == installationId" );
+
+ Collection result = (Collection) query.execute( installationId );
+
+ if ( result.size() == 0 )
+ {
+ tx.commit();
+
+ return null;
+ }
+
+ Object object = pm.detachCopy( result.iterator().next() );
+
+ tx.commit();
+
+ return (Installation) object;
+ }
+ finally
+ {
+ rollback( tx );
+ }
+ }
+}
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ProfileDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ProfileDaoImpl.java?rev=682358&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ProfileDaoImpl.java (added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ProfileDaoImpl.java Mon Aug 4 05:21:59 2008
@@ -0,0 +1,109 @@
+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.Profile;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @plexus.component role="org.apache.continuum.dao.ProfileDao"
+ */
+public class ProfileDaoImpl
+ extends AbstractDao
+ implements ProfileDao
+{
+ public Profile getProfileByName( String profileName )
+ throws ContinuumStoreException
+ {
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ tx.begin();
+
+ Extent extent = pm.getExtent( Profile.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareImports( "import java.lang.String" );
+
+ query.declareParameters( "String name" );
+
+ query.setFilter( "this.name == name" );
+
+ Collection result = (Collection) query.execute( profileName );
+
+ if ( result.size() == 0 )
+ {
+ tx.commit();
+
+ return null;
+ }
+
+ Object object = pm.detachCopy( result.iterator().next() );
+
+ tx.commit();
+
+ return (Profile) object;
+ }
+ finally
+ {
+ rollback( tx );
+ }
+ }
+
+ public List<Profile> getAllProfilesByName()
+ {
+ return getAllObjectsDetached( Profile.class, "name ascending", null );
+ }
+
+ public Profile addProfile( Profile profile )
+ {
+ return (Profile) addObject( profile );
+ }
+
+ public Profile getProfile( int profileId )
+ throws ContinuumStoreException
+ {
+ return (Profile) getObjectById( Profile.class, profileId );
+ }
+
+ public void updateProfile( Profile profile )
+ throws ContinuumStoreException
+ {
+ updateObject( profile );
+ }
+
+ public void removeProfile( Profile profile )
+ {
+ removeObject( profile );
+ }
+}
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ProfileDaoImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ProfileDaoImpl.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ScheduleDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ScheduleDaoImpl.java?rev=682358&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ScheduleDaoImpl.java (added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ScheduleDaoImpl.java Mon Aug 4 05:21:59 2008
@@ -0,0 +1,117 @@
+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.Schedule;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @plexus.component role="org.apache.continuum.dao.ScheduleDao"
+ */
+public class ScheduleDaoImpl
+ extends AbstractDao
+ implements ScheduleDao
+{
+ public List<Schedule> getAllSchedulesByName()
+ {
+ return getAllObjectsDetached( Schedule.class, "name ascending", null );
+ }
+
+ public Schedule addSchedule( Schedule schedule )
+ {
+ return (Schedule) addObject( schedule );
+ }
+
+ public Schedule getScheduleByName( String name )
+ throws ContinuumStoreException
+ {
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ tx.begin();
+
+ Extent extent = pm.getExtent( Schedule.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareImports( "import java.lang.String" );
+
+ query.declareParameters( "String name" );
+
+ query.setFilter( "this.name == name" );
+
+ Collection result = (Collection) query.execute( name );
+
+ if ( result.size() == 0 )
+ {
+ tx.commit();
+
+ return null;
+ }
+
+ Object object = pm.detachCopy( result.iterator().next() );
+
+ tx.commit();
+
+ return (Schedule) object;
+ }
+ finally
+ {
+ rollback( tx );
+ }
+ }
+
+ public Schedule storeSchedule( Schedule schedule )
+ throws ContinuumStoreException
+ {
+ updateObject( schedule );
+
+ return schedule;
+ }
+
+ public void updateSchedule( Schedule schedule )
+ throws ContinuumStoreException
+ {
+ updateObject( schedule );
+ }
+
+ public void removeSchedule( Schedule schedule )
+ {
+ removeObject( schedule );
+ }
+
+ public Schedule getSchedule( int scheduleId )
+ throws ContinuumStoreException
+ {
+ return (Schedule) getObjectById( Schedule.class, scheduleId );
+ }
+}
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ScheduleDaoImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ScheduleDaoImpl.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=682358&r1=682357&r2=682358&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 05:21:59 2008
@@ -50,8 +50,6 @@
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;
@@ -75,16 +73,11 @@
// ContinuumStore Implementation
// ----------------------------------------------------------------------
- private ProjectGroup getProjectGroupWithBuildDetailsByProjectGroupId( int projectGroupId )
- throws ContinuumStoreException
- {
- return (ProjectGroup) getObjectById( ProjectGroup.class, projectGroupId, PROJECT_BUILD_DETAILS_FETCH_GROUP );
- }
-
private List<BuildDefinition> getDefaultBuildDefinitionsForProjectGroup( int projectGroupId )
throws ContinuumStoreException
{
- ProjectGroup projectGroup = getProjectGroupWithBuildDetailsByProjectGroupId( projectGroupId );
+ ProjectGroup projectGroup =
+ (ProjectGroup) getObjectById( ProjectGroup.class, projectGroupId, PROJECT_BUILD_DETAILS_FETCH_GROUP );
List<BuildDefinition> bds = new ArrayList<BuildDefinition>();
@@ -869,324 +862,6 @@
PlexusJdoUtils.attachAndDelete( getPersistenceManager(), object );
}
- // ----------------------------------------------------------------------
- // Transaction Management
- // ----------------------------------------------------------------------
-
- public List<Project> getAllProjectsByName()
- {
- return getAllObjectsDetached( Project.class, "name ascending", null );
- }
-
- // todo get this natively supported in the store
- public List<Project> getProjectsWithDependenciesByGroupId( int projectGroupId )
- {
- List<Project> allProjects =
- getAllObjectsDetached( Project.class, "name ascending", PROJECT_DEPENDENCIES_FETCH_GROUP );
-
- List<Project> groupProjects = new ArrayList<Project>();
-
- for ( Project project : allProjects )
- {
- if ( project.getProjectGroup().getId() == projectGroupId )
- {
- groupProjects.add( project );
- }
- }
- return groupProjects;
- }
-
- public List<Project> getAllProjectsByNameWithDependencies()
- {
- return getAllObjectsDetached( Project.class, "name ascending", PROJECT_DEPENDENCIES_FETCH_GROUP );
- }
-
- public List<Project> getAllProjectsByNameWithBuildDetails()
- {
- return getAllObjectsDetached( Project.class, "name ascending", PROJECT_BUILD_DETAILS_FETCH_GROUP );
- }
-
- public List<Schedule> getAllSchedulesByName()
- {
- return getAllObjectsDetached( Schedule.class, "name ascending", null );
- }
-
- public Schedule addSchedule( Schedule schedule )
- {
- return (Schedule) addObject( schedule );
- }
-
- public Schedule getScheduleByName( String name )
- throws ContinuumStoreException
- {
- PersistenceManager pm = getPersistenceManager();
-
- Transaction tx = pm.currentTransaction();
-
- try
- {
- tx.begin();
-
- Extent extent = pm.getExtent( Schedule.class, true );
-
- Query query = pm.newQuery( extent );
-
- query.declareImports( "import java.lang.String" );
-
- query.declareParameters( "String name" );
-
- query.setFilter( "this.name == name" );
-
- Collection result = (Collection) query.execute( name );
-
- if ( result.size() == 0 )
- {
- tx.commit();
-
- return null;
- }
-
- Object object = pm.detachCopy( result.iterator().next() );
-
- tx.commit();
-
- return (Schedule) object;
- }
- finally
- {
- rollback( tx );
- }
- }
-
- public Schedule storeSchedule( Schedule schedule )
- throws ContinuumStoreException
- {
- updateObject( schedule );
-
- return schedule;
- }
-
- // ----------------------------------------------------------------
- // Profile
- // ----------------------------------------------------------------
-
- public List<Profile> getAllProfilesByName()
- {
- return getAllObjectsDetached( Profile.class, "name ascending", null );
- }
-
- public Profile getProfileByName( String profileName )
- throws ContinuumStoreException
- {
- PersistenceManager pm = getPersistenceManager();
-
- Transaction tx = pm.currentTransaction();
-
- try
- {
- tx.begin();
-
- Extent extent = pm.getExtent( Profile.class, true );
-
- Query query = pm.newQuery( extent );
-
- query.declareImports( "import java.lang.String" );
-
- query.declareParameters( "String name" );
-
- query.setFilter( "this.name == name" );
-
- Collection result = (Collection) query.execute( profileName );
-
- if ( result.size() == 0 )
- {
- tx.commit();
-
- return null;
- }
-
- Object object = pm.detachCopy( result.iterator().next() );
-
- tx.commit();
-
- return (Profile) object;
- }
- finally
- {
- rollback( tx );
- }
- }
-
- public Profile addProfile( Profile profile )
- {
- return (Profile) addObject( profile );
- }
-
- // ----------------------------------------------------------------
- // Installation
- // ----------------------------------------------------------------
-
- public Installation addInstallation( Installation installation )
- {
- return (Installation) addObject( installation );
- }
-
- public List<Installation> getAllInstallations()
- {
- return getAllObjectsDetached( Installation.class, "name ascending", null );
- }
-
- public void removeInstallation( Installation installation )
- throws ContinuumStoreException, ContinuumObjectNotFoundException
- {
- // first delete link beetwen profile and this installation
- // then removing this
- //attachAndDelete( installation );
- PersistenceManager pm = getPersistenceManager();
-
- Transaction tx = pm.currentTransaction();
-
- try
- {
- // this must be done in the same transaction
- tx.begin();
-
- // first removing linked jdk
-
- Extent extent = pm.getExtent( Profile.class, true );
-
- Query query = pm.newQuery( extent );
-
- query.declareImports( "import java.lang.String" );
-
- query.declareParameters( "String name" );
-
- query.setFilter( "this.jdk.name == name" );
-
- Collection<Profile> result = (Collection) query.execute( installation.getName() );
-
- if ( result.size() != 0 )
- {
- for ( Iterator<Profile> iterator = result.iterator(); iterator.hasNext(); )
- {
- Profile profile = iterator.next();
- profile.setJdk( null );
- pm.makePersistent( profile );
- }
- }
-
- // removing linked builder
- query = pm.newQuery( extent );
-
- query.declareImports( "import java.lang.String" );
-
- query.declareParameters( "String name" );
-
- query.setFilter( "this.builder.name == name" );
-
- result = (Collection) query.execute( installation.getName() );
-
- if ( result.size() != 0 )
- {
- for ( Iterator<Profile> iterator = result.iterator(); iterator.hasNext(); )
- {
- Profile profile = iterator.next();
- profile.setBuilder( null );
- pm.makePersistent( profile );
- }
- }
-
- // removing linked env Var
- query = pm.newQuery( extent );
-
- query.declareImports( "import java.lang.String" );
- query.declareImports( "import " + Installation.class.getName() );
-
- query.declareParameters( "Installation installation" );
-
- query.setFilter( "environmentVariables.contains(installation)" );
-
- //query = pm
- // .newQuery( "SELECT FROM profile WHERE environmentVariables.contains(installation) && installation.name == name" );
-
- result = (Collection) query.execute( installation );
-
- if ( result.size() != 0 )
- {
- for ( Profile profile : result )
- {
- List<Installation> newEnvironmentVariables = new ArrayList<Installation>();
- for ( Installation current : (Iterable<Installation>) profile.getEnvironmentVariables() )
- {
- if ( !StringUtils.equals( current.getName(), installation.getName() ) )
- {
- newEnvironmentVariables.add( current );
- }
- }
- profile.setEnvironmentVariables( newEnvironmentVariables );
- pm.makePersistent( profile );
- }
- }
-
- pm.deletePersistent( installation );
-
- tx.commit();
-
- }
- finally
- {
- rollback( tx );
- }
- }
-
- public void updateInstallation( Installation installation )
- throws ContinuumStoreException, ContinuumObjectNotFoundException
- {
- updateObject( installation );
- }
-
- public Installation getInstallation( int installationId )
- throws ContinuumStoreException, ContinuumObjectNotFoundException
- {
- PersistenceManager pm = getPersistenceManager();
-
- Transaction tx = pm.currentTransaction();
-
- try
- {
- tx.begin();
-
- Extent extent = pm.getExtent( Installation.class, true );
-
- Query query = pm.newQuery( extent );
-
- query.declareImports( "import java.lang.String" );
-
- query.declareParameters( "int installationId" );
-
- query.setFilter( "this.installationId == installationId" );
-
- Collection result = (Collection) query.execute( installationId );
-
- if ( result.size() == 0 )
- {
- tx.commit();
-
- return null;
- }
-
- Object object = pm.detachCopy( result.iterator().next() );
-
- tx.commit();
-
- return (Installation) object;
- }
- finally
- {
- rollback( tx );
- }
- }
-
public List<BuildResult> getAllBuildsForAProjectByDate( int projectId )
{
PersistenceManager pm = getPersistenceManager();
@@ -1224,28 +899,6 @@
return (Project) getObjectById( Project.class, projectId );
}
- public void updateProfile( Profile profile )
- throws ContinuumStoreException
- {
- updateObject( profile );
- }
-
- public void updateSchedule( Schedule schedule )
- throws ContinuumStoreException
- {
- updateObject( schedule );
- }
-
- public void removeProfile( Profile profile )
- {
- removeObject( profile );
- }
-
- public void removeSchedule( Schedule schedule )
- {
- removeObject( schedule );
- }
-
public BuildResult getBuildResult( int buildId )
throws ContinuumObjectNotFoundException, ContinuumStoreException
{
@@ -1554,18 +1207,6 @@
}
}
- public Schedule getSchedule( int scheduleId )
- throws ContinuumObjectNotFoundException, ContinuumStoreException
- {
- return (Schedule) getObjectById( Schedule.class, scheduleId );
- }
-
- public Profile getProfile( int profileId )
- throws ContinuumObjectNotFoundException, ContinuumStoreException
- {
- return (Profile) getObjectById( Profile.class, profileId );
- }
-
private List getAllObjectsDetached( Class clazz )
{
return getAllObjectsDetached( clazz, null );
@@ -1576,16 +1217,6 @@
return getAllObjectsDetached( clazz, null, fetchGroup );
}
- private List getAllObjectsDetached( PersistenceManager pmf, Class clazz )
- {
- return getAllObjectsDetached( pmf, clazz, null );
- }
-
- private List getAllObjectsDetached( PersistenceManager pmf, Class clazz, String fetchGroup )
- {
- return getAllObjectsDetached( pmf, clazz, null, fetchGroup );
- }
-
public Project getProjectWithBuildDetails( int projectId )
throws ContinuumObjectNotFoundException, ContinuumStoreException
{
@@ -1628,16 +1259,6 @@
closePersistenceManagerFactory( getContinuumPersistenceManagerFactory(), 1 );
}
- public Collection<ProjectGroup> getAllProjectGroupsWithTheLot()
- {
- List fetchGroups = Arrays.asList( new String[]{PROJECT_WITH_BUILDS_FETCH_GROUP,
- PROJECTGROUP_PROJECTS_FETCH_GROUP, BUILD_RESULT_WITH_DETAILS_FETCH_GROUP,
- PROJECT_WITH_CHECKOUT_RESULT_FETCH_GROUP, PROJECT_ALL_DETAILS_FETCH_GROUP,
- PROJECT_BUILD_DETAILS_FETCH_GROUP} );
- return PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager(), ProjectGroup.class, "name ascending",
- fetchGroups );
- }
-
public void eraseDatabase()
{
PlexusJdoUtils.removeAll( getPersistenceManager(), BuildDefinitionTemplate.class );
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=682358&r1=682357&r2=682358&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 05:21:59 2008
@@ -19,8 +19,11 @@
* under the License.
*/
+import org.apache.continuum.dao.InstallationDao;
+import org.apache.continuum.dao.ProfileDao;
import org.apache.continuum.dao.ProjectDao;
import org.apache.continuum.dao.ProjectGroupDao;
+import org.apache.continuum.dao.ScheduleDao;
import org.apache.maven.continuum.installation.InstallationService;
import org.apache.maven.continuum.model.project.BuildDefinition;
import org.apache.maven.continuum.model.project.BuildResult;
@@ -54,10 +57,16 @@
{
protected ContinuumStore store;
+ protected InstallationDao installationDao;
+
+ protected ProfileDao profileDao;
+
protected ProjectGroupDao projectGroupDao;
protected ProjectDao projectDao;
+ protected ScheduleDao scheduleDao;
+
protected ProjectGroup defaultProjectGroup;
protected ProjectGroup testProjectGroup2;
@@ -125,9 +134,15 @@
store = createStore();
+ installationDao = (InstallationDao) lookup( InstallationDao.class.getName() );
+
+ profileDao = (ProfileDao) lookup( ProfileDao.class.getName() );
+
projectGroupDao = (ProjectGroupDao) lookup( ProjectGroupDao.class.getName() );
projectDao = (ProjectDao) lookup( ProjectDao.class.getName() );
+
+ scheduleDao = (ScheduleDao) lookup( ScheduleDao.class.getName() );
}
protected void createBuildDatabase()
@@ -207,7 +222,7 @@
Schedule schedule2 = createTestSchedule( testSchedule2 );
if ( addToStore )
{
- schedule2 = store.addSchedule( schedule2 );
+ schedule2 = scheduleDao.addSchedule( schedule2 );
testSchedule2.setId( schedule2.getId() );
}
else
@@ -219,7 +234,7 @@
Schedule schedule1 = createTestSchedule( testSchedule1 );
if ( addToStore )
{
- schedule1 = store.addSchedule( schedule1 );
+ schedule1 = scheduleDao.addSchedule( schedule1 );
testSchedule1.setId( schedule1.getId() );
}
else
@@ -231,7 +246,7 @@
Schedule schedule3 = createTestSchedule( testSchedule3 );
if ( addToStore )
{
- schedule3 = store.addSchedule( schedule3 );
+ schedule3 = scheduleDao.addSchedule( schedule3 );
testSchedule3.setId( schedule3.getId() );
}
else
@@ -243,7 +258,7 @@
Installation installationJava14 = createTestInstallation( testInstallationJava14 );
if ( addToStore )
{
- installationJava14 = store.addInstallation( installationJava14 );
+ installationJava14 = installationDao.addInstallation( installationJava14 );
}
else
{
@@ -253,7 +268,7 @@
Installation installationMaven20a3 = createTestInstallation( testInstallationMaven20a3 );
if ( addToStore )
{
- installationMaven20a3 = store.addInstallation( installationMaven20a3 );
+ installationMaven20a3 = installationDao.addInstallation( installationMaven20a3 );
}
else
{
@@ -263,7 +278,7 @@
Installation installationJava13 = createTestInstallation( testInstallationJava13 );
if ( addToStore )
{
- installationJava13 = store.addInstallation( installationJava13 );
+ installationJava13 = installationDao.addInstallation( installationJava13 );
}
else
{
@@ -280,7 +295,7 @@
Profile profile1 = createTestProfile( testProfile1 );
if ( addToStore )
{
- profile1 = store.addProfile( profile1 );
+ profile1 = profileDao.addProfile( profile1 );
testProfile1.setId( profile1.getId() );
}
else
@@ -291,7 +306,7 @@
Profile profile2 = createTestProfile( testProfile2 );
if ( addToStore )
{
- profile2 = store.addProfile( profile2 );
+ profile2 = profileDao.addProfile( profile2 );
testProfile2.setId( profile2.getId() );
}
else
@@ -302,7 +317,7 @@
Profile profile3 = createTestProfile( testProfile3 );
if ( addToStore )
{
- profile3 = store.addProfile( profile3 );
+ profile3 = profileDao.addProfile( profile3 );
testProfile3.setId( profile3.getId() );
}
else
@@ -483,11 +498,11 @@
assertProjectEquals( testProject1, projectDao.getProject( testProject1.getId() ) );
assertProjectEquals( testProject2, projectDao.getProject( testProject2.getId() ) );
- assertScheduleEquals( testSchedule1, store.getSchedule( testSchedule1.getId() ) );
- assertScheduleEquals( testSchedule2, store.getSchedule( testSchedule2.getId() ) );
- assertScheduleEquals( testSchedule3, store.getSchedule( testSchedule3.getId() ) );
+ assertScheduleEquals( testSchedule1, scheduleDao.getSchedule( testSchedule1.getId() ) );
+ assertScheduleEquals( testSchedule2, scheduleDao.getSchedule( testSchedule2.getId() ) );
+ assertScheduleEquals( testSchedule3, scheduleDao.getSchedule( testSchedule3.getId() ) );
- Iterator<Installation> iterator = store.getAllInstallations().iterator();
+ Iterator<Installation> iterator = installationDao.getAllInstallations().iterator();
assertInstallationEquals( testInstallationJava13, (Installation) iterator.next() );
assertInstallationEquals( testInstallationJava14, (Installation) iterator.next() );
assertInstallationEquals( testInstallationMaven20a3, (Installation) iterator.next() );
@@ -663,10 +678,10 @@
protected void assertEmpty()
throws ContinuumStoreException
{
- assertEquals( 0, store.getAllInstallations().size() );
- assertEquals( 0, store.getAllProfilesByName().size() );
+ assertEquals( 0, installationDao.getAllInstallations().size() );
+ assertEquals( 0, profileDao.getAllProfilesByName().size() );
assertEquals( 0, projectGroupDao.getAllProjectGroups().size() );
- assertEquals( 0, store.getAllProjectsByName().size() );
+ assertEquals( 0, projectDao.getAllProjectsByName().size() );
assertNull( store.getSystemConfiguration() );
}