]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1003] get RID of org.apache.maven package : artifact-converter module
authorOlivier Lamy <olamy@apache.org>
Wed, 14 Sep 2011 14:02:57 +0000 (14:02 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 14 Sep 2011 14:02:57 +0000 (14:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170632 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/RepositoryConversionException.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyRepositoryConverter.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/RepositoryConversionException.java [deleted file]
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java [deleted file]
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java [deleted file]
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyRepositoryConverter.java [deleted file]
archiva-modules/archiva-base/archiva-converter/src/main/resources/org/apache/archiva/converter/DefaultRepositoryConverter.properties [new file with mode: 0644]
archiva-modules/archiva-base/archiva-converter/src/main/resources/org/apache/maven/archiva/converter/DefaultRepositoryConverter.properties [deleted file]

diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/RepositoryConversionException.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/RepositoryConversionException.java
new file mode 100644 (file)
index 0000000..a5edc27
--- /dev/null
@@ -0,0 +1,38 @@
+package org.apache.archiva.converter;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Exception occuring during repository conversion.
+ *
+ */
+public class RepositoryConversionException
+    extends Exception
+{
+    public RepositoryConversionException( String message )
+    {
+        super( message );
+    }
+
+    public RepositoryConversionException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java
new file mode 100644 (file)
index 0000000..01b0fd7
--- /dev/null
@@ -0,0 +1,119 @@
+package org.apache.archiva.converter.legacy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
+import org.apache.archiva.converter.RepositoryConversionException;
+import org.apache.archiva.repository.scanner.RepositoryScanner;
+import org.apache.archiva.repository.scanner.RepositoryScannerException;
+import org.apache.maven.archiva.common.utils.PathUtil;
+import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * DefaultLegacyRepositoryConverter
+ *
+ * @version $Id$
+ */
+@Service( "legacyRepositoryConverter#default" )
+public class DefaultLegacyRepositoryConverter
+    implements LegacyRepositoryConverter
+{
+    /**
+     *
+     */
+    private ArtifactRepositoryFactory artifactRepositoryFactory;
+
+    /**
+     *
+     */
+    private ArtifactRepositoryLayout defaultLayout;
+
+    /**
+     *
+     */
+    @Inject
+    @Named( value = "knownRepositoryContentConsumer#artifact-legacy-to-default-converter" )
+    private LegacyConverterArtifactConsumer legacyConverterConsumer;
+
+    /**
+     *
+     */
+    @Inject
+    private RepositoryScanner repoScanner;
+
+    @Inject
+    public DefaultLegacyRepositoryConverter( PlexusSisuBridge plexusSisuBridge )
+        throws PlexusSisuBridgeException
+    {
+        artifactRepositoryFactory = plexusSisuBridge.lookup( ArtifactRepositoryFactory.class );
+        defaultLayout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "default" );
+    }
+
+    public void convertLegacyRepository( File legacyRepositoryDirectory, File repositoryDirectory,
+                                         List<String> fileExclusionPatterns )
+        throws RepositoryConversionException
+    {
+        try
+        {
+            String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory );
+
+            ManagedRepository legacyRepository = new ManagedRepository();
+            legacyRepository.setId( "legacy" );
+            legacyRepository.setName( "Legacy Repository" );
+            legacyRepository.setLocation( legacyRepositoryDirectory.getAbsolutePath() );
+            legacyRepository.setLayout( "legacy" );
+
+            ArtifactRepository repository =
+                artifactRepositoryFactory.createArtifactRepository( "default", defaultRepositoryUrl, defaultLayout,
+                                                                    null, null );
+            legacyConverterConsumer.setExcludes( fileExclusionPatterns );
+            legacyConverterConsumer.setDestinationRepository( repository );
+
+            List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
+            knownConsumers.add( legacyConverterConsumer );
+
+            List<InvalidRepositoryContentConsumer> invalidConsumers = Collections.emptyList();
+            List<String> ignoredContent = new ArrayList<String>();
+            ignoredContent.addAll( Arrays.asList( RepositoryScanner.IGNORABLE_CONTENT ) );
+
+            repoScanner.scan( legacyRepository, knownConsumers, invalidConsumers, ignoredContent,
+                              RepositoryScanner.FRESH_SCAN );
+        }
+        catch ( RepositoryScannerException e )
+        {
+            throw new RepositoryConversionException( "Error convering legacy repository.", e );
+        }
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
new file mode 100644 (file)
index 0000000..6f06acc
--- /dev/null
@@ -0,0 +1,185 @@
+package org.apache.archiva.converter.legacy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
+import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
+import org.apache.maven.archiva.consumers.ConsumerException;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.archiva.converter.artifact.ArtifactConversionException;
+import org.apache.archiva.converter.artifact.ArtifactConverter;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * LegacyConverterArtifactConsumer - convert artifacts as they are found
+ * into the destination repository.
+ *
+ * @version $Id$
+ */
+@Service( "knownRepositoryContentConsumer#artifact-legacy-to-default-converter" )
+@Scope( "prototype" )
+public class LegacyConverterArtifactConsumer
+    extends AbstractMonitoredConsumer
+    implements KnownRepositoryContentConsumer
+{
+    private Logger log = LoggerFactory.getLogger( LegacyConverterArtifactConsumer.class );
+
+    /**
+     *
+     */
+    @Inject
+    private ArtifactConverter artifactConverter;
+
+    /**
+     *
+     */
+    private ArtifactFactory artifactFactory;
+
+    private ManagedRepositoryContent managedRepository;
+
+    private ArtifactRepository destinationRepository;
+
+    private List<String> includes;
+
+    private List<String> excludes;
+
+    @Inject
+    public LegacyConverterArtifactConsumer( PlexusSisuBridge plexusSisuBridge )
+        throws PlexusSisuBridgeException
+    {
+        includes = new ArrayList<String>();
+        includes.add( "**/*.jar" );
+        includes.add( "**/*.ear" );
+        includes.add( "**/*.war" );
+        artifactFactory = plexusSisuBridge.lookup( ArtifactFactory.class );
+    }
+
+    public void beginScan( ManagedRepository repository, Date whenGathered )
+        throws ConsumerException
+    {
+        this.managedRepository = new ManagedDefaultRepositoryContent();
+        this.managedRepository.setRepository( repository );
+    }
+
+    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
+        throws ConsumerException
+    {
+        beginScan( repository, whenGathered );
+    }
+
+    public void completeScan()
+    {
+        // no op
+    }
+
+    public void completeScan( boolean executeOnEntireRepo )
+    {
+        completeScan();
+    }
+
+    public List<String> getExcludes()
+    {
+        return excludes;
+    }
+
+    public List<String> getIncludes()
+    {
+        return includes;
+    }
+
+    public void processFile( String path )
+        throws ConsumerException
+    {
+        try
+        {
+            ArtifactReference reference = managedRepository.toArtifactReference( path );
+            Artifact artifact = artifactFactory.createArtifact( reference.getGroupId(), reference.getArtifactId(),
+                                                                reference.getVersion(), reference.getClassifier(),
+                                                                reference.getType() );
+            artifactConverter.convert( artifact, destinationRepository );
+        }
+        catch ( LayoutException e )
+        {
+            log.warn( "Unable to convert artifact: " + path + " : " + e.getMessage(), e );
+        }
+        catch ( ArtifactConversionException e )
+        {
+            log.warn( "Unable to convert artifact: " + path + " : " + e.getMessage(), e );
+        }
+    }
+
+    public void processFile( String path, boolean executeOnEntireRepo )
+        throws Exception
+    {
+        processFile( path );
+    }
+
+    public String getDescription()
+    {
+        return "Legacy Artifact to Default Artifact Converter";
+    }
+
+    public String getId()
+    {
+        return "artifact-legacy-to-default-converter";
+    }
+
+    public boolean isPermanent()
+    {
+        return false;
+    }
+
+    public void setExcludes( List<String> excludes )
+    {
+        this.excludes = excludes;
+    }
+
+    public void setIncludes( List<String> includes )
+    {
+        this.includes = includes;
+    }
+
+    public ArtifactRepository getDestinationRepository()
+    {
+        return destinationRepository;
+    }
+
+    public void setDestinationRepository( ArtifactRepository destinationRepository )
+    {
+        this.destinationRepository = destinationRepository;
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyRepositoryConverter.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyRepositoryConverter.java
new file mode 100644 (file)
index 0000000..bb1c51b
--- /dev/null
@@ -0,0 +1,47 @@
+package org.apache.archiva.converter.legacy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.converter.RepositoryConversionException;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * Convert an entire repository.
+ * 
+ */
+public interface LegacyRepositoryConverter
+{
+    String ROLE = LegacyRepositoryConverter.class.getName();
+
+    /**
+     * Convert a legacy repository to a modern repository. This means a Maven 1.x repository
+     * using v3 POMs to a Maven 2.x repository using v4.0.0 POMs.
+     *
+     * @param legacyRepositoryDirectory the directory of the legacy repository. 
+     * @param destinationRepositoryDirectory the directory of the modern repository.
+     * @param fileExclusionPatterns the list of patterns to exclude from the conversion.
+     * @throws RepositoryConversionException 
+     */
+    void convertLegacyRepository( File legacyRepositoryDirectory, File destinationRepositoryDirectory,
+                                  List<String> fileExclusionPatterns )
+        throws RepositoryConversionException;
+}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/RepositoryConversionException.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/RepositoryConversionException.java
deleted file mode 100644 (file)
index 31f9dc8..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.apache.maven.archiva.converter;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Exception occuring during repository conversion.
- *
- */
-public class RepositoryConversionException
-    extends Exception
-{
-    public RepositoryConversionException( String message )
-    {
-        super( message );
-    }
-
-    public RepositoryConversionException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java
deleted file mode 100644 (file)
index dd45dce..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.apache.maven.archiva.converter.legacy;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.admin.model.managed.ManagedRepository;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
-import org.apache.archiva.repository.scanner.RepositoryScanner;
-import org.apache.archiva.repository.scanner.RepositoryScannerException;
-import org.apache.maven.archiva.common.utils.PathUtil;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
-import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.maven.archiva.converter.RepositoryConversionException;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * DefaultLegacyRepositoryConverter
- *
- * @version $Id$
- */
-@Service( "legacyRepositoryConverter#default" )
-public class DefaultLegacyRepositoryConverter
-    implements LegacyRepositoryConverter
-{
-    /**
-     *
-     */
-    private ArtifactRepositoryFactory artifactRepositoryFactory;
-
-    /**
-     *
-     */
-    private ArtifactRepositoryLayout defaultLayout;
-
-    /**
-     *
-     */
-    @Inject
-    @Named( value = "knownRepositoryContentConsumer#artifact-legacy-to-default-converter" )
-    private LegacyConverterArtifactConsumer legacyConverterConsumer;
-
-    /**
-     *
-     */
-    @Inject
-    private RepositoryScanner repoScanner;
-
-    @Inject
-    public DefaultLegacyRepositoryConverter( PlexusSisuBridge plexusSisuBridge )
-        throws PlexusSisuBridgeException
-    {
-        artifactRepositoryFactory = plexusSisuBridge.lookup( ArtifactRepositoryFactory.class );
-        defaultLayout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "default" );
-    }
-
-    public void convertLegacyRepository( File legacyRepositoryDirectory, File repositoryDirectory,
-                                         List<String> fileExclusionPatterns )
-        throws RepositoryConversionException
-    {
-        try
-        {
-            String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory );
-
-            ManagedRepository legacyRepository = new ManagedRepository();
-            legacyRepository.setId( "legacy" );
-            legacyRepository.setName( "Legacy Repository" );
-            legacyRepository.setLocation( legacyRepositoryDirectory.getAbsolutePath() );
-            legacyRepository.setLayout( "legacy" );
-
-            ArtifactRepository repository =
-                artifactRepositoryFactory.createArtifactRepository( "default", defaultRepositoryUrl, defaultLayout,
-                                                                    null, null );
-            legacyConverterConsumer.setExcludes( fileExclusionPatterns );
-            legacyConverterConsumer.setDestinationRepository( repository );
-
-            List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
-            knownConsumers.add( legacyConverterConsumer );
-
-            List<InvalidRepositoryContentConsumer> invalidConsumers = Collections.emptyList();
-            List<String> ignoredContent = new ArrayList<String>();
-            ignoredContent.addAll( Arrays.asList( RepositoryScanner.IGNORABLE_CONTENT ) );
-
-            repoScanner.scan( legacyRepository, knownConsumers, invalidConsumers, ignoredContent,
-                              RepositoryScanner.FRESH_SCAN );
-        }
-        catch ( RepositoryScannerException e )
-        {
-            throw new RepositoryConversionException( "Error convering legacy repository.", e );
-        }
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
deleted file mode 100644 (file)
index 44218a0..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.apache.maven.archiva.converter.legacy;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.archiva.admin.model.managed.ManagedRepository;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
-import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
-import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.archiva.converter.artifact.ArtifactConversionException;
-import org.apache.archiva.converter.artifact.ArtifactConverter;
-import org.apache.maven.archiva.model.ArtifactReference;
-import org.apache.maven.archiva.repository.ManagedRepositoryContent;
-import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent;
-import org.apache.maven.archiva.repository.layout.LayoutException;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * LegacyConverterArtifactConsumer - convert artifacts as they are found
- * into the destination repository.
- *
- * @version $Id$
- */
-@Service( "knownRepositoryContentConsumer#artifact-legacy-to-default-converter" )
-@Scope( "prototype" )
-public class LegacyConverterArtifactConsumer
-    extends AbstractMonitoredConsumer
-    implements KnownRepositoryContentConsumer
-{
-    private Logger log = LoggerFactory.getLogger( LegacyConverterArtifactConsumer.class );
-
-    /**
-     *
-     */
-    @Inject
-    private ArtifactConverter artifactConverter;
-
-    /**
-     *
-     */
-    private ArtifactFactory artifactFactory;
-
-    private ManagedRepositoryContent managedRepository;
-
-    private ArtifactRepository destinationRepository;
-
-    private List<String> includes;
-
-    private List<String> excludes;
-
-    @Inject
-    public LegacyConverterArtifactConsumer( PlexusSisuBridge plexusSisuBridge )
-        throws PlexusSisuBridgeException
-    {
-        includes = new ArrayList<String>();
-        includes.add( "**/*.jar" );
-        includes.add( "**/*.ear" );
-        includes.add( "**/*.war" );
-        artifactFactory = plexusSisuBridge.lookup( ArtifactFactory.class );
-    }
-
-    public void beginScan( ManagedRepository repository, Date whenGathered )
-        throws ConsumerException
-    {
-        this.managedRepository = new ManagedDefaultRepositoryContent();
-        this.managedRepository.setRepository( repository );
-    }
-
-    public void beginScan( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
-        throws ConsumerException
-    {
-        beginScan( repository, whenGathered );
-    }
-
-    public void completeScan()
-    {
-        // no op
-    }
-
-    public void completeScan( boolean executeOnEntireRepo )
-    {
-        completeScan();
-    }
-
-    public List<String> getExcludes()
-    {
-        return excludes;
-    }
-
-    public List<String> getIncludes()
-    {
-        return includes;
-    }
-
-    public void processFile( String path )
-        throws ConsumerException
-    {
-        try
-        {
-            ArtifactReference reference = managedRepository.toArtifactReference( path );
-            Artifact artifact = artifactFactory.createArtifact( reference.getGroupId(), reference.getArtifactId(),
-                                                                reference.getVersion(), reference.getClassifier(),
-                                                                reference.getType() );
-            artifactConverter.convert( artifact, destinationRepository );
-        }
-        catch ( LayoutException e )
-        {
-            log.warn( "Unable to convert artifact: " + path + " : " + e.getMessage(), e );
-        }
-        catch ( ArtifactConversionException e )
-        {
-            log.warn( "Unable to convert artifact: " + path + " : " + e.getMessage(), e );
-        }
-    }
-
-    public void processFile( String path, boolean executeOnEntireRepo )
-        throws Exception
-    {
-        processFile( path );
-    }
-
-    public String getDescription()
-    {
-        return "Legacy Artifact to Default Artifact Converter";
-    }
-
-    public String getId()
-    {
-        return "artifact-legacy-to-default-converter";
-    }
-
-    public boolean isPermanent()
-    {
-        return false;
-    }
-
-    public void setExcludes( List<String> excludes )
-    {
-        this.excludes = excludes;
-    }
-
-    public void setIncludes( List<String> includes )
-    {
-        this.includes = includes;
-    }
-
-    public ArtifactRepository getDestinationRepository()
-    {
-        return destinationRepository;
-    }
-
-    public void setDestinationRepository( ArtifactRepository destinationRepository )
-    {
-        this.destinationRepository = destinationRepository;
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyRepositoryConverter.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyRepositoryConverter.java
deleted file mode 100644 (file)
index 53db298..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.apache.maven.archiva.converter.legacy;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.archiva.converter.RepositoryConversionException;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * Convert an entire repository.
- * 
- */
-public interface LegacyRepositoryConverter
-{
-    String ROLE = LegacyRepositoryConverter.class.getName();
-
-    /**
-     * Convert a legacy repository to a modern repository. This means a Maven 1.x repository
-     * using v3 POMs to a Maven 2.x repository using v4.0.0 POMs.
-     *
-     * @param legacyRepositoryDirectory the directory of the legacy repository. 
-     * @param destinationRepositoryDirectory the directory of the modern repository.
-     * @param fileExclusionPatterns the list of patterns to exclude from the conversion.
-     * @throws RepositoryConversionException 
-     */
-    void convertLegacyRepository( File legacyRepositoryDirectory, File destinationRepositoryDirectory,
-                                  List<String> fileExclusionPatterns )
-        throws RepositoryConversionException;
-}
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/resources/org/apache/archiva/converter/DefaultRepositoryConverter.properties b/archiva-modules/archiva-base/archiva-converter/src/main/resources/org/apache/archiva/converter/DefaultRepositoryConverter.properties
new file mode 100644 (file)
index 0000000..8589df4
--- /dev/null
@@ -0,0 +1,38 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+failure.incorrect.md5=The MD5 checksum value was incorrect.
+failure.incorrect.sha1=The SHA1 checksum value was incorrect.
+failure.target.already.exists=The artifact could not be converted because it already exists.
+failure.invalid.source.pom=The source POM was invalid: {0}.
+
+warning.missing.pom=The artifact had no POM in the source repository.
+
+exception.repositories.match=Source and target repositories are identical.
+
+failure.incorrect.groupMetadata.groupId=The group ID in the source group metadata is incorrect.
+
+failure.incorrect.artifactMetadata.artifactId=The artifact ID in the source artifact metadata is incorrect.
+failure.incorrect.artifactMetadata.groupId=The group ID in the source artifact metadata is incorrect.
+failure.incorrect.artifactMetadata.versions=The version list in the source artifact metadata is incorrect.
+
+failure.incorrect.snapshotMetadata.artifactId=The artifact ID in the source artifact version metadata is incorrect.
+failure.incorrect.snapshotMetadata.groupId=The group ID in the source artifact version metadata is incorrect.
+failure.incorrect.snapshotMetadata.version=The version in the source artifact version metadata is incorrect.
+failure.incorrect.snapshotMetadata.snapshot=The snapshot information in the source artifact version metadata is incorrect.
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/resources/org/apache/maven/archiva/converter/DefaultRepositoryConverter.properties b/archiva-modules/archiva-base/archiva-converter/src/main/resources/org/apache/maven/archiva/converter/DefaultRepositoryConverter.properties
deleted file mode 100644 (file)
index 8589df4..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-failure.incorrect.md5=The MD5 checksum value was incorrect.
-failure.incorrect.sha1=The SHA1 checksum value was incorrect.
-failure.target.already.exists=The artifact could not be converted because it already exists.
-failure.invalid.source.pom=The source POM was invalid: {0}.
-
-warning.missing.pom=The artifact had no POM in the source repository.
-
-exception.repositories.match=Source and target repositories are identical.
-
-failure.incorrect.groupMetadata.groupId=The group ID in the source group metadata is incorrect.
-
-failure.incorrect.artifactMetadata.artifactId=The artifact ID in the source artifact metadata is incorrect.
-failure.incorrect.artifactMetadata.groupId=The group ID in the source artifact metadata is incorrect.
-failure.incorrect.artifactMetadata.versions=The version list in the source artifact metadata is incorrect.
-
-failure.incorrect.snapshotMetadata.artifactId=The artifact ID in the source artifact version metadata is incorrect.
-failure.incorrect.snapshotMetadata.groupId=The group ID in the source artifact version metadata is incorrect.
-failure.incorrect.snapshotMetadata.version=The version in the source artifact version metadata is incorrect.
-failure.incorrect.snapshotMetadata.snapshot=The snapshot information in the source artifact version metadata is incorrect.