diff options
author | Olivier Lamy <olamy@apache.org> | 2012-03-12 08:10:38 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-03-12 08:10:38 +0000 |
commit | 6a46674535827acd278ba5271b2fac924bb24bb0 (patch) | |
tree | 23e7f339f2317eeb6c06077bbd0f3a5b8767423d /archiva-modules/archiva-base/archiva-repository-layer | |
parent | 2bf4472cafd03e28fe0cd89ec59281349c9d16df (diff) | |
download | archiva-6a46674535827acd278ba5271b2fac924bb24bb0.tar.gz archiva-6a46674535827acd278ba5271b2fac924bb24bb0.zip |
remove deprecated class
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1299574 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-layer')
3 files changed, 32 insertions, 77 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/MetadataTools.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/MetadataTools.java index f0db9917d..eab28b403 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/MetadataTools.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/MetadataTools.java @@ -21,11 +21,6 @@ package org.apache.archiva.repository.metadata; import org.apache.archiva.checksum.ChecksumAlgorithm; import org.apache.archiva.checksum.ChecksummedFile; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; -import org.apache.commons.lang.time.DateUtils; import org.apache.archiva.common.utils.PathUtil; import org.apache.archiva.common.utils.VersionComparator; import org.apache.archiva.common.utils.VersionUtil; @@ -33,6 +28,7 @@ import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.ConfigurationNames; import org.apache.archiva.configuration.FileTypes; import org.apache.archiva.configuration.ProxyConnectorConfiguration; +import org.apache.archiva.maven2.metadata.MavenMetadataReader; import org.apache.archiva.model.ArchivaRepositoryMetadata; import org.apache.archiva.model.ArtifactReference; import org.apache.archiva.model.Plugin; @@ -43,6 +39,12 @@ import org.apache.archiva.repository.ContentNotFoundException; import org.apache.archiva.repository.ManagedRepositoryContent; import org.apache.archiva.repository.RemoteRepositoryContent; import org.apache.archiva.repository.layout.LayoutException; +import org.apache.archiva.xml.XMLException; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; +import org.apache.commons.lang.time.DateUtils; import org.codehaus.plexus.registry.Registry; import org.codehaus.plexus.registry.RegistryListener; import org.slf4j.Logger; @@ -98,7 +100,7 @@ public class MetadataTools * */ @Inject - @Named(value = "fileTypes") + @Named( value = "fileTypes" ) private FileTypes filetypes; private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 }; @@ -366,9 +368,9 @@ public class MetadataTools try { - return RepositoryMetadataReader.read( metadataFile ); + return MavenMetadataReader.read( metadataFile ); } - catch ( RepositoryMetadataException e ) + catch ( XMLException e ) { // TODO: [monitor] consider a monitor for this event. // TODO: consider a read-redo on monitor return code? @@ -391,9 +393,9 @@ public class MetadataTools try { - return RepositoryMetadataReader.read( metadataFile ); + return MavenMetadataReader.read( metadataFile ); } - catch ( RepositoryMetadataException e ) + catch ( XMLException e ) { // TODO: [monitor] consider a monitor for this event. // TODO: consider a read-redo on monitor return code? @@ -416,9 +418,9 @@ public class MetadataTools try { - return RepositoryMetadataReader.read( metadataFile ); + return MavenMetadataReader.read( metadataFile ); } - catch ( RepositoryMetadataException e ) + catch ( XMLException e ) { // TODO: [monitor] consider a monitor for this event. // TODO: consider a read-redo on monitor return code? @@ -506,13 +508,13 @@ public class MetadataTools { try { - ArchivaRepositoryMetadata existingMetadata = RepositoryMetadataReader.read( file ); + ArchivaRepositoryMetadata existingMetadata = MavenMetadataReader.read( file ); if ( existingMetadata != null ) { metadatas.add( existingMetadata ); } } - catch ( RepositoryMetadataException e ) + catch ( XMLException e ) { log.debug( "Could not read metadata at {}. Metadata will be removed.", file.getAbsolutePath() ); FileUtils.deleteQuietly( file ); @@ -574,7 +576,14 @@ public class MetadataTools Set<Plugin> allPlugins; if ( metadataFile.exists() ) { - allPlugins = new LinkedHashSet<Plugin>( RepositoryMetadataReader.read( metadataFile ).getPlugins() ); + try + { + allPlugins = new LinkedHashSet<Plugin>( MavenMetadataReader.read( metadataFile ).getPlugins() ); + } + catch ( XMLException e ) + { + throw new RepositoryMetadataException( e.getMessage(), e ); + } } else { @@ -730,11 +739,11 @@ public class MetadataTools try { - ArchivaRepositoryMetadata metadata = RepositoryMetadataReader.read( metadataFile ); + ArchivaRepositoryMetadata metadata = MavenMetadataReader.read( metadataFile ); return getLastUpdated( metadata ); } - catch ( RepositoryMetadataException e ) + catch ( XMLException e ) { // Error. return 0; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataReader.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataReader.java deleted file mode 100644 index 160afc1a8..000000000 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataReader.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.archiva.repository.metadata; - -/* - * 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.maven2.metadata.MavenMetadataReader; -import org.apache.archiva.model.ArchivaRepositoryMetadata; -import org.apache.archiva.xml.XMLException; - -import java.io.File; - -/** - * RepositoryMetadataReader - read maven-metadata.xml files. - * - * @version $Id$ - * @deprecated use {@link MavenMetadataReader} - */ -public class RepositoryMetadataReader -{ - - /** - * Read and return the {@link ArchivaRepositoryMetadata} object from the provided xml file. - * - * @param metadataFile the maven-metadata.xml file to read. - * @return the archiva repository metadata object that represents the provided file contents. - * @throws RepositoryMetadataException - */ - public static ArchivaRepositoryMetadata read( File metadataFile ) - throws RepositoryMetadataException - { - try - { - return MavenMetadataReader.read( metadataFile ); - } - catch ( XMLException e ) - { - throw new RepositoryMetadataException( e.getMessage(), e ); - } - } -} diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java index d015e73e8..8da14bd08 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java @@ -20,7 +20,9 @@ package org.apache.archiva.repository.metadata; */ import junit.framework.TestCase; +import org.apache.archiva.maven2.metadata.MavenMetadataReader; import org.apache.archiva.model.ArchivaRepositoryMetadata; +import org.apache.archiva.xml.XMLException; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -38,12 +40,12 @@ public class RepositoryMetadataReaderTest { @Test public void testLoadSimple() - throws RepositoryMetadataException + throws XMLException { File defaultRepoDir = new File( "src/test/repositories/default-repository" ); File metadataFile = new File( defaultRepoDir, "org/apache/maven/shared/maven-downloader/maven-metadata.xml" ); - ArchivaRepositoryMetadata metadata = RepositoryMetadataReader.read( metadataFile ); + ArchivaRepositoryMetadata metadata = MavenMetadataReader.read( metadataFile ); assertNotNull( metadata ); assertEquals( "Group Id", "org.apache.maven.shared", metadata.getGroupId() ); @@ -56,12 +58,12 @@ public class RepositoryMetadataReaderTest @Test public void testLoadComplex() - throws RepositoryMetadataException + throws XMLException { File defaultRepoDir = new File( "src/test/repositories/default-repository" ); File metadataFile = new File( defaultRepoDir, "org/apache/maven/samplejar/maven-metadata.xml" ); - ArchivaRepositoryMetadata metadata = RepositoryMetadataReader.read( metadataFile ); + ArchivaRepositoryMetadata metadata = MavenMetadataReader.read( metadataFile ); assertNotNull( metadata ); assertEquals( "Group Id", "org.apache.maven", metadata.getGroupId() ); |