Author: cschneider Date: Tue Jan 3 15:02:23 2012 New Revision: 1226798 URL: http://svn.apache.org/viewvc?rev=1226798&view=rev Log: KARAF-1132 Removing aether dependency
Added: karaf/branches/karaf-2.2.x/features/command/src/main/java/org/apache/karaf/features/command/Artifact.java (with props) Modified: karaf/branches/karaf-2.2.x/features/command/pom.xml karaf/branches/karaf-2.2.x/features/command/src/main/java/org/apache/karaf/features/command/FeatureFinder.java Modified: karaf/branches/karaf-2.2.x/features/command/pom.xml URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.2.x/features/command/pom.xml?rev=1226798&r1=1226797&r2=1226798&view=diff ============================================================================== --- karaf/branches/karaf-2.2.x/features/command/pom.xml (original) +++ karaf/branches/karaf-2.2.x/features/command/pom.xml Tue Jan 3 15:02:23 2012 @@ -90,18 +90,6 @@ <artifactId>slf4j-jdk14</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.sonatype.aether</groupId> - <artifactId>aether-api</artifactId> - <version>${aether.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.sonatype.aether</groupId> - <artifactId>aether-util</artifactId> - <version>${aether.version}</version> - <scope>provided</scope> - </dependency> </dependencies> <build> @@ -136,7 +124,6 @@ * </Import-Package> <Private-Package> - org.sonatype.*, !* </Private-Package> </instructions> Added: karaf/branches/karaf-2.2.x/features/command/src/main/java/org/apache/karaf/features/command/Artifact.java URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.2.x/features/command/src/main/java/org/apache/karaf/features/command/Artifact.java?rev=1226798&view=auto ============================================================================== --- karaf/branches/karaf-2.2.x/features/command/src/main/java/org/apache/karaf/features/command/Artifact.java (added) +++ karaf/branches/karaf-2.2.x/features/command/src/main/java/org/apache/karaf/features/command/Artifact.java Tue Jan 3 15:02:23 2012 @@ -0,0 +1,53 @@ +/* + * 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. + */ +package org.apache.karaf.features.command; + +import java.net.URI; + +/** + * Simple abstraction of a maven artifact to avoid external deps + */ +public class Artifact { + String groupId; + String artifactId; + String version; + String extension; + String classifier; + + public Artifact(String coords) { + String[] coordsAr = coords.split(":"); + this.groupId = coordsAr[0]; + this.artifactId = coordsAr[1]; + this.version = coordsAr[4]; + this.extension = coordsAr[2]; + this.classifier = coordsAr[3]; + } + + public Artifact(String coords, String version) { + this(coords); + this.version = version; + } + + public URI getPaxUrlForArtifact(String version) { + String uriSt = "mvn:" + this.groupId + "/" + this.artifactId + "/" + version + "/" + this.extension + "/" + this.classifier; + try { + return new URI(uriSt); + } catch (Exception e) { + return null; + } + } +} Propchange: karaf/branches/karaf-2.2.x/features/command/src/main/java/org/apache/karaf/features/command/Artifact.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: karaf/branches/karaf-2.2.x/features/command/src/main/java/org/apache/karaf/features/command/FeatureFinder.java URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.2.x/features/command/src/main/java/org/apache/karaf/features/command/FeatureFinder.java?rev=1226798&r1=1226797&r2=1226798&view=diff ============================================================================== --- karaf/branches/karaf-2.2.x/features/command/src/main/java/org/apache/karaf/features/command/FeatureFinder.java (original) +++ karaf/branches/karaf-2.2.x/features/command/src/main/java/org/apache/karaf/features/command/FeatureFinder.java Tue Jan 3 15:02:23 2012 @@ -24,8 +24,6 @@ import java.util.Map; import org.osgi.service.cm.ConfigurationException; import org.osgi.service.cm.ManagedService; -import org.sonatype.aether.artifact.Artifact; -import org.sonatype.aether.util.artifact.DefaultArtifact; public class FeatureFinder implements ManagedService { Map<String, String> nameToArtifactMap = new HashMap<String, String>(); @@ -33,30 +31,13 @@ public class FeatureFinder implements Ma return nameToArtifactMap.keySet().toArray(new String[] {}); } - private Artifact getArtifactWithVersion(Artifact artifact, String version) { - return new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getExtension(), version); - } - public URI getUriFor(String name, String version) { String coords = nameToArtifactMap.get(name); if (coords == null) { return null; } - Artifact artifact = new DefaultArtifact(coords); - Artifact resultArtifact = getArtifactWithVersion(artifact, version); - URI uri = getPaxUrlForArtifact(resultArtifact); - return uri; - } - - private URI getPaxUrlForArtifact(Artifact resultArtifact) { - String uriSt = "mvn:" + resultArtifact.getGroupId() + "/" + resultArtifact.getArtifactId() - + "/" + resultArtifact.getVersion() - + "/" + resultArtifact.getExtension() + "/" + resultArtifact.getClassifier(); - try { - return new URI(uriSt); - } catch (Exception e) { - return null; - } + Artifact artifact = new Artifact(coords); + return artifact.getPaxUrlForArtifact(version); } @SuppressWarnings("rawtypes")