continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1160736 - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/dao/ continuum-api/src/main/java/org/apache/maven/continuum/installation/ continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buil...
Date Tue, 23 Aug 2011 15:11:44 GMT
Author: ctan
Date: Tue Aug 23 15:11:43 2011
New Revision: 1160736

URL: http://svn.apache.org/viewvc?rev=1160736&view=rev
Log:
[CONTINUUM-2654] expose some methods via XMLRPC

Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/installation/InstallationService.java
    continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationService.java
    continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/installation/DefaultInstallationService.java
    continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/installation/DefaultInstallationServiceTest.java
    continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
    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
    continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/resources/dozerBeanMapping.xml

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java?rev=1160736&r1=1160735&r2=1160736&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/dao/InstallationDao.java
Tue Aug 23 15:11:43 2011
@@ -45,4 +45,6 @@ public interface InstallationDao
     Installation getInstallation( int installationId )
         throws ContinuumStoreException;
 
+    Installation getInstallation( String installationName )
+                    throws ContinuumStoreException;
 }

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/installation/InstallationService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/installation/InstallationService.java?rev=1160736&r1=1160735&r2=1160736&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/installation/InstallationService.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/installation/InstallationService.java
Tue Aug 23 15:11:43 2011
@@ -60,6 +60,9 @@ public interface InstallationService
     public Installation getInstallation( int installationId )
         throws InstallationException;
 
+    public Installation getInstallation( String installationName )
+        throws InstallationException;
+
     public List<Installation> getAllInstallations()
         throws InstallationException;
 

Modified: continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationService.java?rev=1160736&r1=1160735&r2=1160736&view=diff
==============================================================================
--- continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationService.java
(original)
+++ continuum/trunk/continuum-buildagent/continuum-buildagent-api/src/main/java/org/apache/continuum/buildagent/configuration/BuildAgentConfigurationService.java
Tue Aug 23 15:11:43 2011
@@ -46,7 +46,7 @@ public interface BuildAgentConfiguration
         throws BuildAgentConfigurationException;
 
     List<Installation> getAvailableInstallations();
-    
+
     List<LocalRepository> getLocalRepositories();
 
     String getSharedSecretPassword();

Modified: continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/installation/DefaultInstallationService.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/installation/DefaultInstallationService.java?rev=1160736&r1=1160735&r2=1160736&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/installation/DefaultInstallationService.java
(original)
+++ continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/installation/DefaultInstallationService.java
Tue Aug 23 15:11:43 2011
@@ -202,6 +202,22 @@ public class DefaultInstallationService
     }
 
     /**
+     * @see org.apache.maven.continuum.installation.InstallationService#getInstallation(String)
+     */
+    public Installation getInstallation( String installationName )
+        throws InstallationException
+    {
+        try
+        {
+            return installationDao.getInstallation( installationName );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new InstallationException( e.getMessage(), e );
+        }
+    }
+
+    /**
      * @see org.apache.maven.continuum.installation.InstallationService#update(org.apache.maven.continuum.model.system.Installation)
      */
     public void update( Installation installation )

Modified: continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/installation/DefaultInstallationServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/installation/DefaultInstallationServiceTest.java?rev=1160736&r1=1160735&r2=1160736&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/installation/DefaultInstallationServiceTest.java
(original)
+++ continuum/trunk/continuum-commons/src/test/java/org/apache/continuum/installation/DefaultInstallationServiceTest.java
Tue Aug 23 15:11:43 2011
@@ -78,6 +78,7 @@ public class DefaultInstallationServiceT
         assertEquals( getInstallationService().getEnvVar( InstallationService.JDK_TYPE ),
getted.getVarName() );
         assertEquals( "bar", getted.getVarValue() );
         assertEquals( 1, getInstallationService().getAllInstallations().size() );
+        assertNotNull( getInstallationService().getInstallation( NEW_INSTALLATION_NAME )
);
     }
 
     public void testAddDuplicateInstallation()

Modified: continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java?rev=1160736&r1=1160735&r2=1160736&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java
(original)
+++ continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/InstallationDaoImpl.java
Tue Aug 23 15:11:43 2011
@@ -176,8 +176,6 @@ public class InstallationDaoImpl
 
             Query query = pm.newQuery( extent );
 
-            query.declareImports( "import java.lang.String" );
-
             query.declareParameters( "int installationId" );
 
             query.setFilter( "this.installationId == installationId" );
