continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r554947 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/profile/ continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/ ...
Date Tue, 10 Jul 2007 13:58:02 GMT
Author: evenisse
Date: Tue Jul 10 06:57:57 2007
New Revision: 554947

URL: http://svn.apache.org/viewvc?view=rev&rev=554947
Log:
Add read access to profiles and schedules

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/profile/ProfileException.java
    maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
    maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
    maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
    maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/profile/ProfileException.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/profile/ProfileException.java?view=diff&rev=554947&r1=554946&r2=554947
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/profile/ProfileException.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/profile/ProfileException.java
Tue Jul 10 06:57:57 2007
@@ -18,13 +18,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
+import org.apache.maven.continuum.ContinuumException;
+
 /**
  * @author <a href="mailto:olamy@codehaus.org">olamy</a>
  * @version $Id$
  * @since 15 juin 07
  */
 public class ProfileException
-    extends Exception
+    extends ContinuumException
 {
 
     public ProfileException( String message, Throwable throwable )
@@ -36,10 +39,4 @@
     {
         super( message );
     }
-
-    public ProfileException( Throwable throwable )
-    {
-        super( throwable );
-    }
-
 }

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java?view=diff&rev=554947&r1=554946&r2=554947
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumService.java
Tue Jul 10 06:57:57 2007
@@ -27,6 +27,8 @@
 import org.apache.maven.continuum.xmlrpc.project.ProjectGroup;
 import org.apache.maven.continuum.xmlrpc.project.ProjectGroupSummary;
 import org.apache.maven.continuum.xmlrpc.project.ProjectSummary;
+import org.apache.maven.continuum.xmlrpc.project.Schedule;
+import org.apache.maven.continuum.xmlrpc.system.Profile;
 import org.apache.xmlrpc.XmlRpcException;
 
 import java.util.List;
@@ -443,8 +445,54 @@
     // ----------------------------------------------------------------------
 
     // ----------------------------------------------------------------------
-    // TODO:Schedule
+    // Schedules
     // ----------------------------------------------------------------------
+
+    /**
+     * Return the schedules list.
+     *
+     * @return The schedule list.
+     * @throws ContinuumException
+     * @throws XmlRpcException
+     */
+    List getSchedules()
+        throws ContinuumException, XmlRpcException;
+
+    /**
+     * Return the schedule defined by this id.
+     *
+     * @param scheduleId The schedule id
+     * @return The schedule.
+     * @throws ContinuumException
+     * @throws XmlRpcException
+     */
+    Schedule getSchedule( int scheduleId )
+        throws ContinuumException, XmlRpcException;
+
+    // ----------------------------------------------------------------------
+    // Profiles
+    // ----------------------------------------------------------------------
+
+    /**
+     * Return the profiles list.
+     *
+     * @return The profiles list.
+     * @throws ContinuumException
+     * @throws XmlRpcException
+     */
+    List getProfiles()
+        throws ContinuumException, XmlRpcException;
+
+    /**
+     * Return the profile defined by this id.
+     *
+     * @param profileId The profile id
+     * @return The profile.
+     * @throws ContinuumException
+     * @throws XmlRpcException
+     */
+    Profile getProfile( int profileId )
+        throws ContinuumException, XmlRpcException;
 
     // ----------------------------------------------------------------------
     // TODO:Users

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml?view=diff&rev=554947&r1=554946&r2=554947
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/mdo/continuum-service.xml
Tue Jul 10 06:57:57 2007
@@ -965,6 +965,7 @@
 
     <class>
       <name>Profile</name>
+      <packageName>org.apache.maven.continuum.xmlrpc.system</packageName>
       <version>1.1.0+</version>
       <fields>
         <field>
@@ -997,6 +998,57 @@
           <name>buildWithoutChanges</name>
           <version>1.1.0+</version>
           <type>boolean</type>
