maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r546040 - in /maven/sandbox/trunk/continuum/continuum-data-upgrade: ./ continuum-legacy/ continuum-legacy/src/main/mdo/ data-management-api/ data-management-api/src/ data-management-api/src/main/ data-management-api/src/main/java/ data-mana...
Date Mon, 11 Jun 2007 08:18:04 GMT
Author: brett
Date: Mon Jun 11 01:18:01 2007
New Revision: 546040

URL: http://svn.apache.org/viewvc?view=rev&rev=546040
Log:
create an import/export tool

Added:
    maven/sandbox/trunk/continuum/continuum-data-upgrade/   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/continuum-legacy/
      - copied from r543064, maven/continuum/trunk/continuum-model/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/continuum-legacy/pom.xml
      - copied, changed from r544162, maven/continuum/trunk/continuum-model/pom.xml
    maven/sandbox/trunk/continuum/continuum-data-upgrade/continuum-legacy/src/main/mdo/continuum.xml
      - copied, changed from r544162, maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/pom.xml   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementException.java   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseManager.java   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseParams.java   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/pom.xml   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/assembly/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/assembly/app.xml   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DatabaseFormat.java   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/resources/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/resources/META-INF/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/resources/META-INF/plexus/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/resources/META-INF/plexus/plexus.xml   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/pom.xml   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/
      - copied from r543064, maven/continuum/trunk/continuum-data-management/src/main/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDatabaseManager.java   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java   (with props)
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/test/
      - copied from r543064, maven/continuum/trunk/continuum-data-management/src/test/
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java
      - copied, changed from r544191, maven/continuum/trunk/continuum-data-management/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java
    maven/sandbox/trunk/continuum/continuum-data-upgrade/pom.xml   (with props)
Removed:
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java
Modified:
    maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jun 11 01:18:01 2007
@@ -0,0 +1,4 @@
+target
+*.iml
+*.ipr
+*.iws

Copied: maven/sandbox/trunk/continuum/continuum-data-upgrade/continuum-legacy/pom.xml (from r544162, maven/continuum/trunk/continuum-model/pom.xml)
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/continuum-legacy/pom.xml?view=diff&rev=546040&p1=maven/continuum/trunk/continuum-model/pom.xml&r1=544162&p2=maven/sandbox/trunk/continuum/continuum-data-upgrade/continuum-legacy/pom.xml&r2=546040
==============================================================================
--- maven/continuum/trunk/continuum-model/pom.xml (original)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/continuum-legacy/pom.xml Mon Jun 11 01:18:01 2007
@@ -1,12 +1,32 @@
-<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">
+<!--
+  ~ 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>
-    <artifactId>continuum-parent</artifactId>
+    <artifactId>continuum-data-upgrade</artifactId>
     <groupId>org.apache.maven.continuum</groupId>
     <version>1.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <artifactId>continuum-model</artifactId>
-  <name>Continuum Model</name>
+  <artifactId>continuum-legacy</artifactId>
+  <name>Continuum Legacy Model</name>
   <build>
     <plugins>
       <plugin>
@@ -17,20 +37,10 @@
             <id>modello-continuum-metadata</id>
             <goals>
               <goal>jpox-metadata-class</goal>
-            </goals>
-          </execution>
-          <execution>
-            <id>modello-continuum</id>
-            <goals>
               <goal>java</goal>
               <goal>stax-reader</goal>
               <goal>stax-writer</goal>
             </goals>
-            <configuration>
-              <packagedVersions>
-                <packagedVersion>1.0.9</packagedVersion>
-              </packagedVersions>
-            </configuration>
           </execution>
           <execution>
             <id>jpox-jdo-mapping</id>
@@ -53,8 +63,8 @@
           </execution>
         </executions>
         <configuration>
-          <version>1.1.0</version>
-          <packageWithVersion>false</packageWithVersion>
+          <version>1.0.9</version>
+          <packageWithVersion>true</packageWithVersion>
           <model>src/main/mdo/continuum.xml</model>
         </configuration>
       </plugin>
@@ -66,6 +76,49 @@
           <execution>
             <goals>
               <goal>enhance</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>hack-sources</id>
+            <phase>process-sources</phase>
+            <configuration>
+              <tasks>
+                <!-- Workaround for MODELLO-89 -->
+                <replace
+                    file="target/generated-sources/modello/org/apache/maven/continuum/model/project/v1_0_9/ContinuumModelloMetadata.java"
+                    token="project;" value="project.v1_0_9;"/>
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>hack-resources</id>
+            <phase>process-resources</phase>
+            <configuration>
+              <tasks>
+                <!-- Workaround for MODELLO-91 -->
+                <replace dir="target/classes/META-INF" token='name="notifiertype"' value='name="type"'/>
+                <replace dir="target/classes/META-INF" token='name="resultstate"' value='name="state"'/>
+                <replace dir="target/classes/META-INF" token='name="resulttrigger"' value='name="trigger"'/>
+                <replace dir="target/classes/META-INF" token='name="projectstate"' value='name="state"'/>
+                <replace dir="target/classes/META-INF" token='name="changecomment"' value='name="comment"'/>
+                <replace dir="target/classes/META-INF" token='name="changedate"' value='name="date"'/>
+                <replace dir="target/classes/META-INF" token='name="scheduledelay"' value='name="delay"'/>
+                <!-- TODO: can we remove this? -->
+                <move file="target/classes/META-INF/package.jdorepl"
+                      tofile="target/classes/META-INF/package.jdorepl109"/>
+                <copy file="target/classes/META-INF/package.jdo" tofile="target/classes/META-INF/package.jdo109"/>
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
             </goals>
           </execution>
         </executions>

