maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r448161 [1/2] - in /maven/sandbox/maven-metamorphosis: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/maven/ src/main/java/org/apache/maven/modulo/ src/main/java/org/apache/maven/pomo/...
Date Wed, 20 Sep 2006 11:10:20 GMT
Author: jvanzyl
Date: Wed Sep 20 04:10:17 2006
New Revision: 448161

URL: http://svn.apache.org/viewvc?view=rev&rev=448161
Log:
o little project converter in the works

Added:
    maven/sandbox/maven-metamorphosis/
    maven/sandbox/maven-metamorphosis/pom.xml   (with props)
    maven/sandbox/maven-metamorphosis/src/
    maven/sandbox/maven-metamorphosis/src/main/
    maven/sandbox/maven-metamorphosis/src/main/java/
    maven/sandbox/maven-metamorphosis/src/main/java/org/
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultMappingModel.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultModulo.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModel.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParser.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParsingException.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelRetrievalException.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelSource.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/ModuleConversionException.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Modulo.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Resource.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelParser.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelSource.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/DefaultPomo.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelGenerationException.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelWritingException.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/PomInfoSource.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/Pomo.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/SimplePomInfoSource.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/DefaultReducto.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/Reducto.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/AbstractJarAnalyser.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisContext.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisResult.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisContext.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisException.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisResult.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalyzer.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarEntryComparator.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarException.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/AbstractArchivaClient.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaAnalyser.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaClient.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/LocalArchivaClient.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/DirectoryJarDataSource.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/JarDataSource.java   (with props)
    maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/JarDataSourceRetrievalException.java   (with props)
    maven/sandbox/maven-metamorphosis/src/site/
    maven/sandbox/maven-metamorphosis/src/site/apt/
    maven/sandbox/maven-metamorphosis/src/site/apt/usage.apt   (with props)
    maven/sandbox/maven-metamorphosis/src/site/site.xml   (with props)
    maven/sandbox/maven-metamorphosis/src/test/
    maven/sandbox/maven-metamorphosis/src/test/jar-sets/
    maven/sandbox/maven-metamorphosis/src/test/jar-sets/multiple/
    maven/sandbox/maven-metamorphosis/src/test/jar-sets/multiple/commons-codec-1.3.jar   (with props)
    maven/sandbox/maven-metamorphosis/src/test/jar-sets/multiple/commons-io-1.1.jar   (with props)
    maven/sandbox/maven-metamorphosis/src/test/jar-sets/multiple/commons-pool-1.0.1.jar   (with props)
    maven/sandbox/maven-metamorphosis/src/test/jar-sets/single/
    maven/sandbox/maven-metamorphosis/src/test/jar-sets/single/commons-beanutils-1.7.0.jar   (with props)
    maven/sandbox/maven-metamorphosis/src/test/java/
    maven/sandbox/maven-metamorphosis/src/test/java/org/
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/maven/
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/maven/modulo/
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/maven/modulo/ModuloTest.java   (with props)
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/maven/modulo/SimpleMappingModelParserTest.java   (with props)
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/maven/pomo/
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/maven/pomo/PomoTest.java   (with props)
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/maven/reducto/
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/maven/reducto/ReductoTest.java   (with props)
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/maven/reducto/analysis/
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/maven/reducto/analysis/archiva/
    maven/sandbox/maven-metamorphosis/src/test/java/org/apache/maven/reducto/analysis/archiva/LocalArchivaClientTest.java   (with props)
    maven/sandbox/maven-metamorphosis/src/test/modules/
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/etc/
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/etc/DSSBatch_log4j.properties   (with props)
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/etc/distributionrules.properties   (with props)
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/etc/dss.properties   (with props)
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/etc/invoicerules.properties   (with props)
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/lib/
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/lib/commons-codec-1.3.jar   (with props)
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/lib/commons-io-1.1.jar   (with props)
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/lib/commons-pool-1.0.1.jar   (with props)
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/map.txt   (with props)
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/src/
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/src/META-INF/
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/src/META-INF/application.xml   (with props)
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/src/no/
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/src/no/bbs/
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/src/no/bbs/Foo.java   (with props)
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/unittest/
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/unittest/no/
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/unittest/no/bbs/
    maven/sandbox/maven-metamorphosis/src/test/modules/basic/unittest/no/bbs/FooTest.java   (with props)

Added: maven/sandbox/maven-metamorphosis/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/pom.xml?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/pom.xml (added)
+++ maven/sandbox/maven-metamorphosis/pom.xml Wed Sep 20 04:10:17 2006
@@ -0,0 +1,89 @@
+<?xml version="1.0" ?>
+
+<!--
+  ~ Copyright 2005-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.
+  -->
+
+<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>
+
+  <groupId>org.apache.maven.metamorphosis</groupId>
+  <artifactId>maven-metamorphosis</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Maven Metamorphosis</name>
+  <description>A tool to transform non-Maven builds to Maven</description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-model</artifactId>
+      <version>2.0.2</version>
+      <scope>compile</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact-manager</artifactId>
+      <version>2.0.2</version>
+      <scope>compile</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.archiva</groupId>
+      <artifactId>archiva-indexer</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.maven.archiva</groupId>
+      <artifactId>archiva-utils</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>3.1</version>
+      <scope>compile</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.2</version>
+    </dependency>
+
+  </dependencies>
+
+</project>