+        </field>
+        <field>
+          <name>jdk</name>
+          <version>1.1.0+</version>
+          <association xml.reference="true">
+            <type>Installation</type>
+          </association>
+        </field>
+        <field>
+          <name>builder</name>
+          <version>1.1.0+</version>
+          <association xml.reference="true">
+            <type>Installation</type>
+          </association>
+        </field>
+        <field>
+          <name>environmentVariables</name>
+          <version>1.1.0+</version>
+          <association xml.reference="true">
+            <type>Installation</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>          
+      </fields>
+    </class>
+
+    <class>
+      <name>Installation</name>
+      <packageName>org.apache.maven.continuum.xmlrpc.system</packageName>
+      <version>1.1.0+</version>
+      <fields>
+        <field>
+          <name>type</name>
+          <version>1.1.0+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>varValue</name>
+          <version>1.1.0+</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>varName</name>
+          <version>1.1.0+</version>
+          <type>String</type>
+        </field>          
+        <field>
+          <name>name</name>
+          <version>1.1.0+</version>
+          <type>String</type>
+          <identifier>true</identifier>
         </field>
       </fields>
     </class>

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java?view=diff&rev=554947&r1=554946&r2=554947
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/ContinuumXmlRpcClient.java
Tue Jul 10 06:57:57 2007
@@ -29,6 +29,9 @@
 import org.apache.maven.continuum.xmlrpc.project.ProjectGroup;
 import org.apache.maven.continuum.xmlrpc.project.ProjectGroupSummary;
 import org.apache.maven.continuum.xmlrpc.project.ProjectSummary;
+import org.apache.maven.continuum.xmlrpc.project.Schedule;
+import org.apache.maven.continuum.xmlrpc.system.Profile;
+import org.apache.xmlrpc.XmlRpcException;
 import org.apache.xmlrpc.client.XmlRpcClient;
 import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
 import org.apache.xmlrpc.client.util.ClientFactory;
