You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/06/28 17:47:23 UTC

svn commit: r551602 [1/4] - in /incubator/servicemix/trunk/tooling: ./ jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ jbi-maven-plugin/src/test/java/org/apache/servicemix/maven/plugin/jbi/ xfire-maven-plugin/src/main/java/org/ap...

Author: gnodet
Date: Thu Jun 28 08:47:21 2007
New Revision: 551602

URL: http://svn.apache.org/viewvc?view=rev&rev=551602
Log:
Fix checkstyle and pmd for tooling

Modified:
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDescriptorWriter.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/DependencyInformation.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateComponentDescriptorMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateComponentMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceUnitDescriptorMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceUnitMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateSharedLibraryDescriptorMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateSharedLibraryMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GraphArtifactCollector.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/IsDeployedTask.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiComponentDescriptorWriter.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiPluginException.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiProjectDeployerMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiResolutionListener.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceAssemblyDescriptorWriter.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceFileAnalyzer.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceUnitDescriptorWriter.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiSharedLibraryDescriptorWriter.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixEmbeddedMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixMojo.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/XmlDescriptorHelper.java
    incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/test/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceUnitDescriptorWriterTest.java
    incubator/servicemix/trunk/tooling/pom.xml
    incubator/servicemix/trunk/tooling/xfire-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/xfire/WsdlgenMojo.java
    incubator/servicemix/trunk/tooling/xfire-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/xfire/WsgenMojo.java

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java?view=diff&rev=551602&r1=551601&r2=551602
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java Thu Jun 28 08:47:21 2007
@@ -21,64 +21,64 @@
 
 public abstract class AbstractDeployableMojo extends AbstractJbiMojo {
 
-	/**
-	 * @parameter default-value="rmi"
-	 */
-	private String serverProtocol;
-
-	/**
-	 * @parameter default-value="localhost" expression="${host}"
-	 */
-	private String host;
-
-	/**
-	 * @parameter default-value="ServiceMix"
-	 */
-	private String containerName;
-
-	/**
-	 * @parameter default-value="org.apache.servicemix"
-	 */
-	private String jmxDomainName;
-
-	/**
-	 * @parameter default-value="1099" expression="${port}"
-	 */
-	protected String port;
-
-	/**
-	 * @parameter default-value="/jmxrmi"
-	 */
-	private String jndiPath;
-
-	/**
-	 * @parameter default-value="smx" expression="${username}"
-	 */
-	private String username;
-
-	/**
-	 * @parameter default-value="smx" expression="${password}"
-	 */
-	private String password;
-
-	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.setTaskName("JBITask");		
-		task.setTaskType("JBITask");
-		return task;
-	}
+    /**
+     * @parameter default-value="rmi"
+     */
+    protected String serverProtocol;
+
+    /**
+     * @parameter default-value="localhost" expression="${host}"
+     */
+    protected String host;
+
+    /**
+     * @parameter default-value="ServiceMix"
+     */
+    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;
+
+    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.setTaskName("JBITask");
+        task.setTaskType("JBITask");
+        return task;
+    }
 
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDescriptorWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDescriptorWriter.java?view=diff&rev=551602&r1=551601&r2=551602
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDescriptorWriter.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDescriptorWriter.java Thu Jun 28 08:47:21 2007
@@ -29,55 +29,60 @@
 
 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;