Copied: maven/sandbox/trunk/continuum/continuum-data-upgrade/continuum-legacy/src/main/mdo/continuum.xml (from r544162, maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml)
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/continuum-legacy/src/main/mdo/continuum.xml?view=diff&rev=546040&p1=maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml&r1=544162&p2=maven/sandbox/trunk/continuum/continuum-data-upgrade/continuum-legacy/src/main/mdo/continuum.xml&r2=546040
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/mdo/continuum.xml (original)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/continuum-legacy/src/main/mdo/continuum.xml Mon Jun 11 01:18:01 2007
@@ -1141,8 +1141,8 @@
       </fields>
       <codeSegments>
         <codeSegment>
-           <version>1.1.0+</version>
-           <code><![CDATA[
+          <version>1.1.0+</version>
+          <code><![CDATA[
     public final static int NEW = 1;
     public final static int OK = 2;
     public final static int FAILED = 3;

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jun 11 01:18:01 2007
@@ -0,0 +1,2 @@
+target
+*.iml

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/pom.xml?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/pom.xml (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/pom.xml Mon Jun 11 01:18:01 2007
@@ -0,0 +1,29 @@
+<?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.
+  -->
+
+<project>
+  <parent>
+    <artifactId>continuum-data-upgrade</artifactId>
+    <groupId>org.apache.maven.continuum</groupId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>data-management-api</artifactId>
+</project>
\ No newline at end of file

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementException.java?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementException.java (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementException.java Mon Jun 11 01:18:01 2007
@@ -0,0 +1,37 @@
+package org.apache.maven.continuum.management;
+
+/*
+ * 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.
+ */
+
+/**
+ * Exception wrapper for application errors that can't be recovered from.
+ */
+public class DataManagementException
+    extends RuntimeException
+{
+    public DataManagementException( Throwable nested )
+    {
+        super( nested );
+    }
+
+    public DataManagementException( String msg, Throwable nested )
+    {
+        super( msg, nested );
+    }
+}

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java Mon Jun 11 01:18:01 2007
@@ -0,0 +1,64 @@
+package org.apache.maven.continuum.management;
+
+/*
+ * 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 java.io.File;
+import java.io.IOException;
+
+/**
+ * Continuum database management tool API.
+ */
+public interface DataManagementTool
+{
+    /**
+     * Plexus Role.
+     */
+    String ROLE = DataManagementTool.class.getName();
+
+    /**
+     * The filename to use.
+     */
+    String BUILDS_XML = "builds.xml";
+
+    /**
+     * Backup the build database.
+     *
+     * @param backupDirectory the directory to backup to
+     * @throws java.io.IOException     if there is a problem writing to the backup file
+     * @throws DataManagementException if there is a problem reading from the database
+     */
+    void backupBuildDatabase( File backupDirectory )
+        throws IOException, DataManagementException;
+
+    /**
+     * Restore the build database.
+     *
+     * @param backupDirectory the directory where the backup to restore from resides
+     * @throws java.io.IOException     if there is a problem reading the backup file
+     * @throws DataManagementException if there is a problem parsing the backup file
+     */
+    void restoreBuildDatabase( File backupDirectory )
+        throws IOException, DataManagementException;
+
+    /**
+     * Smoke the build database.
+     */
+    void eraseBuildDatabase();
+}

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseManager.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseManager.java?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseManager.java (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseManager.java Mon Jun 11 01:18:01 2007
@@ -0,0 +1,30 @@
+package org.apache.maven.continuum.management;
+
+/*
+ * 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.
+ */
+
+/**
+ * A little indirection to help load things in the right order.
+ *
+ * @todo I can probably remove this
+ */
+public interface DatabaseManager
+{
+    void configure( DatabaseParams params );
+}

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseParams.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseParams.java?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseParams.java (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseParams.java Mon Jun 11 01:18:01 2007
@@ -0,0 +1,113 @@
+package org.apache.maven.continuum.management;
+
+/*
+ * 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.
+ */
+
+/**
+ * Bean for storing database parameters.
+ */
+public class DatabaseParams
+{
+    private final String driverClass;
+
+    private String url;
+
+    private final String groupId;
+
+    private final String artifactId;
+
+    private String version;
+
+    private String username;
+
+    private String password;
+
+    DatabaseParams( String driverClass, String groupId, String artifactId, String version, String username,
+                    String password )
+    {
+        this.driverClass = driverClass;
+
+        this.groupId = groupId;
+
+        this.artifactId = artifactId;
+
+        this.version = version;
+
+        this.username = username;
+
+        this.password = password;
+    }
+
+    DatabaseParams( DatabaseParams params )
+    {
+        this.driverClass = params.driverClass;
+
+        this.groupId = params.groupId;
+
+        this.artifactId = params.artifactId;
+
+        this.version = params.version;
+
+        this.username = params.username;
+
+        this.password = params.password;
+
+        this.url = params.url;
+    }
+
+    public String getUrl()
+    {
+        return url;
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public String getUsername()
+    {
+        return username;
+    }
+
+    public String getPassword()
+    {
+        return password;
+    }
+
+    public String getDriverClass()
+    {
+        return driverClass;
+    }
+
+    public void setUrl( String url )
+    {
+        this.url = url;
+    }
+}

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseParams.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jun 11 01:18:01 2007
@@ -0,0 +1,3 @@
+*.iml
+target
+derby.log

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/pom.xml?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/pom.xml (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/pom.xml Mon Jun 11 01:18:01 2007
@@ -0,0 +1,142 @@
+<?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.
+  -->
+
+<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>
+    <artifactId>continuum-data-upgrade</artifactId>
+    <groupId>org.apache.maven.continuum</groupId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>data-management-cli</artifactId>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>data-management-api</artifactId>
+      <version>1.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>data-management-jdo</artifactId>
+      <version>1.1-SNAPSHOT</version>
+      <!-- Ensures correct build order -->
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.cli-parser</groupId>
+      <artifactId>cli</artifactId>
+      <version>7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-jdo2</artifactId>
+      <version>1.0-alpha-8</version>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.8</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.wagon</groupId>
+      <artifactId>wagon-http-lightweight</artifactId>
+      <version>1.0-beta-2</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>stax</groupId>
+      <artifactId>stax</artifactId>
+      <version>1.1.1-dev</version>
+      <scope>runtime</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>xmlbeans</groupId>
+          <artifactId>xmlbeans-jsr173-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>stax</groupId>
+      <artifactId>stax-api</artifactId>
+      <version>1.0.1</version>
+      <scope>runtime</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <!-- TODO: shade it instead, not currently working with this
+        <plugin>
+          <artifactId>shade-maven-plugin</artifactId>
+          <groupId>org.codehaus.mojo</groupId>
+          <version>1.0-alpha-7</version>
+          <executions>
+            <execution>
+              <goals>
+                <goal>shade</goal>
+              </goals>
+            </execution>
+          </executions>
+        </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.management.DataManagementCli</mainClass>
+            </manifest>
+          </archive>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-artifact-manager</artifactId>
+        <version>2.0.6</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-artifact</artifactId>
+        <version>2.0.6</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+</project>

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/assembly/app.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/assembly/app.xml?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/assembly/app.xml (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/assembly/app.xml Mon Jun 11 01:18:01 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/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/assembly/app.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java Mon Jun 11 01:18:01 2007
@@ -0,0 +1,281 @@
+package org.apache.maven.continuum.management;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * An application for performing database upgrades from old Continuum and Redback versions. A suitable tool until it
+ * is natively incorporated into Continuum itself.
+ */
+public class DataManagementCli
+{
+    public static void main( String[] args )
+        throws Exception
+    {
+        Commands command = new Commands();
+
+        DatabaseFormat databaseFormat;
+        OperationMode mode;
+        SupportedDatabase databaseType;
+
+        try
+        {
+            Args.parse( command, args );
+
+            databaseFormat = DatabaseFormat.valueOf( command.databaseFormat );
+            mode = OperationMode.valueOf( command.mode );
+            databaseType = SupportedDatabase.valueOf( command.databaseType );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            Args.usage( command );
+
+            System.err.println( e.getMessage() );
+            return;
+        }
+
+        if ( command.directory.exists() && !command.directory.isDirectory() )
+        {
+            System.err.println( command.directory + " already exists and is not a directory." );
+            return;
+        }
+
+        if ( !command.overwrite && mode == OperationMode.EXPORT && command.directory.exists() )
+        {
+            System.err.println(
+                command.directory + " already exists and will not be overwritten unless the -overwrite flag is used." );
+            return;
+        }
+
+        if ( command.debug )
+        {
+            BasicConfigurator.configure();
+            Logger.getRootLogger().setLevel( Level.DEBUG );
+            Logger.getLogger( "JPOX" ).setLevel( Level.DEBUG );
+        }
+
+        DatabaseParams params = new DatabaseParams( databaseType.defaultParams );
+        params.setUrl( command.jdbcUrl );
+
+        DefaultPlexusContainer container = new DefaultPlexusContainer();
+        List<Artifact> artifacts = new ArrayList<Artifact>();
+        artifacts.addAll( downloadArtifact( container, "jpox", "jpox", databaseFormat.getJpoxVersion() ) );
+        artifacts.addAll(
+            downloadArtifact( container, params.getGroupId(), params.getArtifactId(), params.getVersion() ) );
+        artifacts.addAll(
+            downloadArtifact( container, "org.apache.maven.continuum", "data-management-jdo", "1.1-SNAPSHOT" ) );
+
+        List<File> jars = new ArrayList<File>();
+
+        // Little hack to make it work more nicely in the IDE
+        List<String> exclusions = new ArrayList<String>();
+        URLClassLoader cp = (URLClassLoader) DataManagementCli.class.getClassLoader();
+        for ( URL url : cp.getURLs() )
+        {
+            String urlEF = url.toExternalForm();
+            if ( urlEF.endsWith( "target/classes/" ) )
+            {
+                int idEndIdx = urlEF.length() - 16;
+                String id = urlEF.substring( urlEF.lastIndexOf( '/', idEndIdx - 1 ) + 1, idEndIdx );
+                // continuum-legacy included because the IDE doesn't do the proper assembly of enhanced classes and JDO metadata
+                if ( !"data-management-api".equals( id ) && !"data-management-cli".equals( id ) &&
+                    !"continuum-legacy".equals( id ) )
+                {
+                    exclusions.add( "org.apache.maven.continuum:" + id );
+                    jars.add( new File( url.getPath() ) );
+                }
+            }
+        }
+        ArtifactFilter filter = new ExcludesArtifactFilter( exclusions );
+
+        for ( Artifact a : artifacts )
+        {
+            if ( filter.include( a ) )
+            {
+                jars.add( a.getFile() );
+            }
+        }
+
+        ClassRealm realm = container.createComponentRealm( "app", jars );
+
+        ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader( realm );
+
+        ClassRealm oldRealm = container.setLookupRealm( realm );
+
+        DatabaseManager manager = (DatabaseManager) container.lookup( DatabaseManager.class.getName(), "jdo", realm );
+        manager.configure( params );
+
+        DataManagementTool tool =
+            (DataManagementTool) container.lookup( DataManagementTool.ROLE, databaseFormat.getToolRoleHint(), realm );
+
+        if ( mode == OperationMode.EXPORT )
+        {
+            tool.backupBuildDatabase( command.directory );
+        }
+        else if ( mode == OperationMode.IMPORT )
+        {
+            tool.eraseBuildDatabase();
+            tool.restoreBuildDatabase( command.directory );
+        }
+
+        container.setLookupRealm( oldRealm );
+        Thread.currentThread().setContextClassLoader( oldLoader );
+    }
+
+    private static Collection<Artifact> downloadArtifact( PlexusContainer container, String groupId, String artifactId,
+                                                          String version )
+        throws ComponentLookupException, MalformedURLException, ArtifactNotFoundException, ArtifactResolutionException
+    {
+        ArtifactRepositoryFactory factory =
+            (ArtifactRepositoryFactory) container.lookup( ArtifactRepositoryFactory.ROLE );
+
+        DefaultRepositoryLayout layout =
+            (DefaultRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, "default" );
+
+        File file = new File( System.getProperty( "user.home" ), "/.m2/repository" );
+        ArtifactRepository localRepository =
+            factory.createArtifactRepository( "local", file.toURL().toString(), layout, null, null );
+
+        List<ArtifactRepository> remoteRepositories = Collections.singletonList(
+            factory.createArtifactRepository( "central", "http://repo1.maven.org/maven2", layout, null, null ) );
+
+        ArtifactFactory artifactFactory = (ArtifactFactory) container.lookup( ArtifactFactory.ROLE );
+        Artifact artifact =
+            artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME, "jar" );
+        Artifact dummyArtifact = artifactFactory.createProjectArtifact( "dummy", "dummy", "1.0" );
+
+        ArtifactResolver resolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE );
+
+        List<String> exclusions = new ArrayList<String>();
+        exclusions.add( "org.apache.maven.continuum:data-management-api" );
+        exclusions.add( "org.codehaus.plexus:plexus-component-api" );
+        exclusions.add( "org.codehaus.plexus:plexus-container-default" );
+        exclusions.add( "stax:stax-api" );
+        exclusions.add( "log4j:log4j" );
+
+        Collection<File> jars = new ArrayList<File>();
+
+        ArtifactFilter filter = new ExcludesArtifactFilter( exclusions );
+
+        ArtifactMetadataSource source =
+            (ArtifactMetadataSource) container.lookup( ArtifactMetadataSource.ROLE, "maven" );
+        ArtifactResolutionResult result = resolver.resolveTransitively( Collections.singleton( artifact ),
+                                                                        dummyArtifact, localRepository,
+                                                                        remoteRepositories, source, filter );
+
+        return result.getArtifacts();
+    }
+
+    private static class Commands
+    {
+        @Argument(required = true,
+                  description = "The JDBC URL for the database that contains the data to convert, or to import the data into",
+                  value = "jdbcUrl")
+        private String jdbcUrl;
+
+        // TODO: ability to use the enum directly would be nice
+        @Argument(
+            description = "Format of the database. Valid values are CONTINUUM_103, CONTINUUM_109, CONTINUUM_11. Default is CONTINUUM_11.")
+        private String databaseFormat = DatabaseFormat.CONTINUUM_11.toString();
+
+/* TODO: not yet supported
+        @Argument(
+            description = "Format of the backup directory. Valid values are CONTINUUM_103, CONTINUUM_109, CONTINUUM_11. Default is CONTINUUM_11.")
+        private String dataFileFormat = DatabaseFormat.CONTINUUM_11.toString();
+*/
+
+        @Argument(
+            description = "The directory to export the data to, or import the data from. Default is 'backups' in the current working directory.",
+            value = "directory")
+        private File directory = new File( "backups" );
+
+        @Argument(
+            description = "Mode of operation. Valid values are IMPORT and EXPORT. Default is EXPORT.",
+            value = "mode")
+        private String mode = OperationMode.EXPORT.toString();
+
+        @Argument(
+            description = "Whether to overwrite the designated directory if it already exists in export mode. Default is false.",
+            value = "overwrite")
+        private boolean overwrite;
+
+        @Argument(
+            description = "The type of database to use. Currently supported values are DERBY_10_1. The default value is DERBY_10_1.",
+            value = "databaseType")
+        private String databaseType = SupportedDatabase.DERBY_10_1.toString();
+
+        @Argument(
+            description = "Turn on debugging information. Default is off.",
+            value = "debug")
+        private boolean debug;
+    }
+
+    // TODO: add user database formats
+
+    private enum OperationMode
+    {
+        IMPORT, EXPORT
+    }
+
+    private enum SupportedDatabase
+    {
+        DERBY_10_1( new DatabaseParams( "org.apache.derby.jdbc.EmbeddedDriver", "org.apache.derby", "derby", "10.1.3.1",
+                                        "sa", "" ) );
+
+        private DatabaseParams defaultParams;
+
+        SupportedDatabase( DatabaseParams defaultParams )
+        {
+            this.defaultParams = defaultParams;
+        }
+    }
+}

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DatabaseFormat.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DatabaseFormat.java?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DatabaseFormat.java (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DatabaseFormat.java Mon Jun 11 01:18:01 2007
@@ -0,0 +1,90 @@
+package org.apache.maven.continuum.management;
+
+/*
+ * 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.
+ */
+
+/**
+ * Enumeration of known database formats.
+ */
+public enum DatabaseFormat
+{
+    /**
+     * Continuum 1.0.3 build database.
+     *
+     * @todo this hasn't been completed/tested - the model needs to be annotated with 1.0.3 metadata and converters written.
+     */
+    CONTINUUM_103( "1.1.1", "legacy-jdo" )
+        {
+            public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
+            {
+                return false;
+            }
+        },
+
+    /**
+     * Continuum pre-alpha build database.
+     */
+    CONTINUUM_109( "1.1.1", "legacy-jdo" )
+        {
+            public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
+            {
+                return false;
+            }
+        },
+
+    /**
+     * Continuum 1.1+ build database.
+     */
+    CONTINUUM_11( "1.1.6", "jdo" )
+        {
+            public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
+            {
+                return sourceFormat == CONTINUUM_103 || sourceFormat == CONTINUUM_109;
+            }
+        };
+
+    private String jpoxVersion;
+
+    private String toolRoleHint;
+
+    DatabaseFormat( String jpoxVersion, String toolRoleHint )
+    {
+        this.jpoxVersion = jpoxVersion;
+
+        this.toolRoleHint = toolRoleHint;
+    }
+
+    /**
+     * Whether a database can be converted from the given format to this format.
+     *
+     * @param sourceFormat the database format to convert from
+     * @return whether it can be successfully converted from that format
+     */
+    public abstract boolean isConvertibleFrom( DatabaseFormat sourceFormat );
+
+    public String getJpoxVersion()
+    {
+        return jpoxVersion;
+    }
+
+    public String getToolRoleHint()
+    {
+        return toolRoleHint;
+    }
+}

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/java/org/apache/maven/continuum/management/DatabaseFormat.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/resources/META-INF/plexus/plexus.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/resources/META-INF/plexus/plexus.xml?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/resources/META-INF/plexus/plexus.xml (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/resources/META-INF/plexus/plexus.xml Mon Jun 11 01:18:01 2007
@@ -0,0 +1,80 @@
+<!--
+  ~ 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.
+  -->
+
+<plexus>
+  <components>
+    <component>
+      <role>org.codehaus.plexus.jdo.JdoFactory</role>
+      <role-hint>continuum</role-hint>
+      <implementation>org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory</implementation>
+      <configuration>
+        <!-- Database Configuration -->
+        <!--
+              <driverName>org.hsqldb.jdbcDriver</driverName>
+              <url>jdbc:hsqldb:mem:database</url>
+              <userName>sa</userName>
+              <password></password>
+        -->
+        <persistenceManagerFactoryClass>org.jpox.PersistenceManagerFactoryImpl</persistenceManagerFactoryClass>
+
+        <otherProperties>
+          <property>
+            <name>org.jpox.autoCreateSchema</name>
+            <value>true</value>
+          </property>
+          <property>
+            <name>org.jpox.validateTables</name>
+            <value>false</value>
+          </property>
+          <property>
+            <name>org.jpox.validateConstraints</name>
+            <value>false</value>
+          </property>
+          <property>
+            <name>org.jpox.validateColumns</name>
+            <value>false</value>
+          </property>
+          <property>
+            <name>org.jpox.autoStartMechanism</name>
+            <value>None</value>
+          </property>
+          <property>
+            <name>org.jpox.transactionIsolation</name>
+            <value>READ_UNCOMMITTED</value>
+          </property>
+          <property>
+            <name>org.jpox.poid.transactionIsolation</name>
+            <value>READ_UNCOMMITTED</value>
+          </property>
+          <property>
+            <name>org.jpox.rdbms.dateTimezone</name>
+            <value>JDK_DEFAULT_TIMEZONE</value>
+          </property>
+          <!--
+                    <property>
+                      <name>org.jpox.identifier.case</name>
+                      <value>PreserveCase</value>
+                    </property>
+          -->
+        </otherProperties>
+      </configuration>
+    </component>
+
+  </components>
+</plexus>

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-cli/src/main/resources/META-INF/plexus/plexus.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jun 11 01:18:01 2007
@@ -0,0 +1,2 @@
+target
+*.iml

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/pom.xml?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/pom.xml (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/pom.xml Mon Jun 11 01:18:01 2007
@@ -0,0 +1,84 @@
+<?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.
+  -->
+
+<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>
+    <artifactId>continuum-data-upgrade</artifactId>
+    <groupId>org.apache.maven.continuum</groupId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>data-management-jdo</artifactId>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>data-management-api</artifactId>
+      <version>1.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-jdo2</artifactId>
+      <version>1.0-alpha-8</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-model</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-store</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-store</artifactId>
+      <classifier>tests</classifier>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>jpox</groupId>
+      <artifactId>jpox</artifactId>
+      <version>1.1.6</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>stax</groupId>
+      <artifactId>stax</artifactId>
+      <version>1.1.1-dev</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>xmlbeans</groupId>
+          <artifactId>xmlbeans-jsr173-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java?view=diff&rev=546040&r1=543064&r2=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java (original)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java Mon Jun 11 01:18:01 2007
@@ -19,7 +19,6 @@
  * under the License.
  */
 
-import org.apache.maven.continuum.ContinuumRuntimeException;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.ContinuumDatabase;
 import org.apache.maven.continuum.model.project.Profile;
@@ -73,11 +72,19 @@
     private ConfigurableJdoFactory factory;
 
     public void backupBuildDatabase( File backupDirectory )
-        throws IOException, ContinuumStoreException
+        throws IOException
     {
         ContinuumDatabase database = new ContinuumDatabase();
-        database.setSystemConfiguration( store.getSystemConfiguration() );
+        try
+        {
+            database.setSystemConfiguration( store.getSystemConfiguration() );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new DataManagementException( e );
+        }
 
+        // TODO: need these to lazy load to conserve memory while we stream out the model
         Collection projectGroups = store.getAllProjectGroupsWithTheLot();
         database.setProjectGroups( new ArrayList( projectGroups ) );
 
@@ -87,6 +94,8 @@
 
         ContinuumStaxWriter writer = new ContinuumStaxWriter();
 
+        backupDirectory.mkdirs();
+
         OutputStream out = new FileOutputStream( new File( backupDirectory, BUILDS_XML ) );
         Writer fileWriter = new OutputStreamWriter( out, Charset.forName( database.getModelEncoding() ) );
 
@@ -96,7 +105,7 @@
         }
         catch ( XMLStreamException e )
         {
-            throw new ContinuumRuntimeException( "Modello failure: unable to write data to StAX writer", e );
+            throw new DataManagementException( "Modello failure: unable to write data to StAX writer", e );
         }
         finally
         {
@@ -110,7 +119,7 @@
     }
 
     public void restoreBuildDatabase( File backupDirectory )
-        throws IOException, XMLStreamException
+        throws IOException
     {
         ContinuumStaxReader reader = new ContinuumStaxReader();
 
@@ -121,6 +130,10 @@
         {
             database = reader.read( fileReader );
         }
+        catch ( XMLStreamException e )
+        {
+            throw new DataManagementException( e );
+        }
         finally
         {
             IOUtil.close( fileReader );
@@ -135,16 +148,16 @@
 
         PlexusJdoUtils.addObject( pmf.getPersistenceManager(), database.getSystemConfiguration() );
 
-        Map schedules = new HashMap();
+        Map<Integer, Schedule> schedules = new HashMap<Integer, Schedule>();
         for ( Iterator i = database.getSchedules().iterator(); i.hasNext(); )
         {
             Schedule schedule = (Schedule) i.next();
 
             schedule = (Schedule) PlexusJdoUtils.addObject( pmf.getPersistenceManager(), schedule );
-            schedules.put( new Integer( schedule.getId() ), schedule );
+            schedules.put( Integer.valueOf( schedule.getId() ), schedule );
         }
 
-        Map installations = new HashMap();
+        Map<String, Installation> installations = new HashMap<String, Installation>();
         for ( Iterator i = database.getInstallations().iterator(); i.hasNext(); )
         {
             Installation installation = (Installation) i.next();
@@ -153,7 +166,7 @@
             installations.put( installation.getName(), installation );
         }
 
-        Map profiles = new HashMap();
+        Map<Integer, Profile> profiles = new HashMap<Integer, Profile>();
         for ( Iterator i = database.getProfiles().iterator(); i.hasNext(); )
         {
             Profile profile = (Profile) i.next();
@@ -161,15 +174,15 @@
             // process installations
             if ( profile.getJdk() != null )
             {
-                profile.setJdk( (Installation) installations.get( profile.getJdk().getName() ) );
+                profile.setJdk( installations.get( profile.getJdk().getName() ) );
             }
             if ( profile.getBuilder() != null )
             {
-                profile.setBuilder( (Installation) installations.get( profile.getBuilder().getName() ) );
+                profile.setBuilder( installations.get( profile.getBuilder().getName() ) );
             }
 
             profile = (Profile) PlexusJdoUtils.addObject( pmf.getPersistenceManager(), profile );
-            profiles.put( new Integer( profile.getId() ), profile );
+            profiles.put( Integer.valueOf( profile.getId() ), profile );
         }
 
         for ( Iterator i = database.getProjectGroups().iterator(); i.hasNext(); )
@@ -190,7 +203,8 @@
         }
     }
 
-    private static void processBuildDefinitions( List buildDefinitions, Map schedules, Map profiles )
+    private static void processBuildDefinitions( List buildDefinitions, Map<Integer, Schedule> schedules,
+                                                 Map<Integer, Profile> profiles )
     {
         for ( Iterator i = buildDefinitions.iterator(); i.hasNext(); )
         {
@@ -198,12 +212,12 @@
 
             if ( def.getSchedule() != null )
             {
-                def.setSchedule( (Schedule) schedules.get( new Integer( def.getSchedule().getId() ) ) );
+                def.setSchedule( schedules.get( Integer.valueOf( def.getSchedule().getId() ) ) );
             }
 
             if ( def.getProfile() != null )
             {
-                def.setProfile( (Profile) profiles.get( new Integer( def.getProfile().getId() ) ) );
+                def.setProfile( profiles.get( Integer.valueOf( def.getProfile().getId() ) ) );
             }
         }
     }

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDatabaseManager.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDatabaseManager.java?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDatabaseManager.java (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDatabaseManager.java Mon Jun 11 01:18:01 2007
@@ -0,0 +1,45 @@
+package org.apache.maven.continuum.management;
+
+import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
+
+/*
+ * 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.
+ */
+
+/**
+ * Initialization helper.
+ *
+ * @plexus.component role="org.apache.maven.continuum.management.DatabaseManager" role-hint="jdo"
+ */
+public class JdoDatabaseManager
+    implements DatabaseManager
+{
+    /**
+     * @plexus.requirement role="org.codehaus.plexus.jdo.JdoFactory" role-hint="continuum"
+     */
+    private DefaultConfigurableJdoFactory factory;
+
+    public void configure( DatabaseParams params )
+    {
+        // Must occur before store is looked up
+        factory.setDriverName( params.getDriverClass() );
+        factory.setUserName( params.getUsername() );
+        factory.setPassword( params.getPassword() );
+        factory.setUrl( params.getUrl() );
+    }
+}

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDatabaseManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java Mon Jun 11 01:18:01 2007
@@ -0,0 +1,266 @@
+package org.apache.maven.continuum.management;
+
+/*
+ * 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 org.apache.maven.continuum.model.project.v1_0_9.BuildDefinition;
+import org.apache.maven.continuum.model.project.v1_0_9.BuildResult;
+import org.apache.maven.continuum.model.project.v1_0_9.ContinuumDatabase;
+import org.apache.maven.continuum.model.project.v1_0_9.Project;
+import org.apache.maven.continuum.model.project.v1_0_9.ProjectDependency;
+import org.apache.maven.continuum.model.project.v1_0_9.ProjectDeveloper;
+import org.apache.maven.continuum.model.project.v1_0_9.ProjectGroup;
+import org.apache.maven.continuum.model.project.v1_0_9.ProjectNotifier;
+import org.apache.maven.continuum.model.project.v1_0_9.Schedule;
+import org.apache.maven.continuum.model.project.v1_0_9.io.stax.ContinuumStaxReader;
+import org.apache.maven.continuum.model.project.v1_0_9.io.stax.ContinuumStaxWriter;
+import org.apache.maven.continuum.model.scm.v1_0_9.ChangeFile;
+import org.apache.maven.continuum.model.scm.v1_0_9.ChangeSet;
+import org.apache.maven.continuum.model.scm.v1_0_9.ScmResult;
+import org.apache.maven.continuum.model.scm.v1_0_9.SuiteResult;
+import org.apache.maven.continuum.model.scm.v1_0_9.TestCaseFailure;
+import org.apache.maven.continuum.model.scm.v1_0_9.TestResult;
+import org.apache.maven.continuum.model.system.v1_0_9.SystemConfiguration;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.codehaus.plexus.jdo.ConfigurableJdoFactory;
+import org.codehaus.plexus.jdo.PlexusJdoUtils;
+import org.codehaus.plexus.util.IOUtil;
+
+import javax.jdo.FetchPlan;
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.xml.stream.XMLStreamException;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * JDO implementation the database management tool API.
+ *
+ * @plexus.component role="org.apache.maven.continuum.management.DataManagementTool" role-hint="legacy-jdo"
+ */
+public class LegacyJdoDataManagementTool
+    implements DataManagementTool
+{
+    /**
+     * @plexus.requirement role="org.codehaus.plexus.jdo.JdoFactory" role-hint="continuum"
+     */
+    private ConfigurableJdoFactory factory;
+
+    public void backupBuildDatabase( File backupDirectory )
+        throws IOException
+    {
+        PersistenceManagerFactory pmf = getPersistenceManagerFactory( "jdo109" );
+
+        ContinuumDatabase database = new ContinuumDatabase();
+        try
+        {
+            database.setSystemConfiguration( retrieveSystemConfiguration( pmf ) );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new DataManagementException( e );
+        }
+
+        Collection<ProjectGroup> projectGroups = retrieveAllProjectGroups( pmf );
+        database.setProjectGroups( new ArrayList<ProjectGroup>( projectGroups ) );
+
+        database.setSchedules( retrieveAllSchedules( pmf ) );
+
+        ContinuumStaxWriter writer = new ContinuumStaxWriter();
+
+        backupDirectory.mkdirs();
+        OutputStream out = new FileOutputStream( new File( backupDirectory, BUILDS_XML ) );
+        Writer fileWriter = new OutputStreamWriter( out, Charset.forName( database.getModelEncoding() ) );
+
+        try
+        {
+            writer.write( fileWriter, database );
+        }
+        catch ( XMLStreamException e )
+        {
+            throw new DataManagementException( "Modello failure: unable to write data to StAX writer", e );
+        }
+        finally
+        {
+            IOUtil.close( fileWriter );
+        }
+    }
+
+    private List retrieveAllSchedules( PersistenceManagerFactory pmf )
+    {
+        return PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager( pmf ), Schedule.class, "name ascending",
+                                                     (String) null );
+    }
+
+    private Collection<ProjectGroup> retrieveAllProjectGroups( PersistenceManagerFactory pmf )
+    {
+        List<String> fetchGroups = Arrays.asList( "project-with-builds", "projectgroup-projects",
+                                                  "build-result-with-details", "project-with-checkout-result",
+                                                  "project-all-details", "project-build-details" );
+        return PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager( pmf ), ProjectGroup.class, "name ascending",
+                                                     fetchGroups );
+    }
+
+    private SystemConfiguration retrieveSystemConfiguration( PersistenceManagerFactory pmf )
+        throws ContinuumStoreException
+    {
+        SystemConfiguration result;
+        List systemConfs = PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager( pmf ),
+                                                                 SystemConfiguration.class, null, (String) null );
+
+        if ( systemConfs == null || systemConfs.isEmpty() )
+        {
+            result = null;
+        }
+        else if ( systemConfs.size() > 1 )
+        {
+            throw new ContinuumStoreException(
+                "Database is corrupted. There are more than one systemConfiguration object." );
+        }
+        else
+        {
+            result = (SystemConfiguration) systemConfs.get( 0 );
+        }
+        return result;
+    }
+
+    @SuppressWarnings({"OverlyCoupledMethod"})
+    public void eraseBuildDatabase()
+    {
+        PersistenceManagerFactory pmf = getPersistenceManagerFactory( "jdo109" );
+        PersistenceManager persistenceManager = getPersistenceManager( pmf );
+        PlexusJdoUtils.removeAll( persistenceManager, ProjectGroup.class );
+        PlexusJdoUtils.removeAll( persistenceManager, Project.class );
+        PlexusJdoUtils.removeAll( persistenceManager, Schedule.class );
+        PlexusJdoUtils.removeAll( persistenceManager, ScmResult.class );
+        PlexusJdoUtils.removeAll( persistenceManager, BuildResult.class );
+        PlexusJdoUtils.removeAll( persistenceManager, TestResult.class );
+        PlexusJdoUtils.removeAll( persistenceManager, SuiteResult.class );
+        PlexusJdoUtils.removeAll( persistenceManager, TestCaseFailure.class );
+        PlexusJdoUtils.removeAll( persistenceManager, SystemConfiguration.class );
+        PlexusJdoUtils.removeAll( persistenceManager, ProjectNotifier.class );
+        PlexusJdoUtils.removeAll( persistenceManager, ProjectDeveloper.class );
+        PlexusJdoUtils.removeAll( persistenceManager, ProjectDependency.class );
+        PlexusJdoUtils.removeAll( persistenceManager, ChangeSet.class );
+        PlexusJdoUtils.removeAll( persistenceManager, ChangeFile.class );
+        PlexusJdoUtils.removeAll( persistenceManager, BuildDefinition.class );
+    }
+
+    private PersistenceManager getPersistenceManager( PersistenceManagerFactory pmf )
+    {
+        PersistenceManager pm = pmf.getPersistenceManager();
+
+        pm.getFetchPlan().setMaxFetchDepth( -1 );
+        pm.getFetchPlan().setDetachmentOptions( FetchPlan.DETACH_LOAD_FIELDS );
+
+        return pm;
+    }
+
+    public void restoreBuildDatabase( File backupDirectory )
+        throws IOException
+    {
+        ContinuumStaxReader reader = new ContinuumStaxReader();
+
+        FileReader fileReader = new FileReader( new File( backupDirectory, BUILDS_XML ) );
+
+        ContinuumDatabase database;
+        try
+        {
+            database = reader.read( fileReader );
+        }
+        catch ( XMLStreamException e )
+        {
+            throw new DataManagementException( e );
+        }
+        finally
+        {
+            IOUtil.close( fileReader );
+        }
+
+        PersistenceManagerFactory pmf = getPersistenceManagerFactory( "jdorepl109" );
+
+        PlexusJdoUtils.addObject( pmf.getPersistenceManager(), database.getSystemConfiguration() );
+
+        Map<Integer, Schedule> schedules = new HashMap<Integer, Schedule>();
+        for ( Iterator i = database.getSchedules().iterator(); i.hasNext(); )
+        {
+            Schedule schedule = (Schedule) i.next();
+
+            schedule = (Schedule) PlexusJdoUtils.addObject( pmf.getPersistenceManager(), schedule );
+            schedules.put( Integer.valueOf( schedule.getId() ), schedule );
+        }
+
+        for ( Iterator i = database.getProjectGroups().iterator(); i.hasNext(); )
+        {
+            ProjectGroup projectGroup = (ProjectGroup) i.next();
+
+            // first, we must map up any schedules, etc.
+            processBuildDefinitions( projectGroup.getBuildDefinitions(), schedules );
+
+            for ( Iterator j = projectGroup.getProjects().iterator(); j.hasNext(); )
+            {
+                Project project = (Project) j.next();
+
+                processBuildDefinitions( project.getBuildDefinitions(), schedules );
+            }
+
+            PlexusJdoUtils.addObject( pmf.getPersistenceManager(), projectGroup );
+        }
+        pmf.close();
+    }
+
+    private PersistenceManagerFactory getPersistenceManagerFactory( String ext )
+    {
+        // Take control of the JDO instead of using the store, and configure a new persistence factory
+        // that won't generate new object IDs.
+        Properties properties = new Properties();
+        //noinspection UseOfPropertiesAsHashtable
+        properties.putAll( factory.getProperties() );
+        properties.setProperty( "org.jpox.metadata.jdoFileExtension", ext );
+        return JDOHelper.getPersistenceManagerFactory( properties );
+    }
+
+    private static void processBuildDefinitions( List buildDefinitions, Map<Integer, Schedule> schedules )
+    {
+        for ( Iterator i = buildDefinitions.iterator(); i.hasNext(); )
+        {
+            BuildDefinition def = (BuildDefinition) i.next();
+
+            if ( def.getSchedule() != null )
+            {
+                def.setSchedule( schedules.get( Integer.valueOf( def.getSchedule().getId() ) ) );
+            }
+        }
+    }
+}

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java (from r544191, maven/continuum/trunk/continuum-data-management/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java)
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java?view=diff&rev=546040&p1=maven/continuum/trunk/continuum-data-management/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java&r1=544191&p2=maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java&r2=546040
==============================================================================
--- maven/continuum/trunk/continuum-data-management/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java (original)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/data-management-jdo/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java Mon Jun 11 01:18:01 2007
@@ -141,14 +141,16 @@
     private static String removeTimestampVariance( String content )
     {
         return fixXmlQuotes( removeTagContent(
-            removeTagContent( removeTagContent( removeTagContent( content, "startTime" ), "endTime" ), "date" ), "id" ) );
+            removeTagContent( removeTagContent( removeTagContent( content, "startTime" ), "endTime" ), "date" ),
+            "id" ) );
     }
 
     private static String fixXmlQuotes( String s )
     {
-        if ( s.startsWith( "<?xml version='1.0' encoding='UTF-8'?>"))
+        if ( s.startsWith( "<?xml version='1.0' encoding='UTF-8'?>" ) )
         {
-            return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + s.substring( "<?xml version='1.0' encoding='UTF-8'?>".length() );
+            return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+                s.substring( "<?xml version='1.0' encoding='UTF-8'?>".length() );
         }
         return cleanLineEndings( s );
     }

Added: maven/sandbox/trunk/continuum/continuum-data-upgrade/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-data-upgrade/pom.xml?view=auto&rev=546040
==============================================================================
--- maven/sandbox/trunk/continuum/continuum-data-upgrade/pom.xml (added)
+++ maven/sandbox/trunk/continuum/continuum-data-upgrade/pom.xml Mon Jun 11 01:18:01 2007
@@ -0,0 +1,57 @@
+<?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">
+  <modelVersion>4.0.0</modelVersion>
+  <prerequisites>
+    <maven>2.0.6</maven>
+  </prerequisites>
+  <parent>
+    <artifactId>continuum-parent</artifactId>
+    <groupId>org.apache.maven.continuum</groupId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <packaging>pom</packaging>
+  <artifactId>continuum-data-upgrade</artifactId>
+  <modules>
+    <module>data-management-cli</module>
+    <module>data-management-api</module>
+    <module>continuum-legacy</module>
+    <module>data-management-jdo</module>
+  </modules>
+  <build>
+    <plugins>
+      <!-- TODO: move up to continuum parent and use in all modules -->
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-maven-plugin</artifactId>
+        <version>1.3.2</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/sandbox/trunk/continuum/continuum-data-upgrade/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message