@@ -601,6 +604,65 @@
         try
         {
             return continuum.addShellProject( project, projectGroupId );
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumException( "The remote method failed.", e );
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    // Schedules
+    // ----------------------------------------------------------------------
+
+    public List getSchedules()
+        throws ContinuumException
+    {
+        try
+        {
+            return continuum.getSchedules();
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumException( "The remote method failed.", e );
+        }
+    }
+
+    public Schedule getSchedule( int scheduleId )
+        throws ContinuumException
+    {
+        try
+        {
+            return continuum.getSchedule( scheduleId );
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumException( "The remote method failed.", e );
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    // Profiles
+    // ----------------------------------------------------------------------
+    public List getProfiles()
+        throws ContinuumException, XmlRpcException
+    {
+        try
+        {
+            return continuum.getProfiles();
+        }
+        catch ( Exception e )
+        {
+            throw new ContinuumException( "The remote method failed.", e );
+        }
+    }
+
+    public Profile getProfile( int profileId )
+        throws ContinuumException, XmlRpcException
+    {
+        try
+        {
+            return continuum.getProfile( profileId );
         }
         catch ( Exception e )
         {

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?view=diff&rev=554947&r1=554946&r2=554947
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Tue Jul 10 06:57:57 2007
@@ -35,9 +35,12 @@
 import org.apache.maven.continuum.xmlrpc.project.ProjectGroupSummary;
 import org.apache.maven.continuum.xmlrpc.project.ProjectNotifier;
 import org.apache.maven.continuum.xmlrpc.project.ProjectSummary;
+import org.apache.maven.continuum.xmlrpc.project.Schedule;
 import org.apache.maven.continuum.xmlrpc.scm.ChangeFile;
 import org.apache.maven.continuum.xmlrpc.scm.ChangeSet;
 import org.apache.maven.continuum.xmlrpc.scm.ScmResult;
+import org.apache.maven.continuum.xmlrpc.system.Installation;
+import org.apache.maven.continuum.xmlrpc.system.Profile;
 import org.apache.maven.continuum.xmlrpc.test.SuiteResult;
 import org.apache.maven.continuum.xmlrpc.test.TestCaseFailure;
 import org.apache.maven.continuum.xmlrpc.test.TestResult;
@@ -364,6 +367,11 @@
     {
         checkAddProjectBuildDefinitionAuthorization( getProjectSummary( projectId ).getName()
);
 
+        if ( buildDef.getSchedule() == null )
+        {
+            throw new ContinuumException( "The schedule can't be null." );
+        }
+
         org.apache.maven.continuum.model.project.BuildDefinition bd = populateBuildDefinition(
buildDef );
         bd = continuum.addBuildDefinitionToProject( projectId, bd );
         return populateBuildDefinition( bd );
@@ -374,6 +382,11 @@
     {
         checkAddGroupBuildDefinitionAuthorization( getPGSummary( projectGroupId ).getName()
);
 
+        if ( buildDef.getSchedule() == null )
+        {
+            throw new ContinuumException( "The schedule can't be null." );
+        }
+
         org.apache.maven.continuum.model.project.BuildDefinition bd = populateBuildDefinition(
buildDef );
         bd = continuum.addBuildDefinitionToProjectGroup( projectGroupId, bd );
         return populateBuildDefinition( bd );
@@ -568,6 +581,54 @@
     }
 
     // ----------------------------------------------------------------------
+    // Schedules
+    // ----------------------------------------------------------------------
+
+    public List getSchedules()
+        throws ContinuumException
+    {
+        Collection schedules = continuum.getSchedules();
+
+        List s = new ArrayList();
+        for ( Iterator i = schedules.iterator(); i.hasNext(); )
+        {
+            s.add( populateSchedule( (org.apache.maven.continuum.model.project.Schedule)
i.next() ) );
+        }
+
+        return s;
+    }
+
+    public Schedule getSchedule( int scheduleId )
+        throws ContinuumException
+    {
+        return populateSchedule( continuum.getSchedule( scheduleId ) );
+    }
+
+    // ----------------------------------------------------------------------
+    // Profiles
+    // ----------------------------------------------------------------------
+
+    public List getProfiles()
+        throws ContinuumException
+    {
+        Collection profiles = continuum.getProfileService().getAllProfiles();
+
+        List p = new ArrayList();
+        for ( Iterator i = profiles.iterator(); i.hasNext(); )
+        {
+            p.add( populateProfile( (org.apache.maven.continuum.model.system.Profile) i.next()
) );
+        }
+
+        return p;
+    }
+
+    public Profile getProfile( int profileId )
+        throws ContinuumException
+    {
+        return populateProfile( continuum.getProfileService().getProfile( profileId ) );
+    }
+
+    // ----------------------------------------------------------------------
     // Converters
     // ----------------------------------------------------------------------
 
@@ -1034,8 +1095,8 @@
         bd.setBuildFresh( buildDef.isBuildFresh() );
         bd.setDefaultForProject( buildDef.isDefaultForProject() );
         bd.setGoals( buildDef.getGoals() );
-        //TODO: bd.setProfile( populateProfile( buildDef.getProfile() ) );
-        //TODO: bd.setSchedule( populateSchedule( buildDef.getSchedule() ) );
+        bd.setProfile( populateProfile( buildDef.getProfile() ) );
+        bd.setSchedule( populateSchedule( buildDef.getSchedule() ) );
         return bd;
     }
 
@@ -1053,8 +1114,131 @@
         bd.setBuildFresh( buildDef.isBuildFresh() );
         bd.setDefaultForProject( buildDef.isDefaultForProject() );
         bd.setGoals( buildDef.getGoals() );
-        //TODO: bd.setProfile( populateProfile( buildDef.getProfile() ) );
-        //TODO: bd.setSchedule( populateSchedule( buildDef.getSchedule() ) );
+        bd.setProfile( populateProfile( buildDef.getProfile() ) );
+        bd.setSchedule( populateSchedule( buildDef.getSchedule() ) );
         return bd;
+    }
+
+    private org.apache.maven.continuum.model.project.Schedule populateSchedule( Schedule
schedule )
+    {
+        if ( schedule == null )
+        {
+            return null;
+        }
+
+        org.apache.maven.continuum.model.project.Schedule s = new org.apache.maven.continuum.model.project.Schedule();
+        s.setActive( schedule.isActive() );
+        s.setCronExpression( schedule.getCronExpression() );
+        s.setDelay( schedule.getDelay() );
+        s.setDescription( schedule.getDescription() );
+        s.setId( schedule.getId() );
+        s.setMaxJobExecutionTime( schedule.getMaxJobExecutionTime() );
+        s.setName( schedule.getName() );
+        return s;
+    }
+
+    private Schedule populateSchedule( org.apache.maven.continuum.model.project.Schedule
schedule )
+    {
+        if ( schedule == null )
+        {
+            return null;
+        }
+
+        Schedule s = new Schedule();
+        s.setActive( schedule.isActive() );
+        s.setCronExpression( schedule.getCronExpression() );
+        s.setDelay( schedule.getDelay() );
+        s.setDescription( schedule.getDescription() );
+        s.setId( schedule.getId() );
+        s.setMaxJobExecutionTime( schedule.getMaxJobExecutionTime() );
+        s.setName( schedule.getName() );
+        return s;
+    }
+
+    public org.apache.maven.continuum.model.system.Profile populateProfile( Profile profile
)
+    {
+        if ( profile == null )
+        {
+            return null;
+        }
+
+        org.apache.maven.continuum.model.system.Profile p = new org.apache.maven.continuum.model.system.Profile();
+        p.setActive( profile.isActive() );
+        p.setBuilder( populateInstallation( profile.getBuilder() ) );
+        p.setBuildWithoutChanges( profile.isBuildWithoutChanges() );
+        p.setDescription( profile.getDescription() );
+        if ( profile.getEnvironmentVariables() != null )
+        {
+            List envs = new ArrayList();
+            for ( Iterator i = profile.getEnvironmentVariables().iterator(); i.hasNext();
)
+            {
+                envs.add( populateInstallation( (Installation) i.next() ) );
+            }
+            p.setEnvironmentVariables( envs );
+        }
+        p.setId( profile.getId() );
+        p.setJdk( populateInstallation( profile.getJdk() ) );
+        p.setName( profile.getName() );
+        p.setScmMode( profile.getScmMode() );
+        return p;
+    }
+
+    public Profile populateProfile( org.apache.maven.continuum.model.system.Profile profile
)
+    {
+        if ( profile == null )
+        {
+            return null;
+        }
+
+        Profile p = new Profile();
+        p.setActive( profile.isActive() );
+        p.setBuilder( populateInstallation( profile.getBuilder() ) );
+        p.setBuildWithoutChanges( profile.isBuildWithoutChanges() );
+        p.setDescription( profile.getDescription() );
+        if ( profile.getEnvironmentVariables() != null )
+        {
+            List envs = new ArrayList();
+            for ( Iterator i = profile.getEnvironmentVariables().iterator(); i.hasNext();
)
+            {
+                envs.add( populateInstallation( (org.apache.maven.continuum.model.system.Installation)
i.next() ) );
+            }
+            p.setEnvironmentVariables( envs );
+        }
+        p.setId( profile.getId() );
+        p.setJdk( populateInstallation( profile.getJdk() ) );
+        p.setName( profile.getName() );
+        p.setScmMode( profile.getScmMode() );
+        return p;
+    }
+
+    public org.apache.maven.continuum.model.system.Installation populateInstallation( Installation
install )
+    {
+        if ( install == null )
+        {
+            return null;
+        }
+
+        org.apache.maven.continuum.model.system.Installation inst =
+            new org.apache.maven.continuum.model.system.Installation();
+        inst.setName( install.getName() );
+        inst.setType( install.getType() );
+        inst.setVarName( install.getVarName() );
+        inst.setVarValue( install.getVarValue() );
+        return inst;
+    }
+
+    public Installation populateInstallation( org.apache.maven.continuum.model.system.Installation
install )
+    {
+        if ( install == null )
+        {
+            return null;
+        }
+
+        Installation inst = new Installation();
+        inst.setName( install.getName() );
+        inst.setType( install.getType() );
+        inst.setVarName( install.getVarName() );
+        inst.setVarValue( install.getVarValue() );
+        return inst;
     }
 }



Mime
View raw message