continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r593480 - in /maven/continuum/trunk/continuum-xmlrpc: continuum-xmlrpc-api/src/main/java/org/apache/maven/continuum/xmlrpc/ continuum-xmlrpc-api/src/main/mdo/ continuum-xmlrpc-api/src/main/resources/ continuum-xmlrpc-backup/src/main/java/or...
Date Fri, 09 Nov 2007 10:25:42 GMT
Author: evenisse
Date: Fri Nov  9 02:25:41 2007
New Revision: 593480

URL: http://svn.apache.org/viewvc?rev=593480&view=rev
Log:
Backup build definitions templates

Modified:
    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-api/src/main/resources/dozerBeanMapping.xml
    maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java
    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/AbstractContinuumSecureService.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-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?rev=593480&r1=593479&r2=593480&view=diff
==============================================================================
--- 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
Fri Nov  9 02:25:41 2007
@@ -21,6 +21,7 @@
 
 import org.apache.maven.continuum.xmlrpc.project.AddingResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
+import org.apache.maven.continuum.xmlrpc.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.xmlrpc.project.BuildResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildResultSummary;
 import org.apache.maven.continuum.xmlrpc.project.Project;
@@ -242,6 +243,15 @@
      * @throws Exception
      */
     BuildDefinition addBuildDefinitionToProjectGroup( int projectGroupId, BuildDefinition
buildDef )
+        throws Exception;
+
+    /**
+     * Get the build definition templates list.
+     *
+     * @return The build definitions templates list
+     * @throws Exception
+     */
+    List<BuildDefinitionTemplate> getBuildDefinitionTemplates()
         throws Exception;
 
     // ----------------------------------------------------------------------

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?rev=593480&r1=593479&r2=593480&view=diff
==============================================================================
--- 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
Fri Nov  9 02:25:41 2007
@@ -819,6 +819,48 @@
         </field>
       </fields>
     </class>
+    <class>
+      <name>BuildDefinitionTemplate</name>
+      <version>1.1.0+</version>
+      <description>Template which contains some buildDefinitions</description>
+      <fields>
+        <field>
+          <name>id</name>
+          <identifier>true</identifier>
+          <version>1.1.0+</version>
+          <type>int</type>
+        </field>
+        <field>
+          <name>name</name>
+          <version>1.1.0+</version>
+          <type>String</type>
+          <required>true</required>
+        </field>
+        <field>
+          <name>continuumDefault</name>
+          <version>1.1.0+</version>
+          <type>boolean</type>
+          <defaultValue>false</defaultValue>
+          <description>
+            true if this definition is a continuum default build def (cannot be removed)
+          </description>
+        </field>
+        <field>
+          <name>type</name>
+          <version>1.1.0+</version>
+          <type>String</type>
+          <description>type of the buid BuildDefinitionTemplate use for default</description>
         
+        </field>                                
+        <field xml.reference="true" stash.part="true">
+          <name>buildDefinitions</name>
+          <version>1.1.0+</version>
+          <association xml.reference="true" stash.part="true">
+            <type>BuildDefinition</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
 
     <class>
       <name>Schedule</name>

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/resources/dozerBeanMapping.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/resources/dozerBeanMapping.xml?rev=593480&r1=593479&r2=593480&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/resources/dozerBeanMapping.xml
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/resources/dozerBeanMapping.xml
Fri Nov  9 02:25:41 2007
@@ -184,4 +184,15 @@
     <class-a>org.apache.maven.continuum.xmlrpc.system.Installation</class-a>
     <class-b>org.apache.maven.continuum.model.system.Installation</class-b>
   </mapping>
+
+  <mapping>
+    <class-a>org.apache.maven.continuum.xmlrpc.project.BuildDefinitionTemplate</class-a>
+    <class-b>org.apache.maven.continuum.model.project.BuildDefinitionTemplate</class-b>
+    <field>
+      <a>buildDefinitions</a>
+      <b>buildDefinitions</b>
+      <a-hint>org.apache.maven.continuum.xmlrpc.project.BuildDefinition</a-hint>
+      <b-hint>org.apache.maven.continuum.model.project.BuildDefinition</b-hint>
+    </field>
+  </mapping>
 </mappings>

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java?rev=593480&r1=593479&r2=593480&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java
Fri Nov  9 02:25:41 2007
@@ -26,6 +26,7 @@
 import org.apache.log4j.Logger;
 import org.apache.maven.continuum.xmlrpc.client.ContinuumXmlRpcClient;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
+import org.apache.maven.continuum.xmlrpc.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.xmlrpc.project.BuildResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildResultSummary;
 import org.apache.maven.continuum.xmlrpc.project.Project;
@@ -231,6 +232,34 @@
                 writeObject( install, "installation", true );
             }
             endTag( "installations", true );