@@ -202,4 +200,46 @@ public class InstallationDaoImpl
             rollback( tx );
         }
     }
+
+    public Installation getInstallation( String installationName )
+        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( "String name" );
+
+            query.setFilter( "this.name == name" );
+
+            Collection result = (Collection) query.execute( installationName );
+
+            if ( result.size() == 0 )
+            {
+                tx.commit();
+
+                return null;
+            }
+
+            Object object = pm.detachCopy( result.iterator().next() );
+
+            tx.commit();
+
+            return (Installation) object;
+        }
+        finally
+        {
+            rollback( tx );
+        }
+    }
 }

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=1160736&r1=1160735&r2=1160736&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
Tue Aug 23 15:11:43 2011
@@ -30,6 +30,7 @@ import org.apache.continuum.xmlrpc.repos
 import org.apache.continuum.xmlrpc.utils.BuildTrigger;
 import org.apache.maven.continuum.xmlrpc.project.AddingResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildAgentConfiguration;
+import org.apache.maven.continuum.xmlrpc.project.BuildAgentGroupConfiguration;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.xmlrpc.project.BuildProjectTask;
@@ -397,6 +398,24 @@ public interface ContinuumService
         throws Exception;
 
     /**
+     * Get the build definition
+     * @param buildDefinitionId The build definition id
+     * @return The build definition
+     * @throws Exception
+     */
+    BuildDefinition getBuildDefinition( int buildDefinitionId )
+        throws Exception;
+
+    /**
+     * Same method but compatible with standard XMLRPC
+     * @param buildDefinitionId The build definition id
+     * @return The build definition as RPC value
+     * @throws Exception
+     */
+    Map<String, Object> getBuildDefinitionRPC( int buildDefinitionId )
+        throws Exception;
+
+    /**
      * Update a project build definition.
      * 
      * @param projectId The project id
@@ -1043,6 +1062,12 @@ public interface ContinuumService
     Map<String, Object> getProfileRPC( int profileId )
         throws Exception;
 
+    Profile getProfileWithName( String profileName )
+        throws Exception;
+
+    Map<String, Object> getProfileWithNameRPC( String profileName )
+        throws Exception;
+
     Profile addProfile( Profile profile )
         throws Exception;
 
@@ -1101,6 +1126,26 @@ public interface ContinuumService
         throws Exception;
 
     /**
+     * Return the installation defined by this name
+     * 
+     * @param installationName The installation name
+     * @return The installation
+     * @throws Exception
+     */
+    Installation getInstallation( String installationName )
+        throws Exception;
+
+    /**
+     * Same method but compatible with standard XMLRPC
+     * 
+     * @param installationName The installation name
+     * @return The installation
+     * @throws Exception
+     */
+    Map<String, Object> getInstallationRPC( String installationName )
+        throws Exception;
+
+    /**
      * Return the installations list defined by this URL.
      * 
      * @param url The build agent URL
@@ -1807,4 +1852,23 @@ public interface ContinuumService
 
     boolean pingBuildAgent( String buildAgentUrl )
         throws Exception;
+
+    BuildAgentGroupConfiguration addBuildAgentGroup( BuildAgentGroupConfiguration buildAgentGroup
)
+        throws Exception;
+
+    Map<String, Object> addBuildAgentGroupRPC( Map<String, Object> buildAgentGroup
)
+        throws Exception;
+
+    BuildAgentGroupConfiguration getBuildAgentGroup( String name );
+
+    Map<String, Object> getBuildAgentGroupRPC( String name );
+
+    BuildAgentGroupConfiguration updateBuildAgentGroup( BuildAgentGroupConfiguration buildAgentGroup
)
+        throws Exception;
+
+    Map<String, Object> updateBuildAgentGroupRPC( Map<String, Object> buildAgentGroup
)
+        throws Exception;
+
+    void removeBuildAgentGroup( String name )
+        throws Exception;
 }

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml?rev=1160736&r1=1160735&r2=1160736&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
Tue Aug 23 15:11:43 2011
@@ -1016,7 +1016,12 @@
             <type>Installation</type>
             <multiplicity>*</multiplicity>
           </association>
-        </field>          
+        </field>
+        <field>
+          <name>buildAgentGroup</name>
+          <version>1.4.1+</version>
+          <type>String</type>
+        </field>  
       </fields>
     </class>
 
@@ -1504,7 +1509,26 @@
         </field>
       </fields>
     </class>
-
+    <class>
+      <name>BuildAgentGroupConfiguration</name>
+      <version>1.4.1+</version>
+      <packageName>org.apache.maven.continuum.xmlrpc.project</packageName>
+      <fields>
+        <field>
+          <name>name</name>
+          <version>1.4.1+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>buildAgents</name>
+          <version>1.4.1+</version>
+          <association>
+            <type>BuildAgentConfiguration</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
     <class>
       <name>ProjectScmRoot</name>
       <version>1.4.1+</version>

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=1160736&r1=1160735&r2=1160736&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
Tue Aug 23 15:11:43 2011
@@ -33,6 +33,7 @@ import org.apache.continuum.xmlrpc.utils
 import org.apache.maven.continuum.xmlrpc.ContinuumService;
 import org.apache.maven.continuum.xmlrpc.project.AddingResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildAgentConfiguration;
+import org.apache.maven.continuum.xmlrpc.project.BuildAgentGroupConfiguration;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.xmlrpc.project.BuildProjectTask;
@@ -516,6 +517,12 @@ public class ContinuumXmlRpcClient
         return continuum.getProfile( profileId );
     }
 
+    public Profile getProfileWithName( String profileName )
+        throws Exception
+    {
+        return continuum.getProfileWithName( profileName );
+    }
+
     // ----------------------------------------------------------------------
     // Installations
     // ----------------------------------------------------------------------
@@ -532,6 +539,12 @@ public class ContinuumXmlRpcClient
         return continuum.getInstallation( installationId );
     }
 
+    public Installation getInstallation( String installationName )
+        throws Exception
+    {
+        return continuum.getInstallation( installationName );
+    }
+
     public List<Installation> getBuildAgentInstallations( String url )
         throws Exception
     {
@@ -928,6 +941,12 @@ public class ContinuumXmlRpcClient
         return continuum.getInstallationRPC( installationId );
     }
 
+    public Map<String, Object> getInstallationRPC( String installationName )
+        throws Exception
+    {
+        return continuum.getInstallationRPC( installationName );
+    }
+
     public List<Object> getInstallationsRPC()
         throws Exception
     {
@@ -952,6 +971,12 @@ public class ContinuumXmlRpcClient
         return continuum.getProfileRPC( profileId );
     }
 
+    public Map<String, Object> getProfileWithNameRPC( String profileName )
+        throws Exception
+    {
+        return continuum.getProfileWithNameRPC( profileName );
+    }
+
     public List<Object> getProfilesRPC()
         throws Exception
     {
@@ -1377,4 +1402,56 @@ public class ContinuumXmlRpcClient
     {
         return continuum.getBuildAgentUrl( projectId, buildDefinitionId );
     }
+
+    public BuildDefinition getBuildDefinition( int buildDefinitionId )
+        throws Exception
+    {
+        return continuum.getBuildDefinition( buildDefinitionId );
+    }
+
+    public Map<String, Object> getBuildDefinitionRPC( int buildDefinitionId )
+        throws Exception
+    {
+        return continuum.getBuildDefinitionRPC( buildDefinitionId );
+    }
+
+    public BuildAgentGroupConfiguration addBuildAgentGroup( BuildAgentGroupConfiguration
buildAgentGroup )
+        throws Exception
+    {
+        return continuum.addBuildAgentGroup( buildAgentGroup );
+    }
+
+    public Map<String, Object> addBuildAgentGroupRPC( Map<String, Object> buildAgentGroup
)
+        throws Exception
+    {
+        return continuum.addBuildAgentGroupRPC( buildAgentGroup );
+    }
+
+    public BuildAgentGroupConfiguration getBuildAgentGroup( String name )
+    {
+        return continuum.getBuildAgentGroup( name );
+    }
+
+    public Map<String, Object> getBuildAgentGroupRPC( String name )
+    {
+        return continuum.getBuildAgentGroupRPC( name );
+    }
+
+    public BuildAgentGroupConfiguration updateBuildAgentGroup( BuildAgentGroupConfiguration
buildAgentGroup )
+        throws Exception
+    {
+        return continuum.updateBuildAgentGroup( buildAgentGroup );
+    }
+
+    public Map<String, Object> updateBuildAgentGroupRPC( Map<String, Object>
buildAgentGroup )
+        throws Exception
+    {
+        return continuum.updateBuildAgentGroupRPC( buildAgentGroup );
+    }
+
+    public void removeBuildAgentGroup( String name )
+        throws Exception
+    {
+        continuum.removeBuildAgentGroup( name );
+    }
 }

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=1160736&r1=1160735&r2=1160736&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
Tue Aug 23 15:11:43 2011
@@ -39,7 +39,6 @@ import org.apache.continuum.builder.dist
 import org.apache.continuum.buildmanager.BuildManagerException;
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.configuration.BuildAgentConfigurationException;
-import org.apache.continuum.configuration.BuildAgentGroupConfiguration;
 import org.apache.continuum.configuration.ContinuumConfigurationException;
 import org.apache.continuum.dao.SystemConfigurationDao;
 import org.apache.continuum.purge.ContinuumPurgeManagerException;
@@ -67,6 +66,7 @@ import org.apache.maven.continuum.securi
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.xmlrpc.project.AddingResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildAgentConfiguration;
+import org.apache.maven.continuum.xmlrpc.project.BuildAgentGroupConfiguration;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.xmlrpc.project.BuildProjectTask;
@@ -635,6 +635,14 @@ public class ContinuumServiceImpl
         return result;
     }
 
+    public BuildDefinition getBuildDefinition( int buildDefinitionId )
+        throws Exception
+    {
+        org.apache.maven.continuum.model.project.BuildDefinition bd = continuum.getBuildDefinition(
buildDefinitionId );
+
+        return populateBuildDefinition( bd );
+    }
+
     public int removeBuildDefinitionFromProjectGroup( int projectGroupId, int buildDefinitionId
)
         throws ContinuumException
     {
@@ -1165,6 +1173,15 @@ public class ContinuumServiceImpl
         return populateProfile( continuum.getProfileService().getProfile( profileId ) );
     }
 
+    public Profile getProfileWithName( String profileName )
+        throws ContinuumException
+    {
+        checkManageProfilesAuthorization();
+        org.apache.maven.continuum.model.system.Profile profile = 
+                        continuum.getProfileService().getProfileWithName( profileName );
+        return profile != null ? populateProfile( profile ) : null;
+    }
+
     public Profile addProfile( Profile profile )
         throws ContinuumException
     {
@@ -1254,6 +1271,22 @@ public class ContinuumServiceImpl
         }
     }
 
+    public Installation getInstallation( String installationName )
+        throws ContinuumException
+    {
+        checkManageInstallationsAuthorization();
+        try
+        {
+            org.apache.maven.continuum.model.system.Installation install =
+                continuum.getInstallationService().getInstallation( installationName );
+            return install != null ? populateInstallation( install ) : null;
+        }
+        catch ( InstallationException e )
+        {
+            throw new ContinuumException( "Can't load installations", e );
+        }
+    }
+
     public Installation addInstallation( Installation installation )
         throws ContinuumException
     {
@@ -1957,7 +1990,7 @@ public class ContinuumServiceImpl
     }
 
     // ----------------------------------------------------------------------
-    // ConfigurationService
+    // Build agent
     // ----------------------------------------------------------------------
 
     public BuildAgentConfiguration addBuildAgent( BuildAgentConfiguration buildAgentConfiguration
)
@@ -2056,7 +2089,7 @@ public class ContinuumServiceImpl
 
             if ( configurationService.getBuildAgentGroups() != null )
             {
-                for ( BuildAgentGroupConfiguration buildAgentGroup : configurationService.getBuildAgentGroups()
)
+                for ( org.apache.continuum.configuration.BuildAgentGroupConfiguration buildAgentGroup
: configurationService.getBuildAgentGroups() )
                 {
                     if ( configurationService.containsBuildAgentUrl( buildAgentConfiguration.getUrl(),
buildAgentGroup ) )
                     {
@@ -2106,6 +2139,87 @@ public class ContinuumServiceImpl
     }
 
     // ----------------------------------------------------------------------
+    // Build agent group
+    // ----------------------------------------------------------------------
+
+    public BuildAgentGroupConfiguration addBuildAgentGroup( BuildAgentGroupConfiguration
buildAgentGroup )
+        throws ConfigurationException, ConfigurationStoringException, ContinuumConfigurationException
+    {
+        ConfigurationService configurationService = continuum.getConfiguration();
+
+        if ( buildAgentGroup == null )
+        {
+            return null;
+        }
+        try
+        {
+            configurationService.addBuildAgentGroup( populateBuildAgentGroup( buildAgentGroup
) );
+            configurationService.store();
+            return populateBuildAgentGroup( configurationService.getBuildAgentGroup( buildAgentGroup.getName()
) );
+        }
+        catch ( ContinuumException e )
+        {
+            throw new ConfigurationException( "Error in adding buildAgentGroup", e );
+        }
+    }
+
+    public BuildAgentGroupConfiguration getBuildAgentGroup( String name )
+    {
+        ConfigurationService configurationService = continuum.getConfiguration();
+        org.apache.continuum.configuration.BuildAgentGroupConfiguration buildAgentGroup =
+            configurationService.getBuildAgentGroup( name );
+        BuildAgentGroupConfiguration buildAgentGroupConfiguration = buildAgentGroup != null
? populateBuildAgentGroup( buildAgentGroup ) : null;
+        return buildAgentGroupConfiguration;
+    }
+
+    public BuildAgentGroupConfiguration updateBuildAgentGroup( BuildAgentGroupConfiguration
buildAgentGroup ) 
+        throws ConfigurationException, ConfigurationStoringException, ContinuumConfigurationException
+    {
+        try
+        {
+            ConfigurationService configurationService = continuum.getConfiguration();
+            org.apache.continuum.configuration.BuildAgentGroupConfiguration buildAgentGroupConfiguration
=
+                configurationService.getBuildAgentGroup( buildAgentGroup.getName() );
+    
+            if ( buildAgentGroupConfiguration != null )
+            {
+                buildAgentGroupConfiguration.setName( StringEscapeUtils.escapeXml( buildAgentGroup.getName()
) );
+                if ( buildAgentGroup.getBuildAgents() != null )
+                {
+                    buildAgentGroupConfiguration.getBuildAgents().clear();
+                    for ( BuildAgentConfiguration buildAgent : buildAgentGroup.getBuildAgents()
)
+                    {
+                        buildAgentGroupConfiguration.getBuildAgents().add( populateBuildAgent(
buildAgent ) );
+                    }
+                }
+                else
+                {
+                    buildAgentGroupConfiguration.setBuildAgents( null );
+                }
+                configurationService.updateBuildAgentGroup( buildAgentGroupConfiguration
);
+                configurationService.store();
+                return populateBuildAgentGroup( configurationService.getBuildAgentGroup(
buildAgentGroup.getName() ) );
+            }
+            else
+            {
+                return null;
+            }
+        }
+        catch ( ContinuumException e )
+        {
+            throw new ContinuumConfigurationException( "Error in updating build agent group
" + buildAgentGroup.getName(), e );
+        }
+    }
+
+    public void removeBuildAgentGroup( String name ) 
+        throws ConfigurationException
+    {
+        ConfigurationService configurationService = continuum.getConfiguration();
+        org.apache.continuum.configuration.BuildAgentGroupConfiguration buildAgentGroupConfiguration
=
+            configurationService.getBuildAgentGroup( name );
+        configurationService.removeBuildAgentGroup( buildAgentGroupConfiguration );
+    }
+    // ----------------------------------------------------------------------
     // Converters
     // ----------------------------------------------------------------------
 
@@ -2462,6 +2576,7 @@ public class ContinuumServiceImpl
             newProfile.setDescription( StringEscapeUtils.escapeXml( profile.getDescription()
) );
             newProfile.setName( profile.getName() );
             newProfile.setScmMode( profile.getScmMode() );
+            newProfile.setBuildAgentGroup( profile.getBuildAgentGroup() );
             if ( profile.getBuilder() != null )
             {
                 final org.apache.maven.continuum.model.system.Installation newBuilder =
@@ -2762,6 +2877,40 @@ public class ContinuumServiceImpl
         }
     }
 
+    private org.apache.continuum.configuration.BuildAgentGroupConfiguration populateBuildAgentGroup(
BuildAgentGroupConfiguration buildAgentGroup )
+        throws ContinuumException
+    {
+        if ( buildAgentGroup == null )
+        {
+            return null;
+        }
+
+        org.apache.continuum.configuration.BuildAgentGroupConfiguration buildAgentGroupConfiguration
=
+            new org.apache.continuum.configuration.BuildAgentGroupConfiguration();
+
+        if ( StringUtils.isBlank( buildAgentGroup.getName() ) )
+        {
+            throw new ContinuumException( "Build agent group name is required" );
+        }
+
+        buildAgentGroupConfiguration.setName( StringEscapeUtils.escapeXml( buildAgentGroup.getName()
) );
+
+        buildAgentGroupConfiguration.getBuildAgents().clear();
+        if ( buildAgentGroup.getBuildAgents() != null )
+        {
+            for( BuildAgentConfiguration buildAgent : buildAgentGroup.getBuildAgents() )
+            {
+                buildAgentGroupConfiguration.getBuildAgents().add( populateBuildAgent( buildAgent
) );
+            }
+        }
+        return buildAgentGroupConfiguration;
+    }
+    
+    private BuildAgentGroupConfiguration populateBuildAgentGroup( org.apache.continuum.configuration.BuildAgentGroupConfiguration
buildAgentGroup )
+    {
+        return (BuildAgentGroupConfiguration) mapper.map( buildAgentGroup, BuildAgentGroupConfiguration.class
);
+    }
+
     private Map<String, Object> serializeObject( Object o, final String... ignore )
     {
         if ( o != null )
@@ -3268,6 +3417,12 @@ public class ContinuumServiceImpl
         return serializeObject( this.getBuildDefinitionsForProject( projectId ) );
     }
 
+    public Map<String, Object> getBuildDefinitionRPC( int buildDefinitionId )
+        throws Exception
+    {
+        return serializeObject( this.getBuildDefinition( buildDefinitionId ) );
+    }
+
     public Map<String, Object> getBuildResultRPC( int projectId, int buildId )
         throws Exception
     {
@@ -3286,6 +3441,12 @@ public class ContinuumServiceImpl
         return serializeObject( this.getInstallation( installationId ) );
     }
 
+    public Map<String, Object> getInstallationRPC( String installationName )
+        throws Exception
+    {
+        return serializeObject( this.getInstallation( installationName ) );
+    }
+
     public List<Object> getInstallationsRPC()
         throws Exception
     {
@@ -3310,6 +3471,12 @@ public class ContinuumServiceImpl
         return serializeObject( this.getProfile( profileId ) );
     }
 
+    public Map<String, Object> getProfileWithNameRPC( String profileName )
+        throws Exception
+    {
+        return serializeObject( this.getProfileWithName( profileName ) );
+    }
+
     public List<Object> getProfilesRPC()
         throws Exception
     {
@@ -3582,6 +3749,23 @@ public class ContinuumServiceImpl
         return serializeObject( this.getAllBuildAgents() );
     }
 
+    public Map<String, Object> addBuildAgentGroupRPC( Map<String, Object> buildAgentGroup
) 
+        throws ConfigurationException, ConfigurationStoringException, ContinuumConfigurationException
+    {
+        return serializeObject( this.addBuildAgentGroup( (BuildAgentGroupConfiguration) unserializeObject(
buildAgentGroup ) ) );
+    }
+
+    public Map<String, Object> getBuildAgentGroupRPC( String name )
+    {
+        return serializeObject( this.getBuildAgentGroup( name ) );
+    }
+
+    public Map<String, Object> updateBuildAgentGroupRPC( Map<String, Object>
buildAgentGroup )
+        throws ConfigurationException, ConfigurationStoringException, ContinuumConfigurationException
+    {
+        return serializeObject( this.updateBuildAgentGroup( (BuildAgentGroupConfiguration)
unserializeObject( buildAgentGroup ) ) );
+    }
+
     public String releasePrepare( int projectId, Properties releaseProperties, Map<String,
String> releaseVersions,
                                   Map<String, String> developmentVersions, Map<String,
String> environments,
                                   String username )

Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/resources/dozerBeanMapping.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/resources/dozerBeanMapping.xml?rev=1160736&r1=1160735&r2=1160736&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/resources/dozerBeanMapping.xml
(original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/resources/dozerBeanMapping.xml
Tue Aug 23 15:11:43 2011
@@ -271,4 +271,15 @@
     <class-a>org.apache.maven.continuum.xmlrpc.project.BuildAgentConfiguration</class-a>
     <class-b>org.apache.continuum.configuration.BuildAgentConfiguration</class-b>
   </mapping>
+
+  <mapping>
+    <class-a>org.apache.maven.continuum.xmlrpc.project.BuildAgentGroupConfiguration</class-a>
+    <class-b>org.apache.continuum.configuration.BuildAgentGroupConfiguration</class-b>
+    <field>
+      <a>buildAgents</a>
+      <b>buildAgents</b>
+      <a-hint>org.apache.maven.continuum.xmlrpc.project.BuildAgentConfiguration</a-hint>
+      <b-hint>org.apache.continuum.configuration.BuildAgentConfiguration</b-hint>
+    </field>
+  </mapping>
 </mappings>



Mime
View raw message