You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ks...@apache.org on 2015/10/29 21:35:15 UTC
[10/13] servicemix-maven-plugins git commit: Deprecated plugins
removed
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/MojoSupport.java
----------------------------------------------------------------------
diff --git a/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/MojoSupport.java b/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/MojoSupport.java
deleted file mode 100644
index 0d2af3e..0000000
--- a/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/MojoSupport.java
+++ /dev/null
@@ -1,299 +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.
- */
-package org.apache.servicemix.tooling.features;
-
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactCollector;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.DependencyManagement;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
-import org.apache.maven.project.MavenProjectHelper;
-import org.apache.maven.project.ProjectBuildingException;
-
-/**
- * @version $Revision: 1.1 $
- */
-public abstract class MojoSupport extends AbstractMojo {
-
- /**
- * Maven ProjectHelper
- *
- * @component
- */
- protected MavenProjectHelper projectHelper;
-
- /**
- * The maven project.
- *
- * @parameter expression="${project}"
- * @required
- * @readonly
- */
- protected MavenProject project;
-
- /**
- * Directory that resources are copied to during the build.
- *
- * @parameter expression="${project.build.directory}/${project.artifactId}-${project.version}-installer"
- * @required
- */
- protected File workDirectory;
-
- /**
- * @component
- */
- protected MavenProjectBuilder projectBuilder;
-
- /**
- * @parameter default-value="${localRepository}"
- */
- protected ArtifactRepository localRepo;
-
- /**
- * @parameter default-value="${project.remoteArtifactRepositories}"
- */
- protected List remoteRepos;
-
- /**
- * @component
- */
- protected ArtifactMetadataSource artifactMetadataSource;
-
- /**
- * @component
- */
- protected ArtifactResolver resolver;
-
- protected ArtifactCollector collector = new GraphArtifactCollector();
-
- /**
- * @component
- */
- protected ArtifactFactory factory;
-
- protected MavenProject getProject() {
- return project;
- }
-
- protected File getWorkDirectory() {
- return workDirectory;
- }
-
- public MavenProjectHelper getProjectHelper() {
- return projectHelper;
- }
-
- protected void removeBranch(ResolutionListenerImpl listener,
- Artifact artifact) {
- Node n = listener.getNode(artifact);
- if (n != null) {
- for (Iterator it = n.getParents().iterator(); it.hasNext();) {
- Node parent = (Node) it.next();
- parent.getChildren().remove(n);
- }
- }
- }
-
- protected void removeChildren(ResolutionListenerImpl listener,
- Artifact artifact) {
- Node n = listener.getNode(artifact);
- n.getChildren().clear();
- }
-
- protected Set getArtifacts(Node n, Set s) {
- if (!s.contains(n.getArtifact())) {
- s.add(n.getArtifact());
- for (Iterator iter = n.getChildren().iterator(); iter.hasNext();) {
- Node c = (Node) iter.next();
- getArtifacts(c, s);
- }
- }
- return s;
- }
-
- protected void excludeBranch(Node n, Set excludes) {
- excludes.add(n);
- for (Iterator iter = n.getChildren().iterator(); iter.hasNext();) {
- Node c = (Node) iter.next();
- excludeBranch(c, excludes);
- }
- }
-
- protected void print(Node rootNode) {
- for (Iterator iter = getArtifacts(rootNode, new HashSet()).iterator(); iter.hasNext();) {
- Artifact a = (Artifact) iter.next();
- getLog().info(" " + a);
- }
- }
-
- protected Set retainArtifacts(Set includes, ResolutionListenerImpl listener) {
- Set finalIncludes = new HashSet();
- Set filteredArtifacts = getArtifacts(listener.getRootNode(),
- new HashSet());
- for (Iterator iter = includes.iterator(); iter.hasNext();) {
- Artifact artifact = (Artifact) iter.next();
- for (Iterator iter2 = filteredArtifacts.iterator(); iter2.hasNext();) {
- Artifact filteredArtifact = (Artifact) iter2.next();
- if (filteredArtifact.getArtifactId().equals(
- artifact.getArtifactId())
- && filteredArtifact.getType()
- .equals(artifact.getType())
- && filteredArtifact.getGroupId().equals(
- artifact.getGroupId())) {
- if (!filteredArtifact.getVersion().equals(
- artifact.getVersion())) {
- getLog()
- .warn(
- "Resolved artifact "
- + artifact
- + " has a different version from that in dependency management "
- + filteredArtifact
- + ", overriding dependency management");
- }
- finalIncludes.add(artifact);
- }
- }
-
- }
-
- return finalIncludes;
- }
-
- protected ResolutionListenerImpl resolveProject() {
- Map managedVersions = null;
- try {
- managedVersions = createManagedVersionMap(project.getId(), project
- .getDependencyManagement());
- } catch (ProjectBuildingException e) {
- getLog().error(
- "An error occurred while resolving project dependencies.",
- e);
- }
- ResolutionListenerImpl listener = new ResolutionListenerImpl();
- listener.setLog(getLog());
- try {
- collector.collect(project.getDependencyArtifacts(), project
- .getArtifact(), managedVersions, localRepo, remoteRepos,
- artifactMetadataSource, null, Collections
- .singletonList(listener));
- } catch (ArtifactResolutionException e) {
- getLog().error(
- "An error occurred while resolving project dependencies.",
- e);
- }
- if (getLog().isDebugEnabled()) {
- getLog().debug("Dependency graph");
- getLog().debug("================");
- print(listener.getRootNode());
- getLog().debug("================");
- }
- return listener;
- }
-
- protected Map createManagedVersionMap(String projectId,
- DependencyManagement dependencyManagement) throws ProjectBuildingException {
- Map map;
- if (dependencyManagement != null
- && dependencyManagement.getDependencies() != null) {
- map = new HashMap();
- for (Iterator i = dependencyManagement.getDependencies().iterator(); i
- .hasNext();) {
- Dependency d = (Dependency) i.next();
-
- try {
- VersionRange versionRange = VersionRange
- .createFromVersionSpec(d.getVersion());
- Artifact artifact = factory.createDependencyArtifact(d
- .getGroupId(), d.getArtifactId(), versionRange, d
- .getType(), d.getClassifier(), d.getScope());
- map.put(d.getManagementKey(), artifact);
- } catch (InvalidVersionSpecificationException e) {
- throw new ProjectBuildingException(projectId,
- "Unable to parse version '" + d.getVersion()
- + "' for dependency '"
- + d.getManagementKey() + "': "
- + e.getMessage(), e);
- }
- }
- } else {
- map = Collections.EMPTY_MAP;
- }
- return map;
- }
-
- /**
- * Set up a classloader for the execution of the main class.
- *
- * @return
- * @throws MojoExecutionException
- */
- protected URLClassLoader getClassLoader() throws MojoExecutionException {
- try {
- Set urls = new HashSet();
-
- URL mainClasses = new File(project.getBuild().getOutputDirectory())
- .toURL();
- getLog().debug("Adding to classpath : " + mainClasses);
- urls.add(mainClasses);
-
- URL testClasses = new File(project.getBuild()
- .getTestOutputDirectory()).toURL();
- getLog().debug("Adding to classpath : " + testClasses);
- urls.add(testClasses);
-
- Set dependencies = project.getArtifacts();
- Iterator iter = dependencies.iterator();
- while (iter.hasNext()) {
- Artifact classPathElement = (Artifact) iter.next();
- getLog().debug(
- "Adding artifact: " + classPathElement.getFile()
- + " to classpath");
- urls.add(classPathElement.getFile().toURL());
- }
- URLClassLoader appClassloader = new URLClassLoader((URL[]) urls
- .toArray(new URL[urls.size()]), this.getClass().getClassLoader());
- return appClassloader;
- } catch (MalformedURLException e) {
- throw new MojoExecutionException(
- "Error during setting up classpath", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/Node.java
----------------------------------------------------------------------
diff --git a/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/Node.java b/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/Node.java
deleted file mode 100644
index 4920939..0000000
--- a/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/Node.java
+++ /dev/null
@@ -1,56 +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.
- */
-package org.apache.servicemix.tooling.features;
-
-import java.util.Set;
-import java.util.HashSet;
-
-import org.apache.maven.artifact.Artifact;
-
-/**
- * @version $Revision: 1.1 $
-*/
-public class Node {
- private Set children = new HashSet();
- private Set parents = new HashSet();
- private Artifact artifact;
-
- public Set getChildren() {
- return children;
- }
-
- public Artifact getArtifact() {
- return artifact;
- }
-
- public Set getParents() {
- return parents;
- }
-
- public void setChildren(Set children) {
- this.children = children;
- }
-
- public void setParents(Set parents) {
- this.parents = parents;
- }
-
- public void setArtifact(Artifact artifact) {
- this.artifact = artifact;
- }
-}
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/ResolutionListenerImpl.java
----------------------------------------------------------------------
diff --git a/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/ResolutionListenerImpl.java b/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/ResolutionListenerImpl.java
deleted file mode 100644
index 1bf5e1a..0000000
--- a/features-maven-plugin/src/main/java/org/apache/servicemix/tooling/features/ResolutionListenerImpl.java
+++ /dev/null
@@ -1,161 +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.
- */
-package org.apache.servicemix.tooling.features;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Stack;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.resolver.ResolutionListener;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.plugin.logging.Log;
-
-/**
- * @author Edwin Punzalan
- * @version $Revision: 1.1 $
- */
-public class ResolutionListenerImpl implements ResolutionListener {
- private Stack parents = new Stack();
- private Map artifacts = new HashMap();
- private Node rootNode;
- private Log log;
-
- public void setLog(Log log) {
- this.log = log;
- }
-
- public Log getLog() {
- return log;
- }
-
- public void testArtifact(Artifact artifact) {
- // getLog().debug("testArtifact: " + artifact);
- // intentionally blank
- }
-
- public void startProcessChildren(Artifact artifact) {
- // getLog().debug("startProcessChildren: " + artifact);
- Node node = (Node) artifacts.get(artifact.getDependencyConflictId());
- if (parents.isEmpty()) {
- rootNode = node;
- }
- parents.push(node);
- }
-
- public void endProcessChildren(Artifact artifact) {
- // getLog().debug("endProcessChildren: " + artifact);
- Node check = (Node) parents.pop();
- assert artifact.equals(check.getArtifact());
- }
-
- public void omitForNearer(Artifact omitted, Artifact kept) {
- // getLog().debug("omitForNearer: omitted=" + omitted + ", kept=" +
- // kept);
- assert omitted.getDependencyConflictId().equals(
- kept.getDependencyConflictId());
- Node node = (Node) artifacts.get(omitted.getDependencyConflictId());
- assert node != null;
- node.setArtifact(kept);
- }
-
- public void omitForCycle(Artifact artifact) {
- // getLog().debug("omitForCycle: " + artifact);
- // intentionally blank
- }
-
- public void includeArtifact(Artifact artifact) {
- // getLog().debug("includeArtifact: " + artifact);
- Node node = (Node) artifacts.get(artifact.getDependencyConflictId());
- if (node == null) {
- node = new Node();
- artifacts.put(artifact.getDependencyConflictId(), node);
- }
- node.setArtifact(artifact);
- if (!parents.isEmpty()) {
- Node parent = (Node) parents.peek();
- parent.getChildren().add(node);
- node.getParents().add(parent);
- }
- if (rootNode != null) {
- // print(rootNode, "");
- }
- }
-
- protected void print(Node node, String string) {
- // getLog().debug(string + rootNode.getArtifact());
- for (Iterator iter = node.getChildren().iterator(); iter.hasNext();) {
- Node n = (Node) iter.next();
- print(n, string + " ");
- }
- }
-
- public void updateScope(Artifact artifact, String scope) {
- // getLog().debug("updateScope: " + artifact);
- Node node = (Node) artifacts.get(artifact.getDependencyConflictId());
-
- node.getArtifact().setScope(scope);
- }
-
- public void manageArtifact(Artifact artifact, Artifact replacement) {
- // getLog().debug("manageArtifact: artifact=" + artifact + ",
- // replacement=" + replacement);
- Node node = (Node) artifacts.get(artifact.getDependencyConflictId());
- if (node != null) {
- if (replacement.getVersion() != null) {
- node.getArtifact().setVersion(replacement.getVersion());
- }
- if (replacement.getScope() != null) {
- node.getArtifact().setScope(replacement.getScope());
- }
- }
- }
-
- public void updateScopeCurrentPom(Artifact artifact, String key) {
-
- getLog().debug("updateScopeCurrentPom: " + artifact);
- // intentionally blank
- }
-
- public void selectVersionFromRange(Artifact artifact) {
-
- getLog().debug("selectVersionFromRange: " + artifact);
- // intentionally blank
- }
-
- public void restrictRange(Artifact artifact, Artifact artifact1,
- VersionRange versionRange) {
-
- getLog().debug("restrictRange: " + artifact);
- // intentionally blank
- }
-
- public Node getNode(Artifact artifact) {
- return (Node) artifacts.get(artifact.getDependencyConflictId());
- }
-
- public Collection getArtifacts() {
- return artifacts.values();
- }
-
- public Node getRootNode() {
- return rootNode;
- }
-}
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/features-maven-plugin/src/main/resources/config.properties
----------------------------------------------------------------------
diff --git a/features-maven-plugin/src/main/resources/config.properties b/features-maven-plugin/src/main/resources/config.properties
deleted file mode 100644
index 2f93d13..0000000
--- a/features-maven-plugin/src/main/resources/config.properties
+++ /dev/null
@@ -1,127 +0,0 @@
-jre-1.5= \
- javax.accessibility; \
- javax.activity; \
- javax.crypto; \
- javax.crypto.interfaces; \
- javax.crypto.spec; \
- javax.imageio; \
- javax.imageio.event; \
- javax.imageio.metadata; \
- javax.imageio.plugins.bmp; \
- javax.imageio.plugins.jpeg; \
- javax.imageio.spi; \
- javax.imageio.stream; \
- javax.management; \
- javax.management.loading; \
- javax.management.modelmbean; \
- javax.management.monitor; \
- javax.management.openmbean; \
- javax.management.relation; \
- javax.management.remote; \
- javax.management.remote.rmi; \
- javax.management.timer; \
- javax.naming; \
- javax.naming.directory; \
- javax.naming.event; \
- javax.naming.ldap; \
- javax.naming.spi; \
- javax.net; \
- javax.net.ssl; \
- javax.print; \
- javax.print.attribute; \
- javax.print.attribute.standard; \
- javax.print.event; \
- javax.rmi; \
- javax.rmi.CORBA; \
- javax.rmi.ssl; \
- javax.security.auth; \
- javax.security.auth.callback; \
- javax.security.auth.kerberos; \
- javax.security.auth.login; \
- javax.security.auth.spi; \
- javax.security.auth.x500; \
- javax.security.cert; \
- javax.security.sasl; \
- javax.sound.midi; \
- javax.sound.midi.spi; \
- javax.sound.sampled; \
- javax.sound.sampled.spi; \
- javax.sql; \
- javax.sql.rowset; \
- javax.sql.rowset.serial; \
- javax.sql.rowset.spi; \
- javax.swing; \
- javax.swing.border; \
- javax.swing.colorchooser; \
- javax.swing.event; \
- javax.swing.filechooser; \
- javax.swing.plaf; \
- javax.swing.plaf.basic; \
- javax.swing.plaf.metal; \
- javax.swing.plaf.multi; \
- javax.swing.plaf.synth; \
- javax.swing.table; \
- javax.swing.text; \
- javax.swing.text.html; \
- javax.swing.text.html.parser; \
- javax.swing.text.rtf; \
- javax.swing.tree; \
- javax.swing.undo; \
- javax.xml; \
- javax.xml.datatype; \
- javax.xml.namespace; \
- javax.xml.parsers; \
- javax.xml.transform; \
- javax.xml.transform.dom; \
- javax.xml.transform.sax; \
- javax.xml.transform.stream; \
- javax.xml.validation; \
- javax.xml.xpath; \
- org.ietf.jgss; \
- org.omg.CORBA; \
- org.omg.CORBA_2_3; \
- org.omg.CORBA_2_3.portable; \
- org.omg.CORBA.DynAnyPackage; \
- org.omg.CORBA.ORBPackage; \
- org.omg.CORBA.portable; \
- org.omg.CORBA.TypeCodePackage; \
- org.omg.CosNaming; \
- org.omg.CosNaming.NamingContextExtPackage; \
- org.omg.CosNaming.NamingContextPackage; \
- org.omg.Dynamic; \
- org.omg.DynamicAny; \
- org.omg.DynamicAny.DynAnyFactoryPackage; \
- org.omg.DynamicAny.DynAnyPackage; \
- org.omg.IOP; \
- org.omg.IOP.CodecFactoryPackage; \
- org.omg.IOP.CodecPackage; \
- org.omg.Messaging; \
- org.omg.PortableInterceptor; \
- org.omg.PortableInterceptor.ORBInitInfoPackage; \
- org.omg.PortableServer; \
- org.omg.PortableServer.CurrentPackage; \
- org.omg.PortableServer.POAManagerPackage; \
- org.omg.PortableServer.POAPackage; \
- org.omg.PortableServer.portable; \
- org.omg.PortableServer.ServantLocatorPackage; \
- org.omg.SendingContext; \
- org.omg.stub.java.rmi; \
- org.omg.stub.javax.management.remote.rmi; \
- org.w3c.dom; \
- org.w3c.dom.bootstrap; \
- org.w3c.dom.css; \
- org.w3c.dom.events; \
- org.w3c.dom.html; \
- org.w3c.dom.ls; \
- org.w3c.dom.ranges; \
- org.w3c.dom.stylesheets; \
- org.w3c.dom.traversal; \
- org.w3c.dom.views; \
- org.xml.sax; \
- org.xml.sax.ext; \
- org.xml.sax.helpers; \
- sun.misc; \
- sun.reflect
-
-osgi= \
- org.osgi.framework;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/features-maven-plugin/src/test/java/org/apache/servicemix/tooling/features/GenerateFeaturesFileMojoTest.java
----------------------------------------------------------------------
diff --git a/features-maven-plugin/src/test/java/org/apache/servicemix/tooling/features/GenerateFeaturesFileMojoTest.java b/features-maven-plugin/src/test/java/org/apache/servicemix/tooling/features/GenerateFeaturesFileMojoTest.java
deleted file mode 100644
index 7331b3e..0000000
--- a/features-maven-plugin/src/test/java/org/apache/servicemix/tooling/features/GenerateFeaturesFileMojoTest.java
+++ /dev/null
@@ -1,105 +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.
- */
-package org.apache.servicemix.tooling.features;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-
-/**
- * Test cases for {@link GenerateFeaturesFileMojo}
- */
-public class GenerateFeaturesFileMojoTest extends TestCase {
-
- private Mockery mockery;
- private GenerateFeaturesFileMojo mojo;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mojo = new GenerateFeaturesFileMojo();
- mockery = new Mockery();
- }
-
- public void testGetBestVersionForArtifactWithOneVersion() throws Exception {
- final Artifact artifact = mockery.mock(Artifact.class);
- mockery.checking(new Expectations() {{
- allowing(artifact).getVersion(); will(returnValue("2.1.6"));
- }});
-
- assertEquals("2.1.6_1-SNAPSHOT", mojo.getBestVersionForArtifact(artifact, createVersionList("2.1.6_1-SNAPSHOT")));
- }
-
- public void testGetBestVersionForArtifactWithTwoVersions() throws Exception {
- final Artifact artifact = mockery.mock(Artifact.class);
- mockery.checking(new Expectations() {{
- allowing(artifact).getVersion(); will(returnValue("2.1.6"));
- }});
-
- assertEquals("2.1.6_2-SNAPSHOT", mojo.getBestVersionForArtifact(artifact, createVersionList("2.1.6_1-SNAPSHOT", "2.1.6_2-SNAPSHOT")));
- }
-
- public void testGetBestVersionForArtifactWithSameMajorMinor() throws Exception {
- final Artifact artifact = mockery.mock(Artifact.class);
- mockery.checking(new Expectations() {{
- allowing(artifact).getVersion(); will(returnValue("3.8.2"));
- }});
-
- assertEquals("3.8.1_1-SNAPSHOT", mojo.getBestVersionForArtifact(artifact, createVersionList("3.8.1_1-SNAPSHOT")));
- }
-
-
- public void testGetBestVersionForArtifactWithOneNonMatchingVersion() throws Exception {
- final Artifact artifact = mockery.mock(Artifact.class);
- mockery.checking(new Expectations() {{
- allowing(artifact).getVersion(); will(returnValue("9.1.0.1"));
- }});
-
- try {
- mojo.getBestVersionForArtifact(artifact, createVersionList("9.0_1-SNAPSHOT"));
- fail("ArtifactMetadataRetrievalException should have been thrown if no matching version was found");
- } catch (ArtifactMetadataRetrievalException e) {
- // this is expected
- }
- }
-
- public void testGetBestVersionForArtifactWithNoVersions() throws Exception {
- try {
- mojo.getBestVersionForArtifact(mockery.mock(Artifact.class), createVersionList());
- fail("ArtifactMetadataRetrievalException should have been thrown if no matching version was found");
- } catch (ArtifactMetadataRetrievalException e) {
- // this is expected
- }
- }
-
- private List<ArtifactVersion> createVersionList(String... versions) {
- List<ArtifactVersion> results = new ArrayList<ArtifactVersion>();
- for (final String version : versions) {
- results.add(new DefaultArtifactVersion(version));
- }
- return results;
- }
-}
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/features-maven-plugin/src/test/java/org/apache/servicemix/tooling/features/GenerateFeaturesXmlMojoTest.java
----------------------------------------------------------------------
diff --git a/features-maven-plugin/src/test/java/org/apache/servicemix/tooling/features/GenerateFeaturesXmlMojoTest.java b/features-maven-plugin/src/test/java/org/apache/servicemix/tooling/features/GenerateFeaturesXmlMojoTest.java
deleted file mode 100644
index 7d1ee7e..0000000
--- a/features-maven-plugin/src/test/java/org/apache/servicemix/tooling/features/GenerateFeaturesXmlMojoTest.java
+++ /dev/null
@@ -1,48 +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.
- */
-package org.apache.servicemix.tooling.features;
-
-import org.apache.maven.artifact.Artifact;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-
-import junit.framework.TestCase;
-
-/**
- * Test cases for {@link GenerateFeaturesXmlMojo}
- */
-public class GenerateFeaturesXmlMojoTest extends TestCase {
-
- private Mockery mockery;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mockery = new Mockery();
- }
-
- public void testToString() throws Exception {
- final Artifact artifact = mockery.mock(Artifact.class);
- mockery.checking(new Expectations() {{
- allowing(artifact).getGroupId(); will(returnValue("org.apache.servicemix.test"));
- allowing(artifact).getArtifactId(); will(returnValue("test-artifact"));
- allowing(artifact).getVersion(); will(returnValue("1.2.3"));
- }});
- assertEquals("org.apache.servicemix.test/test-artifact/1.2.3", GenerateFeaturesXmlMojo.toString(artifact));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/jbi-maven-plugin/.gitignore
----------------------------------------------------------------------
diff --git a/jbi-maven-plugin/.gitignore b/jbi-maven-plugin/.gitignore
deleted file mode 100644
index 1ef66d2..0000000
--- a/jbi-maven-plugin/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-target
-.project
-.classpath
-.settings
-*.i??
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/jbi-maven-plugin/LICENSE
----------------------------------------------------------------------
diff --git a/jbi-maven-plugin/LICENSE b/jbi-maven-plugin/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/jbi-maven-plugin/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
-
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/jbi-maven-plugin/NOTICE
----------------------------------------------------------------------
diff --git a/jbi-maven-plugin/NOTICE b/jbi-maven-plugin/NOTICE
deleted file mode 100644
index b6212c4..0000000
--- a/jbi-maven-plugin/NOTICE
+++ /dev/null
@@ -1,9 +0,0 @@
- =========================================================================
- == NOTICE file for use with the Apache License, Version 2.0, ==
- == in this case for the Apache ServiceMix distribution. ==
- =========================================================================
-
- This product contains software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
-
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/jbi-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/jbi-maven-plugin/pom.xml b/jbi-maven-plugin/pom.xml
deleted file mode 100644
index 5b1a39c..0000000
--- a/jbi-maven-plugin/pom.xml
+++ /dev/null
@@ -1,269 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <!--
-
- 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.
- -->
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicemix.tooling</groupId>
- <artifactId>maven-plugins-pom</artifactId>
- <version>4</version>
- <relativePath>../maven-plugins-pom/pom.xml</relativePath>
- </parent>
-
- <groupId>org.apache.servicemix.tooling</groupId>
- <artifactId>jbi-maven-plugin</artifactId>
- <version>4.6-SNAPSHOT</version>
-
- <packaging>maven-plugin</packaging>
- <name>Apache ServiceMix :: Plugins :: Maven2 JBI Plugin</name>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/servicemix/maven-plugins/jbi-maven-plugin/trunk</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/servicemix/maven-plugins/jbi-maven-plugin/trunk
- </developerConnection>
- <url>http://svn.apache.org/viewcvs.cgi/servicemix/maven-plugins/jbi-maven-plugin/trunk</url>
- </scm>
-
- <properties>
- <servicemix.specs.version>1.8.0</servicemix.specs.version>
- </properties>
-
- <dependencies>
- <!-- little hack to make sure this gets downloaded before maven-repository.dev.java.net gets pulled in -->
- <dependency>
- <groupId>org.apache.servicemix</groupId>
- <artifactId>servicemix-pom</artifactId>
- <version>2</version>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>2.0.9</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>2.0.9</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-archiver</artifactId>
- <version>2.4.1</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- <version>1.5.2</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>2.0.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-script-ant</artifactId>
- <version>2.0.9</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.servicemix</groupId>
- <artifactId>servicemix-core</artifactId>
- <version>3.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.servicemix</groupId>
- <artifactId>servicemix-common</artifactId>
- <version>2011.01</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.6.1</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.6.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-javamail_1.4_spec</artifactId>
- <version>1.5</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-ejb_2.1_spec</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jta_1.1_spec</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
- <version>2.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
- <version>3.0.5.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- <version>2.0.9</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>2.0.9</version>
- </dependency>
- <dependency>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- <version>1.6.2</version>
- </dependency>
- </dependencies>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.servicemix.specs</groupId>
- <artifactId>org.apache.servicemix.specs.jbi-api-1.0</artifactId>
- <version>${servicemix.specs.version}</version>
- </dependency>
- <!-- little hack to avoid touching jencks 2.1 (refers to servicemix.org) -->
- <dependency>
- <groupId>org.jencks</groupId>
- <artifactId>jencks</artifactId>
- <version>2.2</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <profiles>
- <profile>
- <id>release</id>
- <build>
- <plugins>
- <!-- We want to deploy the artifact to a staging location for perusal -->
- <plugin>
- <inherited>true</inherited>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <altDeploymentRepository>${deploy.altRepository}</altDeploymentRepository>
- <updateReleaseInfo>true</updateReleaseInfo>
- </configuration>
- </plugin>
- <!-- We want to sign the artifact, the POM, and all attached artifacts -->
- <plugin>
- <artifactId>maven-gpg-plugin</artifactId>
- <version>1.0-alpha-4</version>
- <configuration>
- <passphrase>${gpg.passphrase}</passphrase>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>sign</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>deploy</id>
- <build>
- <defaultGoal>deploy</defaultGoal>
- <plugins>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.2</version>
- <executions>
- <execution>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <source>1.5</source>
- <attach>true</attach>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.0.2</version>
- <executions>
- <execution>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <attach>true</attach>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-plugin-plugin</artifactId>
- <!-- Add the Ant plugin tools -->
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-ant</artifactId>
- <version>2.5</version>
- </dependency>
- </dependencies>
- <configuration>
- <goalPrefix>jbi</goalPrefix>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java
----------------------------------------------------------------------
diff --git a/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java b/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java
deleted file mode 100644
index 9d59b70..0000000
--- a/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java
+++ /dev/null
@@ -1,96 +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.
- */
-package org.apache.servicemix.maven.plugin.jbi;
-
-import org.apache.servicemix.jbi.management.task.JbiTask;
-import org.apache.tools.ant.Project;
-
-public abstract class AbstractDeployableMojo extends AbstractJbiMojo {
-
- /**
- * @parameter default-value="rmi"
- */
- protected String serverProtocol;
-
- /**
- * @parameter default-value="localhost" expression="${host}"
- */
- protected String host;
-
- /**
- * @parameter default-value="ServiceMix" expression="${containerName}
- */
- protected String containerName;
-
- /**
- * @parameter default-value="org.apache.servicemix"
- */
- protected String jmxDomainName;
-
- /**
- * @parameter default-value="1099" expression="${port}"
- */
- protected String port;
-
- /**
- * @parameter default-value="/jmxrmi"
- */
- protected String jndiPath;
-
- /**
- * @parameter default-value="smx" expression="${username}"
- */
- protected String username;
-
- /**
- * @parameter default-value="smx" expression="${password}"
- */
- protected String password;
-
- /**
- * @parameter expression="${serviceUrl}
- */
- protected String serviceUrl;
-
- /**
- * @parameter expression=${environment}
- */
- protected String environment;
-
- protected JbiTask initializeJbiTask(JbiTask task) {
-
- Project antProject = new Project();
- antProject.init();
- task.setProject(antProject);
-
- task.setContainerName(containerName);
- task.setHost(host);
- task.setServerProtocol(serverProtocol);
- task.setJmxDomainName(jmxDomainName);
- task.setPort(Integer.parseInt(port));
- task.setJndiPath(jndiPath);
- task.setUsername(username);
- task.setPassword(password);
- task.setServiceUrl(serviceUrl);
- task.setEnvironment(environment);
-
- task.setTaskName("JBITask");
- task.setTaskType("JBITask");
- return task;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDescriptorWriter.java
----------------------------------------------------------------------
diff --git a/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDescriptorWriter.java b/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDescriptorWriter.java
deleted file mode 100644
index ed0585c..0000000
--- a/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDescriptorWriter.java
+++ /dev/null
@@ -1,88 +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.
- */
-package org.apache.servicemix.maven.plugin.jbi;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.servicemix.common.packaging.Consumes;
-import org.apache.servicemix.common.packaging.Provides;
-import org.codehaus.plexus.util.xml.XMLWriter;
-
-public class AbstractDescriptorWriter {
-
- protected void addStringAttribute(XMLWriter writer, String attributeName,
- String attributeValue) {
- if (attributeValue != null) {
- writer.addAttribute(attributeName, attributeValue);
- }
- }
-
- protected void addQNameAttribute(XMLWriter writer, String attributeName,
- QName attributeValue, Map namespaceMap) {
- if (attributeValue != null) {
- StringBuffer attributeStringValue = new StringBuffer();
- attributeStringValue.append(namespaceMap.get(attributeValue
- .getNamespaceURI()));
- attributeStringValue.append(":");
- attributeStringValue.append(attributeValue.getLocalPart());
- writer.addAttribute(attributeName, attributeStringValue.toString());
- }
-
- }
-
- protected Map getNamespaceMap(List provides, List consumes) {
- Map namespaceMap = new HashMap();
- int namespaceCounter = 1;
- for (Iterator iterator = provides.iterator(); iterator.hasNext();) {
- Provides providesEntry = (Provides) iterator.next();
- namespaceCounter = resolveMapEntry(namespaceMap, providesEntry
- .getInterfaceName(), namespaceCounter);
- namespaceCounter = resolveMapEntry(namespaceMap, providesEntry
- .getServiceName(), namespaceCounter);
- }
-
- for (Iterator iterator = consumes.iterator(); iterator.hasNext();) {
- Consumes consumesEntry = (Consumes) iterator.next();
- namespaceCounter = resolveMapEntry(namespaceMap, consumesEntry
- .getInterfaceName(), namespaceCounter);
- namespaceCounter = resolveMapEntry(namespaceMap, consumesEntry
- .getServiceName(), namespaceCounter);
- }
-
- return namespaceMap;
- }
-
- private int resolveMapEntry(Map namespaceMap, QName qname,
- int namespaceCounter) {
- if ((qname != null)
- && (!namespaceMap.containsKey(qname.getNamespaceURI()))) {
- if (qname.getPrefix() == null || qname.getPrefix().equals("")) {
- namespaceMap.put(qname.getNamespaceURI(), "ns"
- + namespaceCounter++);
- } else {
- namespaceMap.put(qname.getNamespaceURI(), qname.getPrefix());
- }
- }
- return namespaceCounter;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java
----------------------------------------------------------------------
diff --git a/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java b/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java
deleted file mode 100644
index 86e5251..0000000
--- a/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java
+++ /dev/null
@@ -1,376 +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.
- */
-package org.apache.servicemix.maven.plugin.jbi;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactCollector;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.DependencyManagement;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
-import org.apache.maven.project.MavenProjectHelper;
-import org.apache.maven.project.ProjectBuildingException;
-import org.apache.servicemix.maven.plugin.jbi.JbiResolutionListener.Node;
-import org.codehaus.plexus.archiver.jar.Manifest;
-import org.codehaus.plexus.archiver.jar.ManifestException;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-
-public abstract class AbstractJbiMojo extends AbstractMojo {
-
- public static final String META_INF = "META-INF";
-
- public static final String JBI_DESCRIPTOR = "jbi.xml";
-
- public static final String LIB_DIRECTORY = "lib";
-
- private static final Pattern VERSION_PATTERN = Pattern.compile("^(\\d+(\\.\\d+(\\.\\d+)?)?)-");
-
- private static final String[] VERSION_COMPLETERS = new String[] {".0.0", ".0" };
-
- /**
- * Maven ProjectHelper
- *
- * @component
- */
- protected MavenProjectHelper projectHelper;
-
- /**
- * The maven project.
- *
- * @parameter expression="${project}"
- * @required
- * @readonly
- */
- protected MavenProject project;
-
- /**
- * Directory that resources are copied to during the build.
- *
- * @parameter expression="${project.build.directory}/${project.artifactId}-${project.version}-installer"
- * @required
- */
- protected File workDirectory;
-
- /**
- * @component
- */
- protected MavenProjectBuilder projectBuilder;
-
- /**
- * @parameter default-value="${localRepository}"
- */
- protected ArtifactRepository localRepo;
-
- /**
- * @parameter default-value="${project.remoteArtifactRepositories}"
- */
- protected List remoteRepos;
-
- /**
- * @component
- */
- protected ArtifactMetadataSource artifactMetadataSource;
-
- /**
- * @component
- */
- protected ArtifactResolver resolver;
-
- /**
- * @component
- * @required
- * @readonly
- */
- protected ArtifactCollector collector;
-
- /**
- * @component
- */
- protected ArtifactFactory factory;
-
- protected MavenProject getProject() {
- return project;
- }
-
- protected File getWorkDirectory() {
- return workDirectory;
- }
-
- public MavenProjectHelper getProjectHelper() {
- return projectHelper;
- }
-
- protected void removeBranch(JbiResolutionListener listener, Artifact artifact) {
- Node n = listener.getNode(artifact);
- if (n != null) {
- for (Node parent : n.getParents()) {
- parent.getChildren().remove(n);
- }
- }
- }
-
- protected void removeChildren(JbiResolutionListener listener, Artifact artifact) {
- Node n = listener.getNode(artifact);
- n.getChildren().clear();
- }
-
- protected Set<Artifact> getArtifacts(Node n, Set<Artifact> s) {
- if (s.add(n.getArtifact())) {
- for (Node c : n.getChildren()) {
- getArtifacts(c, s);
- }
- }
- return s;
- }
-
- protected void excludeBranch(Node n, Set<Artifact> excludes) {
- excludes.add(n.getArtifact());
- for (Node c : n.getChildren()) {
- excludeBranch(c, excludes);
- }
- }
-
- protected void print(Node rootNode) {
- for (Artifact a : getArtifacts(rootNode, new HashSet<Artifact>())) {
- getLog().info(" " + a);
- }
- }
-
- protected void print(Node rootNode, String pfx) {
- getLog().info(pfx + rootNode.getArtifact());
- for (Node child : rootNode.getChildren()) {
- print(child, " " + pfx);
- }
- }
-
- protected void pruneTree(Node node, Set<Artifact> excludes) {
- for (Iterator<Node> iter = node.getChildren().iterator(); iter.hasNext();) {
- Node child = iter.next();
- if (child.getArtifact().isOptional() ||
- (!child.getScope().equals(Artifact.SCOPE_COMPILE) && !child.getScope().equals(Artifact.SCOPE_RUNTIME)) ||
- excludes.contains(child.getArtifact())) {
- iter.remove();
- } else {
- pruneTree(child, excludes);
- }
- }
- }
-
- protected Set<Artifact> retainArtifacts(Set<Artifact> includes, JbiResolutionListener listener) {
- Set<Artifact> finalIncludes = new HashSet<Artifact>();
- Set<Artifact> filteredArtifacts = getArtifacts(listener.getRootNode(), new HashSet<Artifact>());
- for (Artifact artifact : includes) {
- for (Artifact filteredArtifact : filteredArtifacts) {
- if (filteredArtifact.getArtifactId().equals(
- artifact.getArtifactId())
- && filteredArtifact.getType()
- .equals(artifact.getType())
- && filteredArtifact.getGroupId().equals(
- artifact.getGroupId())) {
- if (!filteredArtifact.getVersion().equals(
- artifact.getVersion())) {
- getLog()
- .warn(
- "Resolved artifact "
- + artifact
- + " has a different version from that in dependency management "
- + filteredArtifact
- + ", overriding dependency management");
- }
- finalIncludes.add(artifact);
- }
- }
-
- }
- return finalIncludes;
- }
-
-
- protected JbiResolutionListener resolveProject() {
- Map managedVersions = null;
- try {
- managedVersions = createManagedVersionMap(project.getId(), project.getDependencyManagement());
- } catch (ProjectBuildingException e) {
- getLog().error("An error occurred while resolving project dependencies.", e);
- }
- JbiResolutionListener listener = new JbiResolutionListener();
- listener.setLog(getLog());
- try {
- collector.collect(project.getDependencyArtifacts(), project
- .getArtifact(), managedVersions, localRepo, remoteRepos,
- artifactMetadataSource, null, Collections
- .singletonList(listener));
- } catch (ArtifactResolutionException e) {
- getLog().error(
- "An error occurred while resolving project dependencies.",
- e);
- }
- if (getLog().isDebugEnabled()) {
- getLog().debug("Dependency graph");
- getLog().debug("================");
- print(listener.getRootNode());
- getLog().debug("================");
- }
- return listener;
- }
-
- protected Map createManagedVersionMap(String projectId,
- DependencyManagement dependencyManagement) throws ProjectBuildingException {
- Map map;
- if (dependencyManagement != null
- && dependencyManagement.getDependencies() != null) {
- map = new HashMap();
- for (Iterator i = dependencyManagement.getDependencies().iterator(); i
- .hasNext();) {
- Dependency d = (Dependency) i.next();
-
- try {
- VersionRange versionRange = VersionRange
- .createFromVersionSpec(d.getVersion());
- Artifact artifact = factory.createDependencyArtifact(d
- .getGroupId(), d.getArtifactId(), versionRange, d
- .getType(), d.getClassifier(), d.getScope());
- map.put(d.getManagementKey(), artifact);
- } catch (InvalidVersionSpecificationException e) {
- throw new ProjectBuildingException(projectId,
- "Unable to parse version '" + d.getVersion()
- + "' for dependency '"
- + d.getManagementKey() + "': "
- + e.getMessage(), e);
- }
- }
- } else {
- map = Collections.EMPTY_MAP;
- }
- return map;
- }
-
- /**
- * Set up a classloader for the execution of the main class.
- *
- * @return
- * @throws MojoExecutionException
- */
- protected URLClassLoader getClassLoader() throws MojoExecutionException {
- try {
- Set urls = new HashSet();
-
- URL mainClasses = new File(project.getBuild().getOutputDirectory())
- .toURL();
- getLog().debug("Adding to classpath : " + mainClasses);
- urls.add(mainClasses);
-
- URL testClasses = new File(project.getBuild()
- .getTestOutputDirectory()).toURL();
- getLog().debug("Adding to classpath : " + testClasses);
- urls.add(testClasses);
-
- Set dependencies = project.getArtifacts();
- Iterator iter = dependencies.iterator();
- while (iter.hasNext()) {
- Artifact classPathElement = (Artifact) iter.next();
- getLog().debug(
- "Adding artifact: " + classPathElement.getFile()
- + " to classpath");
- urls.add(classPathElement.getFile().toURL());
- }
- URLClassLoader appClassloader = new URLClassLoader((URL[]) urls
- .toArray(new URL[urls.size()]), this.getClass().getClassLoader());
- return appClassloader;
- } catch (MalformedURLException e) {
- throw new MojoExecutionException(
- "Error during setting up classpath", e);
- }
- }
-
- protected Manifest createManifest() throws ManifestException {
- Manifest manifest = new Manifest();
- //manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Bundle-Name", project.getName()));
- //manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Bundle-SymbolicName", project.getArtifactId()));
- //manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute(
- //"Bundle-Version", fixBundleVersion(project.getVersion())));
- return manifest;
- }
-
- public static String fixBundleVersion(String version) {
- // Maven uses a '-' to separate the version qualifier, while
- // OSGi uses a '.', so we need to convert the first '-' to a
- // '.' and fill in any missing minor or micro version
- // components if necessary.
- final Matcher matcher = VERSION_PATTERN.matcher(version);
- if (!matcher.lookingAt()) {
- return version;
- }
- // Leave extra space for worst-case additional insertion:
- final StringBuffer sb = new StringBuffer(version.length() + 4);
- sb.append(matcher.group(1));
- if (null == matcher.group(3)) {
- final int count = null != matcher.group(2) ? 2 : 1;
- sb.append(VERSION_COMPLETERS[count - 1]);
- }
- sb.append('.');
- sb.append(version.substring(matcher.end(), version.length()));
- return sb.toString();
- }
-
- protected String getServiceUnitName(MavenProject project) {
- for (Object elem : project.getBuildPlugins()) {
- if (elem instanceof Plugin) {
- Plugin plugin = (Plugin)elem;
- if (plugin.getGroupId().equals("org.apache.servicemix.tooling")
- && plugin.getArtifactId().equals("jbi-maven-plugin")) {
- Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
- if (configuration != null) {
- Xpp3Dom serviceUnitName = configuration.getChild("serviceUnitName");
- if (serviceUnitName != null) {
- return serviceUnitName.getValue();
- }
- }
- break;
- }
- }
- }
- return null;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/servicemix-maven-plugins/blob/681882ee/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/DependencyInformation.java
----------------------------------------------------------------------
diff --git a/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/DependencyInformation.java b/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/DependencyInformation.java
deleted file mode 100644
index 114cf94..0000000
--- a/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/DependencyInformation.java
+++ /dev/null
@@ -1,98 +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.
- */
-package org.apache.servicemix.maven.plugin.jbi;
-
-/**
- * The dependency information is a simple value object to help with passing
- * around information on dependencies used to help in the creation of the jbi
- * descriptors
- *
- */
-public class DependencyInformation {
-
- /**
- * Artifact type for a JBI Shared Library
- */
- public static final String SHARED_LIBRARY_TYPE = "jbi-shared-library";
-
- private String filename;
-
- private String component;
-
- private String description;
-
- private String name;
-
- private String version;
-
- private String type;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getFilename() {
- return filename;
- }
-
- public String getComponent() {
- return component;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getName() {
- return name;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setFilename(String artifactZip) {
- this.filename = artifactZip;
- }
-
- public void setComponent(String component) {
- this.component = component;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * Is this dependency a JBI Shared Library?
- */
- public boolean isSharedLibrary() {
- return SHARED_LIBRARY_TYPE.equals(type);
- }
-}