You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ev...@apache.org on 2007/11/07 20:27:42 UTC
svn commit: r592861 - in /maven/continuum/trunk:
continuum-api/src/main/java/org/apache/maven/continuum/
continuum-core/src/main/java/org/apache/maven/continuum/ continuum-xmlrpc/
continuum-xmlrpc/continuum-xmlrpc-api/src/main/java/org/apache/maven/con...
Author: evenisse
Date: Wed Nov 7 11:27:37 2007
New Revision: 592861
URL: http://svn.apache.org/viewvc?rev=592861&view=rev
Log:
Add xmlrpc backup tool
Added:
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/resources/
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/resources/dozerBeanMapping.xml (with props)
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/ (with props)
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/pom.xml (with props)
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/assembly/
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/assembly/app.xml (with props)
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java (with props)
Modified:
maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.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-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml
maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
maven/continuum/trunk/continuum-xmlrpc/pom.xml
Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=592861&r1=592860&r2=592861&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java (original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java Wed Nov 7 11:27:37 2007
@@ -64,6 +64,8 @@
*/
public Collection<ProjectGroup> getAllProjectGroupsWithProjects();
+ public List<ProjectGroup> getAllProjectGroupsWithBuildDetails();
+
public Collection<ProjectGroup> getAllProjectGroups();
public ProjectGroup getProjectGroupByProjectId( int projectId )
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=592861&r1=592860&r2=592861&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Wed Nov 7 11:27:37 2007
@@ -3021,7 +3021,11 @@
{
// todo check why this interface isn't throwing exceptions on this guy
return store.getAllProjectGroupsWithProjects();
+ }
+ public List<ProjectGroup> getAllProjectGroupsWithBuildDetails()
+ {
+ return store.getAllProjectGroupsWithBuildDetails();
}
public Collection<Project> getProjectsInGroup( int projectGroupId )
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=592861&r1=592860&r2=592861&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 Wed Nov 7 11:27:37 2007
@@ -23,12 +23,15 @@
import org.apache.maven.continuum.xmlrpc.project.AddingResult;
import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
import org.apache.maven.continuum.xmlrpc.project.BuildResult;
+import org.apache.maven.continuum.xmlrpc.project.BuildResultSummary;
import org.apache.maven.continuum.xmlrpc.project.Project;
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.Installation;
import org.apache.maven.continuum.xmlrpc.system.Profile;
+import org.apache.maven.continuum.xmlrpc.system.SystemConfiguration;
import org.apache.xmlrpc.XmlRpcException;
import java.util.List;
@@ -107,7 +110,17 @@
* @throws ContinuumException
* @throws XmlRpcException
*/
- List getAllProjectGroups()
+ List<ProjectGroupSummary> getAllProjectGroups()
+ throws ContinuumException, XmlRpcException;
+
+ /**
+ * Get all project groups with all details (project summaries, notifiers, build definitions).
+ *
+ * @return All project groups
+ * @throws ContinuumException
+ * @throws XmlRpcException
+ */
+ List<ProjectGroup> getAllProjectGroupsWithAllDetails()
throws ContinuumException, XmlRpcException;
/**
@@ -116,8 +129,9 @@
* @return All project groups
* @throws ContinuumException
* @throws XmlRpcException
+ * @deprecated
*/
- List getAllProjectGroupsWithProjects()
+ List<ProjectGroup> getAllProjectGroupsWithProjects()
throws ContinuumException, XmlRpcException;
/**
@@ -337,7 +351,7 @@
* @throws ContinuumException
* @throws XmlRpcException
*/
- List getBuildResultsForProject( int projectId )
+ List<BuildResultSummary> getBuildResultsForProject( int projectId )
throws ContinuumException, XmlRpcException;
/**
@@ -486,7 +500,7 @@
* @throws ContinuumException
* @throws XmlRpcException
*/
- List getSchedules()
+ List<Schedule> getSchedules()
throws ContinuumException, XmlRpcException;
/**
@@ -533,7 +547,7 @@
* @throws ContinuumException
* @throws XmlRpcException
*/
- List getProfiles()
+ List<Profile> getProfiles()
throws ContinuumException, XmlRpcException;
/**
@@ -545,6 +559,38 @@
* @throws XmlRpcException
*/
Profile getProfile( int profileId )
+ throws ContinuumException, XmlRpcException;
+
+ // ----------------------------------------------------------------------
+ // Installations
+ // ----------------------------------------------------------------------
+
+ /**
+ * Return the installations list.
+ *
+ * @return The installations list.
+ * @throws ContinuumException
+ * @throws XmlRpcException
+ */
+ List<Installation> getInstallations()
+ throws ContinuumException, XmlRpcException;
+
+ /**
+ * Return the installation defined by this id.
+ *
+ * @param installationId The installation id
+ * @return The installation.
+ * @throws ContinuumException
+ * @throws XmlRpcException
+ */
+ Installation getInstallation( int installationId )
+ throws ContinuumException, XmlRpcException;
+
+ // ----------------------------------------------------------------------
+ // SystemConfiguration
+ // ----------------------------------------------------------------------
+
+ SystemConfiguration getSystemConfiguration()
throws ContinuumException, XmlRpcException;
// ----------------------------------------------------------------------
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=592861&r1=592860&r2=592861&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 Wed Nov 7 11:27:37 2007
@@ -189,7 +189,11 @@
<version>1.1.0+</version>
<type>String</type>
</field>
- <!-- TODO, this is not exported over XMLRPC yet -->
+ <field>
+ <name>relativePath</name>
+ <version>1.1.0+</version>
+ <type>String</type>
+ </field>
<field>
<name>projectGroup</name>
<version>1.1.0+</version>
@@ -480,14 +484,6 @@
</association>
</field>
<field>
- <name>changesSinceLastSuccess</name>
- <version>1.1.0+</version>
- <association>
- <type>ChangeSet</type>
- <multiplicity>*</multiplicity>
- </association>
- </field>
- <field>
<name>modifiedDependencies</name>
<version>1.1.0+</version>
<association>
@@ -963,7 +959,65 @@
<name>name</name>
<version>1.1.0+</version>
<type>String</type>
+ </field>
+ <field>
+ <name>installationId</name>
+ <version>1.1.0+</version>
+ <type>int</type>
<identifier>true</identifier>
+ </field>
+ </fields>
+ </class>
+ <class>
+ <name>SystemConfiguration</name>
+ <packageName>org.apache.maven.continuum.xmlrpc.system</packageName>
+ <version>1.0.9+</version>
+ <fields>
+ <field>
+ <name>guestAccountEnabled</name>
+ <version>1.0.9+</version>
+ <type>boolean</type>
+ <defaultValue>true</defaultValue>
+ </field>
+ <field>
+ <name>defaultScheduleDescription</name>
+ <version>1.0.9+</version>
+ <type>String</type>
+ <defaultValue>Run hourly</defaultValue>
+ </field>
+ <field>
+ <name>defaultScheduleCronExpression</name>
+ <version>1.0.9+</version>
+ <type>String</type>
+ <defaultValue>0 0 * * * ?</defaultValue>
+ </field>
+ <field>
+ <name>workingDirectory</name>
+ <version>1.0.9+</version>
+ <type>String</type>
+ <defaultValue>working-directory</defaultValue>
+ </field>
+ <field>
+ <name>buildOutputDirectory</name>
+ <version>1.0.9+</version>
+ <type>String</type>
+ <defaultValue>build-output-directory</defaultValue>
+ </field>
+ <field>
+ <name>deploymentRepositoryDirectory</name>
+ <version>1.0.9+</version>
+ <type>String</type>
+ </field>
+ <field>
+ <name>baseUrl</name>
+ <version>1.0.9+</version>
+ <type>String</type>
+ </field>
+ <field>
+ <name>initialized</name>
+ <version>1.0.9+</version>
+ <type>boolean</type>
+ <defaultValue>false</defaultValue>
</field>
</fields>
</class>
Added: 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=592861&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/resources/dozerBeanMapping.xml (added)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/resources/dozerBeanMapping.xml Wed Nov 7 11:27:37 2007
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mappings PUBLIC "-//DOZER//DTD MAPPINGS//EN"
+ "http://dozer.sourceforge.net/dtd/dozerbeanmapping.dtd">
+<mappings>
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.project.ProjectGroupSummary</class-a>
+ <class-b>org.apache.maven.continuum.model.project.ProjectGroup</class-b>
+ </mapping>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.project.ProjectGroup</class-a>
+ <class-b>org.apache.maven.continuum.model.project.ProjectGroup</class-b>
+ <field>
+ <a>projects</a>
+ <b>projects</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.project.ProjectSummary</a-hint>
+ <b-hint>org.apache.maven.continuum.model.project.Project</b-hint>
+ </field>
+ <field>
+ <a>notifiers</a>
+ <b>notifiers</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.project.ProjectNotifier</a-hint>
+ <b-hint>org.apache.maven.continuum.model.project.ProjectNotifier</b-hint>
+ </field>
+ <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>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.project.ProjectSummary</class-a>
+ <class-b>org.apache.maven.continuum.model.project.Project</class-b>
+ <field>
+ <a>projectGroup</a>
+ <b>projectGroup</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.project.ProjectGroupSummary</a-hint>
+ <b-hint>org.apache.maven.continuum.model.project.ProjectGroup</b-hint>
+ </field>
+ </mapping>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.project.Project</class-a>
+ <class-b>org.apache.maven.continuum.model.project.Project</class-b>
+ <field>
+ <a>projectGroup</a>
+ <b>projectGroup</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.project.ProjectGroupSummary</a-hint>
+ <b-hint>org.apache.maven.continuum.model.project.ProjectGroup</b-hint>
+ </field>
+ <field>
+ <a>developers</a>
+ <b>developers</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.project.ProjectDeveloper</a-hint>
+ <b-hint>org.apache.maven.continuum.model.project.ProjectDeveloper</b-hint>
+ </field>
+ <field>
+ <a>dependencies</a>
+ <b>dependencies</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.project.ProjectDependency</a-hint>
+ <b-hint>org.apache.maven.continuum.model.project.ProjectDependency</b-hint>
+ </field>
+ <field>
+ <a>notifiers</a>
+ <b>notifiers</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.project.ProjectNotifier</a-hint>
+ <b-hint>org.apache.maven.continuum.model.project.ProjectNotifier</b-hint>
+ </field>
+ <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>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.project.ProjectDependency</class-a>
+ <class-b>org.apache.maven.continuum.model.project.ProjectDependency</class-b>
+ </mapping>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.project.ProjectNotifier</class-a>
+ <class-b>org.apache.maven.continuum.model.project.ProjectNotifier</class-b>
+ </mapping>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.project.ProjectDeveloper</class-a>
+ <class-b>org.apache.maven.continuum.model.project.ProjectDeveloper</class-b>
+ </mapping>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.project.BuildResultSummary</class-a>
+ <class-b>org.apache.maven.continuum.model.project.BuildResult</class-b>
+ <field>
+ <a>project</a>
+ <b>project</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.project.ProjectSummary</a-hint>
+ <b-hint>org.apache.maven.continuum.model.project.Project</b-hint>
+ </field>
+ <field>
+ <a>buildDefinition</a>
+ <b>buildDefinition</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>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.project.BuildResult</class-a>
+ <class-b>org.apache.maven.continuum.model.project.BuildResult</class-b>
+ <field>
+ <a>scmResult</a>
+ <b>scmResult</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.scm.ScmResult</a-hint>
+ <b-hint>org.apache.maven.continuum.model.scm.ScmResult</b-hint>
+ </field>
+ <field>
+ <a>modifiedDependencies</a>
+ <b>modifiedDependencies</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.project.ProjectDependency</a-hint>
+ <b-hint>org.apache.maven.continuum.model.project.ProjectDependency</b-hint>
+ </field>
+ </mapping>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.project.Schedule</class-a>
+ <class-b>org.apache.maven.continuum.model.project.Schedule</class-b>
+ </mapping>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.scm.ScmResult</class-a>
+ <class-b>org.apache.maven.continuum.model.scm.ScmResult</class-b>
+ <field>
+ <a>changes</a>
+ <b>changes</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.scm.ChangeSet</a-hint>
+ <b-hint>org.apache.maven.continuum.model.scm.ChangeSet</b-hint>
+ </field>
+ </mapping>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.scm.ChangeSet</class-a>
+ <class-b>org.apache.maven.continuum.model.scm.ChangeSet</class-b>
+ <field>
+ <a>files</a>
+ <b>files</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.scm.ChangeFile</a-hint>
+ <b-hint>org.apache.maven.continuum.model.scm.ChangeFile</b-hint>
+ </field>
+ </mapping>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.scm.ChangeFile</class-a>
+ <class-b>org.apache.maven.continuum.model.scm.ChangeFile</class-b>
+ </mapping>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.system.Profile</class-a>
+ <class-b>org.apache.maven.continuum.model.system.Profile</class-b>
+ <field>
+ <a>jdk</a>
+ <b>jdk</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.system.Installation</a-hint>
+ <b-hint>org.apache.maven.continuum.model.system.Installation</b-hint>
+ </field>
+ <field>
+ <a>builder</a>
+ <b>builder</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.system.Installation</a-hint>
+ <b-hint>org.apache.maven.continuum.model.system.Installation</b-hint>
+ </field>
+ <field>
+ <a>environmentVariables</a>
+ <b>environmentVariables</b>
+ <a-hint>org.apache.maven.continuum.xmlrpc.system.Installation</a-hint>
+ <b-hint>org.apache.maven.continuum.model.system.Installation</b-hint>
+ </field>
+ </mapping>
+
+ <mapping>
+ <class-a>org.apache.maven.continuum.xmlrpc.system.Installation</class-a>
+ <class-b>org.apache.maven.continuum.model.system.Installation</class-b>
+ </mapping>
+</mappings>
Propchange: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/resources/dozerBeanMapping.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-api/src/main/resources/dozerBeanMapping.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Nov 7 11:27:37 2007
@@ -0,0 +1,2 @@
+target
+*.iml
Added: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/pom.xml?rev=592861&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/pom.xml (added)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/pom.xml Wed Nov 7 11:27:37 2007
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.maven.continuum</groupId>
+ <artifactId>continuum-xmlrpc</artifactId>
+ <version>1.1-beta-5-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>continuum-xmlrpc-backup</artifactId>
+ <name>Continuum XMLRPC :: Backup Tool</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.continuum</groupId>
+ <artifactId>continuum-xmlrpc-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.cli-parser</groupId>
+ <artifactId>cli</artifactId>
+ <version>7</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <!-- plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <executable>java</executable>
+ <arguments>
+ <argument>-classpath</argument>
+ <classpath />
+ <argument>org.apache.maven.continuum.xmlrpc.backup.Backup</argument>
+ <argument>-h</argument>
+ </arguments>
+ </configuration>
+ </plugin -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <descriptor>src/assembly/app.xml</descriptor>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.maven.continuum.xmlrpc.backup.Backup</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Propchange: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/assembly/app.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/assembly/app.xml?rev=592861&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/assembly/app.xml (added)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/assembly/app.xml Wed Nov 7 11:27:37 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+ ~ 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.
+ -->
+
+<assembly>
+ <id>app</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/</outputDirectory>
+ <unpack>true</unpack>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+</assembly>
Propchange: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/assembly/app.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/assembly/app.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: 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=592861&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java (added)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java Wed Nov 7 11:27:37 2007
@@ -0,0 +1,633 @@
+package org.apache.maven.continuum.xmlrpc.backup;
+
+/*
+ * 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 com.sampullara.cli.Args;
+import com.sampullara.cli.Argument;
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+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.BuildResult;
+import org.apache.maven.continuum.xmlrpc.project.BuildResultSummary;
+import org.apache.maven.continuum.xmlrpc.project.Project;
+import org.apache.maven.continuum.xmlrpc.project.ProjectDependency;
+import org.apache.maven.continuum.xmlrpc.project.ProjectDeveloper;
+import org.apache.maven.continuum.xmlrpc.project.ProjectGroup;
+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 java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Field;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+public class Backup
+{
+ private static final Logger LOGGER = Logger.getLogger( Backup.class );
+
+ private static ContinuumXmlRpcClient client;
+
+ private static int indent = 0;
+
+ private static PrintWriter writer;
+
+ public static void main( String[] args )
+ throws Exception
+ {
+ Commands command = new Commands();
+
+ try
+ {
+ Args.parse( command, args );
+
+ if ( command.help )
+ {
+ Args.usage( command );
+ return;
+ }
+ if ( command.version )
+ {
+ System.out.println( "continuum-xmlrpc-backup version: " + getVersion() );
+ return;
+ }
+ if ( command.url == null )
+ {
+ System.out.println( "You must specified the Continuum XMLRPC URL" );
+ Args.usage( command );
+ return;
+ }
+ if ( command.username == null )
+ {
+ System.out.println( "You must specified the Continuum username" );
+ Args.usage( command );
+ return;
+ }
+ if ( command.password == null )
+ {
+ System.out.println( "You must specified the Continuum password" );
+ Args.usage( command );
+ return;
+ }
+ }
+ catch ( IllegalArgumentException e )
+ {
+ System.err.println( e.getMessage() );
+ Args.usage( command );
+ return;
+ }
+
+ BasicConfigurator.configure();
+ if ( command.debug )
+ {
+ Logger.getRootLogger().setLevel( Level.DEBUG );
+ }
+ else
+ {
+ Logger.getRootLogger().setLevel( Level.INFO );
+ }
+
+ LOGGER.info( "Connection to " + command.url + "with username '" + command.username + "'..." );
+ client = new ContinuumXmlRpcClient( command.url, command.username, command.password );
+ LOGGER.info( "connected" );
+
+ File out = command.outputFile;
+ if ( out == null )
+ {
+ out = new File( "backup/builds.xml" );
+ }
+
+ writer = new PrintWriter( new FileWriter( out ) );
+
+ writer.println( "<?xml version='1.0' encoding='UTF-8'?>" );
+ startTag( "continuumDatabase", true );
+ backupSystemConfiguration();
+ backupAllSchedules();
+ backupAllInstallations();
+ backupAllProfiles();
+ backupAllProjectGroup();
+ endTag( "continuumDatabase", true );
+ writer.close();
+ LOGGER.info( "Done." );
+ }
+
+ private static String getVersion()
+ throws IOException
+ {
+ Properties properties = new Properties();
+ properties.load( Backup.class.getResourceAsStream(
+ "/META-INF/maven/org.apache.maven.continuum/continuum-xmlrpc-backup/pom.properties" ) );
+ return properties.getProperty( "version" );
+ }
+
+ private static class Commands
+ {
+
+ @Argument(description = "Display help information", value = "help", alias = "h")
+ private boolean help;
+
+ @Argument(description = "Display version information", value = "version", alias = "v")
+ private boolean version;
+
+ @Argument(description = "Continuum XMLRPC URL", value = "url")
+ private URL url;
+
+ @Argument(description = "Username", value = "username", alias = "u")
+ private String username;
+
+ @Argument(description = "Password", value = "password", alias = "p")
+ private String password;
+
+ @Argument(description = "Backup file", value = "outputFile", alias = "o")
+ private File outputFile;
+
+ @Argument(
+ description = "Turn on debugging information. Default is off.",
+ value = "debug")
+ private boolean debug;
+ }
+
+ private static void backupSystemConfiguration()
+ throws Exception
+ {
+ LOGGER.info( "Backup system configuration" );
+ writeObject( client.getSystemConfiguration(), "systemConfiguration", true );
+ }
+
+ private static void backupAllSchedules()
+ throws Exception
+ {
+ LOGGER.info( "Backup schedules" );
+ List<Schedule> schedules = client.getSchedules();
+ if ( schedules != null && !schedules.isEmpty() )
+ {
+ startTag( "schedules", true );
+ for ( Schedule schedule : schedules )
+ {
+ LOGGER.debug( "Backup schedule " + schedule.getName() );
+ writeObject( schedule, "schedule", true );
+ }
+ endTag( "schedules", true );
+ }
+ }
+
+ private static void backupAllInstallations()
+ throws Exception
+ {
+ LOGGER.info( "Backup installations" );
+ List<Installation> installs = client.getInstallations();
+ if ( installs != null && !installs.isEmpty() )
+ {
+ startTag( "installations", true );
+ for ( Installation install : installs )
+ {
+ LOGGER.debug( "Backup installation " + install.getName() );
+ writeObject( install, "installation", true );
+ }
+ endTag( "installations", true );
+ }
+ }
+
+ private static void backupAllProfiles()
+ throws Exception
+ {
+ LOGGER.info( "Backup profiles" );
+ List<Profile> profiles = client.getProfiles();
+ if ( profiles != null && !profiles.isEmpty() )
+ {
+ startTag( "profiles", true );
+ for ( Profile p : profiles )
+ {
+ LOGGER.debug( "Backup profile " + p.getName() );
+ writeProfile( p );
+ }
+ endTag( "profiles", true );
+ }
+ }
+
+ private static void backupAllProjectGroup()
+ throws Exception
+ {
+ LOGGER.info( "Backup project groups" );
+ List<ProjectGroup> pgs = client.getAllProjectGroupsWithAllDetails();
+ if ( pgs != null && !pgs.isEmpty() )
+ {
+ startTag( "projectGroups", true );
+ for ( ProjectGroup pg : pgs )
+ {
+ backupProjectGroup( pg );
+ }
+ endTag( "projectGroups", true );
+ }
+ }
+
+ private static void backupProjectGroup( ProjectGroup pg )
+ throws Exception
+ {
+ if ( pg == null )
+ {
+ return;
+ }
+
+ LOGGER.debug( "Backup project group " + pg.getName() );
+ startTag( "projectGroup", true );
+ writeSimpleFields( pg );
+
+ if ( pg.getProjects() != null && !pg.getProjects().isEmpty() )
+ {
+ startTag( "projects", true );
+ for ( ProjectSummary ps : (List<ProjectSummary>) pg.getProjects() )
+ {
+ backupProject( ps );
+ }
+ endTag( "projects", true );
+ }
+
+ if ( pg.getBuildDefinitions() != null && !pg.getBuildDefinitions().isEmpty() )
+ {
+ startTag( "buildDefinitions", true );
+ for ( BuildDefinition bd : (List<BuildDefinition>) pg.getBuildDefinitions() )
+ {
+ backupBuildDefinition( bd );
+ }
+ endTag( "buildDefinitions", true );
+ }
+
+ if ( pg.getNotifiers() != null && !pg.getNotifiers().isEmpty() )
+ {
+ startTag( "notifiers", true );
+ for ( ProjectNotifier notif : (List<ProjectNotifier>) pg.getNotifiers() )
+ {
+ backupNotifier( notif );
+ }
+ endTag( "notifiers", true );
+ }
+
+ endTag( "projectGroup", true );
+ }
+
+ private static void backupProject( ProjectSummary ps )
+ throws Exception
+ {
+ if ( ps == null )
+ {
+ return;
+ }
+
+ LOGGER.debug( "Backup project " + ps.getName() );
+
+ Project p = client.getProjectWithAllDetails( ps.getId() );
+ startTag( "project", true );
+ writeSimpleFields( p );
+
+ if ( p.getProjectGroup() != null )
+ {
+ writeTagWithParameter( "projectGroup", "id", String.valueOf( p.getProjectGroup().getId() ) );
+ }
+
+ if ( p.getDevelopers() != null && !p.getDevelopers().isEmpty() )
+ {
+ startTag( "developers", true );
+ for ( ProjectDeveloper pd : (List<ProjectDeveloper>) p.getDevelopers() )
+ {
+ writeObject( pd, "developer", true );
+ }
+ endTag( "developers", true );
+ }
+
+ if ( p.getDependencies() != null && !p.getDependencies().isEmpty() )
+ {
+ startTag( "dependencies", true );
+ for ( ProjectDependency pd : (List<ProjectDependency>) p.getDependencies() )
+ {
+ writeObject( pd, "dependency", true );
+ }
+ endTag( "dependencies", true );
+ }
+
+ if ( p.getBuildDefinitions() != null && !p.getBuildDefinitions().isEmpty() )
+ {
+ startTag( "buildDefinitions", true );
+ for ( BuildDefinition bd : (List<BuildDefinition>) p.getBuildDefinitions() )
+ {
+ backupBuildDefinition( bd );
+ }
+ endTag( "buildDefinitions", true );
+ }
+
+ if ( p.getNotifiers() != null && !p.getNotifiers().isEmpty() )
+ {
+ startTag( "notifiers", true );
+ for ( ProjectNotifier notif : (List<ProjectNotifier>) p.getNotifiers() )
+ {
+ backupNotifier( notif );
+ }
+ endTag( "notifiers", true );
+ }
+
+ List<BuildResultSummary> brs = client.getBuildResultsForProject( p.getId() );
+ if ( brs != null && !brs.isEmpty() )
+ {
+ startTag( "buildResults", true );
+ for ( BuildResultSummary brSummary : brs )
+ {
+ BuildResult br = client.getBuildResult( p.getId(), brSummary.getId() );
+ backupBuildResult( br );
+ }
+ endTag( "buildResults", true );
+ }
+ endTag( "project", true );
+ }
+
+ private static void backupBuildResult( BuildResult br )
+ throws Exception
+ {
+ if ( br == null )
+ {
+ return;
+ }
+
+ startTag( "buildResult", true );
+ writeSimpleFields( br );
+
+ if ( br.getProject() != null )
+ {
+ writeTagWithParameter( "project", "id", String.valueOf( br.getProject().getId() ) );
+ }
+
+ if ( br.getBuildDefinition() != null )
+ {
+ writeTagWithParameter( "buildDefinition", "id", String.valueOf( br.getBuildDefinition().getId() ) );
+ }
+
+ if ( br.getModifiedDependencies() != null && !br.getModifiedDependencies().isEmpty() )
+ {
+ startTag( "dependencies", true );
+ for ( ProjectDependency pd : (List<ProjectDependency>) br.getModifiedDependencies() )
+ {
+ writeObject( pd, "dependency", true );
+ }
+ endTag( "dependencies", true );
+ }
+ endTag( "buildResult", true );
+ }
+
+ private static void writeSimpleFields( Object obj )
+ throws Exception
+ {
+ if ( obj == null )
+ {
+ return;
+ }
+
+ for ( Field f : getFieldsIncludingSuperclasses( obj.getClass() ) )
+ {
+ if ( "modelEncoding".equals( f.getName() ) )
+ {
+ continue;
+ }
+
+ if ( !f.isAccessible() )
+ {
+ f.setAccessible( true );
+ }
+
+ if ( f.getType().getName().equals( "int" ) || f.getType().getName().equals( "long" ) ||
+ f.getType().getName().equals( "boolean" ) || f.getType().getName().equals( "java.lang.String" ) )
+ {
+ Object value = f.get( obj );
+ if ( value != null )
+ {
+ startTag( f.getName(), false );
+ writer.print( value );
+ endTag( f.getName(), false );
+ }
+ }
+ /*else if ( BuildDefinition.class.getName().equals( f.getType().getName() ) )
+ {
+ backupBuildDefinition( (BuildDefinition) f.get( obj ) );
+ }*/
+ else if ( ScmResult.class.getName().equals( f.getType().getName() ) )
+ {
+ writeScmResult( (ScmResult) f.get( obj ) );
+ }
+ else if ( ChangeFile.class.getName().equals( f.getType().getName() ) )
+ {
+ writeObject( f.get( obj ), "changeFile", true );
+ }
+ /*else if ( Schedule.class.getName().equals( f.getType().getName() ) )
+ {
+ writeObject( f.get( obj ), "schedule", true );
+ }*/
+ else if ( Profile.class.getName().equals( f.getType().getName() ) )
+ {
+ writeProfile( (Profile) f.get( obj ) );
+ }
+ else
+ {
+ writer.println( "Rejected: (" + f.getName() + ") " + f.getType() );
+ }
+ }
+ }
+
+ private static void writeObject( Object obj, String tagName, boolean addNewLine )
+ throws Exception
+ {
+ if ( obj == null )
+ {
+ return;
+ }
+ startTag( tagName, addNewLine );
+ writeSimpleFields( obj );
+ endTag( tagName, addNewLine );
+ }
+
+ private static void backupBuildDefinition( BuildDefinition buildDef )
+ throws Exception
+ {
+ if ( buildDef == null )
+ {
+ return;
+ }
+ startTag( "buildDefinition", true );
+ writeSimpleFields( buildDef );
+ if ( buildDef.getSchedule() != null )
+ {
+ writeTagWithParameter( "schedule", "id", String.valueOf( buildDef.getSchedule().getId() ) );
+ }
+ endTag( "buildDefinition", true );
+ }
+
+ private static void backupNotifier( ProjectNotifier notifier )
+ throws Exception
+ {
+ startTag( "notifier", true );
+ writeSimpleFields( notifier );
+
+ Map conf = notifier.getConfiguration();
+ startTag( "configuration", true );
+ for ( String key : (Set<String>) conf.keySet() )
+ {
+ startTag( key, false );
+ writer.print( conf.get( key ) );
+ endTag( key, false );
+ }
+ endTag( "configuration", true );
+
+ endTag( "notifier", true );
+ }
+
+ private static void writeProfile( Profile profile )
+ throws Exception
+ {
+ if ( profile == null )
+ {
+ return;
+ }
+
+ startTag( "profile", true );
+ writeSimpleFields( profile );
+
+ if ( profile.getEnvironmentVariables() != null && !profile.getEnvironmentVariables().isEmpty() )
+ {
+ startTag( "environmentVariables", true );
+ for ( Installation env : (List<Installation>) profile.getEnvironmentVariables() )
+ {
+ writeTagWithParameter( "environmentVariable", "installationId",
+ String.valueOf( env.getInstallationId() ) );
+ }
+ endTag( "environmentVariables", true );
+ }
+
+ if ( profile.getJdk() != null )
+ {
+ writeTagWithParameter( "jdk", "installationId", String.valueOf( profile.getJdk().getInstallationId() ) );
+ }
+
+ if ( profile.getBuilder() != null )
+ {
+ writeTagWithParameter( "builder", "installationId",
+ String.valueOf( profile.getBuilder().getInstallationId() ) );
+ }
+
+ endTag( "profile", true );
+ }
+
+ private static void writeScmResult( ScmResult scmResult )
+ throws Exception
+ {
+ if ( scmResult == null )
+ {
+ return;
+ }
+
+ startTag( "scmResult", true );
+ writeSimpleFields( scmResult );
+
+ if ( scmResult.getChanges() != null && !scmResult.getChanges().isEmpty() )
+ {
+ startTag( "changeSets", true );
+ for ( ChangeSet cs : (List<ChangeSet>) scmResult.getChanges() )
+ {
+ writeObject( cs, "changeSet", true );
+ }
+ endTag( "changeSets", true );
+ }
+ endTag( "scmResult", true );
+ }
+
+ private static void startTag( String tagName, boolean addNewLineAfter )
+ {
+ writer.print( getIndent() );
+ writer.print( "<" );
+ writer.print( tagName );
+ writer.print( ">" );
+ if ( addNewLineAfter )
+ {
+ writer.println();
+ indent++;
+ }
+ }
+
+ private static void endTag( String tagName, boolean isOnNewLine )
+ {
+ if ( isOnNewLine )
+ {
+ indent--;
+ writer.print( getIndent() );
+ }
+ writer.print( "</" );
+ writer.print( tagName );
+ writer.println( ">" );
+ }
+
+ private static void writeTagWithParameter( String tagName, String parameterName, String parameterValue )
+ {
+ writer.print( getIndent() );
+ writer.print( "<" );
+ writer.print( tagName );
+ writer.print( " " );
+ writer.print( parameterName );
+ writer.print( "=\"" );
+ writer.print( parameterValue );
+ writer.print( "\"></" );
+ writer.print( tagName );
+ writer.println( ">" );
+ }
+
+ private static String getIndent()
+ {
+ String result = "";
+ for ( int i = 0; i < indent; i++ )
+ {
+ result += " ";
+ }
+ return result;
+ }
+
+ private static List<Field> getFieldsIncludingSuperclasses( Class clazz )
+ {
+ List<Field> fields = new ArrayList<Field>( Arrays.asList( clazz.getDeclaredFields() ) );
+
+ Class superclass = clazz.getSuperclass();
+
+ if ( superclass != null )
+ {
+ fields.addAll( getFieldsIncludingSuperclasses( superclass ) );
+ }
+
+ return fields;
+ }
+}
Propchange: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-backup/src/main/java/org/apache/maven/continuum/xmlrpc/backup/Backup.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
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=592861&r1=592860&r2=592861&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 Wed Nov 7 11:27:37 2007
@@ -24,13 +24,16 @@
import org.apache.maven.continuum.xmlrpc.project.AddingResult;
import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
import org.apache.maven.continuum.xmlrpc.project.BuildResult;
+import org.apache.maven.continuum.xmlrpc.project.BuildResultSummary;
import org.apache.maven.continuum.xmlrpc.project.ContinuumProjectState;
import org.apache.maven.continuum.xmlrpc.project.Project;
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.Installation;
import org.apache.maven.continuum.xmlrpc.system.Profile;
+import org.apache.maven.continuum.xmlrpc.system.SystemConfiguration;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
@@ -199,7 +202,7 @@
// Projects Groups
// ----------------------------------------------------------------------
- public List getAllProjectGroups()
+ public List<ProjectGroupSummary> getAllProjectGroups()
throws ContinuumException
{
try
@@ -212,12 +215,12 @@
}
}
- public List getAllProjectGroupsWithProjects()
+ public List<ProjectGroup> getAllProjectGroupsWithAllDetails()
throws ContinuumException
{
try
{
- return continuum.getAllProjectGroupsWithProjects();
+ return continuum.getAllProjectGroupsWithAllDetails();
}
catch ( Exception e )
{
@@ -225,6 +228,12 @@
}
}
+ public List<ProjectGroup> getAllProjectGroupsWithProjects()
+ throws ContinuumException
+ {
+ return getAllProjectGroupsWithAllDetails();
+ }
+
public ProjectGroupSummary getProjectGroupSummary( int projectGroupId )
throws ContinuumException
{
@@ -491,7 +500,7 @@
}
}
- public List getBuildResultsForProject( int projectId )
+ public List<BuildResultSummary> getBuildResultsForProject( int projectId )
throws ContinuumException
{
try
@@ -654,7 +663,7 @@
// Schedules
// ----------------------------------------------------------------------
- public List getSchedules()
+ public List<Schedule> getSchedules()
throws ContinuumException
{
try
@@ -710,7 +719,7 @@
// Profiles
// ----------------------------------------------------------------------
- public List getProfiles()
+ public List<Profile> getProfiles()
throws ContinuumException
{
try
@@ -729,6 +738,53 @@
try
{
return continuum.getProfile( profileId );
+ }
+ catch ( Exception e )
+ {
+ throw new ContinuumException( "The remote method failed.", e );
+ }
+ }
+
+ // ----------------------------------------------------------------------
+ // Installations
+ // ----------------------------------------------------------------------
+
+ public List<Installation> getInstallations()
+ throws ContinuumException
+ {
+ try
+ {
+ return continuum.getInstallations();
+ }
+ catch ( Exception e )
+ {
+ throw new ContinuumException( "The remote method failed.", e );
+ }
+ }
+
+ public Installation getInstallation( int installationId )
+ throws ContinuumException
+ {
+ try
+ {
+ return continuum.getInstallation( installationId );
+ }
+ catch ( Exception e )
+ {
+ throw new ContinuumException( "The remote method failed.", e );
+ }
+ }
+
+ // ----------------------------------------------------------------------
+ // SystemConfiguration
+ // ----------------------------------------------------------------------
+
+ public SystemConfiguration getSystemConfiguration()
+ throws ContinuumException
+ {
+ try
+ {
+ return continuum.getSystemConfiguration();
}
catch ( Exception e )
{
Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java?rev=592861&r1=592860&r2=592861&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java (original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-client/src/main/java/org/apache/maven/continuum/xmlrpc/client/SampleClient.java Wed Nov 7 11:27:37 2007
@@ -193,15 +193,6 @@
System.out.println( "Scm Result:" );
printScmResult( result.getScmResult() );
}
-
- if ( result.getChangesSinceLastSuccess() != null )
- {
- System.out.println( "Changes since last success:" );
- for ( Iterator i = result.getChangesSinceLastSuccess().iterator(); i.hasNext(); )
- {
- printChangeSet( (ChangeSet) i.next() );
- }
- }
}
public static void printDependency( ProjectDependency dep )
Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml?rev=592861&r1=592860&r2=592861&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml (original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml Wed Nov 7 11:27:37 2007
@@ -53,6 +53,11 @@
<artifactId>xmlrpc-server</artifactId>
<version>3.0</version>
</dependency>
+ <dependency>
+ <groupId>net.sf.dozer</groupId>
+ <artifactId>dozer</artifactId>
+ <version>4.0</version>
+ </dependency>
</dependencies>
<build>
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=592861&r1=592860&r2=592861&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 Wed Nov 7 11:27:37 2007
@@ -19,29 +19,29 @@
* under the License.
*/
+import net.sf.dozer.util.mapping.DozerBeanMapperSingletonWrapper;
+import net.sf.dozer.util.mapping.MapperIF;
import org.apache.maven.continuum.Continuum;
import org.apache.maven.continuum.ContinuumException;
import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
+import org.apache.maven.continuum.installation.InstallationException;
import org.apache.maven.continuum.project.ContinuumProjectState;
import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
import org.apache.maven.continuum.security.ContinuumRoleConstants;
+import org.apache.maven.continuum.store.ContinuumStore;
+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.BuildResult;
import org.apache.maven.continuum.xmlrpc.project.BuildResultSummary;
import org.apache.maven.continuum.xmlrpc.project.Project;
-import org.apache.maven.continuum.xmlrpc.project.ProjectDependency;
-import org.apache.maven.continuum.xmlrpc.project.ProjectDeveloper;
import org.apache.maven.continuum.xmlrpc.project.ProjectGroup;
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.system.SystemConfiguration;
import org.codehaus.plexus.redback.authorization.AuthorizationException;
import org.codehaus.plexus.redback.role.RoleManager;
import org.codehaus.plexus.redback.role.RoleManagerException;
@@ -49,10 +49,8 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -62,12 +60,19 @@
public class ContinuumServiceImpl
extends AbstractContinuumSecureService
{
+ private static MapperIF mapper = DozerBeanMapperSingletonWrapper.getInstance();
+
/**
* @plexus.requirement
*/
private Continuum continuum;
/**
+ * @plexus.requirement role-hint="jdo"
+ */
+ private ContinuumStore store;
+
+ /**
* @plexus.requirement role-hint="default"
*/
private RoleManager roleManager;
@@ -162,15 +167,13 @@
// Projects Groups
// ----------------------------------------------------------------------
- public List getAllProjectGroups()
+ public List<ProjectGroupSummary> getAllProjectGroups()
throws ContinuumException
{
- Collection pgList = continuum.getAllProjectGroups();
- List result = new ArrayList();
- for ( Iterator i = pgList.iterator(); i.hasNext(); )
+ Collection<org.apache.maven.continuum.model.project.ProjectGroup> pgList = continuum.getAllProjectGroups();
+ List<ProjectGroupSummary> result = new ArrayList<ProjectGroupSummary>();
+ for ( org.apache.maven.continuum.model.project.ProjectGroup projectGroup : pgList )
{
- org.apache.maven.continuum.model.project.ProjectGroup projectGroup =
- (org.apache.maven.continuum.model.project.ProjectGroup) i.next();
try
{
if ( isAuthorized( ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION, projectGroup.getName() ) )
@@ -186,20 +189,19 @@
return result;
}
- public List getAllProjectGroupsWithProjects()
+ public List<ProjectGroup> getAllProjectGroupsWithAllDetails()
throws ContinuumException
{
- Collection pgList = continuum.getAllProjectGroupsWithProjects();
- List result = new ArrayList();
- for ( Iterator i = pgList.iterator(); i.hasNext(); )
+ Collection<org.apache.maven.continuum.model.project.ProjectGroup> pgList =
+ continuum.getAllProjectGroupsWithBuildDetails();
+ List<ProjectGroup> result = new ArrayList<ProjectGroup>();
+ for ( org.apache.maven.continuum.model.project.ProjectGroup projectGroup : pgList )
{
- org.apache.maven.continuum.model.project.ProjectGroup projectGroup =
- (org.apache.maven.continuum.model.project.ProjectGroup) i.next();
try
{
if ( isAuthorized( ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION, projectGroup.getName() ) )
{
- result.add( populateProjectGroupWithProjects( projectGroup ) );
+ result.add( populateProjectGroupWithAllDetails( projectGroup ) );
}
}
catch ( AuthorizationException e )
@@ -210,6 +212,12 @@
return result;
}
+ public List<ProjectGroup> getAllProjectGroupsWithProjects()
+ throws ContinuumException
+ {
+ return getAllProjectGroupsWithAllDetails();
+ }
+
protected String getProjectGroupName( int projectGroupId )
throws ContinuumException
{
@@ -242,7 +250,7 @@
org.apache.maven.continuum.model.project.ProjectGroup projectGroup =
continuum.getProjectGroupWithProjects( projectGroupId );
- return populateProjectGroupWithProjects( projectGroup );
+ return populateProjectGroupWithAllDetails( projectGroup );
}
public int removeProjectGroup( int projectGroupId )
@@ -481,20 +489,18 @@
return populateBuildResult( continuum.getBuildResult( buildId ) );
}
- public List getBuildResultsForProject( int projectId )
+ public List<BuildResultSummary> getBuildResultsForProject( int projectId )
throws ContinuumException
{
ProjectSummary ps = getProjectSummary( projectId );
checkViewProjectGroupAuthorization( ps.getProjectGroup().getName() );
- List result = new ArrayList();
+ List<BuildResultSummary> result = new ArrayList<BuildResultSummary>();
Collection buildResults = continuum.getBuildResultsForProject( projectId );
if ( buildResults != null )
{
- for ( Iterator i = buildResults.iterator(); i.hasNext(); )
+ for ( org.apache.maven.continuum.model.project.BuildResult buildResult : (List<org.apache.maven.continuum.model.project.BuildResult>) buildResults )
{
- org.apache.maven.continuum.model.project.BuildResult buildResult =
- (org.apache.maven.continuum.model.project.BuildResult) i.next();
BuildResultSummary br = populateBuildResultSummary( buildResult );
result.add( br );
}
@@ -617,15 +623,15 @@
// Schedules
// ----------------------------------------------------------------------
- public List getSchedules()
+ public List<Schedule> getSchedules()
throws ContinuumException
{
Collection schedules = continuum.getSchedules();
- List s = new ArrayList();
- for ( Iterator i = schedules.iterator(); i.hasNext(); )
+ List<Schedule> s = new ArrayList<Schedule>();
+ for ( Object schedule : schedules )
{
- s.add( populateSchedule( (org.apache.maven.continuum.model.project.Schedule) i.next() ) );
+ s.add( populateSchedule( (org.apache.maven.continuum.model.project.Schedule) schedule ) );
}
return s;
@@ -661,15 +667,15 @@
// Profiles
// ----------------------------------------------------------------------
- public List getProfiles()
+ public List<Profile> getProfiles()
throws ContinuumException
{
Collection profiles = continuum.getProfileService().getAllProfiles();
- List p = new ArrayList();
- for ( Iterator i = profiles.iterator(); i.hasNext(); )
+ List<Profile> p = new ArrayList<Profile>();
+ for ( Object profile : profiles )
{
- p.add( populateProfile( (org.apache.maven.continuum.model.system.Profile) i.next() ) );
+ p.add( populateProfile( (org.apache.maven.continuum.model.system.Profile) profile ) );
}
return p;
@@ -682,130 +688,75 @@
}
// ----------------------------------------------------------------------
- // Converters
+ // Installations
// ----------------------------------------------------------------------
- private ProjectSummary populateProjectSummary( org.apache.maven.continuum.model.project.Project project )
+ public List<Installation> getInstallations()
+ throws ContinuumException
{
- if ( project == null )
+ try
{
- return null;
- }
+ List<org.apache.maven.continuum.model.system.Installation> installs =
+ continuum.getInstallationService().getAllInstallations();
- ProjectSummary ps = new Project();
- ps.setArtifactId( project.getArtifactId() );
- ps.setBuildNumber( project.getBuildNumber() );
- ps.setDescription( project.getDescription() );
- ps.setExecutorId( project.getExecutorId() );
- ps.setGroupId( project.getGroupId() );
- ps.setId( project.getId() );
- ps.setLatestBuildId( project.getLatestBuildId() );
- ps.setName( project.getName() );
- ps.setProjectGroup( populateProjectGroupSummary( project.getProjectGroup() ) );
- ps.setScmTag( project.getScmTag() );
- ps.setScmUrl( project.getScmUrl() );
- ps.setScmUseCache( project.isScmUseCache() );
- ps.setScmUsername( project.getScmUsername() );
- ps.setState( project.getState() );
- ps.setUrl( project.getUrl() );
- ps.setVersion( project.getVersion() );
- ps.setWorkingDirectory( project.getWorkingDirectory() );
- return ps;
+ List<Installation> i = new ArrayList<Installation>();
+ for ( Object install : installs )
+ {
+ i.add( populateInstallation( (org.apache.maven.continuum.model.system.Installation) install ) );
+ }
+ return i;
+ }
+ catch ( InstallationException e )
+ {
+ throw new ContinuumException( "Can't load installations", e );
+ }
}
- private Project populateProject( org.apache.maven.continuum.model.project.Project project )
+ public Installation getInstallation( int installationId )
+ throws ContinuumException
{
- if ( project == null )
+ try
{
- return null;
+ org.apache.maven.continuum.model.system.Installation install =
+ continuum.getInstallationService().getInstallation( installationId );
+ return populateInstallation( install );
}
-
- Project p = (Project) populateProjectSummary( project );
-
- p.setParent( populateProjectDependency( project.getParent() ) );
-
- if ( project.getDependencies() != null )
+ catch ( InstallationException e )
{
- List deps = new ArrayList();
- for ( Iterator i = project.getDependencies().iterator(); i.hasNext(); )
- {
- org.apache.maven.continuum.model.project.ProjectDependency d =
- (org.apache.maven.continuum.model.project.ProjectDependency) i.next();
- deps.add( populateProjectDependency( d ) );
- }
- p.setDependencies( deps );
+ throw new ContinuumException( "Can't load installations", e );
}
+ }
- //TODO: p.setBuildDefinitions( );
+ // ----------------------------------------------------------------------
+ // SystemConfiguration
+ // ----------------------------------------------------------------------
- if ( project.getDevelopers() != null )
+ public SystemConfiguration getSystemConfiguration()
+ throws ContinuumException
+ {
+ try
{
- for ( Iterator i = project.getDevelopers().iterator(); i.hasNext(); )
- {
- org.apache.maven.continuum.model.project.ProjectDeveloper developer =
- (org.apache.maven.continuum.model.project.ProjectDeveloper) i.next();
- p.addDeveloper( populateProjectDeveloper( developer ) );
- }
+ org.apache.maven.continuum.model.system.SystemConfiguration sysConf = store.getSystemConfiguration();
+ return populateSystemConfiguration( sysConf );
}
-
- if ( project.getNotifiers() != null )
+ catch ( ContinuumStoreException e )
{
- for ( Iterator i = project.getNotifiers().iterator(); i.hasNext(); )
- {
- org.apache.maven.continuum.model.project.ProjectNotifier notifier =
- (org.apache.maven.continuum.model.project.ProjectNotifier) i.next();
- p.addNotifier( populateProjectNotifier( notifier ) );
- }
+ throw new ContinuumException( "Can't get SystemConfiguration.", e );
}
-
- return p;
}
- private ProjectDeveloper populateProjectDeveloper(
- org.apache.maven.continuum.model.project.ProjectDeveloper developer )
- {
- if ( developer == null )
- {
- return null;
- }
+ // ----------------------------------------------------------------------
+ // Converters
+ // ----------------------------------------------------------------------
- ProjectDeveloper res = new ProjectDeveloper();
- res.setContinuumId( developer.getContinuumId() );
- res.setEmail( developer.getEmail() );
- res.setName( developer.getName() );
- res.setScmId( developer.getScmId() );
- return res;
+ private ProjectSummary populateProjectSummary( org.apache.maven.continuum.model.project.Project project )
+ {
+ return (ProjectSummary) mapper.map( project, ProjectSummary.class );
}
- private ProjectNotifier populateProjectNotifier( org.apache.maven.continuum.model.project.ProjectNotifier notifier )
+ private Project populateProject( org.apache.maven.continuum.model.project.Project project )
{
- if ( notifier == null )
- {
- return null;
- }
-
- ProjectNotifier res = new ProjectNotifier();
- res.setEnabled( notifier.isEnabled() );
- res.setFrom( notifier.getFrom() );
- res.setId( notifier.getId() );
- res.setRecipientType( notifier.getRecipientType() );
- res.setSendOnError( notifier.isSendOnError() );
- res.setSendOnFailure( notifier.isSendOnFailure() );
- res.setSendOnSuccess( notifier.isSendOnSuccess() );
- res.setSendOnWarning( notifier.isSendOnWarning() );
- res.setType( notifier.getType() );
-
- if ( notifier.getConfiguration() != null )
- {
- Map conf = new HashMap();
- for ( Iterator i = notifier.getConfiguration().keySet().iterator(); i.hasNext(); )
- {
- String key = (String) i.next();
- conf.put( key, notifier.getConfiguration().get( key ) );
- }
- res.setConfiguration( conf );
- }
- return res;
+ return (Project) mapper.map( project, Project.class );
}
private org.apache.maven.continuum.model.project.Project populateProject( ProjectSummary projectSummary )
@@ -837,35 +788,10 @@
return project;
}
- private ProjectDependency populateProjectDependency(
- org.apache.maven.continuum.model.project.ProjectDependency dependency )
- {
- if ( dependency == null )
- {
- return null;
- }
-
- ProjectDependency dep = new ProjectDependency();
- dep.setArtifactId( dependency.getArtifactId() );
- dep.setGroupId( dependency.getGroupId() );
- dep.setVersion( dependency.getVersion() );
- return dep;
- }
-
private ProjectGroupSummary populateProjectGroupSummary(
org.apache.maven.continuum.model.project.ProjectGroup group )
{
- if ( group == null )
- {
- return null;
- }
-
- ProjectGroupSummary g = new ProjectGroup();
- g.setDescription( group.getDescription() );
- g.setGroupId( group.getGroupId() );
- g.setId( group.getId() );
- g.setName( group.getName() );
- return g;
+ return (ProjectGroupSummary) mapper.map( group, ProjectGroupSummary.class );
}
private org.apache.maven.continuum.model.project.ProjectGroup populateProjectGroupSummary(
@@ -885,84 +811,22 @@
return g;
}
- private ProjectGroup populateProjectGroupWithProjects( org.apache.maven.continuum.model.project.ProjectGroup group )
+ private ProjectGroup populateProjectGroupWithAllDetails(
+ org.apache.maven.continuum.model.project.ProjectGroup group )
{
- if ( group == null )
- {
- return null;
- }
- ProjectGroup g = (ProjectGroup) populateProjectGroupSummary( group );
-
- if ( group.getProjects() != null )
- {
- List projects = new ArrayList();
- for ( Iterator i = group.getProjects().iterator(); i.hasNext(); )
- {
- org.apache.maven.continuum.model.project.Project p =
- (org.apache.maven.continuum.model.project.Project) i.next();
- ProjectSummary ps = populateProjectSummary( p );
- projects.add( ps );
- }
- g.setProjects( projects );
- }
- return g;
+ return (ProjectGroup) mapper.map( group, ProjectGroup.class );
}
private BuildResultSummary populateBuildResultSummary(
org.apache.maven.continuum.model.project.BuildResult buildResult )
{
- if ( buildResult == null )
- {
- return null;
- }
- BuildResultSummary br = new BuildResult();
- br.setBuildNumber( buildResult.getBuildNumber() );
- br.setEndTime( buildResult.getEndTime() );
- br.setError( buildResult.getError() );
- br.setExitCode( buildResult.getExitCode() );
- br.setId( buildResult.getId() );
- br.setStartTime( buildResult.getStartTime() );
- br.setState( buildResult.getState() );
- br.setSuccess( buildResult.isSuccess() );
- br.setTrigger( buildResult.getTrigger() );
- br.setProject( populateProjectSummary( buildResult.getProject() ) );
- br.setBuildDefinition( populateBuildDefinition( buildResult.getBuildDefinition() ) );
- return br;
+ return (BuildResultSummary) mapper.map( buildResult, BuildResultSummary.class );
}
private BuildResult populateBuildResult( org.apache.maven.continuum.model.project.BuildResult buildResult )
throws ContinuumException
{
- if ( buildResult == null )
- {
- return null;
- }
- BuildResult br = (BuildResult) populateBuildResultSummary( buildResult );
-
- List changeSet = continuum.getChangesSinceLastSuccess( br.getProject().getId(), br.getId() );
- if ( changeSet != null )
- {
- for ( Iterator i = changeSet.iterator(); i.hasNext(); )
- {
- br.addChangesSinceLastSucces(
- populateChangeSet( (org.apache.maven.continuum.model.scm.ChangeSet) i.next() ) );
- }
- }
-
- br.setScmResult( populateScmResult( buildResult.getScmResult() ) );
-
- if ( buildResult.getModifiedDependencies() != null )
- {
- for ( Iterator i = buildResult.getModifiedDependencies().iterator(); i.hasNext(); )
- {
- org.apache.maven.continuum.model.project.ProjectDependency dependency =
- (org.apache.maven.continuum.model.project.ProjectDependency) i.next();
- ProjectDependency dep = populateProjectDependency( dependency );
- br.addModifiedDependency( dep );
- }
- }
-
- return br;
+ return (BuildResult) mapper.map( buildResult, BuildResult.class );
}
private AddingResult populateAddingResult( ContinuumProjectBuildingResult result )
@@ -1005,90 +869,9 @@
return res;
}
- private ScmResult populateScmResult( org.apache.maven.continuum.model.scm.ScmResult scmResult )
- {
- if ( scmResult == null )
- {
- return null;
- }
-
- ScmResult res = new ScmResult();
-
- if ( scmResult.getChanges() != null )
- {
- for ( Iterator i = scmResult.getChanges().iterator(); i.hasNext(); )
- {
- org.apache.maven.continuum.model.scm.ChangeSet changeSet =
- (org.apache.maven.continuum.model.scm.ChangeSet) i.next();
- res.addChange( populateChangeSet( changeSet ) );
- }
- }
-
- res.setCommandLine( scmResult.getCommandLine() );
- res.setCommandOutput( scmResult.getCommandOutput() );
- res.setException( scmResult.getException() );
- res.setProviderMessage( scmResult.getProviderMessage() );
- res.setSuccess( scmResult.isSuccess() );
- return res;
- }
-
- private ChangeSet populateChangeSet( org.apache.maven.continuum.model.scm.ChangeSet changeSet )
- {
- if ( changeSet == null )
- {
- return null;
- }
-
- ChangeSet res = new ChangeSet();
- res.setAuthor( changeSet.getAuthor() );
- res.setComment( changeSet.getComment() );
- res.setDate( changeSet.getDate() );
-
- if ( changeSet.getFiles() != null )
- {
- for ( Iterator i = changeSet.getFiles().iterator(); i.hasNext(); )
- {
- org.apache.maven.continuum.model.scm.ChangeFile changeFile =
- (org.apache.maven.continuum.model.scm.ChangeFile) i.next();
- res.addFile( populateChangeFile( changeFile ) );
- }
- }
-
- res.setId( changeSet.getId() );
- return res;
- }
-
- private ChangeFile populateChangeFile( org.apache.maven.continuum.model.scm.ChangeFile changeFile )
- {
- if ( changeFile == null )
- {
- return null;
- }
-
- ChangeFile res = new ChangeFile();
- res.setName( changeFile.getName() );
- res.setRevision( changeFile.getRevision() );
- res.setStatus( changeFile.getStatus() );
- return res;
- }
-
private BuildDefinition populateBuildDefinition( org.apache.maven.continuum.model.project.BuildDefinition buildDef )
{
- if ( buildDef == null )
- {
- return null;
- }
-
- BuildDefinition bd = new BuildDefinition();
- bd.setArguments( buildDef.getArguments() );
- bd.setBuildFile( buildDef.getBuildFile() );
- bd.setBuildFresh( buildDef.isBuildFresh() );
- bd.setDefaultForProject( buildDef.isDefaultForProject() );
- bd.setGoals( buildDef.getGoals() );
- bd.setId( buildDef.getId() );
- bd.setProfile( populateProfile( buildDef.getProfile() ) );
- bd.setSchedule( populateSchedule( buildDef.getSchedule() ) );
- return bd;
+ return (BuildDefinition) mapper.map( buildDef, BuildDefinition.class );
}
private org.apache.maven.continuum.model.project.BuildDefinition populateBuildDefinition( BuildDefinition buildDef )
@@ -1131,23 +914,10 @@
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;
+ return (Schedule) mapper.map( schedule, Schedule.class );
}
- public org.apache.maven.continuum.model.system.Profile populateProfile( Profile profile )
+ private org.apache.maven.continuum.model.system.Profile populateProfile( Profile profile )
{
if ( profile == null )
{
@@ -1175,35 +945,12 @@
return p;
}
- public Profile populateProfile( org.apache.maven.continuum.model.system.Profile profile )
+ private 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;
+ return (Profile) mapper.map( profile, Profile.class );
}
- public org.apache.maven.continuum.model.system.Installation populateInstallation( Installation install )
+ private org.apache.maven.continuum.model.system.Installation populateInstallation( Installation install )
{
if ( install == null )
{
@@ -1219,18 +966,14 @@
return inst;
}
- public Installation populateInstallation( org.apache.maven.continuum.model.system.Installation install )
+ private Installation populateInstallation( org.apache.maven.continuum.model.system.Installation install )
{
- if ( install == null )
- {
- return null;
- }
+ return (Installation) mapper.map( install, Installation.class );
+ }
- Installation inst = new Installation();
- inst.setName( install.getName() );
- inst.setType( install.getType() );
- inst.setVarName( install.getVarName() );
- inst.setVarValue( install.getVarValue() );
- return inst;
+ private SystemConfiguration populateSystemConfiguration(
+ org.apache.maven.continuum.model.system.SystemConfiguration sysConf )
+ {
+ return (SystemConfiguration) mapper.map( sysConf, SystemConfiguration.class );
}
}
Modified: maven/continuum/trunk/continuum-xmlrpc/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/pom.xml?rev=592861&r1=592860&r2=592861&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/pom.xml (original)
+++ maven/continuum/trunk/continuum-xmlrpc/pom.xml Wed Nov 7 11:27:37 2007
@@ -29,6 +29,7 @@
<packaging>pom</packaging>
<modules>
<module>continuum-xmlrpc-api</module>
+ <module>continuum-xmlrpc-backup</module>
<module>continuum-xmlrpc-client</module>
<module>continuum-xmlrpc-server</module>
</modules>