From dd05b8a93e124d351446bc6215a14af74f837942 Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Fri, 1 Apr 2005 04:09:37 +0000 Subject: [PATCH] remove unneeded code git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163738 13f79535-47bb-0310-9956-ffa450edef68 --- .../AbstractArtifactRepositoryLayout.java | 100 ------------------ .../layout/DefaultRepositoryLayout.java | 13 --- .../layout/LegacyRepositoryLayout.java | 13 --- 3 files changed, 126 deletions(-) delete mode 100644 maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/AbstractArtifactRepositoryLayout.java diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/AbstractArtifactRepositoryLayout.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/AbstractArtifactRepositoryLayout.java deleted file mode 100644 index 2b7d204b56..0000000000 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/AbstractArtifactRepositoryLayout.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.apache.maven.artifact.repository.layout; - -/* - * Copyright 2001-2005 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.artifact.Artifact; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; -import org.apache.maven.artifact.handler.manager.ArtifactHandlerNotFoundException; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.codehaus.plexus.util.StringUtils; - -/** - * @author jdcasey - */ -public abstract class AbstractArtifactRepositoryLayout - implements ArtifactRepositoryLayout -{ - private ArtifactHandlerManager artifactHandlerManager; - - protected abstract String layoutPattern(); - - protected abstract String metadataLayoutPattern(); - - protected abstract String groupIdAsPath( String groupId ); - - public String pathOf( Artifact artifact ) - throws ArtifactPathFormatException - { - String path = basicPathOf( artifact, layoutPattern() ); - - if ( artifact.hasClassifier() ) - { - path = StringUtils.replace( path, "${classifier}", artifact.getClassifier() ); - } - else - { - path = StringUtils.replace( path, "-${classifier}", "" ); - } - - return path; - } - - public String pathOfMetadata( ArtifactMetadata metadata ) - throws ArtifactPathFormatException - { - String path = basicPathOf( metadata.getArtifact(), metadataLayoutPattern() ); - - path = StringUtils.replace( path, "${metadataFilename}", metadata.getFilename() ); - - return path; - } - - private String basicPathOf( Artifact artifact, String pattern ) - throws ArtifactPathFormatException - { - String path = pattern; - - String groupPath = groupIdAsPath( artifact.getGroupId() ); - - path = StringUtils.replace( path, "${groupPath}", groupPath ); - - path = StringUtils.replace( path, "${artifactId}", artifact.getArtifactId() ); - - path = StringUtils.replace( path, "${version}", artifact.getVersion() ); - - path = StringUtils.replace( path, "${baseVersion}", artifact.getBaseVersion() ); - - ArtifactHandler artifactHandler = null; - try - { - // TODO: this is a poor excuse to have this method throwing an exception. Validate the artifact first, perhaps associate the handler with it - artifactHandler = artifactHandlerManager.getArtifactHandler( artifact.getType() ); - } - catch ( ArtifactHandlerNotFoundException e ) - { - throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId() + - "\'.", e ); - } - - path = StringUtils.replace( path, "${directory}", artifactHandler.directory() ); - - path = StringUtils.replace( path, "${extension}", artifactHandler.extension() ); - return path; - } - -} \ No newline at end of file diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java index 65727ad89c..6671c4104e 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java @@ -68,19 +68,6 @@ public class DefaultRepositoryLayout { Artifact artifact = metadata.getArtifact(); - ArtifactHandler artifactHandler = null; - - try - { - // TODO: this is a poor excuse to have this method throwing an exception. Validate the artifact first, perhaps associate the handler with it - artifactHandler = artifactHandlerManager.getArtifactHandler( artifact.getType() ); - } - catch ( ArtifactHandlerNotFoundException e ) - { - throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId() - + "\'.", e ); - } - StringBuffer path = new StringBuffer(); path.append( artifact.getGroupId().replace( '.', '/' ) ).append( '/' ); diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/LegacyRepositoryLayout.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/LegacyRepositoryLayout.java index d10295c275..fa3940636c 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/LegacyRepositoryLayout.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/LegacyRepositoryLayout.java @@ -67,19 +67,6 @@ public class LegacyRepositoryLayout { Artifact artifact = metadata.getArtifact(); - ArtifactHandler artifactHandler = null; - - try - { - // TODO: this is a poor excuse to have this method throwing an exception. Validate the artifact first, perhaps associate the handler with it - artifactHandler = artifactHandlerManager.getArtifactHandler( artifact.getType() ); - } - catch ( ArtifactHandlerNotFoundException e ) - { - throw new ArtifactPathFormatException( "Cannot find ArtifactHandler for artifact: \'" + artifact.getId() - + "\'.", e ); - } - StringBuffer path = new StringBuffer(); path.append(artifact.getGroupId()).append("/poms/");