From: Olivier Lamy Date: Wed, 14 Sep 2011 14:02:57 +0000 (+0000) Subject: [MRM-1003] get RID of org.apache.maven package : artifact-converter module X-Git-Tag: archiva-1.4-M1~300 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=63e9988bb537635051fa1b16083205a2c5d0d13a;p=archiva.git [MRM-1003] get RID of org.apache.maven package : artifact-converter module git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170632 13f79535-47bb-0310-9956-ffa450edef68 --- 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 index 000000000..a5edc27d3 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/RepositoryConversionException.java @@ -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 index 000000000..01b0fd78d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java @@ -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 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 knownConsumers = new ArrayList(); + knownConsumers.add( legacyConverterConsumer ); + + List invalidConsumers = Collections.emptyList(); + List ignoredContent = new ArrayList(); + 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 index 000000000..6f06acc33 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyConverterArtifactConsumer.java @@ -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 includes; + + private List excludes; + + @Inject + public LegacyConverterArtifactConsumer( PlexusSisuBridge plexusSisuBridge ) + throws PlexusSisuBridgeException + { + includes = new ArrayList(); + 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 getExcludes() + { + return excludes; + } + + public List 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 excludes ) + { + this.excludes = excludes; + } + + public void setIncludes( List 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 index 000000000..bb1c51b60 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/LegacyRepositoryConverter.java @@ -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 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 index 31f9dc853..000000000 --- a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/RepositoryConversionException.java +++ /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 index dd45dce71..000000000 --- a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java +++ /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 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 knownConsumers = new ArrayList(); - knownConsumers.add( legacyConverterConsumer ); - - List invalidConsumers = Collections.emptyList(); - List ignoredContent = new ArrayList(); - 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 index 44218a056..000000000 --- a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java +++ /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 includes; - - private List excludes; - - @Inject - public LegacyConverterArtifactConsumer( PlexusSisuBridge plexusSisuBridge ) - throws PlexusSisuBridgeException - { - includes = new ArrayList(); - 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 getExcludes() - { - return excludes; - } - - public List 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 excludes ) - { - this.excludes = excludes; - } - - public void setIncludes( List 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 index 53db2980f..000000000 --- a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyRepositoryConverter.java +++ /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 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 index 000000000..8589df468 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-converter/src/main/resources/org/apache/archiva/converter/DefaultRepositoryConverter.properties @@ -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 index 8589df468..000000000 --- a/archiva-modules/archiva-base/archiva-converter/src/main/resources/org/apache/maven/archiva/converter/DefaultRepositoryConverter.properties +++ /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.