geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r424845 - in /geronimo/sandbox/svkmerge/geronimo-repository: geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/ geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/ geronimo-repository-providers/ geron...
Date Sun, 23 Jul 2006 22:41:25 GMT
Author: jdillon
Date: Sun Jul 23 15:41:23 2006
New Revision: 424845

URL: http://svn.apache.org/viewvc?rev=424845&view=rev
Log:
Copied over the kernel repository apis (same package, pending renaming)
Added modules for the maven1 and maven2 impls
Created basic JDBM repository impl
Added RepositoryCopier util to copy from a listable repo to a writable repo

Added:
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/
      - copied from r424798, geronimo/sandbox/svkmerge/m2migration/modules/kernel/src/java/org/apache/geronimo/kernel/repository/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/RepositoryCopier.java
  (with props)
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/test/data/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/test/data/m1/
      - copied from r424798, geronimo/sandbox/svkmerge/m2migration/modules/system/src/test-repo/m1/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/test/data/m2/
      - copied from r424798, geronimo/sandbox/svkmerge/m2migration/modules/system/src/test-repo/m2/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/test/java/org/apache/geronimo/repository/jdbm/RepositoryCopierTest.java
  (with props)
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/pom.xml
  (with props)
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/main/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/main/java/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/main/java/org/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/main/java/org/apache/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/main/java/org/apache/geronimo/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/main/java/org/apache/geronimo/repository/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/main/java/org/apache/geronimo/repository/maven1/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/test/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/test/java/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/test/java/org/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/test/java/org/apache/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/test/java/org/apache/geronimo/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/test/java/org/apache/geronimo/repository/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/src/test/java/org/apache/geronimo/repository/maven1/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/pom.xml
  (with props)
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/main/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/main/java/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/main/java/org/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/main/java/org/apache/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/main/java/org/apache/geronimo/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/main/java/org/apache/geronimo/repository/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/main/java/org/apache/geronimo/repository/maven2/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/test/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/test/java/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/test/java/org/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/test/java/org/apache/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/test/java/org/apache/geronimo/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/test/java/org/apache/geronimo/repository/
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/src/test/java/org/apache/geronimo/repository/maven2/
Modified:
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/Artifact.java
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/Environment.java
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/pom.xml
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/ArtifactDatabase.java
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/JdbmRepository.java
    geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/pom.xml

