continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1035889 - in /continuum/trunk: continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/ continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ continuum-xmlrpc/continuum-xmlrpc-client/s...
Date Wed, 17 Nov 2010 00:45:59 GMT
Author: ctan
Date: Wed Nov 17 00:45:59 2010
New Revision: 1035889

URL: http://svn.apache.org/viewvc?rev=1035889&view=rev
Log:
[CONTINUUM-2582] ability to check if project is in queue or is currently preparing/building
with distributed builds enabled

Modified:
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java?rev=1035889&r1=1035888&r2=1035889&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/builder/distributed/manager/DefaultDistributedBuildManager.java
Wed Nov 17 00:45:59 2010
@@ -853,7 +853,7 @@ public class DefaultDistributedBuildMana
                             int pid = ContinuumBuildConstant.getProjectId( context );
                             int buildId = ContinuumBuildConstant.getBuildDefinitionId( context
);
 
-                            if ( pid == projectId && buildId == buildDefinitionId
)
+                            if ( pid == projectId && ( buildId == buildDefinitionId
|| buildDefinitionId == -1 ) )
                             {
                                 found = true;
                                 break;
@@ -900,7 +900,8 @@ public class DefaultDistributedBuildMana
         {
             for ( BuildProjectTask task : map.get( url ) )
             {
-                if ( task.getProjectId() == projectId && task.getBuildDefinitionId()
== buildDefinitionId )
+                if ( task.getProjectId() == projectId && 
+                   ( buildDefinitionId == -1 || task.getBuildDefinitionId() == buildDefinitionId
) )
                 {
                     return true;
                 }
@@ -931,7 +932,7 @@ public class DefaultDistributedBuildMana
                             int pid = ContinuumBuildConstant.getProjectId( context );
                             int buildId = ContinuumBuildConstant.getBuildDefinitionId( context
);
     
-                            if ( pid == projectId && buildId == buildDefinitionId
)
+                            if ( pid == projectId && ( buildDefinitionId == -1 ||
buildId == buildDefinitionId ) )
                             {
                                 found = true;
                                 break;
@@ -977,7 +978,8 @@ public class DefaultDistributedBuildMana
         {
             BuildProjectTask task = map.get( url );
 
-            if ( task.getProjectId() == projectId && task.getBuildDefinitionId()
== buildDefinitionId )
+            if ( task.getProjectId() == projectId && 
+               ( buildDefinitionId == -1 || task.getBuildDefinitionId() == buildDefinitionId
) )
             {
                 return true;
             }

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java?rev=1035889&r1=1035888&r2=1035889&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
Wed Nov 17 00:45:59 2010
@@ -1078,6 +1078,25 @@ public interface ContinuumService
         throws Exception;
 
     /**
+     * Return true if the project is currently preparing build
+     * 
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+    boolean isProjectCurrentlyPreparingBuild( int projectId )
+        throws Exception;
+
+    /**
+     * Return true if the project is currently building
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+    boolean isProjectCurrentlyBuilding( int projectId )
+        throws Exception;
+
+    /**
      * Return projects building queue.
      *
      * @throws ContinuumException

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java?rev=1035889&r1=1035888&r2=1035889&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
Wed Nov 17 00:45:59 2010
@@ -536,6 +536,18 @@ public class ContinuumXmlRpcClient
         return continuum.isProjectInBuildingQueue( projectId );
     }
 
+    public boolean isProjectCurrentlyPreparingBuild( int projectId )
+        throws Exception
+    {
+        return continuum.isProjectCurrentlyPreparingBuild( projectId );
+    }
+
+    public boolean isProjectCurrentlyBuilding( int projectId )
+        throws Exception
+    {
+        return continuum.isProjectCurrentlyBuilding( projectId );
+    }
+
     public int removeProjectsFromBuildingQueue( int[] projectsId )
         throws Exception
     {

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?rev=1035889&r1=1035888&r2=1035889&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Wed Nov 17 00:45:59 2010
@@ -33,6 +33,7 @@ import java.util.Set;
 
 import org.apache.continuum.buildagent.NoBuildAgentException;
 import org.apache.continuum.buildagent.NoBuildAgentInGroupException;
+import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.continuum.buildmanager.BuildManagerException;
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.dao.SystemConfigurationDao;
@@ -111,6 +112,11 @@ public class ContinuumServiceImpl
      */
     private BuildsManager parallelBuildsManager;
 
+    /**
+     * @plexus.requirement
+     */
+    private DistributedBuildManager distributedBuildManager;
+
     public boolean ping()
         throws ContinuumException
     {
@@ -693,7 +699,12 @@ public class ContinuumServiceImpl
         org.apache.maven.continuum.model.project.BuildResult buildResult =
             continuum.getLatestBuildResultForProject( projectId );
 
-        return getBuildResult( projectId, buildResult.getId() );
+        if ( buildResult != null )
+        {
+            return getBuildResult( projectId, buildResult.getId() );
+        }
+
+        return null;
     }
 
     public BuildResult getBuildResult( int projectId, int buildId )
@@ -1099,7 +1110,14 @@ public class ContinuumServiceImpl
     {
         try
         {
-            return parallelBuildsManager.isInPrepareBuildQueue( projectId );
+            if ( continuum.getConfiguration().isDistributedBuildEnabled() )
+            {
+                return distributedBuildManager.isProjectInAnyPrepareBuildQueue( projectId,
-1 );
+            }
+            else
+            {
+                return parallelBuildsManager.isInPrepareBuildQueue( projectId );
+            }
         }
         catch ( BuildManagerException e )
         {
@@ -1112,7 +1130,54 @@ public class ContinuumServiceImpl
     {
         try
         {
-            return parallelBuildsManager.isInAnyBuildQueue( projectId );
+            if ( continuum.getConfiguration().isDistributedBuildEnabled() )
+            {
+                return distributedBuildManager.isProjectInAnyBuildQueue( projectId, -1 );
+            }
+            else
+            {
+                return parallelBuildsManager.isInAnyBuildQueue( projectId );
+            }
+        }
+        catch ( BuildManagerException e )
+        {
+            throw new ContinuumException( e.getMessage(), e );
+        }
+    }
+
+    public boolean isProjectCurrentlyPreparingBuild( int projectId )
+        throws ContinuumException
+    {
+        try
+        {
+            if ( continuum.getConfiguration().isDistributedBuildEnabled() )
+            {
+                return distributedBuildManager.isProjectCurrentlyPreparingBuild( projectId,
-1 );
+            }
+            else
+            {
+                return parallelBuildsManager.isProjectCurrentlyPreparingBuild( projectId
);
+            }
+        }
+        catch ( BuildManagerException e )
+        {
+            throw new ContinuumException( e.getMessage(), e );
+        }
+    }
+
+    public boolean isProjectCurrentlyBuilding( int projectId )
+        throws ContinuumException
+    {
+        try
+        {
+            if ( continuum.getConfiguration().isDistributedBuildEnabled() )
+            {
+                return distributedBuildManager.isProjectInAnyBuildQueue( projectId, -1 );
+            }
+            else
+            {
+                return parallelBuildsManager.isProjectInAnyCurrentBuild( projectId );
+            }
         }
         catch ( BuildManagerException e )
         {



Mime
View raw message