-	}
+    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;
+    }
 
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java?view=diff&rev=551602&r1=551601&r2=551602
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractJbiMojo.java Thu Jun 28 08:47:21 2007
@@ -49,254 +49,252 @@
 
 public abstract class AbstractJbiMojo extends AbstractMojo {
 
-	public static final String META_INF = "META-INF";
+    public static final String META_INF = "META-INF";
 
-	public static final String JBI_DESCRIPTOR = "jbi.xml";
+    public static final String JBI_DESCRIPTOR = "jbi.xml";
 
-	public static final String LIB_DIRECTORY = "lib";
+    public static final String LIB_DIRECTORY = "lib";
 
-	/**
-	 * 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;
+    /**
+     * 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(JbiResolutionListener listener,
-			Artifact artifact) {
-		Node n = listener.getNode(artifact);
+    /**
+     * @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 (Iterator it = n.getParents().iterator(); it.hasNext();) {
                 Node parent = (Node) it.next();
                 parent.getChildren().remove(n);
             }
-		}
-	}
+        }
+    }
+
+    protected void removeChildren(JbiResolutionListener listener,
+            Artifact artifact) {
+        Node n = listener.getNode(artifact);
+        n.getChildren().clear();
+    }
+
+    protected Set getArtifacts(Node n, Set s) {
+        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 removeChildren(JbiResolutionListener listener,
-			Artifact artifact) {
-		Node n = listener.getNode(artifact);
-		n.getChildren().clear();
-	}
-
-	protected Set getArtifacts(Node n, Set s) {
-		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, String string) {
-		getLog().info(string + rootNode.getArtifact());
-		for (Iterator iter = rootNode.getChildren().iterator(); iter.hasNext();) {
-			Node n = (Node) iter.next();
-			print(n, string + "  ");
-		}
-	}
-
-	protected Set retainArtifacts(Set includes, JbiResolutionListener listener) {
-		HashSet 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 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();
+    protected void print(Node rootNode, String string) {
+        getLog().info(string + rootNode.getArtifact());
+        for (Iterator iter = rootNode.getChildren().iterator(); iter.hasNext();) {
+            Node n = (Node) iter.next();
+            print(n, string + "  ");
+        }
+    }
+
+    protected Set retainArtifacts(Set includes, JbiResolutionListener 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 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);
-		}
+        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;
-	}
+        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 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);
+        }
+    }
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/DependencyInformation.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/DependencyInformation.java?view=diff&rev=551602&r1=551601&r2=551602
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/DependencyInformation.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/DependencyInformation.java Thu Jun 28 08:47:21 2007
@@ -24,63 +24,63 @@
  */
 public class DependencyInformation {
 
-	private String filename;
+    private String filename;
 
-	private String component;
+    private String component;
 
-	private String description;
+    private String description;
 
-	private String name;
+    private String name;
 
-	private String version;
+    private String version;
 
-	private String type;
+    private String type;
 
-	public String getType() {
-		return type;
-	}
+    public String getType() {
+        return type;
+    }
 
-	public void setType(String type) {
-		this.type = type;
-	}
+    public void setType(String type) {
+        this.type = type;
+    }
 
-	public String getFilename() {
-		return filename;
-	}
+    public String getFilename() {
+        return filename;
+    }
 
-	public String getComponent() {
-		return component;
-	}
+    public String getComponent() {
+        return component;
+    }
 
-	public String getDescription() {
-		return description;
-	}
+    public String getDescription() {
+        return description;
+    }
 
-	public String getName() {
-		return name;
-	}
+    public String getName() {
+        return name;
+    }
 
-	public String getVersion() {
-		return version;
-	}
+    public String getVersion() {
+        return version;
+    }
 
-	public void setFilename(String artifactZip) {
-		this.filename = artifactZip;
-	}
+    public void setFilename(String artifactZip) {
+        this.filename = artifactZip;
+    }
 
-	public void setComponent(String component) {
-		this.component = component;
-	}
+    public void setComponent(String component) {
+        this.component = component;
+    }
 
-	public void setDescription(String description) {
-		this.description = description;
-	}
+    public void setDescription(String description) {
+        this.description = description;
+    }
 
-	public void setName(String name) {
-		this.name = name;
-	}
+    public void setName(String name) {
+        this.name = name;
+    }
 
-	public void setVersion(String version) {
-		this.version = version;
-	}
+    public void setVersion(String version) {
+        this.version = version;
+    }
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateComponentDescriptorMojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateComponentDescriptorMojo.java?view=diff&rev=551602&r1=551601&r2=551602
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateComponentDescriptorMojo.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateComponentDescriptorMojo.java Thu Jun 28 08:47:21 2007
@@ -46,230 +46,230 @@
  */
 public class GenerateComponentDescriptorMojo extends AbstractJbiMojo {
 
-	public static final String UTF_8 = "UTF-8";
+    public static final String UTF_8 = "UTF-8";
 
-	/**
-	 * Whether the application.xml should be generated or not.
-	 * 
-	 * @parameter
-	 */
-	private Boolean generateJbiDescriptor = Boolean.TRUE;
-
-	/**
-	 * The component class name.
-	 * 
-	 * @parameter
-	 * @required
-	 */
-	private String component;
-
-	/**
-	 * The bootstrap class name.
-	 * 
-	 * @parameter
-	 */
-	private String bootstrap;
-
-	/**
-	 * The component type.
-	 * 
-	 * @parameter
-	 * @required
-	 */
-	private String type;
-
-	/**
-	 * The component name.
-	 * 
-	 * @parameter expression="${project.artifactId}"
-	 */
-	private String name;
-
-	/**
-	 * The destination of the default bootstrap.
-	 * 
-	 * @parameter expression="${project.build.directory}/classes/org/apache/servicemix/common/DefaultBootstrap.class"
-	 */
-	private File defaultBootstrapFile;
-
-	/**
-	 * The component description.
-	 * 
-	 * @parameter expression="${project.name}"
-	 */
-	private String description;
-
-	/**
-	 * Character encoding for the auto-generated application.xml file.
-	 * 
-	 * @parameter
-	 */
-	private String encoding = UTF_8;
-
-	/**
-	 * Directory where the application.xml file will be auto-generated.
-	 * 
-	 * @parameter expression="${project.build.directory}"
-	 */
-	private String generatedDescriptorLocation;
-
-	/**
-	 * The component class loader delegation
-	 * 
-	 * @parameter expression="parent-first"
-	 */
-	private String componentClassLoaderDelegation;
-
-	/**
-	 * The bootstrap class loader delegation
-	 * 
-	 * @parameter expression="parent-first"
-	 */
-	private String bootstrapClassLoaderDelegation;
-
-	public void execute() throws MojoExecutionException, MojoFailureException {
-
-		getLog().debug(
-				" ======= GenerateComponentDescriptorMojo settings =======");
-		getLog().debug("workDirectory[" + workDirectory + "]");
-		getLog().debug("generateJbiDescriptor[" + generateJbiDescriptor + "]");
-		getLog().debug("type[" + type + "]");
-		getLog().debug("component[" + component + "]");
-		getLog().debug("bootstrap[" + bootstrap + "]");
-		getLog().debug("name[" + name + "]");
-		getLog().debug("description[" + description + "]");
-		getLog().debug("encoding[" + encoding + "]");
-		getLog().debug(
-				"generatedDescriptorLocation[" + generatedDescriptorLocation
-						+ "]");
-
-		if (!generateJbiDescriptor.booleanValue()) {
-			getLog().debug("Generation of jbi.xml is disabled");
-			return;
-		}
-
-		if (bootstrap == null)
-			injectBootStrap();
-
-		// Generate jbi descriptor and copy it to the build directory
-		getLog().info("Generating jbi.xml");
-		try {
-			generateJbiDescriptor();
-		} catch (JbiPluginException e) {
-			throw new MojoExecutionException("Failed to generate jbi.xml", e);
-		}
-
-		try {
-			FileUtils.copyFileToDirectory(new File(generatedDescriptorLocation,
-					JBI_DESCRIPTOR), new File(getWorkDirectory(), META_INF));
-		} catch (IOException e) {
-			throw new MojoExecutionException(
-					"Unable to copy jbi.xml to final destination", e);
-		}
-	}
-
-	/**
-	 * Helper method used to inject the BaseBootstrap from servicemix-commons
-	 * into the component this allows to you bypass actually having to create a
-	 * bootstrap
-	 * 
-	 * @throws MojoExecutionException
-	 * 
-	 */
-	private void injectBootStrap() throws MojoExecutionException {
-
-		try {
-			URL defaultBootStrap = getClassLoader().getResource(
-					"org/apache/servicemix/common/DefaultBootstrap.class");
-			FileUtils.copyURLToFile(defaultBootStrap, defaultBootstrapFile);
-			bootstrap = "org.apache.servicemix.common.DefaultBootstrap";
-		} catch (IOException e) {
-			throw new MojoExecutionException(
-					"Unable to copy DefaultBootstrap.class to "
-							+ defaultBootstrapFile.getAbsolutePath(), e);
-		}
-	}
-
-	/**
-	 * Generates the deployment descriptor if necessary.
-	 */
-	protected void generateJbiDescriptor() throws JbiPluginException {
-		File outputDir = new File(generatedDescriptorLocation);
-		if (!outputDir.exists()) {
-			outputDir.mkdirs();
-		}
-
-		File descriptor = new File(outputDir, JBI_DESCRIPTOR);
-
-		List uris = new ArrayList();
-		DependencyInformation info = new DependencyInformation();
-		info.setFilename(LIB_DIRECTORY + "/" + project.getArtifactId() + "-"
-				+ project.getVersion() + ".jar");
-		info.setVersion(project.getVersion());
-		info.setName(project.getArtifactId());
-		info.setType("jar");
-		uris.add(info);
-
-		ScopeArtifactFilter filter = new ScopeArtifactFilter(
-				Artifact.SCOPE_RUNTIME);
-
-		JbiResolutionListener listener = resolveProject();
-		// print(listener.getRootNode(), "");
-
-		Set includes = new HashSet();
-		for (Iterator iter = project.getArtifacts().iterator(); iter.hasNext();) {
-			Artifact artifact = (Artifact) iter.next();
-			if (!artifact.isOptional() && filter.include(artifact)) {
-				MavenProject project = null;
-				try {
-					project = projectBuilder.buildFromRepository(artifact,
-							remoteRepos, localRepo);
-				} catch (ProjectBuildingException e) {
-					getLog().warn(
-							"Unable to determine packaging for dependency : "
-									+ artifact.getArtifactId()
-									+ " assuming jar");
-				}
-				String type = project != null ? project.getPackaging()
-						: artifact.getType();
-				if ("jbi-shared-library".equals(type)) {
-					removeChildren(listener, artifact);
-					includes.add(artifact);
-				} else if ("jar".equals(type)) {
-					includes.add(artifact);
-				}
-			}
-		}
-		// print(listener.getRootNode(), "");
-
-		for (Iterator iter = retainArtifacts(includes, listener).iterator(); iter
-				.hasNext();) {
-			Artifact artifact = (Artifact) iter.next();
-			MavenProject project = null;
-			try {
-				project = projectBuilder.buildFromRepository(artifact,
-						remoteRepos, localRepo);
-			} catch (ProjectBuildingException e) {
-				getLog().warn(
-						"Unable to determine packaging for dependency : "
-								+ artifact.getArtifactId() + " assuming jar");
-			}
-			String type = project != null ? project.getPackaging() : artifact
-					.getType();
-			info = new DependencyInformation();
-			info
-					.setFilename(LIB_DIRECTORY + "/"
-							+ artifact.getFile().getName());
-			info.setVersion(artifact.getVersion());
-			info.setName(artifact.getArtifactId());
-			info.setType(type);
-			uris.add(info);
-		}
-
-		JbiComponentDescriptorWriter writer = new JbiComponentDescriptorWriter(
-				encoding);
-		writer.write(descriptor, component, bootstrap, type, name, description,
-				componentClassLoaderDelegation, bootstrapClassLoaderDelegation,
-				uris);
-	}
+    /**
+     * Whether the application.xml should be generated or not.
+     * 
+     * @parameter
+     */
+    private Boolean generateJbiDescriptor = Boolean.TRUE;
+
+    /**
+     * The component class name.
+     * 
+     * @parameter
+     * @required
+     */
+    private String component;
+
+    /**
+     * The bootstrap class name.
+     * 
+     * @parameter
+     */
+    private String bootstrap;
+
+    /**
+     * The component type.
+     * 
+     * @parameter
+     * @required
+     */
+    private String type;
+
+    /**
+     * The component name.
+     * 
+     * @parameter expression="${project.artifactId}"
+     */
+    private String name;
+
+    /**
+     * The destination of the default bootstrap.
+     * 
+     * @parameter expression="${project.build.directory}/classes/org/apache/servicemix/common/DefaultBootstrap.class"
+     */
+    private File defaultBootstrapFile;
+
+    /**
+     * The component description.
+     * 
+     * @parameter expression="${project.name}"
+     */
+    private String description;
+
+    /**
+     * Character encoding for the auto-generated application.xml file.
+     * 
+     * @parameter
+     */
+    private String encoding = UTF_8;
+
+    /**
+     * Directory where the application.xml file will be auto-generated.
+     * 
+     * @parameter expression="${project.build.directory}"
+     */
+    private String generatedDescriptorLocation;
+
+    /**
+     * The component class loader delegation
+     * 
+     * @parameter expression="parent-first"
+     */
+    private String componentClassLoaderDelegation;
+
+    /**
+     * The bootstrap class loader delegation
+     * 
+     * @parameter expression="parent-first"
+     */
+    private String bootstrapClassLoaderDelegation;
+
+    public void execute() throws MojoExecutionException, MojoFailureException {
+
+        getLog().debug(
+                " ======= GenerateComponentDescriptorMojo settings =======");
+        getLog().debug("workDirectory[" + workDirectory + "]");
+        getLog().debug("generateJbiDescriptor[" + generateJbiDescriptor + "]");
+        getLog().debug("type[" + type + "]");
+        getLog().debug("component[" + component + "]");
+        getLog().debug("bootstrap[" + bootstrap + "]");
+        getLog().debug("name[" + name + "]");
+        getLog().debug("description[" + description + "]");
+        getLog().debug("encoding[" + encoding + "]");
+        getLog().debug(
+                "generatedDescriptorLocation[" + generatedDescriptorLocation
+                        + "]");
+
+        if (!generateJbiDescriptor.booleanValue()) {
+            getLog().debug("Generation of jbi.xml is disabled");
+            return;
+        }
+
+        if (bootstrap == null) {
+            injectBootStrap();
+        }
+
+        // Generate jbi descriptor and copy it to the build directory
+        getLog().info("Generating jbi.xml");
+        try {
+            generateJbiDescriptor();
+        } catch (JbiPluginException e) {
+            throw new MojoExecutionException("Failed to generate jbi.xml", e);
+        }
+
+        try {
+            FileUtils.copyFileToDirectory(new File(generatedDescriptorLocation,
+                    JBI_DESCRIPTOR), new File(getWorkDirectory(), META_INF));
+        } catch (IOException e) {
+            throw new MojoExecutionException(
+                    "Unable to copy jbi.xml to final destination", e);
+        }
+    }
+
+    /**
+     * Helper method used to inject the BaseBootstrap from servicemix-commons
+     * into the component this allows to you bypass actually having to create a
+     * bootstrap
+     * 
+     * @throws MojoExecutionException
+     * 
+     */
+    private void injectBootStrap() throws MojoExecutionException {
+
+        try {
+            URL defaultBootStrap = getClassLoader().getResource(
+                    "org/apache/servicemix/common/DefaultBootstrap.class");
+            FileUtils.copyURLToFile(defaultBootStrap, defaultBootstrapFile);
+            bootstrap = "org.apache.servicemix.common.DefaultBootstrap";
+        } catch (IOException e) {
+            throw new MojoExecutionException(
+                    "Unable to copy DefaultBootstrap.class to "
+                            + defaultBootstrapFile.getAbsolutePath(), e);
+        }
+    }
+
+    /**
+     * Generates the deployment descriptor if necessary.
+     */
+    protected void generateJbiDescriptor() throws JbiPluginException {
+        File outputDir = new File(generatedDescriptorLocation);
+        if (!outputDir.exists()) {
+            outputDir.mkdirs();
+        }
+
+        File descriptor = new File(outputDir, JBI_DESCRIPTOR);
+
+        List uris = new ArrayList();
+        DependencyInformation info = new DependencyInformation();
+        info.setFilename(LIB_DIRECTORY + "/" + project.getArtifactId() + "-"
+                + project.getVersion() + ".jar");
+        info.setVersion(project.getVersion());
+        info.setName(project.getArtifactId());
+        info.setType("jar");
+        uris.add(info);
+
+        ScopeArtifactFilter filter = new ScopeArtifactFilter(
+                Artifact.SCOPE_RUNTIME);
+
+        JbiResolutionListener listener = resolveProject();
+        // print(listener.getRootNode(), "");
+
+        Set includes = new HashSet();
+        for (Iterator iter = project.getArtifacts().iterator(); iter.hasNext();) {
+            Artifact artifact = (Artifact) iter.next();
+            if (!artifact.isOptional() && filter.include(artifact)) {
+                MavenProject project = null;
+                try {
+                    project = projectBuilder.buildFromRepository(artifact,
+                            remoteRepos, localRepo);
+                } catch (ProjectBuildingException e) {
+                    getLog().warn(
+                            "Unable to determine packaging for dependency : "
+                                    + artifact.getArtifactId()
+                                    + " assuming jar");
+                }
+                String prjType = project != null ? project.getPackaging()
+                        : artifact.getType();
+                if ("jbi-shared-library".equals(prjType)) {
+                    removeChildren(listener, artifact);
+                    includes.add(artifact);
+                } else if ("jar".equals(prjType)) {
+                    includes.add(artifact);
+                }
+            }
+        }
+        // print(listener.getRootNode(), "");
+
+        for (Iterator iter = retainArtifacts(includes, listener).iterator(); iter
+                .hasNext();) {
+            Artifact artifact = (Artifact) iter.next();
+            MavenProject project = null;
+            try {
+                project = projectBuilder.buildFromRepository(artifact,
+                        remoteRepos, localRepo);
+            } catch (ProjectBuildingException e) {
+                getLog().warn(
+                        "Unable to determine packaging for dependency : "
+                                + artifact.getArtifactId() + " assuming jar");
+            }
+            String prjType = project != null ? project.getPackaging() : artifact
+                    .getType();
+            info = new DependencyInformation();
+            info.setFilename(LIB_DIRECTORY + "/"
+                            + artifact.getFile().getName());
+            info.setVersion(artifact.getVersion());
+            info.setName(artifact.getArtifactId());
+            info.setType(prjType);
+            uris.add(info);
+        }
+
+        JbiComponentDescriptorWriter writer = new JbiComponentDescriptorWriter(
+                encoding);
+        writer.write(descriptor, component, bootstrap, type, name, description,
+                componentClassLoaderDelegation, bootstrapClassLoaderDelegation,
+                uris);
+    }
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateComponentMojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateComponentMojo.java?view=diff&rev=551602&r1=551601&r2=551602
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateComponentMojo.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateComponentMojo.java Thu Jun 28 08:47:21 2007
@@ -50,168 +50,165 @@
  */
 public class GenerateComponentMojo extends AbstractJbiMojo {
 
-	/**
-	 * The directory for the generated JBI component.
-	 * 
-	 * @parameter expression="${project.build.directory}"
-	 * @required
-	 */
-	private File outputDirectory;
-
-	/**
-	 * The name of the generated war.
-	 * 
-	 * @parameter expression="${project.build.finalName}"
-	 * @required
-	 */
-	private String finalName;
-
-	/**
-	 * The name of the generated war.
-	 * 
-	 * @parameter expression="${project.build.finalName}-installer.zip"
-	 * @required
-	 */
-	private String installerName;
-
-	/**
-	 * The Zip archiver.
-	 * 
-	 * @parameter expression="${component.org.codehaus.plexus.archiver.Archiver#jar}"
-	 * @required
-	 */
-	private JarArchiver jarArchiver;
-
-	/**
-	 * Single directory for extra files to include in the JBI component.
-	 * 
-	 * @parameter expression="${basedir}/src/main/jbi"
-	 * @required
-	 */
-	private File jbiSourceDirectory;
-
-	/**
-	 * The maven archive configuration to use.
-	 * 
-	 * @parameter
-	 */
-	private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
-
-	public void execute() throws MojoExecutionException, MojoFailureException {
-
-		getLog().debug(" ======= GenerateInstallerMojo settings =======");
-		getLog().debug("workDirectory[" + workDirectory + "]");
-		getLog().debug("installerName[" + installerName + "]");
-		getLog().debug("jbiSourceDirectory[" + jbiSourceDirectory + "]");
-
-		try {
-
-			createUnpackedInstaller();
-
-			File installerFile = new File(outputDirectory, installerName);
-			createArchive(installerFile);
-
-			projectHelper.attachArtifact(project, "zip", "installer", new File(
-					outputDirectory, installerName));
-
-		} catch (JbiPluginException e) {
-			throw new MojoExecutionException("Failed to create installer", e);
-		}
-	}
-
-	private void createArchive(File installerFile) throws JbiPluginException {
-		try {
-
-			// generate war file
-			getLog().info(
-					"Generating installer " + installerFile.getAbsolutePath());
-			MavenArchiver archiver = new MavenArchiver();
-			archiver.setArchiver(jarArchiver);
-			archiver.setOutputFile(installerFile);
-			jarArchiver.addDirectory(workDirectory);
-			if (jbiSourceDirectory.isDirectory()) {
-				jarArchiver.addDirectory(jbiSourceDirectory, null,
-						DirectoryScanner.DEFAULTEXCLUDES);
-			}
-			// create archive
-			archiver.createArchive(getProject(), archive);
-
-		} catch (ArchiverException e) {
-			throw new JbiPluginException("Error creating assembly: "
-					+ e.getMessage(), e);
-		} catch (ManifestException e) {
-			throw new JbiPluginException("Error creating assembly: "
-					+ e.getMessage(), e);
-		} catch (IOException e) {
-			throw new JbiPluginException("Error creating assembly: "
-					+ e.getMessage(), e);
-		} catch (DependencyResolutionRequiredException e) {
-			throw new JbiPluginException("Error creating assembly: "
-					+ e.getMessage(), e);
-		}
-
-	}
-
-	private void createUnpackedInstaller() throws JbiPluginException {
-
-		if (!workDirectory.isDirectory()) {
-			if (!workDirectory.mkdirs()) {
-				throw new JbiPluginException(
-						"Unable to create work directory: " + workDirectory);
-			}
-		}
-
-		File projectArtifact = new File(outputDirectory, finalName + ".jar");
-		try {
-			FileUtils.copyFileToDirectory(projectArtifact, new File(
-					workDirectory, LIB_DIRECTORY));
-		} catch (IOException e) {
-			throw new JbiPluginException("Unable to copy file "
-					+ projectArtifact, e);
-		}
-
-		ScopeArtifactFilter filter = new ScopeArtifactFilter(
-				Artifact.SCOPE_RUNTIME);		
-
-		JbiResolutionListener listener = resolveProject();
-		// print(listener.getRootNode(), "");
-
-		Set includes = new HashSet();
-		for (Iterator iter = project.getArtifacts().iterator(); iter.hasNext();) {
-			Artifact artifact = (Artifact) iter.next();
-			if (!artifact.isOptional() && filter.include(artifact)) {
-				MavenProject project = null;
-				try {
-					project = projectBuilder.buildFromRepository(artifact,
-							remoteRepos, localRepo);
-				} catch (ProjectBuildingException e) {
-					getLog().warn(
-							"Unable to determine packaging for dependency : "
-									+ artifact.getArtifactId()
-									+ " assuming jar");
-				}
-				String type = project != null ? project.getPackaging()
-						: artifact.getType();
-				if ("jbi-shared-library".equals(type)) {
-					removeBranch(listener, artifact);
-				} else if ("jar".equals(type)) {
-					includes.add(artifact);
-				}
-			}
-		}
-		// print(listener.getRootNode(), "");
-
-		for (Iterator iter = retainArtifacts(includes, listener).iterator(); iter
-				.hasNext();) {
-			Artifact artifact = (Artifact) iter.next();
-			try {
-				getLog().info("Including: " + artifact);
-				FileUtils.copyFileToDirectory(artifact.getFile(), new File(
-						workDirectory, LIB_DIRECTORY));
-			} catch (IOException e) {
-				throw new JbiPluginException("Unable to copy file "
-						+ artifact.getFile(), e);
-			}
-		}
-	}
+    /**
+     * The directory for the generated JBI component.
+     * 
+     * @parameter expression="${project.build.directory}"
+     * @required
+     */
+    private File outputDirectory;
+
+    /**
+     * The name of the generated war.
+     * 
+     * @parameter expression="${project.build.finalName}"
+     * @required
+     */
+    private String finalName;
+
+    /**
+     * The name of the generated war.
+     * 
+     * @parameter expression="${project.build.finalName}-installer.zip"
+     * @required
+     */
+    private String installerName;
+
+    /**
+     * The Zip archiver.
+     * 
+     * @parameter expression="${component.org.codehaus.plexus.archiver.Archiver#jar}"
+     * @required
+     */
+    private JarArchiver jarArchiver;
+
+    /**
+     * Single directory for extra files to include in the JBI component.
+     * 
+     * @parameter expression="${basedir}/src/main/jbi"
+     * @required
+     */
+    private File jbiSourceDirectory;
+
+    /**
+     * The maven archive configuration to use.
+     * 
+     * @parameter
+     */
+    private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
+
+    public void execute() throws MojoExecutionException, MojoFailureException {
+
+        getLog().debug(" ======= GenerateInstallerMojo settings =======");
+        getLog().debug("workDirectory[" + workDirectory + "]");
+        getLog().debug("installerName[" + installerName + "]");
+        getLog().debug("jbiSourceDirectory[" + jbiSourceDirectory + "]");
+
+        try {
+
+            createUnpackedInstaller();
+
+            File installerFile = new File(outputDirectory, installerName);
+            createArchive(installerFile);
+
+            projectHelper.attachArtifact(project, "zip", "installer", new File(
+                    outputDirectory, installerName));
+
+        } catch (JbiPluginException e) {
+            throw new MojoExecutionException("Failed to create installer", e);
+        }
+    }
+
+    private void createArchive(File installerFile) throws JbiPluginException {
+        try {
+
+            // generate war file
+            getLog().info(
+                    "Generating installer " + installerFile.getAbsolutePath());
+            MavenArchiver archiver = new MavenArchiver();
+            archiver.setArchiver(jarArchiver);
+            archiver.setOutputFile(installerFile);
+            jarArchiver.addDirectory(workDirectory);
+            if (jbiSourceDirectory.isDirectory()) {
+                jarArchiver.addDirectory(jbiSourceDirectory, null,
+                        DirectoryScanner.DEFAULTEXCLUDES);
+            }
+            // create archive
+            archiver.createArchive(getProject(), archive);
+
+        } catch (ArchiverException e) {
+            throw new JbiPluginException("Error creating assembly: "
+                    + e.getMessage(), e);
+        } catch (ManifestException e) {
+            throw new JbiPluginException("Error creating assembly: "
+                    + e.getMessage(), e);
+        } catch (IOException e) {
+            throw new JbiPluginException("Error creating assembly: "
+                    + e.getMessage(), e);
+        } catch (DependencyResolutionRequiredException e) {
+            throw new JbiPluginException("Error creating assembly: "
+                    + e.getMessage(), e);
+        }
+
+    }
+
+    private void createUnpackedInstaller() throws JbiPluginException {
+
+        if (!workDirectory.isDirectory() && !workDirectory.mkdirs()) {
+            throw new JbiPluginException("Unable to create work directory: " + workDirectory);
+        }
+
+        File projectArtifact = new File(outputDirectory, finalName + ".jar");
+        try {
+            FileUtils.copyFileToDirectory(projectArtifact, new File(
+                    workDirectory, LIB_DIRECTORY));
+        } catch (IOException e) {
+            throw new JbiPluginException("Unable to copy file "
+                    + projectArtifact, e);
+        }
+
+        ScopeArtifactFilter filter = new ScopeArtifactFilter(
+                Artifact.SCOPE_RUNTIME);
+
+        JbiResolutionListener listener = resolveProject();
+        // print(listener.getRootNode(), "");
+
+        Set includes = new HashSet();
+        for (Iterator iter = project.getArtifacts().iterator(); iter.hasNext();) {
+            Artifact artifact = (Artifact) iter.next();
+            if (!artifact.isOptional() && filter.include(artifact)) {
+                MavenProject project = null;
+                try {
+                    project = projectBuilder.buildFromRepository(artifact,
+                            remoteRepos, localRepo);
+                } catch (ProjectBuildingException e) {
+                    getLog().warn(
+                            "Unable to determine packaging for dependency : "
+                                    + artifact.getArtifactId()
+                                    + " assuming jar");
+                }
+                String type = project != null ? project.getPackaging()
+                        : artifact.getType();
+                if ("jbi-shared-library".equals(type)) {
+                    removeBranch(listener, artifact);
+                } else if ("jar".equals(type)) {
+                    includes.add(artifact);
+                }
+            }
+        }
+        // print(listener.getRootNode(), "");
+
+        for (Iterator iter = retainArtifacts(includes, listener).iterator(); iter
+                .hasNext();) {
+            Artifact artifact = (Artifact) iter.next();
+            try {
+                getLog().info("Including: " + artifact);
+                FileUtils.copyFileToDirectory(artifact.getFile(), new File(
+                        workDirectory, LIB_DIRECTORY));
+            } catch (IOException e) {
+                throw new JbiPluginException("Unable to copy file "
+                        + artifact.getFile(), e);
+            }
+        }
+    }
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java?view=diff&rev=551602&r1=551601&r2=551602
==============================================================================
--- incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/GenerateServiceAssemblyDescriptorMojo.java Thu Jun 28 08:47:21 2007
@@ -27,6 +27,11 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
 import org.apache.maven.model.Dependency;
@@ -39,10 +44,6 @@
 import org.apache.servicemix.common.packaging.Consumes;
 import org.apache.servicemix.common.packaging.Provides;
 import org.codehaus.plexus.util.FileUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 /**
  * A Mojo used to build the jbi.xml file for a service unit.
@@ -57,358 +58,343 @@
  */
 public class GenerateServiceAssemblyDescriptorMojo extends AbstractJbiMojo {
 
-	private static final String JBI_NAMESPACE = "http://java.sun.com/xml/ns/jbi";
+    public static final String JBI_NAMESPACE = "http://java.sun.com/xml/ns/jbi";
+
+    public static final String UTF_8 = "UTF-8";
 
-	public class Connection {
-		private Consumes consumes;
+    public class Connection {
+        private Consumes consumes;
 
-		private Provides provides;
+        private Provides provides;
 
-		public Consumes getConsumes() {
-			return consumes;
-		}
-
-		public void setConsumes(Consumes consumes) {
-			this.consumes = consumes;
-		}
-
-		public Provides getProvides() {
-			return provides;
-		}
-
-		public void setProvides(Provides provides) {
-			this.provides = provides;
-		}
-	}
-
-	public static final String UTF_8 = "UTF-8";
-
-	/**
-	 * Whether the jbi.xml should be generated or not.
-	 * 
-	 * @parameter
-	 */
-	private Boolean generateJbiDescriptor = Boolean.TRUE;
-
-	/**
-	 * The component name.
-	 * 
-	 * @parameter expression="${project.artifactId}"
-	 */
-	private String name;
-
-	/**
-	 * The component description.
-	 * 
-	 * @parameter expression="${project.name}"
-	 */
-	private String description;
-
-	/**
-	 * Character encoding for the auto-generated application.xml file.
-	 * 
-	 * @parameter
-	 */
-	private String encoding = UTF_8;
-
-	/**
-	 * Directory where the application.xml file will be auto-generated.
-	 * 
-	 * @parameter expression="${project.build.directory}/classes/META-INF"
-	 */
-	private String generatedDescriptorLocation;
-
-	/**
-	 * The location of a file containing the connections elements that can be
-	 * merged into the jbi.xml
-	 * 
-	 * @parameter expression="${basedir}/src/main/resources/jbi-connections.xml"
-	 */
-	private File jbiConnectionsFile;
-
-	/**
-	 * Dependency graph
-	 */
-	private JbiResolutionListener listener;
-
-	public void execute() throws MojoExecutionException, MojoFailureException {
-
-		getLog()
-				.debug(
-						" ======= GenerateServiceAssemlbyDescriptorMojo settings =======");
-		getLog().debug("workDirectory[" + workDirectory + "]");
-		getLog().debug("generateJbiDescriptor[" + generateJbiDescriptor + "]");
-		getLog().debug("name[" + name + "]");
-		getLog().debug("description[" + description + "]");
-		getLog().debug("encoding[" + encoding + "]");
-		getLog().debug(
-				"generatedDescriptorLocation[" + generatedDescriptorLocation
-						+ "]");
-
-		if (!generateJbiDescriptor.booleanValue()) {
-			getLog().debug("Generation of jbi.xml is disabled");
-			return;
-		}
-
-		// Generate jbi descriptor and copy it to the build directory
-		getLog().info("Generating jbi.xml");
-		try {
-			listener = resolveProject();
-			generateJbiDescriptor();
-		} catch (JbiPluginException e) {
-			throw new MojoExecutionException("Failed to generate jbi.xml", e);
-		}
-
-		try {
-			FileUtils.copyFileToDirectory(new File(generatedDescriptorLocation,
-					JBI_DESCRIPTOR), new File(getWorkDirectory(), META_INF));
-		} catch (IOException e) {
-			throw new MojoExecutionException(
-					"Unable to copy jbi.xml to final destination", e);
-		}
-	}
-
-	/**
-	 * Generates the deployment descriptor if necessary.
-	 * 
-	 * @throws MojoExecutionException
-	 */
-	protected void generateJbiDescriptor() throws JbiPluginException,
-			MojoExecutionException {
-		File outputDir = new File(generatedDescriptorLocation);
-		if (!outputDir.exists()) {
-			outputDir.mkdirs();
-		}
-
-		File descriptor = new File(outputDir, JBI_DESCRIPTOR);
-
-		List serviceUnits = new ArrayList();
-
-		Set artifacts = project.getArtifacts();
-		for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
-			Artifact artifact = (Artifact) iter.next();
-
-			// TODO: utilise appropriate methods from project builder
-			ScopeArtifactFilter filter = new ScopeArtifactFilter(
-					Artifact.SCOPE_RUNTIME);
-			if (!artifact.isOptional() && filter.include(artifact)
-					&& (artifact.getDependencyTrail().size() == 2)) {
-				MavenProject project = null;
-				try {
-					project = projectBuilder.buildFromRepository(artifact,
-							remoteRepos, localRepo);
-				} catch (ProjectBuildingException e) {
-					getLog().warn(
-							"Unable to determine packaging for dependency : "
-									+ artifact.getArtifactId()
-									+ " assuming jar");
-				}
-				if ((project != null)
-						&& (project.getPackaging().equals("jbi-service-unit"))) {
-					DependencyInformation info = new DependencyInformation();
-					info.setName(artifact.getArtifactId());
-					String name = artifact.getFile().getName();
-					name = name.substring(0, name.lastIndexOf('.')) + ".zip";
-					info.setFilename(name);
-					info.setComponent(getComponentName(project, artifacts,
-							artifact));
-					info.setDescription(project.getDescription());
-					serviceUnits.add(info);
-				}
-
-			}
-		}
-
-		List orderedServiceUnits = reorderServiceUnits(serviceUnits);
-
-		List connections = getConnections();
-
-		JbiServiceAssemblyDescriptorWriter writer = new JbiServiceAssemblyDescriptorWriter(
-				encoding);
-		writer.write(descriptor, name, description, orderedServiceUnits,
-				connections);
-	}
-
-	/**
-	 * Used to return a list of connections if they have been found in the
-	 * jbiConnectionsFile
-	 * 
-	 * @return A list of connections
-	 * @throws MojoExecutionException
-	 */
-	private List getConnections() throws MojoExecutionException {
-
-		if (jbiConnectionsFile.exists())
-			return parseConnectionsXml();
-		else
-			return new ArrayList();
-	}
-
-	/**
-	 * Parse the jbiConnectionsFile
-	 * 
-	 * @return
-	 * @throws MojoExecutionException
-	 */
-	private List parseConnectionsXml() throws MojoExecutionException {
-		getLog().info(
-				"Picking up connections from "
-						+ jbiConnectionsFile.getAbsolutePath());
-		List connections = new ArrayList();
-		try {
-			DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-			dbf.setNamespaceAware(true);
-			DocumentBuilder db = dbf.newDocumentBuilder();
-			Document doc = db.parse(jbiConnectionsFile);
-
-			Node servicesNode = doc.getFirstChild();
-			if (servicesNode instanceof Element) {				
-				if (XmlDescriptorHelper.isElement(servicesNode, JBI_NAMESPACE,
-						"connections")) {
-					// We will process the children
-					Element servicesElement = (Element) servicesNode;
-					NodeList children = servicesElement.getChildNodes();
-					for (int i = 0; i < children.getLength(); i++) {
-						if (XmlDescriptorHelper.isElement(children.item(i),
-								JBI_NAMESPACE, "connection")) {
-							Connection connection = new Connection();
-							NodeList connectionChildren = children.item(i)
-									.getChildNodes();
-							for (int x = 0; x < connectionChildren.getLength(); x++) {
-								if (connectionChildren.item(x) instanceof Element) {
-									Element childElement = (Element) connectionChildren
-											.item(x);
-									if (XmlDescriptorHelper.isElement(childElement,
-											JBI_NAMESPACE,
-											"consumer")) {
-										Consumes newConsumes = new Consumes();
-										newConsumes
-												.setEndpointName(XmlDescriptorHelper
-														.getEndpointName(childElement));
-										newConsumes
-												.setInterfaceName(XmlDescriptorHelper
-														.getInterfaceName(childElement));
-										newConsumes
-												.setServiceName(XmlDescriptorHelper
-														.getServiceName(childElement));
-										connection.setConsumes(newConsumes);
-									} else if (XmlDescriptorHelper.isElement(childElement,
-											JBI_NAMESPACE,
-											"provider")) {
-										Provides newProvides = new Provides();
-										newProvides
-												.setEndpointName(XmlDescriptorHelper
-														.getEndpointName(childElement));
-										newProvides
-												.setInterfaceName(XmlDescriptorHelper
-														.getInterfaceName(childElement));
-										newProvides
-												.setServiceName(XmlDescriptorHelper
-														.getServiceName(childElement));
-										connection.setProvides(newProvides);
-									}
-								}
-							}
-							connections.add(connection);
-						}
-					}
-				}
-			}
-			getLog().info("Found " + connections.size() + " connections");
-			return connections;
-		} catch (Exception e) {
-			throw new MojoExecutionException("Unable to parse "
-					+ jbiConnectionsFile.getAbsolutePath());
-		}
-	}
-
-	/**
-	 * Re-orders the service units to match order in the dependencies section of
-	 * the pom
-	 * 
-	 * @param serviceUnits
-	 * @throws MojoExecutionException
-	 */
-	private List reorderServiceUnits(List serviceUnits)
-			throws MojoExecutionException {
-
-		// TODO Currently we get the model back by re-parsing it however in the
-		// future we should be able to use the getModel() - there should be a
-		// fix post 2.0.4
-
-		// Iterator dependencies =
-		// project.getModel().getDependencies().iterator();
-
-		// For now we will need to reparse the pom without processing
-		Iterator dependencies = getReparsedDependencies();
-
-		List orderedServiceUnits = new ArrayList();
-		while (dependencies.hasNext()) {
-			Dependency dependency = (Dependency) dependencies.next();
-			for (Iterator it = serviceUnits.iterator(); it.hasNext();) {
-				DependencyInformation serviceUnitInfo = (DependencyInformation) it
-						.next();
-				if (dependency.getArtifactId()
-						.equals(serviceUnitInfo.getName())) {
-					getLog().debug("Adding "
-							+ serviceUnitInfo.getFilename());
-					orderedServiceUnits.add(serviceUnitInfo);
-				}
-
-			}
-		}
-
-		return orderedServiceUnits;
-	}
-
-	private Iterator getReparsedDependencies() throws MojoExecutionException {
-		MavenXpp3Reader mavenXpp3Reader = new MavenXpp3Reader();
-		try {
-			Model model = mavenXpp3Reader.read(new FileReader(new File(project
-					.getBasedir(), "pom.xml")), false);
-			return model.getDependencies().iterator();
-		} catch (Exception e) {
-			throw new MojoExecutionException("Unable to reparse the pom.xml");
-		}
-	}
-
-	private String getComponentName(MavenProject project, Set artifacts,
-			Artifact suArtifact) throws MojoExecutionException {
-
-		getLog().info(
-				"Determining component name for service unit "
-						+ project.getArtifactId());
-		if (project.getProperties().getProperty("componentName") != null) {
-			return project.getProperties().getProperty("componentName");
-		}
-
-		JbiResolutionListener.Node n = listener.getNode(suArtifact);
-		for (Iterator it = n.getChildren().iterator(); it.hasNext();) {
-			JbiResolutionListener.Node child = (JbiResolutionListener.Node) it
-					.next();
-			MavenProject artifactProject = null;
-			try {
-				artifactProject = projectBuilder.buildFromRepository(child
-						.getArtifact(), remoteRepos, localRepo);
-			} catch (ProjectBuildingException e) {
-				getLog().warn(
-						"Unable to determine packaging for dependency : "
-								+ child.getArtifact().getArtifactId()
-								+ " assuming jar");
-			}
-			getLog().info(
-					"Project " + artifactProject + " packaged "
-							+ artifactProject.getPackaging());
-			if ((artifactProject != null)
-					&& (artifactProject.getPackaging().equals("jbi-component"))) {
-				return child.getArtifact().getArtifactId();
-			}
-		}
-
-		throw new MojoExecutionException(
-				"The service unit "
-						+ project.getArtifactId()
-						+ " does not have a dependency which is packaged as a jbi-component or a project property 'componentName'");
-	}
+        public Consumes getConsumes() {
+            return consumes;
+        }
+
+        public void setConsumes(Consumes consumes) {
+            this.consumes = consumes;
+        }
+
+        public Provides getProvides() {
+            return provides;
+        }
+
+        public void setProvides(Provides provides) {
+            this.provides = provides;
+        }
+    }
+
+    /**
+     * Whether the jbi.xml should be generated or not.
+     * 
+     * @parameter
+     */
+    private Boolean generateJbiDescriptor = Boolean.TRUE;
+
+    /**
+     * The component name.
+     * 
+     * @parameter expression="${project.artifactId}"
+     */
+    private String name;
+
+    /**
+     * The component description.
+     * 
+     * @parameter expression="${project.name}"
+     */
+    private String description;
+
+    /**
+     * Character encoding for the auto-generated application.xml file.
+     * 
+     * @parameter
+     */
+    private String encoding = UTF_8;
+
+    /**
+     * Directory where the application.xml file will be auto-generated.
+     * 
+     * @parameter expression="${project.build.directory}/classes/META-INF"
+     */
+    private String generatedDescriptorLocation;
+
+    /**
+     * The location of a file containing the connections elements that can be
+     * merged into the jbi.xml
+     * 
+     * @parameter expression="${basedir}/src/main/resources/jbi-connections.xml"
+     */
+    private File jbiConnectionsFile;
+
+    /**
+     * Dependency graph
+     */
+    private JbiResolutionListener listener;
+
+    public void execute() throws MojoExecutionException, MojoFailureException {
+
+        getLog()
+                .debug(
+                        " ======= GenerateServiceAssemlbyDescriptorMojo settings =======");
+        getLog().debug("workDirectory[" + workDirectory + "]");
+        getLog().debug("generateJbiDescriptor[" + generateJbiDescriptor + "]");
+        getLog().debug("name[" + name + "]");
+        getLog().debug("description[" + description + "]");
+        getLog().debug("encoding[" + encoding + "]");
+        getLog().debug(
+                "generatedDescriptorLocation[" + generatedDescriptorLocation
+                        + "]");
+
+        if (!generateJbiDescriptor.booleanValue()) {
+            getLog().debug("Generation of jbi.xml is disabled");
+            return;
+        }
+
+        // Generate jbi descriptor and copy it to the build directory
+        getLog().info("Generating jbi.xml");
+        try {
+            listener = resolveProject();
+            generateJbiDescriptor();
+        } catch (JbiPluginException e) {
+            throw new MojoExecutionException("Failed to generate jbi.xml", e);
+        }
+
+        try {
+            FileUtils.copyFileToDirectory(new File(generatedDescriptorLocation,
+                    JBI_DESCRIPTOR), new File(getWorkDirectory(), META_INF));
+        } catch (IOException e) {
+            throw new MojoExecutionException(
+                    "Unable to copy jbi.xml to final destination", e);
+        }
+    }
+
+    /**
+     * Generates the deployment descriptor if necessary.
+     * 
+     * @throws MojoExecutionException
+     */
+    protected void generateJbiDescriptor() throws JbiPluginException,
+            MojoExecutionException {
+        File outputDir = new File(generatedDescriptorLocation);
+        if (!outputDir.exists()) {
+            outputDir.mkdirs();
+        }
+
+        File descriptor = new File(outputDir, JBI_DESCRIPTOR);
+
+        List serviceUnits = new ArrayList();
+
+        Set artifacts = project.getArtifacts();
+        for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
+            Artifact artifact = (Artifact) iter.next();
+
+            // TODO: utilise appropriate methods from project builder
+            ScopeArtifactFilter filter = new ScopeArtifactFilter(
+                    Artifact.SCOPE_RUNTIME);
+            if (!artifact.isOptional() && filter.include(artifact)
+                    && (artifact.getDependencyTrail().size() == 2)) {
+                MavenProject project = null;
+                try {
+                    project = projectBuilder.buildFromRepository(artifact,
+                            remoteRepos, localRepo);
+                } catch (ProjectBuildingException e) {
+                    getLog().warn(
+                            "Unable to determine packaging for dependency : "
+                                    + artifact.getArtifactId()
+                                    + " assuming jar");
+                }
+                if ((project != null)
+                        && (project.getPackaging().equals("jbi-service-unit"))) {
+                    DependencyInformation info = new DependencyInformation();
+                    info.setName(artifact.getArtifactId());
+                    String fileName = artifact.getFile().getName();
+                    fileName = fileName.substring(0, fileName.lastIndexOf('.')) + ".zip";
+                    info.setFilename(fileName);
+                    info.setComponent(getComponentName(project, artifacts, artifact));
+                    info.setDescription(project.getDescription());
+                    serviceUnits.add(info);
+                }
+
+            }
+        }
+
+        List orderedServiceUnits = reorderServiceUnits(serviceUnits);
+
+        List connections = getConnections();
+
+        JbiServiceAssemblyDescriptorWriter writer = new JbiServiceAssemblyDescriptorWriter(
+                encoding);
+        writer.write(descriptor, name, description, orderedServiceUnits,
+                connections);
+    }
+
+    /**
+     * Used to return a list of connections if they have been found in the
+     * jbiConnectionsFile
+     * 
+     * @return A list of connections
+     * @throws MojoExecutionException
+     */
+    private List getConnections() throws MojoExecutionException {
+
+        if (jbiConnectionsFile.exists()) {
+            return parseConnectionsXml();
+        } else {
+            return new ArrayList();
+        }
+    }
+
+    /**
+     * Parse the jbiConnectionsFile
+     * 
+     * @return
+     * @throws MojoExecutionException
+     */
+    private List parseConnectionsXml() throws MojoExecutionException {
+        getLog().info(
+                "Picking up connections from "
+                        + jbiConnectionsFile.getAbsolutePath());
+        List connections = new ArrayList();
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document doc = db.parse(jbiConnectionsFile);
+
+            Node servicesNode = doc.getFirstChild();
+            if (servicesNode instanceof Element
+                  && XmlDescriptorHelper.isElement(servicesNode, JBI_NAMESPACE, "connections")) {
+                // We will process the children
+                Element servicesElement = (Element) servicesNode;
+                NodeList children = servicesElement.getChildNodes();
+                for (int i = 0; i < children.getLength(); i++) {
+                    if (XmlDescriptorHelper.isElement(children.item(i), JBI_NAMESPACE, "connection")) {
+                        Connection connection = new Connection();
+                        NodeList connectionChildren = children.item(i).getChildNodes();
+                        for (int x = 0; x < connectionChildren.getLength(); x++) {
+                            if (connectionChildren.item(x) instanceof Element) {
+                                Element childElement = (Element) connectionChildren.item(x);
+                                if (XmlDescriptorHelper.isElement(
+                                        childElement, JBI_NAMESPACE, "consumer")) {
+                                    Consumes newConsumes = new Consumes();
+                                    newConsumes.setEndpointName(XmlDescriptorHelper
+                                                    .getEndpointName(childElement));
+                                    newConsumes.setInterfaceName(XmlDescriptorHelper
+                                                    .getInterfaceName(childElement));
+                                    newConsumes.setServiceName(XmlDescriptorHelper
+                                                    .getServiceName(childElement));
+                                    connection.setConsumes(newConsumes);
+                                } else if (XmlDescriptorHelper.isElement(
+                                        childElement, JBI_NAMESPACE, "provider")) {
+                                    Provides newProvides = new Provides();
+                                    newProvides.setEndpointName(XmlDescriptorHelper
+                                                    .getEndpointName(childElement));
+                                    newProvides.setInterfaceName(XmlDescriptorHelper
+                                                    .getInterfaceName(childElement));
+                                    newProvides.setServiceName(XmlDescriptorHelper
+                                                    .getServiceName(childElement));
+                                    connection.setProvides(newProvides);
+                                }
+                            }
+                        }
+                        connections.add(connection);
+                    }
+                }
+            }
+            getLog().info("Found " + connections.size() + " connections");
+            return connections;
+        } catch (Exception e) {
+            throw new MojoExecutionException("Unable to parse "
+                    + jbiConnectionsFile.getAbsolutePath());
+        }
+    }
+
+    /**
+     * Re-orders the service units to match order in the dependencies section of
+     * the pom
+     * 
+     * @param serviceUnits
+     * @throws MojoExecutionException
+     */
+    private List reorderServiceUnits(List serviceUnits) throws MojoExecutionException {
+
+        // TODO Currently we get the model back by re-parsing it however in the
+        // future we should be able to use the getModel() - there should be a
+        // fix post 2.0.4
+
+        // Iterator dependencies =
+        // project.getModel().getDependencies().iterator();
+
+        // For now we will need to reparse the pom without processing
+        Iterator dependencies = getReparsedDependencies();
+
+        List orderedServiceUnits = new ArrayList();
+        while (dependencies.hasNext()) {
+            Dependency dependency = (Dependency) dependencies.next();
+            for (Iterator it = serviceUnits.iterator(); it.hasNext();) {
+                DependencyInformation serviceUnitInfo = (DependencyInformation) it
+                        .next();
+                if (dependency.getArtifactId()
+                        .equals(serviceUnitInfo.getName())) {
+                    getLog().debug("Adding " + serviceUnitInfo.getFilename());
+                    orderedServiceUnits.add(serviceUnitInfo);
+                }
+
+            }
+        }
+
+        return orderedServiceUnits;
+    }
+
+    private Iterator getReparsedDependencies() throws MojoExecutionException {
+        MavenXpp3Reader mavenXpp3Reader = new MavenXpp3Reader();
+        try {
+            Model model = mavenXpp3Reader.read(new FileReader(new File(project
+                    .getBasedir(), "pom.xml")), false);
+            return model.getDependencies().iterator();
+        } catch (Exception e) {
+            throw new MojoExecutionException("Unable to reparse the pom.xml");
+        }
+    }
+
+    private String getComponentName(MavenProject project, Set artifacts,
+            Artifact suArtifact) throws MojoExecutionException {
+
+        getLog().info(
+                "Determining component name for service unit "
+                        + project.getArtifactId());
+        if (project.getProperties().getProperty("componentName") != null) {
+            return project.getProperties().getProperty("componentName");
+        }
+
+        JbiResolutionListener.Node n = listener.getNode(suArtifact);
+        for (Iterator it = n.getChildren().iterator(); it.hasNext();) {
+            JbiResolutionListener.Node child = (JbiResolutionListener.Node) it
+                    .next();
+            MavenProject artifactProject = null;
+            try {
+                artifactProject = projectBuilder.buildFromRepository(child
+                        .getArtifact(), remoteRepos, localRepo);
+            } catch (ProjectBuildingException e) {
+                getLog().warn(
+                        "Unable to determine packaging for dependency : "
+                                + child.getArtifact().getArtifactId()
+                                + " assuming jar");
+            }
+            getLog().info(
+                    "Project " + artifactProject + " packaged "
+                            + artifactProject.getPackaging());
+            if ((artifactProject != null)
+                    && (artifactProject.getPackaging().equals("jbi-component"))) {
+                return child.getArtifact().getArtifactId();
+            }
+        }
+
+        throw new MojoExecutionException(
+                "The service unit "
+                        + project.getArtifactId()
+                        + " does not have a dependency which is packaged as a jbi-component or a project property 'componentName'");
+    }
 
 }