Modified: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/Artifact.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/Artifact.java?rev=424845&r1=424798&r2=424845&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/Artifact.java
(original)
+++ geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/Artifact.java
Sun Jul 23 15:41:23 2006
@@ -20,7 +20,7 @@
 import java.io.Serializable;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class Artifact implements Comparable, Serializable {
     private static final long serialVersionUID = -3459638899709893444L;

Modified: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/Environment.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/Environment.java?rev=424845&r1=424798&r2=424845&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/Environment.java
(original)
+++ geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-api/src/main/java/org/apache/geronimo/kernel/repository/Environment.java
Sun Jul 23 15:41:23 2006
@@ -30,7 +30,7 @@
 /**
  * holds the data from the EnvironmentType xml while it is being resolved, transitively closed,
etc.
  *
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class Environment implements Serializable {
     private static final long serialVersionUID = 7075760873629376317L;

Modified: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/pom.xml?rev=424845&r1=424844&r2=424845&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/pom.xml
(original)
+++ geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/pom.xml
Sun Jul 23 15:41:23 2006
@@ -40,5 +40,37 @@
             <type>jar</type>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <!--
+                Copy the m1 and m2 repos for testing w/o the .svn dirs
+                -->
+                <executions>
+                    <execution>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <tasks>
+                                <mkdir dir="${pom.basedir}/target"/>
+                                <copy todir="${pom.basedir}/target">
+                                    <fileset dir="${pom.basedir}/src/test/data">
+                                        <include name="m1/**"/>
+                                        <include name="m2/**"/>
+                                        <exclude name="**/.svn/**"/>
+                                    </fileset>
+                                </copy>
+                            </tasks>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
     
 </project>

Modified: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/ArtifactDatabase.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/ArtifactDatabase.java?rev=424845&r1=424844&r2=424845&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/ArtifactDatabase.java
(original)
+++ geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/ArtifactDatabase.java
Sun Jul 23 15:41:23 2006
@@ -21,8 +21,14 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Properties;
 
 import org.apache.geronimo.kernel.repository.Artifact;
+import jdbm.RecordManagerFactory;
+import jdbm.RecordManager;
+import jdbm.helper.StringComparator;
+import jdbm.helper.TupleBrowser;
+import jdbm.btree.BTree;
 
 /**
  * Provides a database of {@link Artifact} objects.
@@ -33,8 +39,14 @@
 {
     private static final Log log = LogFactory.getLog(ArtifactDatabase.class);
 
+    private static final String ARTIFACTS_BTREE_NAME = "artifacts_btree";
+
     private File baseDir;
 
+    private RecordManager recman;
+
+    private BTree artifacts;
+
     public ArtifactDatabase(final File baseDir) throws IOException {
         if (baseDir == null) {
             throw new IllegalArgumentException("Basedir is null");
@@ -45,15 +57,59 @@
         //
 
         this.baseDir = baseDir;
+        this.baseDir.mkdirs();
+
+        // Setup the record manager
+        Properties props = new Properties();
+        File file = new File(baseDir, "metadata");
+        this.recman = RecordManagerFactory.createRecordManager(file.getPath(), props);
+
+        // Loade the artifacts btree
+        long recid = recman.getNamedObject(ARTIFACTS_BTREE_NAME);
+        if ( recid != 0 ) {
+            this.artifacts = BTree.load(recman, recid);
+        }
+        else {
+            this.artifacts = BTree.createInstance(recman, new StringComparator());
+            recman.setNamedObject(ARTIFACTS_BTREE_NAME, artifacts.getRecid());
+        }
     }
 
     public File getBaseDir() {
         return baseDir;
     }
 
-    public void close() {
-        //
-        // TODO:
-        //
+    public void commit() throws IOException {
+        recman.commit();
+    }
+
+    public void rollback() throws IOException {
+        recman.rollback();
+    }
+
+    public void close() throws IOException {
+        recman.close();
+    }
+
+    public boolean contains(final Artifact artifact) throws IOException {
+        assert artifact != null;
+        assert artifact.isResolved();
+
+        String key = artifact.toString();
+        Object obj = artifacts.find(key);
+
+        return obj != null;
+    }
+
+    public void insert(final Artifact artifact) throws IOException {
+        assert artifact != null;
+        assert artifact.isResolved();
+
+        String key = artifact.toString();
+        artifacts.insert(key, artifact, false); // do not replace
+    }
+
+    public TupleBrowser browse() throws IOException {
+        return artifacts.browse();
     }
 }

Modified: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/JdbmRepository.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/JdbmRepository.java?rev=424845&r1=424844&r2=424845&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/JdbmRepository.java
(original)
+++ geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/JdbmRepository.java
Sun Jul 23 15:41:23 2006
@@ -22,6 +22,7 @@
 
 import java.net.URI;
 import java.util.SortedSet;
+import java.util.TreeSet;
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -32,6 +33,8 @@
 
 import org.apache.geronimo.system.repository.AbstractRepository;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
+import jdbm.helper.TupleBrowser;
+import jdbm.helper.Tuple;
 
 /**
  * Geronimo repository implemenation backed by <a href="http://jdbm.sourceforge.net">JDBM</a>.
@@ -55,6 +58,12 @@
 
         this.db = new ArtifactDatabase(root);
         this.dataDir = new File(root, "data");
+
+        //
+        // TODO: Validate data dir
+        //
+
+        this.dataDir.mkdirs();
     }
 
     private void ensureFullyResolved(final Artifact artifact) {
@@ -66,14 +75,20 @@
     }
 
     //
+    // TODO: Add GBean lifecycle hooks
+    //
+
+    //
     // Repository
     //
-    
+
     public File getLocation(final Artifact artifact) {
         assert artifact != null;
-        
+
         ensureFullyResolved(artifact);
 
+        log.info("Getting location for artifact: " + artifact);
+
         Artifact base = new Artifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
null);
 
         // Use a shorten but unique path that includes the filename for clarity
@@ -88,71 +103,105 @@
 
         ensureFullyResolved(artifact);
 
-        //
-        // TODO: Query the DB to get the status of the artifact
-        //
-
-        return false;
+        try {
+            return db.contains(artifact);
+        }
+        catch (IOException e) {
+            throw new RuntimeException("Unexpected database failure", e);
+        }
     }
 
     //
     // WritableRepository
     //
-    
+
     public void copyToRepository(final InputStream source, final int size, final Artifact
destination, final FileWriteMonitor monitor) throws IOException {
         assert source != null;
-        assert size > 0;
         assert destination != null;
         assert monitor != null;
-
-        ensureFullyResolved(destination);
+        // size may be == 0
         
-        //
-        // TODO: Copy... maybe able to re-use super-class impl... check
-        //
+        ensureFullyResolved(destination);
 
         //
         // TODO: Insert into DB
         //
+        db.insert(destination);
+
+        try {
+            // For now just delegate to our parent to perform the copy
+            super.copyToRepository(source, size, destination, monitor);
+
+            db.commit();
+        }
+        catch (Exception e) {
+            log.error("Failed to copy artifact; rolling back", e);
+            db.rollback();
+
+            //
+            // TODO: Clean up file?
+            //
+        }
     }
-    
+
     //
     // ListableRepository
     //
-    
+
     public SortedSet list(final Artifact query) {
         assert query != null;
 
-        //
-        // TODO: Query the DB
-        //
+        SortedSet artifacts = new TreeSet();
+
+        try {
+            TupleBrowser browser = db.browse();
+            Tuple tuple = new Tuple();
+
+            while (browser.getNext(tuple)) {
+                //
+                // TODO: ...
+                //
+            }
+        }
+        catch (IOException e) {
+            throw new RuntimeException("Failed to browse database", e);
+        }
 
-        return null;
+        return artifacts;
     }
-    
+
     public SortedSet list() {
+        SortedSet artifacts = new TreeSet();
 
-        //
-        // TODO: List all artifacts from the DB
-        //
+        try {
+            TupleBrowser browser = db.browse();
+            Tuple tuple = new Tuple();
+
+            while (browser.getNext(tuple)) {
+                artifacts.add(tuple.getValue());
+            }
+        }
+        catch (IOException e) {
+            throw new RuntimeException("Failed to browse database", e);
+        }
 
-        return null;
+        return artifacts;
     }
-    
+
     //
     // GBean
     //
-    
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder builder = GBeanInfoBuilder.createStatic(JdbmRepository.class, "Repository");
-        
+
         builder.addAttribute("root", URI.class, true);
         builder.addReference("ServerInfo", ServerInfo.class, "GBean");
         builder.addInterface(JdbmRepository.class);
         builder.setConstructor(new String[]{ "root", "ServerInfo" });
-        
+
         GBEAN_INFO = builder.getBeanInfo();
     }
 

Added: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/RepositoryCopier.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/RepositoryCopier.java?rev=424845&view=auto
==============================================================================
--- geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/RepositoryCopier.java
(added)
+++ geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/RepositoryCopier.java
Sun Jul 23 15:41:23 2006
@@ -0,0 +1,96 @@
+/**
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.
+ */
+
+package org.apache.geronimo.repository.jdbm;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.geronimo.kernel.repository.ListableRepository;
+import org.apache.geronimo.kernel.repository.WriteableRepository;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.FileWriteMonitor;
+
+import java.util.Set;
+import java.util.Iterator;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Utility to copy one listable repository to another writable repository.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RepositoryCopier
+{
+    private static final Log log = LogFactory.getLog(RepositoryCopier.class);
+
+    private ListableRepository source;
+
+    private WriteableRepository target;
+
+    public RepositoryCopier(final ListableRepository source, final WriteableRepository target)
{
+        if (source == null) {
+            throw new IllegalArgumentException("Source is null");
+        }
+        if (target == null) {
+            throw new IllegalArgumentException("Target is null");
+        }
+
+        this.source = source;
+        this.target = target;
+    }
+
+    public void copy(final FileWriteMonitor monitor) throws IOException {
+        assert monitor != null;
+        
+        log.debug("Copying artifacts from " + source + " to " + target);
+
+        Set artifacts = source.list();
+        Iterator iter = artifacts.iterator();
+
+        while (iter.hasNext()) {
+            Artifact artifact = (Artifact)iter.next();
+            log.debug("Copying artifact: " + artifact);
+
+            File sourceFile = source.getLocation(artifact);
+            target.copyToRepository(sourceFile, artifact, monitor);
+        }
+    }
+
+    public static void copy(final ListableRepository source, final WriteableRepository target,
final FileWriteMonitor monitor) throws IOException {
+        RepositoryCopier copier = new RepositoryCopier(source, target);
+        copier.copy(monitor);
+    }
+
+    public static void copy(final ListableRepository source, final WriteableRepository target)
throws IOException {
+        FileWriteMonitor monitor = new FileWriteMonitor() {
+            public void writeStarted(final String fileDescription, final int fileSize) {
+                log.info("Copying " + fileDescription);
+            }
+
+            public void writeProgress(int bytes) {
+                log.debug("Copy progress: " + bytes + " bytes");
+            }
+
+            public void writeComplete(int bytes) {
+                log.info("Copy completed (" + bytes + " bytes)");
+            }
+        };
+
+        copy(source, target, monitor);
+    }
+}

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/RepositoryCopier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/RepositoryCopier.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/main/java/org/apache/geronimo/repository/jdbm/RepositoryCopier.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/test/java/org/apache/geronimo/repository/jdbm/RepositoryCopierTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/test/java/org/apache/geronimo/repository/jdbm/RepositoryCopierTest.java?rev=424845&view=auto
==============================================================================
--- geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/test/java/org/apache/geronimo/repository/jdbm/RepositoryCopierTest.java
(added)
+++ geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/test/java/org/apache/geronimo/repository/jdbm/RepositoryCopierTest.java
Sun Jul 23 15:41:23 2006
@@ -0,0 +1,107 @@
+/**
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.
+ */
+
+package org.apache.geronimo.repository.jdbm;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.geronimo.repository.jdbm.JdbmRepository;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.system.repository.Maven1Repository;
+import org.apache.geronimo.system.repository.Maven2Repository;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Unit tests for the {@link RepositoryCopier} class.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RepositoryCopierTest
+    extends TestCase
+{
+    private static final Log log = LogFactory.getLog(RepositoryCopier.class);
+
+    private File basedir = new File(System.getProperty("basedir"));
+
+    public void testCopyM1toM1() throws Exception {
+        File dir;
+
+        dir = new File(basedir, "target/m1");
+        Maven1Repository source = new Maven1Repository(dir);
+
+        dir = new File(basedir, "target/m1-to-m1");
+        dir.mkdirs();
+        Maven1Repository target = new Maven1Repository(dir);
+
+        RepositoryCopier.copy(source, target);
+    }
+
+    public void testCopyM1toM2() throws Exception {
+        File dir;
+
+        dir = new File(basedir, "target/m1");
+        Maven1Repository source = new Maven1Repository(dir);
+
+        dir = new File(basedir, "target/m1-to-m2");
+        dir.mkdirs();
+        Maven2Repository target = new Maven2Repository(dir);
+
+        RepositoryCopier.copy(source, target);
+    }
+
+    public void testCopyM2toM1() throws Exception {
+        File dir;
+
+        dir = new File(basedir, "target/m2");
+        Maven2Repository source = new Maven2Repository(dir);
+
+        dir = new File(basedir, "target/m2-to-m1");
+        dir.mkdirs();
+        Maven1Repository target = new Maven1Repository(dir);
+
+        RepositoryCopier.copy(source, target);
+    }
+
+    public void testCopyM2toM2() throws Exception {
+        File dir;
+
+        dir = new File(basedir, "target/m2");
+        Maven2Repository source = new Maven2Repository(dir);
+
+        dir = new File(basedir, "target/m2-to-m2");
+        dir.mkdirs();
+        Maven2Repository target = new Maven2Repository(dir);
+
+        RepositoryCopier.copy(source, target);
+    }
+
+    public void testCopyM1toJDBM() throws Exception {
+        File dir;
+
+        dir = new File(basedir, "target/m1");
+        Maven1Repository source = new Maven1Repository(dir);
+
+        dir = new File(basedir, "target/m1-to-jdbm");
+        dir.mkdirs();
+        JdbmRepository target = new JdbmRepository(dir);
+
+        RepositoryCopier.copy(source, target);
+    }
+}

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/test/java/org/apache/geronimo/repository/jdbm/RepositoryCopierTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/test/java/org/apache/geronimo/repository/jdbm/RepositoryCopierTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-jdbm/src/test/java/org/apache/geronimo/repository/jdbm/RepositoryCopierTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/pom.xml?rev=424845&view=auto
==============================================================================
--- geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/pom.xml
(added)
+++ geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/pom.xml
Sun Jul 23 15:41:23 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 2006 The Apache Software Foundation
+
+    Licensed 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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<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>
+    
+    <parent>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-repository-providers</artifactId>
+        <version>1.2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    
+    <artifactId>geronimo-repository-maven1</artifactId>
+    <name>Geronimo Repository Providers :: Maven 1</name>
+    <packaging>jar</packaging>
+    
+</project>

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven1/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/pom.xml?rev=424845&view=auto
==============================================================================
--- geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/pom.xml
(added)
+++ geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/pom.xml
Sun Jul 23 15:41:23 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 2006 The Apache Software Foundation
+
+    Licensed 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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<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>
+    
+    <parent>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-repository-providers</artifactId>
+        <version>1.2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    
+    <artifactId>geronimo-repository-maven2</artifactId>
+    <name>Geronimo Repository Providers :: Maven 2</name>
+    <packaging>jar</packaging>
+    
+</project>

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/geronimo-repository-maven2/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/pom.xml?rev=424845&r1=424844&r2=424845&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/pom.xml (original)
+++ geronimo/sandbox/svkmerge/geronimo-repository/geronimo-repository-providers/pom.xml Sun
Jul 23 15:41:23 2006
@@ -33,6 +33,8 @@
     <packaging>pom</packaging>
     
     <modules>
+        <module>geronimo-repository-maven1</module>
+        <module>geronimo-repository-maven2</module>
         <module>geronimo-repository-jdbm</module>
     </modules>
     



Mime
View raw message