Propchange: maven/sandbox/maven-metamorphosis/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultMappingModel.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultMappingModel.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultMappingModel.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultMappingModel.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,130 @@
+package org.apache.maven.modulo;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+
+/**
+ * @author Jason van Zyl
+ */
+public class DefaultMappingModel
+    implements MappingModel
+{
+    private String groupId;
+
+    private String artifactId;
+
+    private String version;
+
+    private String packaging;
+
+    private Set jarDirectories;
+
+    private String sourceDirectory;
+
+    private String testSourceDirectory;
+
+    private String integrationTestSourceDirectory;
+
+    private Set resourceDirectories;
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public void setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public void setArtifactId( String artifactId )
+    {
+        this.artifactId = artifactId;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public String getPackaging()
+    {
+        return packaging;
+    }
+
+    public void setPackaging( String packaging )
+    {
+        this.packaging = packaging;
+    }
+
+    public Set getJarDirectories()
+    {
+        return jarDirectories;
+    }
+
+    public void addJarDirectory( Resource jarDirectory )
+    {
+        if ( jarDirectories == null )
+        {
+            jarDirectories = new LinkedHashSet();
+        }
+
+        jarDirectories.add( jarDirectory );
+    }
+
+    public String getSourceDirectory()
+    {
+        return sourceDirectory;
+    }
+
+    public void setSourceDirectory( String sourceDirectory )
+    {
+        this.sourceDirectory = sourceDirectory;
+    }
+
+    public String getTestSourceDirectory()
+    {
+        return testSourceDirectory;
+    }
+
+    public void setTestSourceDirectory( String testSourceDirectory )
+    {
+        this.testSourceDirectory = testSourceDirectory;
+    }
+
+    public String getIntegrationTestSourceDirectory()
+    {
+        return integrationTestSourceDirectory;
+    }
+
+    public void setIntegrationTestSourceDirectory( String integrationTestSourceDirectory )
+    {
+        this.integrationTestSourceDirectory = integrationTestSourceDirectory;
+    }
+
+    public Set getResourceDirectories()
+    {
+        return resourceDirectories;
+    }
+
+    public void addResourceDirectory( Resource resourceDirectory )
+    {
+        if ( resourceDirectories == null )
+        {
+            resourceDirectories = new LinkedHashSet();
+        }
+
+        resourceDirectories.add( resourceDirectory );
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultMappingModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultMappingModel.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultModulo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultModulo.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultModulo.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultModulo.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,124 @@
+package org.apache.maven.modulo;
+
+import org.apache.maven.pomo.Pomo;
+import org.apache.maven.pomo.PomInfoSource;
+import org.apache.maven.pomo.SimplePomInfoSource;
+import org.apache.maven.pomo.ModelGenerationException;
+import org.apache.maven.pomo.ModelWritingException;
+import org.apache.maven.reducto.Reducto;
+import org.apache.maven.reducto.analysis.JarAnalysisException;
+import org.apache.maven.reducto.analysis.JarAnalysisResult;
+import org.apache.maven.reducto.source.DirectoryJarDataSource;
+import org.apache.maven.reducto.source.JarDataSourceRetrievalException;
+import org.apache.maven.model.Model;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.Writer;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+/**
+ * @author Jason van Zyl
+ * @plexus.component
+ */
+public class DefaultModulo
+    implements Modulo
+{
+    /**
+     * @plexus.requirement
+     */
+    private Reducto reducto;
+
+    /**
+     * @plexus.requirement
+     */
+    private Pomo pomo;
+
+    public void convert( File sourceDirectory,
+                         MappingModelSource source,
+                         File outputDirectory )
+        throws ModuleConversionException, MappingModelRetrievalException, JarDataSourceRetrievalException,
+        JarAnalysisException, ModelGenerationException, ModelWritingException
+    {
+        if ( !sourceDirectory.exists() )
+        {
+            throw new ModuleConversionException(
+                "The specified source directory " + sourceDirectory + " does not exist." );
+        }
+
+        if ( !outputDirectory.exists() )
+        {
+            //todo: this should return a boolean/throw an exception and take a file.
+            FileUtils.mkdir( outputDirectory.getAbsolutePath() );
+        }
+
+        MappingModel m = source.getMappingModel();
+
+        // ----------------------------------------------------------------------------
+        // Walk through all the directories of JARs that the user may specify and try
+        // to analyze them all to determine if we have entries for them in the
+        // repository metadata.
+        // ----------------------------------------------------------------------------
+
+        Map jarAnalysisResults = new LinkedHashMap();
+
+        Map unresolvedJars = new LinkedHashMap();
+
+        for ( Iterator i = m.getJarDirectories().iterator(); i.hasNext(); )
+        {
+            Resource r = (Resource) i.next();
+
+            Map results = reducto.analyse( new DirectoryJarDataSource( new File( r.getDirectory() ) ) );
+
+            for ( Iterator j = results.values().iterator(); j.hasNext(); )
+            {
+                JarAnalysisResult result = (JarAnalysisResult) j.next();
+
+                if ( result.isResolved() )
+                {
+                    jarAnalysisResults.put( reducto.createKey( result ), result );
+                }
+                else
+                {
+                    unresolvedJars.put( reducto.createKey( result ), result );
+                }
+            }
+        }
+
+        //todo: do something with the unresolved JARs
+        //      create some events of create stubs in the POM so that when people manually figure
+        //      out what the deps are they can flesh them out
+
+        PomInfoSource pomInfo = new SimplePomInfoSource( "4.0.0", m.getGroupId(), m.getArtifactId(), m.getVersion() );
+
+        Model model = pomo.generateModel( pomInfo, jarAnalysisResults );
+
+        Writer writer;
+
+        try
+        {
+            writer = new FileWriter( new File( outputDirectory, "pom.xml" ) );
+
+            pomo.writeModel( writer, model );
+        }
+        catch ( IOException e )
+        {
+            throw new ModuleConversionException( "Error writing out POM.", e );
+        }
+
+        // ----------------------------------------------------------------------------
+        // Translation
+        // ----------------------------------------------------------------------------
+        
+        // sources
+        // resources
+        // allow maven compliance or to adapt to the existing structure
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultModulo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/DefaultModulo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModel.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModel.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModel.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModel.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,33 @@
+package org.apache.maven.modulo;
+
+import java.util.Set;
+
+/**
+ * Information to map a non-Maven project into a Maven compliant project. This would includes:
+ *
+ * JARs that you want resolved to Maven artifacts
+ * sources you want translated to be Maven compliant
+ * resources you want translated to be Maven compliant
+ *
+ * @author Jason van Zyl
+ */
+public interface MappingModel
+{
+    String getGroupId();
+
+    String getArtifactId();
+
+    String getVersion();
+
+    String getPackaging();
+
+    Set getJarDirectories();
+
+    String getSourceDirectory();
+
+    String getTestSourceDirectory();
+
+    String getIntegrationTestSourceDirectory();
+
+    Set getResourceDirectories();
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModel.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParser.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParser.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParser.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParser.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,12 @@
+package org.apache.maven.modulo;
+
+import java.io.File;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface MappingModelParser
+{
+    MappingModel parse( File mapping )
+        throws MappingModelParsingException;
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParser.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParsingException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParsingException.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParsingException.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParsingException.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,24 @@
+package org.apache.maven.modulo;
+
+/**
+ * @author Jason van Zyl
+ */
+public class MappingModelParsingException
+    extends Exception
+{
+    public MappingModelParsingException( String id )
+    {
+        super( id );
+    }
+
+    public MappingModelParsingException( String id,
+                                         Throwable throwable )
+    {
+        super( id, throwable );
+    }
+
+    public MappingModelParsingException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParsingException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelParsingException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelRetrievalException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelRetrievalException.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelRetrievalException.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelRetrievalException.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,24 @@
+package org.apache.maven.modulo;
+
+/**
+ * @author Jason van Zyl
+ */
+public class MappingModelRetrievalException
+    extends Exception
+{
+    public MappingModelRetrievalException( String id )
+    {
+        super( id );
+    }
+
+    public MappingModelRetrievalException( String id,
+                                           Throwable throwable )
+    {
+        super( id, throwable );
+    }
+
+    public MappingModelRetrievalException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelRetrievalException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelRetrievalException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelSource.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelSource.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelSource.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelSource.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,12 @@
+package org.apache.maven.modulo;
+
+import java.io.File;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface MappingModelSource
+{
+    MappingModel getMappingModel()
+        throws MappingModelRetrievalException;    
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/MappingModelSource.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/ModuleConversionException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/ModuleConversionException.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/ModuleConversionException.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/ModuleConversionException.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,24 @@
+package org.apache.maven.modulo;
+
+/**
+ * @author Jason van Zyl
+ */
+public class ModuleConversionException
+    extends Exception
+{
+    public ModuleConversionException( String id )
+    {
+        super( id );
+    }
+
+    public ModuleConversionException( String id,
+                                      Throwable throwable )
+    {
+        super( id, throwable );
+    }
+
+    public ModuleConversionException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/ModuleConversionException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/ModuleConversionException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Modulo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Modulo.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Modulo.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Modulo.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,30 @@
+package org.apache.maven.modulo;
+
+import org.apache.maven.reducto.source.JarDataSourceRetrievalException;
+import org.apache.maven.reducto.analysis.JarAnalysisException;
+import org.apache.maven.pomo.ModelGenerationException;
+import org.apache.maven.pomo.ModelWritingException;
+
+import java.io.File;
+
+//todo: leaving a multi module build in place and using different POMs at different levels (mauro)
+//tood: creating a local repository in the project itself vs making a local repository for all maven projects (mauro)
+//      possbily per project or global as an options
+//todo: an option in Maven itself to use a local library of JARs
+//todo: mapping a directory of JARs using system dependencies
+//todo: for plugins that are created by a migrating project, to create a stand-alone repository that can be installed
+//      so that everything will work locally
+
+/**
+ * @author Jason van Zyl
+ */
+public interface Modulo
+{
+    String ROLE = Modulo.class.getName();
+
+    void convert( File sourceDirectory,
+                  MappingModelSource source,
+                  File outputDirectory )
+        throws ModuleConversionException, MappingModelRetrievalException, JarDataSourceRetrievalException,
+        JarAnalysisException, ModelGenerationException, ModelWritingException;
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Modulo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Modulo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Resource.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Resource.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Resource.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Resource.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,43 @@
+package org.apache.maven.modulo;
+
+/**
+ * @author Jason van Zyl
+ */
+public class Resource
+{
+    private String directory;
+
+    private String includes;
+
+    private String excludse;
+
+    public String getDirectory()
+    {
+        return directory;
+    }
+
+    public void setDirectory( String directory )
+    {
+        this.directory = directory;
+    }
+
+    public String getIncludes()
+    {
+        return includes;
+    }
+
+    public void setIncludes( String includes )
+    {
+        this.includes = includes;
+    }
+
+    public String getExcludse()
+    {
+        return excludse;
+    }
+
+    public void setExcludse( String excludse )
+    {
+        this.excludse = excludse;
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Resource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/Resource.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelParser.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelParser.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelParser.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelParser.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,110 @@
+package org.apache.maven.modulo;
+
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.BufferedReader;
+import java.io.Reader;
+import java.io.FileReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+/**
+ * @author Jason van Zyl
+ */
+public class SimpleMappingModelParser
+    implements MappingModelParser
+{
+    public MappingModel parse( File mapping )
+        throws MappingModelParsingException
+    {
+        DefaultMappingModel model = new DefaultMappingModel();
+
+        try
+        {
+            String line;
+
+            BufferedReader br = new BufferedReader( new FileReader( mapping ) );
+
+            while ( ( line = br.readLine() ) != null )
+            {
+                if ( line.startsWith( "//" ) || line.startsWith( "#" ) || line.trim().length() == 0 )
+                {
+                    continue;
+                }
+
+                if ( line.startsWith( "groupId" ) )
+                {
+                    model.setGroupId( StringUtils.split( line, ":")[1].trim() );
+                }
+                else if ( line.startsWith( "artifactId" ))
+                {
+                    model.setArtifactId( StringUtils.split( line, ":")[1].trim() );
+                }
+                else if ( line.startsWith( "version" ))
+                {
+                    model.setVersion( StringUtils.split( line, ":")[1].trim() );
+                }
+                else if ( line.startsWith( "packaging" ))
+                {
+                    model.setPackaging( StringUtils.split( line, ":")[1].trim() );
+                }
+                else if ( line.startsWith( "jarDir" ))
+                {
+                    model.addJarDirectory( parseResource( line ) );
+                }
+                else if ( line.startsWith( "resourceDir" ))
+                {
+                    model.addResourceDirectory( parseResource( line ) );
+                }
+                else if ( line.startsWith( "srcDir" ))
+                {
+                    model.setSourceDirectory( StringUtils.split( line, ":")[1].trim() );
+                }
+                else if ( line.startsWith( "testSrcDir" ))
+                {
+                    model.setTestSourceDirectory( StringUtils.split( line, ":")[1].trim() );
+                }
+            }
+        }
+        catch ( FileNotFoundException e )
+        {
+            throw new MappingModelParsingException( "Cannot find " + mapping + "." );
+
+        }
+        catch ( IOException e )
+        {
+            throw new MappingModelParsingException( "Error reading the mapping " + mapping + "." );
+        }
+
+        return model;
+    }
+
+    private Resource parseResource( String line )
+    {
+        String[] s = StringUtils.split( StringUtils.split( line, ":")[1], "," );
+
+        Resource r = new Resource();
+
+        if ( s.length == 1 )
+        {
+            r.setDirectory( s[0].trim() );
+        }
+        else if ( s.length == 2 )
+        {
+            r.setDirectory( s[0].trim() );
+
+            r.setIncludes( s[1].trim() );
+        }
+        else if ( s.length == 3 )
+        {
+            r.setDirectory( s[0].trim() );
+
+            r.setIncludes( s[1].trim() );
+
+            r.setExcludse( s[2].trim() );
+        }
+
+        return r;
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelParser.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelSource.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelSource.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelSource.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelSource.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,32 @@
+package org.apache.maven.modulo;
+
+import java.io.File;
+
+/**
+ * @author Jason van Zyl
+ */
+public class SimpleMappingModelSource
+    implements MappingModelSource
+{
+    private File mappingFile;
+
+    public SimpleMappingModelSource( File mappingFile )
+    {
+        this.mappingFile = mappingFile;
+    }
+
+    public MappingModel getMappingModel()
+        throws MappingModelRetrievalException
+    {
+        MappingModelParser p = new SimpleMappingModelParser();
+
+        try
+        {
+            return p.parse( mappingFile );
+        }
+        catch ( MappingModelParsingException e )
+        {
+            throw new MappingModelRetrievalException( "Error parsing mapping file " + mappingFile + "." );
+        }
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/modulo/SimpleMappingModelSource.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/DefaultPomo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/DefaultPomo.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/DefaultPomo.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/DefaultPomo.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,67 @@
+package org.apache.maven.pomo;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.reducto.analysis.JarAnalysisResult;
+
+import java.util.Map;
+import java.util.Iterator;
+import java.io.Writer;
+import java.io.IOException;
+
+/**
+ * @author Jason van Zyl
+ * @plexus.component
+ */
+public class DefaultPomo
+    implements Pomo
+{
+    public Model generateModel( PomInfoSource source,
+                                Map jarAnalysisResults )
+        throws ModelGenerationException
+    {
+        Model model = new Model();
+
+        model.setModelVersion( source.getModelVersion() );
+
+        model.setGroupId( source.getGroupId() );
+
+        model.setArtifactId( source.getArtifactId() );
+
+        model.setVersion( source.getVersion() );
+
+        for ( Iterator i = jarAnalysisResults.values().iterator(); i.hasNext(); )
+        {
+            JarAnalysisResult r = (JarAnalysisResult) i.next();
+
+            Dependency d = new Dependency();
+
+            d.setGroupId( r.getGroupId() );
+
+            d.setArtifactId( r.getArtifactId() );
+
+            d.setVersion( r.getVersion() );
+
+            model.addDependency( d );
+        }
+
+        return model;
+    }
+
+    public void writeModel( Writer writer,
+                            Model model )
+        throws ModelWritingException
+    {
+        MavenXpp3Writer w = new MavenXpp3Writer();
+
+        try
+        {
+            w.write( writer, model );
+        }
+        catch ( IOException e )
+        {
+            throw new ModelWritingException( "Error writing model.", e );
+        }
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/DefaultPomo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/DefaultPomo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelGenerationException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelGenerationException.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelGenerationException.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelGenerationException.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,24 @@
+package org.apache.maven.pomo;
+
+/**
+ * @author Jason van Zyl
+ */
+public class ModelGenerationException
+    extends Exception
+{
+    public ModelGenerationException( String id )
+    {
+        super( id );
+    }
+
+    public ModelGenerationException( String id,
+                                     Throwable throwable )
+    {
+        super( id, throwable );
+    }
+
+    public ModelGenerationException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelGenerationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelGenerationException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelWritingException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelWritingException.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelWritingException.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelWritingException.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,24 @@
+package org.apache.maven.pomo;
+
+/**
+ * @author Jason van Zyl
+ */
+public class ModelWritingException
+    extends Exception
+{
+    public ModelWritingException( String id )
+    {
+        super( id );
+    }
+
+    public ModelWritingException( String id,
+                                  Throwable throwable )
+    {
+        super( id, throwable );
+    }
+
+    public ModelWritingException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelWritingException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/ModelWritingException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/PomInfoSource.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/PomInfoSource.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/PomInfoSource.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/PomInfoSource.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,15 @@
+package org.apache.maven.pomo;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface PomInfoSource
+{
+    String getModelVersion();
+
+    String getGroupId();
+
+    String getArtifactId();
+
+    String getVersion();
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/PomInfoSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/PomInfoSource.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/Pomo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/Pomo.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/Pomo.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/Pomo.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,24 @@
+package org.apache.maven.pomo;
+
+import org.apache.maven.model.Model;
+
+import java.util.Map;
+import java.io.Writer;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface Pomo
+{
+    String ROLE = Pomo.class.getName();
+
+    Model generateModel( PomInfoSource source,
+                         Map jarAnalysisResults )
+        throws ModelGenerationException;
+
+
+    void writeModel( Writer writer,
+                     Model model )
+        throws ModelWritingException;
+
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/Pomo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/Pomo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/SimplePomInfoSource.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/SimplePomInfoSource.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/SimplePomInfoSource.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/SimplePomInfoSource.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,47 @@
+package org.apache.maven.pomo;
+
+/**
+ * @author Jason van Zyl
+ */
+public class SimplePomInfoSource
+    implements PomInfoSource
+{
+    private String modelVersion;
+
+    private String groupId;
+
+    private String artifactId;
+
+    private String version;
+
+    public SimplePomInfoSource( String modelVersion,
+                                String groupId,
+                                String artifactId,
+                                String version )
+    {
+        this.modelVersion = modelVersion;
+        this.groupId = groupId;
+        this.artifactId = artifactId;
+        this.version = version;
+    }
+
+    public String getModelVersion()
+    {
+        return modelVersion;
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/SimplePomInfoSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/pomo/SimplePomInfoSource.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/DefaultReducto.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/DefaultReducto.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/DefaultReducto.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/DefaultReducto.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,75 @@
+package org.apache.maven.reducto;
+
+import org.apache.maven.reducto.analysis.DefaultJarAnalysisContext;
+import org.apache.maven.reducto.analysis.DefaultJarAnalysisResult;
+import org.apache.maven.reducto.analysis.JarAnalysisContext;
+import org.apache.maven.reducto.analysis.JarAnalysisException;
+import org.apache.maven.reducto.analysis.JarAnalyzer;
+import org.apache.maven.reducto.analysis.JarAnalysisResult;
+import org.apache.maven.reducto.source.JarDataSource;
+import org.apache.maven.reducto.source.JarDataSourceRetrievalException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+/**
+ * @author Jason van Zyl
+ * @plexus.component
+ */
+public class DefaultReducto
+    extends AbstractLogEnabled
+    implements Reducto
+{
+    /**
+     * @plexus.requirement role="org.apache.maven.reducto.analysis.JarAnalyzer"
+     */
+    private Map jarAnalyzers;
+
+    public Map analyse( JarDataSource dataSource )
+        throws JarDataSourceRetrievalException, JarAnalysisException
+    {
+        Map jarAnalysisResults = new LinkedHashMap();
+
+        for ( Iterator i = dataSource.retrieveJars().iterator(); i.hasNext(); )
+        {
+            File jar = (File) i.next();
+
+            //todo: reducto found event
+
+            // For each JAR file that we encounter we want to create an analysis context, place the JAR file
+            // and a blank JAR analysis result into the context and then pass that through a chain of
+            // JAR analysers.
+
+            JarAnalysisContext context = new DefaultJarAnalysisContext( jar, new DefaultJarAnalysisResult( jar ) );
+
+            for ( Iterator j = jarAnalyzers.values().iterator(); j.hasNext(); )
+            {
+                JarAnalyzer analyzer = (JarAnalyzer) j.next();
+
+                analyzer.analyze( context );
+
+                if ( context.getJarAnalysisResult().isResolved() )
+                {
+                    break;
+                }
+            }
+
+            jarAnalysisResults.put( createKey( context.getJarAnalysisResult() ), context.getJarAnalysisResult() );
+        }
+
+        return jarAnalysisResults;
+    }
+
+    public String createKey( JarAnalysisResult result )
+    {
+        return result.getGroupId() + result.getArtifactId() + result.getVersion();
+    }
+
+    public String createKey( String groupId, String artifactId, String version )
+    {
+        return groupId + artifactId + version;
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/DefaultReducto.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/DefaultReducto.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/Reducto.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/Reducto.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/Reducto.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/Reducto.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,43 @@
+package org.apache.maven.reducto;
+
+import org.apache.maven.reducto.analysis.JarAnalysisException;
+import org.apache.maven.reducto.analysis.JarAnalysisResult;
+import org.apache.maven.reducto.source.JarDataSource;
+import org.apache.maven.reducto.source.JarDataSourceRetrievalException;
+
+import java.util.Map;
+
+/**
+ * Take a {@link JarDataSource} and return a set {@link org.apache.maven.reducto.analysis.JarAnalysisResult}
+ * objects. The information contained in each {@link org.apache.maven.reducto.analysis.JarAnalysisResult} object
+ * should be enough to give a property identity to a @{link MavenArtifact}.
+ *
+ * @author Jason van Zyl
+ */
+public interface Reducto
+{
+    String ROLE = Reducto.class.getName();
+
+    Map analyse( JarDataSource dataSource )
+        throws JarDataSourceRetrievalException, JarAnalysisException;
+
+    String createKey( JarAnalysisResult result );
+
+    String createKey( String groupId, String artifactId, String version );
+
+    //todo: How to pick what analysis you want to perform: i think want to step through all the available analysers with precedence
+    //      where we might want to have various analysers having more precedence where an archiva lookup can happen
+    //todo: How to pick which exposers you want to use: exposers are analysers
+    //todo: encapsulate the gleaning of information from a JAR with creating the dep info: everything will become an analyser
+    //todo: what real use are the exposers other then looking up the hash?: the ordering of analysers
+    //todo: we need discovery events to that a UI can hook up to it
+
+    // order
+    // hash search
+    // class search: may map to one or more classes, archiva may know if there are unique classes for versions of log4j for example
+    // manifest
+    // filename
+    // textfile
+    // timestamp
+    // main output
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/Reducto.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/Reducto.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/AbstractJarAnalyser.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/AbstractJarAnalyser.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/AbstractJarAnalyser.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/AbstractJarAnalyser.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,25 @@
+package org.apache.maven.reducto.analysis;
+
+/*
+ * Copyright 2001-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.
+ */
+
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+public abstract class AbstractJarAnalyser
+    extends AbstractLogEnabled
+    implements JarAnalyzer
+{
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/AbstractJarAnalyser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/AbstractJarAnalyser.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisContext.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisContext.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisContext.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisContext.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,31 @@
+package org.apache.maven.reducto.analysis;
+
+import java.io.File;
+
+/**
+ * @author Jason van Zyl
+ */
+public class DefaultJarAnalysisContext
+    implements JarAnalysisContext
+{
+    private File jar;
+
+    private JarAnalysisResult jarAnalysisResult;
+
+    public DefaultJarAnalysisContext( File jar,
+                                      JarAnalysisResult result )
+    {
+        this.jar = jar;
+        this.jarAnalysisResult = result;
+    }
+
+    public File getJar()
+    {
+        return jar;
+    }
+
+    public JarAnalysisResult getJarAnalysisResult()
+    {
+        return jarAnalysisResult;
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisContext.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisResult.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisResult.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisResult.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisResult.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,102 @@
+package org.apache.maven.reducto.analysis;
+
+/*
+ * Copyright 2001-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.
+ */
+
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.io.File;
+
+/**
+ * The default JAR analysis result.
+ */
+public class DefaultJarAnalysisResult
+    extends AbstractLogEnabled
+    implements JarAnalysisResult
+{
+    public static final String ROLE = DefaultJarAnalysisResult.class.getName();
+
+    private File jar;
+
+    private boolean isSealed;
+
+    private String groupId;
+
+    private String artifactId;
+
+    private String version;
+
+    private String md5Checksum;
+
+    private String vendor;
+
+    public DefaultJarAnalysisResult( File jar )
+    {
+        this.jar = jar;
+    }
+
+    public File getJar()
+    {
+        return jar;
+    }
+
+    // Accessors
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public void setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public void setArtifactId( String artifactId )
+    {
+        this.artifactId = artifactId;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public String getMd5Checksum()
+    {
+        return md5Checksum;
+    }
+
+    public void setMd5Checksum( String md5Checksum )
+    {
+        this.md5Checksum = md5Checksum;
+    }
+
+    public boolean isResolved()
+    {
+        return ( groupId != null ) && ( artifactId != null ) && ( version != null );
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/DefaultJarAnalysisResult.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisContext.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisContext.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisContext.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisContext.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,13 @@
+package org.apache.maven.reducto.analysis;
+
+import java.io.File;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface JarAnalysisContext
+{
+    public File getJar();
+
+    public JarAnalysisResult getJarAnalysisResult();
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisContext.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisException.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisException.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisException.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,24 @@
+package org.apache.maven.reducto.analysis;
+
+/**
+ * @author Jason van Zyl
+ */
+public class JarAnalysisException
+    extends Exception
+{
+    public JarAnalysisException( String id )
+    {
+        super( id );
+    }
+
+    public JarAnalysisException( String id,
+                                 Throwable throwable )
+    {
+        super( id, throwable );
+    }
+
+    public JarAnalysisException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisResult.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisResult.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisResult.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisResult.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,29 @@
+package org.apache.maven.reducto.analysis;
+
+import java.io.File;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface JarAnalysisResult
+{
+    String getGroupId();
+
+    void setGroupId( String groupId );
+
+    String getArtifactId();
+
+    void setArtifactId( String artifactId );
+
+    String getVersion();
+
+    void setVersion( String version );
+
+    String getMd5Checksum();
+
+    void setMd5Checksum( String md5Checksum );
+
+    boolean isResolved();
+
+    File getJar();
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalysisResult.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalyzer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalyzer.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalyzer.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalyzer.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,28 @@
+package org.apache.maven.reducto.analysis;
+
+/*
+ * Copyright 2001-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.
+ */
+
+/**
+ * Analyzer Interface.
+ */
+public interface JarAnalyzer
+{
+    static final String ROLE = JarAnalyzer.class.getName();
+
+    JarAnalysisResult analyze( JarAnalysisContext context )
+        throws JarAnalysisException;
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalyzer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarAnalyzer.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarEntryComparator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarEntryComparator.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarEntryComparator.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarEntryComparator.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,29 @@
+/**
+ * 
+ */
+package org.apache.maven.reducto.analysis;
+
+import java.util.Comparator;
+import java.util.jar.JarEntry;
+
+class JarEntryComparator
+    implements Comparator
+{
+
+    public int compare( Object o1, Object o2 )
+    {
+        if ( !( o1 instanceof JarEntry ) )
+        {
+            return 0;
+        }
+        if ( !( o2 instanceof JarEntry ) )
+        {
+            return 0;
+        }
+        JarEntry j1 = (JarEntry) o1;
+        JarEntry j2 = (JarEntry) o2;
+
+        return j1.getName().compareTo( j2.getName() );
+    }
+
+}
\ No newline at end of file

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarEntryComparator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarEntryComparator.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarException.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarException.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarException.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,44 @@
+package org.apache.maven.reducto.analysis;
+
+/*
+ * Copyright 2001-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.
+ */
+
+/**
+ * Exceptions that occur during DefaultJarAnalysisResult utility methods.
+ */
+public class JarException
+    extends Exception
+{
+    public JarException()
+    {
+        super();
+    }
+
+    public JarException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public JarException( String message )
+    {
+        super( message );
+    }
+
+    public JarException( Throwable cause )
+    {
+        super( cause );
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/JarException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/AbstractArchivaClient.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/AbstractArchivaClient.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/AbstractArchivaClient.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/AbstractArchivaClient.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,12 @@
+package org.apache.maven.reducto.analysis.archiva;
+
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+/**
+ * @author Jason van Zyl
+ */
+public abstract class AbstractArchivaClient
+    extends AbstractLogEnabled
+    implements ArchivaClient
+{
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/AbstractArchivaClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/AbstractArchivaClient.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaAnalyser.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaAnalyser.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaAnalyser.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaAnalyser.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,92 @@
+package org.apache.maven.reducto.analysis.archiva;
+
+/*
+ * Copyright 2001-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.
+ */
+
+import org.apache.maven.archiva.digest.Digester;
+import org.apache.maven.archiva.digest.DigesterException;
+import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
+import org.apache.maven.archiva.indexer.record.StandardArtifactIndexRecord;
+import org.apache.maven.reducto.analysis.AbstractJarAnalyser;
+import org.apache.maven.reducto.analysis.JarAnalysisContext;
+import org.apache.maven.reducto.analysis.JarAnalysisException;
+import org.apache.maven.reducto.analysis.JarAnalysisResult;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * A {@link org.apache.maven.reducto.analysis.JarAnalyzer} which utilizes Archiva to lookup artifacts by
+ * using the checksum calculated for a given JAR file.
+ *
+ * @plexus.component role="org.apache.maven.reducto.analysis.JarAnalyzer" role-hint="archiva"
+ */
+public class ArchivaAnalyser
+    extends AbstractJarAnalyser
+{
+    /**
+     * @plexus.requirement role="org.apache.maven.archiva.digest.Digester" role-hint="md5"
+     */
+    private Digester md5Digester;
+
+    /**
+     * @plexus.requirement role="org.apache.maven.reducto.analysis.archiva.ArchivaClient" role-hint="local"
+     */
+    private ArchivaClient archivaClient;
+
+    public JarAnalysisResult analyze( JarAnalysisContext context )
+        throws JarAnalysisException
+    {
+        File jar = context.getJar();
+
+        JarAnalysisResult result = context.getJarAnalysisResult();
+
+        String md5Checksum;
+
+        try
+        {
+            md5Checksum = md5Digester.calc( jar );
+
+            result.setMd5Checksum( md5Checksum.toLowerCase() );
+        }
+        catch ( DigesterException e )
+        {
+            throw new JarAnalysisException( "Error calculating checksum for " + jar, e );
+        }
+
+        try
+        {
+            List records = archivaClient.searchFileHash( md5Checksum );
+
+            if ( !records.isEmpty() )
+            {
+                StandardArtifactIndexRecord record = (StandardArtifactIndexRecord) records.get( 0 );
+
+                result.setGroupId( record.getGroupId() );
+
+                result.setArtifactId( record.getArtifactId() );
+
+                result.setVersion( record.getVersion() );
+            }
+        }
+        catch ( RepositoryIndexSearchException e )
+        {
+            throw new JarAnalysisException( "Error searching for artifact with checksum " + md5Checksum + ".", e );
+        }
+
+        return result;
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaAnalyser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaAnalyser.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaClient.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaClient.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaClient.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaClient.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,29 @@
+package org.apache.maven.reducto.analysis.archiva;
+
+/*
+ * Copyright 2001-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.
+ */
+
+import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
+
+import java.util.List;
+
+public interface ArchivaClient
+{
+    public static final String ROLE = ArchivaClient.class.getName();
+
+    public List searchFileHash( String hash )
+        throws RepositoryIndexSearchException;
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/ArchivaClient.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/LocalArchivaClient.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/LocalArchivaClient.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/LocalArchivaClient.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/LocalArchivaClient.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,62 @@
+package org.apache.maven.reducto.analysis.archiva;
+
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.TermQuery;
+import org.apache.maven.archiva.indexer.RepositoryArtifactIndex;
+import org.apache.maven.archiva.indexer.RepositoryArtifactIndexFactory;
+import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
+import org.apache.maven.archiva.indexer.lucene.LuceneQuery;
+import org.apache.maven.archiva.indexer.record.StandardIndexRecordFields;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * This will just use a local Lucene index created by Archiva which contains the md5 checksums of
+ * all the artifacts in the repository.
+ *
+ * @author Jason van Zyl
+ * @plexus.component role="org.apache.maven.reducto.analysis.archiva.ArchivaClient" role-hint="local"
+ */
+public class LocalArchivaClient
+    extends AbstractArchivaClient
+    implements Initializable
+{
+    /**
+     * @plexus.requirement
+     */
+    private RepositoryArtifactIndexFactory factory;
+
+    /**
+     * @plexus.configuration
+     */
+    private String indexPath = "index";
+
+    private RepositoryArtifactIndex index;
+
+    public List searchFileHash( String md5 )
+        throws RepositoryIndexSearchException
+    {
+        return index.search(
+            new LuceneQuery( new TermQuery( new Term( StandardIndexRecordFields.MD5, md5.toLowerCase() ) ) ) );
+    }
+
+    // ----------------------------------------------------------------------------
+    // Lifecycle
+    // ----------------------------------------------------------------------------
+
+    public void initialize()
+        throws InitializationException
+    {
+        File f = new File( indexPath );
+
+        if ( !f.exists() )
+        {
+            throw new InitializationException( "Cannot find index on the specified path: " + indexPath );
+        }
+
+        index = factory.createStandardIndex( f );
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/LocalArchivaClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/analysis/archiva/LocalArchivaClient.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/DirectoryJarDataSource.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/DirectoryJarDataSource.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/DirectoryJarDataSource.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/DirectoryJarDataSource.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,35 @@
+package org.apache.maven.reducto.source;
+
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Jason van Zyl
+ */
+public class DirectoryJarDataSource
+    implements JarDataSource
+{
+    private File directory;
+
+    public DirectoryJarDataSource( File directory )
+    {
+        this.directory = directory;
+    }
+
+    public Set retrieveJars()
+        throws JarDataSourceRetrievalException
+    {
+        try
+        {
+            return new HashSet( FileUtils.getFiles( directory, "*.jar", null ) );
+        }
+        catch ( IOException e )
+        {
+            throw new JarDataSourceRetrievalException( "Error retrieving JARS from " + directory + "." );
+        }
+    }
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/DirectoryJarDataSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/DirectoryJarDataSource.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/JarDataSource.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/JarDataSource.java?view=auto&rev=448161
==============================================================================
--- maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/JarDataSource.java (added)
+++ maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/JarDataSource.java Wed Sep 20 04:10:17 2006
@@ -0,0 +1,15 @@
+package org.apache.maven.reducto.source;
+
+import java.util.Set;
+
+/**
+ * An abstract source of JARs. We could look in a directory, fetch a set from a network connection,
+ * pull them out of some dependency source like a POM, or anywhere else.
+ *
+ * @author Jason van Zyl
+ */
+public interface JarDataSource
+{
+    Set retrieveJars()
+        throws JarDataSourceRetrievalException;
+}

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/JarDataSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/maven-metamorphosis/src/main/java/org/apache/maven/reducto/source/JarDataSource.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message