diff options
author | Brett Porter <brett@apache.org> | 2006-12-23 06:09:30 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2006-12-23 06:09:30 +0000 |
commit | 740994f99de3d6129094b96b0628188063f7c74c (patch) | |
tree | b46f8a1cb1c83353b1bdeea3d5801c58d4d01e77 | |
parent | c205446929ef8ac4df32d0697dafa01f796e664f (diff) | |
download | archiva-740994f99de3d6129094b96b0628188063f7c74c.tar.gz archiva-740994f99de3d6129094b96b0628188063f7c74c.zip |
Get rid of old Archiva component
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@489857 13f79535-47bb-0310-9956-ffa450edef68
6 files changed, 61 insertions, 156 deletions
diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java index 270658ed0..a3a1c1cb1 100644 --- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java +++ b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java @@ -3,12 +3,12 @@ package org.apache.maven.archiva.cli; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; -import org.apache.maven.archiva.Archiva; +import org.apache.commons.lang.StringUtils; +import org.apache.maven.archiva.conversion.LegacyRepositoryConverter; import org.apache.maven.archiva.converter.RepositoryConversionException; import org.apache.maven.archiva.discoverer.DiscovererException; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.tools.cli.AbstractCli; -import org.apache.commons.lang.StringUtils; import java.io.File; import java.io.FileInputStream; @@ -59,11 +59,11 @@ public class ArchivaCli return options; } - public void invokePlexusComponent( CommandLine cli, - PlexusContainer plexus ) + public void invokePlexusComponent( CommandLine cli, PlexusContainer plexus ) throws Exception { - Archiva archiva = (Archiva) plexus.lookup( Archiva.ROLE ); + LegacyRepositoryConverter legacyRepositoryConverter = + (LegacyRepositoryConverter) plexus.lookup( LegacyRepositoryConverter.ROLE ); if ( cli.hasOption( CONVERT ) ) { @@ -95,7 +95,8 @@ public class ArchivaCli try { - archiva.convertLegacyRepository( oldRepositoryPath, newRepositoryPath, blacklistedPatterns, true ); + legacyRepositoryConverter.convertLegacyRepository( oldRepositoryPath, newRepositoryPath, + blacklistedPatterns, true ); } catch ( RepositoryConversionException e ) { diff --git a/archiva-core/src/main/java/org/apache/maven/archiva/Archiva.java b/archiva-core/src/main/java/org/apache/maven/archiva/Archiva.java deleted file mode 100644 index f36b8e706..000000000 --- a/archiva-core/src/main/java/org/apache/maven/archiva/Archiva.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.apache.maven.archiva; - -/* - * 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. - */ - -import org.apache.maven.archiva.converter.RepositoryConversionException; -import org.apache.maven.archiva.discoverer.DiscovererException; - -import java.io.File; -import java.util.List; - -/** - * @author Jason van Zyl - */ -public interface Archiva -{ - /** - * Role of the Repository Manager - */ - String ROLE = Archiva.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 - * @param repositoryDirectory - * @throws RepositoryConversionException - */ - void convertLegacyRepository( File legacyRepositoryDirectory, - File repositoryDirectory, - List blacklistedPatterns, - boolean includeSnapshots ) - throws RepositoryConversionException, DiscovererException; -} diff --git a/archiva-core/src/main/java/org/apache/maven/archiva/DefaultArchiva.java b/archiva-core/src/main/java/org/apache/maven/archiva/DefaultArchiva.java deleted file mode 100644 index b50ed3936..000000000 --- a/archiva-core/src/main/java/org/apache/maven/archiva/DefaultArchiva.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.apache.maven.archiva; - -/* - * 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. - */ - -import org.apache.maven.archiva.conversion.LegacyRepositoryConverter; -import org.apache.maven.archiva.converter.RepositoryConversionException; -import org.apache.maven.archiva.discoverer.DiscovererException; - -import java.io.File; -import java.util.List; - -/** - * @author Jason van Zyl - * @plexus.component - * @todo turn this into a general conversion component and hide all this crap here. - */ -public class DefaultArchiva - implements Archiva -{ - /** - * @plexus.requirement - */ - private LegacyRepositoryConverter legacyRepositoryConverter; - - public void convertLegacyRepository( File legacyRepositoryDirectory, - File repositoryDirectory, - List blacklistedPatterns, - boolean includeSnapshots ) - throws RepositoryConversionException, DiscovererException - { - legacyRepositoryConverter.convertLegacyRepository( legacyRepositoryDirectory, - repositoryDirectory, - blacklistedPatterns, - includeSnapshots ); - } -} diff --git a/archiva-core/src/main/java/org/apache/maven/archiva/conversion/DefaultLegacyRepositoryConverter.java b/archiva-core/src/main/java/org/apache/maven/archiva/conversion/DefaultLegacyRepositoryConverter.java index 007f8459e..d40e83157 100644 --- a/archiva-core/src/main/java/org/apache/maven/archiva/conversion/DefaultLegacyRepositoryConverter.java +++ b/archiva-core/src/main/java/org/apache/maven/archiva/conversion/DefaultLegacyRepositoryConverter.java @@ -1,19 +1,18 @@ package org.apache.maven.archiva.conversion; -import org.apache.maven.archiva.Archiva; -import org.apache.maven.archiva.reporting.group.ReportGroup; -import org.apache.maven.archiva.reporting.database.ReportingDatabase; -import org.apache.maven.archiva.reporting.store.ReportingStore; -import org.apache.maven.archiva.reporting.store.ReportingStoreException; -import org.apache.maven.archiva.converter.RepositoryConverter; import org.apache.maven.archiva.converter.RepositoryConversionException; +import org.apache.maven.archiva.converter.RepositoryConverter; import org.apache.maven.archiva.discoverer.ArtifactDiscoverer; import org.apache.maven.archiva.discoverer.DiscovererException; import org.apache.maven.archiva.discoverer.filter.AcceptAllArtifactFilter; import org.apache.maven.archiva.discoverer.filter.SnapshotArtifactFilter; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; +import org.apache.maven.archiva.reporting.database.ReportingDatabase; +import org.apache.maven.archiva.reporting.group.ReportGroup; +import org.apache.maven.archiva.reporting.store.ReportingStore; +import org.apache.maven.archiva.reporting.store.ReportingStoreException; import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import java.io.File; @@ -24,6 +23,7 @@ import java.util.List; * @author Jason van Zyl * @plexus.component * @todo turn this into a general conversion component and hide all this crap here. + * @todo it should be possible to move this to the converter module without causing it to gain additional dependencies */ public class DefaultLegacyRepositoryConverter implements LegacyRepositoryConverter @@ -63,10 +63,8 @@ public class DefaultLegacyRepositoryConverter */ private ReportGroup reportGroup; - public void convertLegacyRepository( File legacyRepositoryDirectory, - File repositoryDirectory, - List blacklistedPatterns, - boolean includeSnapshots ) + public void convertLegacyRepository( File legacyRepositoryDirectory, File repositoryDirectory, + List blacklistedPatterns, boolean includeSnapshots ) throws RepositoryConversionException, DiscovererException { ArtifactRepository legacyRepository; diff --git a/archiva-core/src/test/java/org/apache/maven/archiva/ArchivaTest.java b/archiva-core/src/test/java/org/apache/maven/archiva/ArchivaTest.java deleted file mode 100644 index 111bf9224..000000000 --- a/archiva-core/src/test/java/org/apache/maven/archiva/ArchivaTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.apache.maven.archiva; - -/* - * 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. - */ - -import org.codehaus.plexus.PlexusTestCase; - -import java.io.File; - -/** - * @author Jason van Zyl - */ -public class ArchivaTest - extends PlexusTestCase -{ - public void testLegacyRepositoryConversion() - throws Exception - { - File legacyRepositoryDirectory = getTestFile( "src/test/maven-1.x-repository" ); - - File repositoryDirectory = getTestFile( "target/maven-2.x-repository" ); - - Archiva rm = (Archiva) lookup( Archiva.ROLE ); - - rm.convertLegacyRepository( legacyRepositoryDirectory, repositoryDirectory, null, true ); - } -} diff --git a/archiva-core/src/test/java/org/apache/maven/archiva/LegacyRepositoryConverterTest.java b/archiva-core/src/test/java/org/apache/maven/archiva/LegacyRepositoryConverterTest.java new file mode 100644 index 000000000..bd13a7deb --- /dev/null +++ b/archiva-core/src/test/java/org/apache/maven/archiva/LegacyRepositoryConverterTest.java @@ -0,0 +1,44 @@ +package org.apache.maven.archiva; + +/* + * 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.conversion.LegacyRepositoryConverter; +import org.codehaus.plexus.PlexusTestCase; + +import java.io.File; + +/** + * @author Jason van Zyl + */ +public class LegacyRepositoryConverterTest + extends PlexusTestCase +{ + public void testLegacyRepositoryConversion() + throws Exception + { + File legacyRepositoryDirectory = getTestFile( "src/test/maven-1.x-repository" ); + + File repositoryDirectory = getTestFile( "target/maven-2.x-repository" ); + + LegacyRepositoryConverter rm = (LegacyRepositoryConverter) lookup( LegacyRepositoryConverter.ROLE ); + + rm.convertLegacyRepository( legacyRepositoryDirectory, repositoryDirectory, null, true ); + } +} |