+        }
+    }
+
+    private static void backupAllBuildDefinitionTemplates()
+        throws Exception
+    {
+        LOGGER.info( "Backup Build Definitions Templates" );
+        List<BuildDefinitionTemplate> bdts = client.getBuildDefinitionTemplates();
+        if ( bdts != null && !bdts.isEmpty() )
+        {
+            startTag( "buildDefinitionTemplates", true );
+            for ( BuildDefinitionTemplate bdt : bdts )
+            {
+                LOGGER.debug( "Backup build definition template " + bdt.getName() );
+                startTag( "buildDefinitionTemplate", true );
+                writeSimpleFields( bdt );
+
+                List<BuildDefinition> bds = bdt.getBuildDefinitions();
+                if ( bds != null && !bds.isEmpty() )
+                {
+                    for ( BuildDefinition bd : bds )
+                    {
+                        backupBuildDefinition( bd );
+                    }
+                }
+                endTag( "buildDefinitionTemplate", true );
+            }
+            endTag( "buildDefinitionTemplates", true );
         }
     }
 

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?rev=593480&r1=593479&r2=593480&view=diff
==============================================================================
--- 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
Fri Nov  9 02:25:41 2007
@@ -22,6 +22,7 @@
 import org.apache.maven.continuum.xmlrpc.ContinuumService;
 import org.apache.maven.continuum.xmlrpc.project.AddingResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
+import org.apache.maven.continuum.xmlrpc.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.xmlrpc.project.BuildResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildResultSummary;
 import org.apache.maven.continuum.xmlrpc.project.ContinuumProjectState;
@@ -274,6 +275,12 @@
         throws Exception
     {
         return continuum.addBuildDefinitionToProjectGroup( projectGroupId, buildDef );
+    }
+
+    public List<BuildDefinitionTemplate> getBuildDefinitionTemplates()
+        throws Exception
+    {
+        return continuum.getBuildDefinitionTemplates();
     }
 
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/AbstractContinuumSecureService.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/AbstractContinuumSecureService.java?rev=593480&r1=593479&r2=593480&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/AbstractContinuumSecureService.java
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/AbstractContinuumSecureService.java
Fri Nov  9 02:25:41 2007
@@ -485,4 +485,20 @@
 
         checkAuthorization( ContinuumRoleConstants.CONTINUUM_MANAGE_PROFILES );
     }
+
+    /**
+     * Check if the current user is authorized to manage the build definitions templates
+     *
+     * @throws ContinuumException if the user isn't authorized if the user isn't authenticated
+     */
+    protected void checkManageBuildDefinitionTemplatesAuthorization()
+        throws ContinuumException
+    {
+        if ( !isAuthenticated() )
+        {
+            throw new ContinuumException( "Authentication required." );
+        }
+
+        checkAuthorization( ContinuumRoleConstants.CONTINUUM_MANAGE_BUILD_TEMPLATES );
+    }
 }

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?rev=593480&r1=593479&r2=593480&view=diff
==============================================================================
--- 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
Fri Nov  9 02:25:41 2007
@@ -32,6 +32,7 @@
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.xmlrpc.project.AddingResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
+import org.apache.maven.continuum.xmlrpc.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.xmlrpc.project.BuildResult;
 import org.apache.maven.continuum.xmlrpc.project.BuildResultSummary;
 import org.apache.maven.continuum.xmlrpc.project.Project;
@@ -411,6 +412,21 @@
         return populateBuildDefinition( bd );
     }
 
+    public List<BuildDefinitionTemplate> getBuildDefinitionTemplates()
+        throws Exception
+    {
+        checkManageBuildDefinitionTemplatesAuthorization();
+        List<org.apache.maven.continuum.model.project.BuildDefinitionTemplate> bdts
=
+            continuum.getBuildDefinitionService().getAllBuildDefinitionTemplate();
+
+        List<BuildDefinitionTemplate> result = new ArrayList<BuildDefinitionTemplate>();
+        for ( org.apache.maven.continuum.model.project.BuildDefinitionTemplate bdt : bdts
)
+        {
+            result.add( populateBuildDefinitionTemplate( bdt ) );
+        }
+        return result;
+    }
+
     // ----------------------------------------------------------------------
     // Building
     // ----------------------------------------------------------------------
@@ -912,6 +928,12 @@
         bd.setProfile( populateProfile( buildDef.getProfile() ) );
         bd.setSchedule( populateSchedule( buildDef.getSchedule() ) );
         return bd;
+    }
+
+    private BuildDefinitionTemplate populateBuildDefinitionTemplate(
+        org.apache.maven.continuum.model.project.BuildDefinitionTemplate bdt )
+    {
+        return (BuildDefinitionTemplate) mapper.map( bdt, BuildDefinitionTemplate.class );
     }
 
     private org.apache.maven.continuum.model.project.Schedule populateSchedule( Schedule
schedule )



Mime
View raw message