continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r731877 - in /continuum/branches/continuum-parallel-builds: continuum-commons/src/main/java/org/apache/continuum/buildqueue/ continuum-core/src/main/java/org/apache/continuum/buildqueue/ continuum-core/src/main/java/org/apache/maven/continuum/
Date Tue, 06 Jan 2009 08:41:19 GMT
Author: oching
Date: Tue Jan  6 00:41:18 2009
New Revision: 731877

URL: http://svn.apache.org/viewvc?rev=731877&view=rev
Log:
moved BuildQueueService to continuum-commons

Added:
    continuum/branches/continuum-parallel-builds/continuum-commons/src/main/java/org/apache/continuum/buildqueue/
    continuum/branches/continuum-parallel-builds/continuum-commons/src/main/java/org/apache/continuum/buildqueue/DefaultBuildQueueService.java
Removed:
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildqueue/
Modified:
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java

Added: continuum/branches/continuum-parallel-builds/continuum-commons/src/main/java/org/apache/continuum/buildqueue/DefaultBuildQueueService.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-commons/src/main/java/org/apache/continuum/buildqueue/DefaultBuildQueueService.java?rev=731877&view=auto
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-commons/src/main/java/org/apache/continuum/buildqueue/DefaultBuildQueueService.java
(added)
+++ continuum/branches/continuum-parallel-builds/continuum-commons/src/main/java/org/apache/continuum/buildqueue/DefaultBuildQueueService.java
Tue Jan  6 00:41:18 2009
@@ -0,0 +1,141 @@
+package org.apache.continuum.buildqueue;
+
+/*
+ * 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 java.util.List;
+
+import org.apache.continuum.dao.BuildQueueDao;
+import org.apache.continuum.dao.ScheduleDao;
+import org.apache.maven.continuum.model.project.BuildQueue;
+import org.apache.maven.continuum.model.project.Schedule;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+/**
+ * DefaultBuildQueueService
+ * 
+ * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
+ * @plexus.component role="org.apache.continuum.buildqueue.BuildQueueService"
+ */
+public class DefaultBuildQueueService
+    implements BuildQueueService
+{
+    /**
+     * @plexus.requirement
+     */
+    private BuildQueueDao buildQueueDao;
+    
+    /**
+     * @plexus.requirement
+     */
+    private ScheduleDao scheduleDao;
+
+    public BuildQueue addBuildQueue( BuildQueue buildQueue )
+        throws BuildQueueServiceException
+    {        
+        try
+        {
+            return buildQueueDao.addBuildQueue( buildQueue );
+        } 
+        catch ( ContinuumStoreException e )
+        {
+            throw new BuildQueueServiceException( e );
+        }
+    }
+
+    public List<BuildQueue> getAllBuildQueues()
+        throws BuildQueueServiceException
+    {
+        try
+        {
+            return buildQueueDao.getAllBuildQueues();
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new BuildQueueServiceException( e );
+        }
+    }
+
+    public BuildQueue getBuildQueue( int buildQueueId )
+        throws BuildQueueServiceException
+    {
+        try
+        {
+            return buildQueueDao.getBuildQueue( buildQueueId );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new BuildQueueServiceException( e );
+        }
+    }
+
+    public BuildQueue getBuildQueueByName( String buildQueueName )
+        throws BuildQueueServiceException
+    {
+        try
+        {
+            return buildQueueDao.getBuildQueueByName( buildQueueName );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new BuildQueueServiceException( e );
+        }
+    }
+
+    public void removeBuildQueue( BuildQueue buildQueue )
+        throws BuildQueueServiceException
+    {   
+        try
+        {
+            // detach from schedule(s) first
+            List<Schedule> schedules = scheduleDao.getAllSchedulesByName();
+            for( Schedule schedule : schedules )
+            {
+                List<BuildQueue> buildQueues = schedule.getBuildQueues();
+                if( buildQueues.contains( buildQueue ) )
+                {
+                    buildQueues.remove( buildQueue );
+                }
+                schedule.setBuildQueues( buildQueues );
+                
+                scheduleDao.updateSchedule( schedule );
+            }        
+        
+            buildQueueDao.removeBuildQueue( buildQueue );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new BuildQueueServiceException( e );
+        }
+    }
+
+    public BuildQueue updateBuildQueue( BuildQueue buildQueue )
+        throws BuildQueueServiceException
+    {
+        try
+        {
+            return buildQueueDao.storeBuildQueue( buildQueue );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new BuildQueueServiceException( e );
+        }
+    }
+
+}

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=731877&r1=731876&r2=731877&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Tue Jan  6 00:41:18 2009
@@ -675,8 +675,6 @@
             BuildDefinition buildDefinition = buildDefinitionDao.getDefaultBuildDefinition(
projectId );
             context.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinition );
             
-            // TODO: deng parallel builds 
-            // - add default build definition of project (schedule is attached to the build
def) to context!
             executeAction( "add-project-to-checkout-queue", context );
         }
         catch ( ContinuumStoreException e )



Mime
View raw message