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 [3/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...

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiComponentDescriptorWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiComponentDescriptorWriter.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/JbiComponentDescriptorWriter.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiComponentDescriptorWriter.java Thu Jun 28 08:47:21 2007
@@ -28,97 +28,103 @@
 
 public class JbiComponentDescriptorWriter {
 
-	private final String encoding;
+    private final String encoding;
 
-	public JbiComponentDescriptorWriter(String encoding) {
-		this.encoding = encoding;
-	}
-
-	public void write(File descriptor, String component, String bootstrap,
-			String type, String name, String description, 
-            String componentClassLoaderDelegation, String bootstrapClassLoaderDelegation, 
-            List uris)
-			throws JbiPluginException {
+    public JbiComponentDescriptorWriter(String encoding) {
+        this.encoding = encoding;
+    }
+
+    public void write(File descriptor, 
+                      String component, 
+                      String bootstrap,
+                      String type, 
+                      String name, 
+                      String description,
+                      String componentClassLoaderDelegation,
+                      String bootstrapClassLoaderDelegation, 
+                      List uris) throws JbiPluginException {
         PrintWriter w;
-		try {
-			w = new PrintWriter(descriptor, encoding);
-		} catch (IOException ex) {
-			throw new JbiPluginException("Exception while opening file["
-					+ descriptor.getAbsolutePath() + "]", ex);
-		}
-
-		XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);		
-		writer.startElement("jbi");
-		writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
-		writer.addAttribute("version", "1.0");
-
-		writer.startElement("component");
-		writer.addAttribute("type", type);
-        writer.addAttribute("component-class-loader-delegation", componentClassLoaderDelegation);
-        writer.addAttribute("bootstrap-class-loader-delegation", bootstrapClassLoaderDelegation);
-
-		writer.startElement("identification");
-		writer.startElement("name");
-		writer.writeText(name);
-		writer.endElement();
-		writer.startElement("description");
-		writer.writeText(description);
-		writer.endElement();
-		writer.endElement();
-
-		writer.startElement("component-class-name");
-		writer.writeText(component);
-		writer.endElement();
-		writer.startElement("component-class-path");
-		for (Iterator it = uris.iterator(); it.hasNext();) {
-			DependencyInformation info = (DependencyInformation) it.next();
-			if ("jar".equals(info.getType())) {
-				writer.startElement("path-element");
-				writer.writeText(info.getFilename());
-				writer.endElement();
-			}
-		}
-		writer.endElement();
-
-		writer.startElement("bootstrap-class-name");
-		writer.writeText(bootstrap);
-		writer.endElement();
-		writer.startElement("bootstrap-class-path");
-		for (Iterator it = uris.iterator(); it.hasNext();) {
-			DependencyInformation info = (DependencyInformation) it.next();
-			if ("jar".equals(info.getType())) {
-				writer.startElement("path-element");
-				writer.writeText(info.getFilename());
-				writer.endElement();
-			}
-		}
-		writer.endElement();
-
-		for (Iterator it = uris.iterator(); it.hasNext();) {
-			DependencyInformation info = (DependencyInformation) it.next();
-			if ("jbi-shared-library".equals(info.getType())) {
-				writer.startElement("shared-library");
-				writer.addAttribute("version", info.getVersion());
-				writer.writeText(info.getName());
-				writer.endElement();
-			}
-		}
-
-		writer.endElement();
-
-		writer.endElement();
-
-		close(w);
-	}
-
-	private void close(Writer closeable) {
-		if (closeable != null) {
-			try {
-				closeable.close();
-			} catch (Exception e) {
-				// TODO: warn
-			}
-		}
-	}
+        try {
+            w = new PrintWriter(descriptor, encoding);
+        } catch (IOException ex) {
+            throw new JbiPluginException("Exception while opening file["
+                    + descriptor.getAbsolutePath() + "]", ex);
+        }
+
+        XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
+        writer.startElement("jbi");
+        writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
+        writer.addAttribute("version", "1.0");
+
+        writer.startElement("component");
+        writer.addAttribute("type", type);
+        writer.addAttribute("component-class-loader-delegation",
+                componentClassLoaderDelegation);
+        writer.addAttribute("bootstrap-class-loader-delegation",
+                bootstrapClassLoaderDelegation);
+
+        writer.startElement("identification");
+        writer.startElement("name");
+        writer.writeText(name);
+        writer.endElement();
+        writer.startElement("description");
+        writer.writeText(description);
+        writer.endElement();
+        writer.endElement();
+
+        writer.startElement("component-class-name");
+        writer.writeText(component);
+        writer.endElement();
+        writer.startElement("component-class-path");
+        for (Iterator it = uris.iterator(); it.hasNext();) {
+            DependencyInformation info = (DependencyInformation) it.next();
+            if ("jar".equals(info.getType())) {
+                writer.startElement("path-element");
+                writer.writeText(info.getFilename());
+                writer.endElement();
+            }
+        }
+        writer.endElement();
+
+        writer.startElement("bootstrap-class-name");
+        writer.writeText(bootstrap);
+        writer.endElement();
+        writer.startElement("bootstrap-class-path");
+        for (Iterator it = uris.iterator(); it.hasNext();) {
+            DependencyInformation info = (DependencyInformation) it.next();
+            if ("jar".equals(info.getType())) {
+                writer.startElement("path-element");
+                writer.writeText(info.getFilename());
+                writer.endElement();
+            }
+        }
+        writer.endElement();
+
+        for (Iterator it = uris.iterator(); it.hasNext();) {
+            DependencyInformation info = (DependencyInformation) it.next();
+            if ("jbi-shared-library".equals(info.getType())) {
+                writer.startElement("shared-library");
+                writer.addAttribute("version", info.getVersion());
+                writer.writeText(info.getName());
+                writer.endElement();
+            }
+        }
+
+        writer.endElement();
+
+        writer.endElement();
+
+        close(w);
+    }
+
+    private void close(Writer closeable) {
+        if (closeable != null) {
+            try {
+                closeable.close();
+            } catch (Exception e) {
+                // TODO: warn
+            }
+        }
+    }
 
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiPluginException.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiPluginException.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/JbiPluginException.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiPluginException.java Thu Jun 28 08:47:21 2007
@@ -18,20 +18,20 @@
 
 public class JbiPluginException extends Exception {
 
-	public JbiPluginException() {
-		super();
-	}
+    public JbiPluginException() {
+        super();
+    }
 
-	public JbiPluginException(String message, Throwable cause) {
-		super(message, cause);
-	}
+    public JbiPluginException(String message, Throwable cause) {
+        super(message, cause);
+    }
 
-	public JbiPluginException(String message) {
-		super(message);
-	}
+    public JbiPluginException(String message) {
+        super(message);
+    }
 
-	public JbiPluginException(Throwable cause) {
-		super(cause);
-	}
+    public JbiPluginException(Throwable cause) {
+        super(cause);
+    }
 
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiProjectDeployerMojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiProjectDeployerMojo.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/JbiProjectDeployerMojo.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiProjectDeployerMojo.java Thu Jun 28 08:47:21 2007
@@ -58,328 +58,357 @@
  */
 public class JbiProjectDeployerMojo extends AbstractDeployableMojo {
 
-	private static final String JBI_SHARED_LIBRARY = "jbi-shared-library";
+    private static final String JBI_SHARED_LIBRARY = "jbi-shared-library";
 
-	private static final String JBI_COMPONENT = "jbi-component";
+    private static final String JBI_COMPONENT = "jbi-component";
 
-	private static final String JBI_SERVICE_ASSEMBLY = "jbi-service-assembly";
+    private static final String JBI_SERVICE_ASSEMBLY = "jbi-service-assembly";
 
-	private List deploymentTypes;
+    private List deploymentTypes;
+
+    /**
+     * @parameter default-value="true" expression="${deployDependencies}"
+     */
+    private boolean deployDependencies;
 
-	/**
-	 * @parameter default-value="true" expression="${deployDependencies}"
-	 */
-	private boolean deployDependencies;
-    
     /**
      * @parameter default-value="false" expression="${forceUpdate}"
      */
     private boolean forceUpdate;
 
-	/**
-	 * @parameter default-value="true" expression="${deferExceptions}"
-	 */
-	private boolean deferExceptions;
-    
+    /**
+     * @parameter default-value="true" expression="${deferExceptions}"
+     */
+    private boolean deferExceptions;
+
     /**
      * @parameter default-value="true" expression="${deployChildren}"
      */
     private boolean deployChildren;
 
-	public void execute() throws MojoExecutionException, MojoFailureException {
-		deployProject();
-	}
-
-	protected void deployProject() throws MojoExecutionException {
-		if (!deployChildren && !getDeployablePackagingTypes().contains(project.getPackaging())) {
-			throw new MojoExecutionException(
-					"Project must be of packaging type ["
-							+ getDeployablePackagingTypes() + "]");
-		}
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        deployProject();
+    }
+
+    protected void deployProject() throws MojoExecutionException {
+        if (!deployChildren
+                && !getDeployablePackagingTypes().contains(
+                        project.getPackaging())) {
+            throw new MojoExecutionException(
+                    "Project must be of packaging type ["
+                            + getDeployablePackagingTypes() + "]");
+        }
 
-		try {
-			Stack dependencies = new Stack();
+        try {
+            Stack dependencies = new Stack();
             if (deployChildren) {
                 resolveArtifact(project.getArtifact(), dependencies);
             } else {
-    			dependencies.add(resolveDeploymentPackage(project, project.getArtifact()));
-    			ArrayList artifactList = new ArrayList();
-    			artifactList.addAll(project.getArtifacts());
-    			Collections.sort(artifactList, new ArtifactDepthComparator());
-    			for (Iterator iter = artifactList.iterator(); iter.hasNext();) {
-    				Artifact artifact = (Artifact) iter.next();
-    				resolveArtifact(artifact, dependencies);
-    			}
+                dependencies.add(resolveDeploymentPackage(project, project
+                        .getArtifact()));
+                List artifactList = new ArrayList();
+                artifactList.addAll(project.getArtifacts());
+                Collections.sort(artifactList, new ArtifactDepthComparator());
+                for (Iterator iter = artifactList.iterator(); iter.hasNext();) {
+                    Artifact artifact = (Artifact) iter.next();
+                    resolveArtifact(artifact, dependencies);
+                }
             }
 
-			getLog().info("------------------ Deployment Analysis --------------------");
-			getLog().info(project.getName() + " has " + (dependencies.size() - 1)
-							+ " child dependencies");
-
-			for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) {
-				getLog().info(" - " + iterator.next());
-			}
-
-			getLog().info("-----------------------------------------------------------");
-
-			if (deployDependencies) {
-				// We need to stop all the dependencies first
-				if (!deferExceptions) {
-					for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) {
-						JbiDeployableArtifact jbiDeployable = (JbiDeployableArtifact) iterator.next();
-
-						if (forceUpdate && isDeployed(jbiDeployable)) {
-							stopDependency(jbiDeployable);
-							undeployDependency(jbiDeployable);
-						}
-					}
-				}
-
-				// Now we can walk the dependencies bottom up - re-deploying and
-				// starting them
-				while (!dependencies.empty()) {
-					JbiDeployableArtifact jbiDeployable = (JbiDeployableArtifact) dependencies
-							.pop();
+            getLog()
+                    .info(
+                            "------------------ Deployment Analysis --------------------");
+            getLog().info(
+                    project.getName() + " has " + (dependencies.size() - 1)
+                            + " child dependencies");
+
+            for (Iterator iterator = dependencies.iterator(); iterator
+                    .hasNext();) {
+                getLog().info(" - " + iterator.next());
+            }
+
+            getLog()
+                    .info(
+                            "-----------------------------------------------------------");
+
+            if (deployDependencies) {
+                // We need to stop all the dependencies first
+                if (!deferExceptions) {
+                    for (Iterator iterator = dependencies.iterator(); iterator
+                            .hasNext();) {
+                        JbiDeployableArtifact jbiDeployable = (JbiDeployableArtifact) iterator
+                                .next();
+
+                        if (forceUpdate && isDeployed(jbiDeployable)) {
+                            stopDependency(jbiDeployable);
+                            undeployDependency(jbiDeployable);
+                        }
+                    }
+                }
+
+                // Now we can walk the dependencies bottom up - re-deploying and
+                // starting them
+                while (!dependencies.empty()) {
+                    JbiDeployableArtifact jbiDeployable = (JbiDeployableArtifact) dependencies
+                            .pop();
                     if (forceUpdate || !isDeployed(jbiDeployable)) {
-    					deployDependency(jbiDeployable, deferExceptions);
-    					if (!deferExceptions) {
-    						startDependency(jbiDeployable);
+                        deployDependency(jbiDeployable, deferExceptions);
+                        if (!deferExceptions) {
+                            startDependency(jbiDeployable);
                         }
                     }
-				}
-			} else {
-				JbiDeployableArtifact jbiDeployable = (JbiDeployableArtifact) dependencies
-						.firstElement();
-				if (isDeployed(jbiDeployable)) {
-					stopDependency(jbiDeployable);
-					undeployDependency(jbiDeployable);
-				}
-				deployDependency(jbiDeployable, deferExceptions);
-				startDependency(jbiDeployable);
-			}
-
-		} catch (Exception e) {
-			throw new MojoExecutionException("Unable to deploy project, "
-					+ e.getMessage(), e);
-		}
-
-	}
-
-	private void startDependency(JbiDeployableArtifact jbiDeployable) {
-		getLog().info("Starting " + jbiDeployable.getName());
-		if (JBI_SERVICE_ASSEMBLY.equals(jbiDeployable.getType())) {
-			StartServiceAssemblyTask startTask = new StartServiceAssemblyTask();
-			initializeJbiTask(startTask);
-			startTask.setName(jbiDeployable.getName());
-			startTask.execute();
-		}
-		if (JBI_COMPONENT.equals(jbiDeployable.getType())) {
-			StartComponentTask startTask = new StartComponentTask();
-			initializeJbiTask(startTask);
-			startTask.setName(jbiDeployable.getName());
-			startTask.execute();
-		}
-	}
-
-	private void undeployDependency(JbiDeployableArtifact jbiDeployable) {
-		getLog().info("Undeploying " + jbiDeployable.getFile());
-		if (JBI_SHARED_LIBRARY.equals(jbiDeployable.getType())) {
-			UninstallSharedLibraryTask sharedLibraryTask = new UninstallSharedLibraryTask();
-			initializeJbiTask(sharedLibraryTask);
-			sharedLibraryTask.setName(jbiDeployable.getName());
-			sharedLibraryTask.execute();
-		} else if (JBI_SERVICE_ASSEMBLY.equals(jbiDeployable.getType())) {
-			UndeployServiceAssemblyTask serviceAssemblyTask = new UndeployServiceAssemblyTask();
-			initializeJbiTask(serviceAssemblyTask);
-			serviceAssemblyTask.setName(jbiDeployable.getName());
-			serviceAssemblyTask.execute();
-		}
-		if (JBI_COMPONENT.equals(jbiDeployable.getType())) {
-			UninstallComponentTask componentTask = new UninstallComponentTask();
-			initializeJbiTask(componentTask);
-			componentTask.setName(jbiDeployable.getName());
-			componentTask.execute();
-		}
-	}
-
-	private boolean isDeployed(JbiDeployableArtifact jbiDeployable) {
-		IsDeployedTask isDeployedTask = new IsDeployedTask();
-		isDeployedTask.setType(jbiDeployable.getType());
-		isDeployedTask.setName(jbiDeployable.getName());
-		initializeJbiTask(isDeployedTask);
-		isDeployedTask.execute();
-		boolean deployed = isDeployedTask.isDeployed();
-		if (deployed)
-			getLog().info(jbiDeployable.getName() + " is deployed");
-		else
-			getLog().info(jbiDeployable.getName() + " is not deployed");
-		return deployed;
-	}
-
-	private void stopDependency(JbiDeployableArtifact jbiDeployable) {
-		getLog().info("Stopping " + jbiDeployable.getName());
-		if (JBI_SERVICE_ASSEMBLY.equals(jbiDeployable.getType())) {
-			StopServiceAssemblyTask stopTask = new StopServiceAssemblyTask();
-			initializeJbiTask(stopTask);
-			stopTask.setName(jbiDeployable.getName());
-			stopTask.execute();
-
-			ShutDownServiceAssemblyTask shutdownTask = new ShutDownServiceAssemblyTask();
-			initializeJbiTask(shutdownTask);
-			shutdownTask.setName(jbiDeployable.getName());
-			shutdownTask.execute();
-		}
-		if (JBI_COMPONENT.equals(jbiDeployable.getType())) {
-			StopComponentTask stopTask = new StopComponentTask();
-			initializeJbiTask(stopTask);
-			stopTask.setName(jbiDeployable.getName());
-			stopTask.execute();
-
-			ShutDownComponentTask shutdownTask = new ShutDownComponentTask();
-			initializeJbiTask(shutdownTask);
-			shutdownTask.setName(jbiDeployable.getName());
-			shutdownTask.execute();
-		}
-	}
-
-	private void deployDependency(JbiDeployableArtifact jbiDeployable,
-			boolean doDeferExceptions) {
-
-		getLog().info(
-				"Deploying " + jbiDeployable.getType() + " from "
-						+ jbiDeployable.getFile());
-		if (JBI_SHARED_LIBRARY.equals(jbiDeployable.getType())) {
-			InstallSharedLibraryTask componentTask = new InstallSharedLibraryTask();
-			initializeJbiTask(componentTask);
-			componentTask.setFile(jbiDeployable.getFile());
-			componentTask.setDeferExceptions(doDeferExceptions);
-			componentTask.execute();
-		} else if (JBI_SERVICE_ASSEMBLY.equals(jbiDeployable.getType())) {
-			DeployServiceAssemblyTask componentTask = new DeployServiceAssemblyTask();
-			initializeJbiTask(componentTask);
-			componentTask.setFile(jbiDeployable.getFile());
-			componentTask.setDeferExceptions(doDeferExceptions);
-			componentTask.execute();
-		}
-		if (JBI_COMPONENT.equals(jbiDeployable.getType())) {
-			InstallComponentTask componentTask = new InstallComponentTask();
-			initializeJbiTask(componentTask);
-			componentTask.setFile(jbiDeployable.getFile());
-			componentTask.setDeferExceptions(doDeferExceptions);
-			componentTask.execute();
-		}
-
-	}
-
-	private List getDeployablePackagingTypes() {
-		if (deploymentTypes == null) {
-			deploymentTypes = new ArrayList();
-			deploymentTypes.add(JBI_SHARED_LIBRARY);
-			deploymentTypes.add(JBI_SERVICE_ASSEMBLY);
-			deploymentTypes.add(JBI_COMPONENT);
-		}
-		return deploymentTypes;
-	}
-
-	private Collection resolveArtifact(Artifact artifact, Stack dependencies)
-			throws ArtifactResolutionException, ArtifactNotFoundException {
-		MavenProject project = null;
-		try {
-			project = projectBuilder.buildFromRepository(artifact, remoteRepos, localRepo, false);
-		} catch (ProjectBuildingException e) {
-			getLog().warn("Unable to determine packaging for dependency : "
-							+ artifact.getArtifactId() + " assuming jar");
-		}
-
-		if (project != null) {
-			if (getDeployablePackagingTypes().contains(project.getPackaging())) {
-				getLog().debug("Checking for dependency from project " + project.getArtifactId());
-				JbiDeployableArtifact deployableArtifact = resolveDeploymentPackage(project, artifact);
-				if (!dependencies.contains(deployableArtifact)) {
-					getLog().debug("Adding dependency from project " + project.getArtifactId());
-					dependencies.push(deployableArtifact);
-				}
-                ArrayList artifactList = new ArrayList();
+                }
+            } else {
+                JbiDeployableArtifact jbiDeployable = (JbiDeployableArtifact) dependencies
+                        .firstElement();
+                if (isDeployed(jbiDeployable)) {
+                    stopDependency(jbiDeployable);
+                    undeployDependency(jbiDeployable);
+                }
+                deployDependency(jbiDeployable, deferExceptions);
+                startDependency(jbiDeployable);
+            }
+
+        } catch (Exception e) {
+            throw new MojoExecutionException("Unable to deploy project, "
+                    + e.getMessage(), e);
+        }
+
+    }
+
+    private void startDependency(JbiDeployableArtifact jbiDeployable) {
+        getLog().info("Starting " + jbiDeployable.getName());
+        if (JBI_SERVICE_ASSEMBLY.equals(jbiDeployable.getType())) {
+            StartServiceAssemblyTask startTask = new StartServiceAssemblyTask();
+            initializeJbiTask(startTask);
+            startTask.setName(jbiDeployable.getName());
+            startTask.execute();
+        }
+        if (JBI_COMPONENT.equals(jbiDeployable.getType())) {
+            StartComponentTask startTask = new StartComponentTask();
+            initializeJbiTask(startTask);
+            startTask.setName(jbiDeployable.getName());
+            startTask.execute();
+        }
+    }
+
+    private void undeployDependency(JbiDeployableArtifact jbiDeployable) {
+        getLog().info("Undeploying " + jbiDeployable.getFile());
+        if (JBI_SHARED_LIBRARY.equals(jbiDeployable.getType())) {
+            UninstallSharedLibraryTask sharedLibraryTask = new UninstallSharedLibraryTask();
+            initializeJbiTask(sharedLibraryTask);
+            sharedLibraryTask.setName(jbiDeployable.getName());
+            sharedLibraryTask.execute();
+        } else if (JBI_SERVICE_ASSEMBLY.equals(jbiDeployable.getType())) {
+            UndeployServiceAssemblyTask serviceAssemblyTask = new UndeployServiceAssemblyTask();
+            initializeJbiTask(serviceAssemblyTask);
+            serviceAssemblyTask.setName(jbiDeployable.getName());
+            serviceAssemblyTask.execute();
+        }
+        if (JBI_COMPONENT.equals(jbiDeployable.getType())) {
+            UninstallComponentTask componentTask = new UninstallComponentTask();
+            initializeJbiTask(componentTask);
+            componentTask.setName(jbiDeployable.getName());
+            componentTask.execute();
+        }
+    }
+
+    private boolean isDeployed(JbiDeployableArtifact jbiDeployable) {
+        IsDeployedTask isDeployedTask = new IsDeployedTask();
+        isDeployedTask.setType(jbiDeployable.getType());
+        isDeployedTask.setName(jbiDeployable.getName());
+        initializeJbiTask(isDeployedTask);
+        isDeployedTask.execute();
+        boolean deployed = isDeployedTask.isDeployed();
+        if (deployed) {
+            getLog().info(jbiDeployable.getName() + " is deployed");
+        } else {
+            getLog().info(jbiDeployable.getName() + " is not deployed");
+        }
+        return deployed;
+    }
+
+    private void stopDependency(JbiDeployableArtifact jbiDeployable) {
+        getLog().info("Stopping " + jbiDeployable.getName());
+        if (JBI_SERVICE_ASSEMBLY.equals(jbiDeployable.getType())) {
+            StopServiceAssemblyTask stopTask = new StopServiceAssemblyTask();
+            initializeJbiTask(stopTask);
+            stopTask.setName(jbiDeployable.getName());
+            stopTask.execute();
+
+            ShutDownServiceAssemblyTask shutdownTask = new ShutDownServiceAssemblyTask();
+            initializeJbiTask(shutdownTask);
+            shutdownTask.setName(jbiDeployable.getName());
+            shutdownTask.execute();
+        }
+        if (JBI_COMPONENT.equals(jbiDeployable.getType())) {
+            StopComponentTask stopTask = new StopComponentTask();
+            initializeJbiTask(stopTask);
+            stopTask.setName(jbiDeployable.getName());
+            stopTask.execute();
+
+            ShutDownComponentTask shutdownTask = new ShutDownComponentTask();
+            initializeJbiTask(shutdownTask);
+            shutdownTask.setName(jbiDeployable.getName());
+            shutdownTask.execute();
+        }
+    }
+
+    private void deployDependency(JbiDeployableArtifact jbiDeployable,
+            boolean doDeferExceptions) {
+
+        getLog().info(
+                "Deploying " + jbiDeployable.getType() + " from "
+                        + jbiDeployable.getFile());
+        if (JBI_SHARED_LIBRARY.equals(jbiDeployable.getType())) {
+            InstallSharedLibraryTask componentTask = new InstallSharedLibraryTask();
+            initializeJbiTask(componentTask);
+            componentTask.setFile(jbiDeployable.getFile());
+            componentTask.setDeferExceptions(doDeferExceptions);
+            componentTask.execute();
+        } else if (JBI_SERVICE_ASSEMBLY.equals(jbiDeployable.getType())) {
+            DeployServiceAssemblyTask componentTask = new DeployServiceAssemblyTask();
+            initializeJbiTask(componentTask);
+            componentTask.setFile(jbiDeployable.getFile());
+            componentTask.setDeferExceptions(doDeferExceptions);
+            componentTask.execute();
+        }
+        if (JBI_COMPONENT.equals(jbiDeployable.getType())) {
+            InstallComponentTask componentTask = new InstallComponentTask();
+            initializeJbiTask(componentTask);
+            componentTask.setFile(jbiDeployable.getFile());
+            componentTask.setDeferExceptions(doDeferExceptions);
+            componentTask.execute();
+        }
+
+    }
+
+    private List getDeployablePackagingTypes() {
+        if (deploymentTypes == null) {
+            deploymentTypes = new ArrayList();
+            deploymentTypes.add(JBI_SHARED_LIBRARY);
+            deploymentTypes.add(JBI_SERVICE_ASSEMBLY);
+            deploymentTypes.add(JBI_COMPONENT);
+        }
+        return deploymentTypes;
+    }
+
+    private Collection resolveArtifact(Artifact artifact, 
+                                       Stack dependencies) throws ArtifactResolutionException, ArtifactNotFoundException {
+        MavenProject project = null;
+        try {
+            project = projectBuilder.buildFromRepository(artifact, remoteRepos,
+                    localRepo, false);
+        } catch (ProjectBuildingException e) {
+            getLog().warn(
+                    "Unable to determine packaging for dependency : "
+                            + artifact.getArtifactId() + " assuming jar");
+        }
+
+        if (project != null) {
+            if (getDeployablePackagingTypes().contains(project.getPackaging())) {
+                getLog().debug(
+                        "Checking for dependency from project "
+                                + project.getArtifactId());
+                JbiDeployableArtifact deployableArtifact = resolveDeploymentPackage(
+                        project, artifact);
+                if (!dependencies.contains(deployableArtifact)) {
+                    getLog().debug(
+                            "Adding dependency from project "
+                                    + project.getArtifactId());
+                    dependencies.push(deployableArtifact);
+                }
+                List artifactList = new ArrayList();
                 artifactList.addAll(project.getArtifacts());
                 Collections.sort(artifactList, new ArtifactDepthComparator());
                 for (Iterator iter = artifactList.iterator(); iter.hasNext();) {
                     resolveArtifact((Artifact) iter.next(), dependencies);
                 }
-			} else {
-			    getLog().debug("Ignoring non-jbi dependency: " + project.getArtifactId() + " of type " + project.getPackaging());         
+            } else {
+                getLog().debug(
+                        "Ignoring non-jbi dependency: "
+                                + project.getArtifactId() + " of type "
+                                + project.getPackaging());
+            }
+        }
+        return dependencies;
+    }
+
+    private JbiDeployableArtifact resolveDeploymentPackage(
+            MavenProject project, 
+            Artifact artifact) throws ArtifactResolutionException, ArtifactNotFoundException {
+        Artifact jbiArtifact = factory.createArtifactWithClassifier(artifact
+                .getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
+                "zip", getExtension(project));
+        resolver.resolve(jbiArtifact, remoteRepos, localRepo);
+        return new JbiDeployableArtifact(project.getArtifactId(), project
+                .getPackaging(), jbiArtifact.getFile().getAbsolutePath());
+    }
+
+    private String getExtension(MavenProject project2) {
+        if (project2.getPackaging().equals(JBI_SERVICE_ASSEMBLY)) {
+            return "";
+        } else {
+            return "installer";
+        }
+    }
+
+    private class ArtifactDepthComparator implements Comparator {
+
+        public int compare(Object arg0, Object arg1) {
+            int size1 = ((Artifact) arg0).getDependencyTrail().size();
+            int size2 = ((Artifact) arg1).getDependencyTrail().size();
+            if (size1 == size2) {
+                return 0;
+            }
+            if (size1 > size2) {
+                return 1;
+            } else {
+                return -1;
+            }
+        }
+
+    }
+
+    private class JbiDeployableArtifact {
+        private String file;
+
+        private String type;
+
+        private String name;
+
+        public JbiDeployableArtifact(String name, String type, String file) {
+            this.name = name;
+            this.file = file;
+            this.type = type;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getFile() {
+            return file;
+        }
+
+        public String getType() {
+            return type;
+        }
+
+        public String toString() {
+            return type + " : " + file;
+        }
+
+        public boolean equals(Object obj) {
+            if (obj instanceof JbiDeployableArtifact) {
+                return ((JbiDeployableArtifact) obj).toString().equals(this.toString());
+            } else {
+                return false;
             }
-		}
-		return dependencies;
-	}
-
-	private JbiDeployableArtifact resolveDeploymentPackage(
-			MavenProject project, Artifact artifact)
-			throws ArtifactResolutionException, ArtifactNotFoundException {
-		Artifact jbiArtifact = factory.createArtifactWithClassifier(artifact
-				.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
-				"zip", getExtension(project));
-		resolver.resolve(jbiArtifact, remoteRepos, localRepo);
-		return new JbiDeployableArtifact(project.getArtifactId(), project
-				.getPackaging(), jbiArtifact.getFile().getAbsolutePath());
-	}
-
-	private String getExtension(MavenProject project2) {
-		if (project2.getPackaging().equals(JBI_SERVICE_ASSEMBLY))
-			return "";
-		else
-			return "installer";
-	}
-
-	private class ArtifactDepthComparator implements Comparator {
-
-		public int compare(Object arg0, Object arg1) {
-			int size1 = ((Artifact) arg0).getDependencyTrail().size();
-			int size2 = ((Artifact) arg1).getDependencyTrail().size();
-			if (size1 == size2)
-				return 0;
-			if (size1 > size2)
-				return 1;
-			else
-				return -1;
-		}
-
-	}
-
-	private class JbiDeployableArtifact {
-		private String file;
-
-		private String type;
-
-		private String name;
-
-		public String getName() {
-			return name;
-		}
-
-		public JbiDeployableArtifact(String name, String type, String file) {
-			this.name = name;
-			this.file = file;
-			this.type = type;
-		}
-
-		public String getFile() {
-			return file;
-		}
-
-		public String getType() {
-			return type;
-		}
-
-		public String toString() {
-			return type + " : " + file;
-		}
-
-		public boolean equals(Object obj) {
-			if (obj instanceof JbiDeployableArtifact)
-				return ((JbiDeployableArtifact) obj).toString().equals(
-						this.toString());
-			else
-				return false;
-		}
-	}
+        }
+        
+        public int hashCode() {
+            return toString().hashCode();
+        }
+    }
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiResolutionListener.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiResolutionListener.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/JbiResolutionListener.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiResolutionListener.java Thu Jun 28 08:47:21 2007
@@ -16,152 +16,136 @@
  */
 package org.apache.servicemix.maven.plugin.jbi;
 
-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;
-
-import java.util.ArrayList;
 import java.util.Collection;
 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.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
  */
-public class JbiResolutionListener
-    implements ResolutionListener
-{
+public class JbiResolutionListener 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);
+    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() )
-        {
+    public void startProcessChildren(Artifact artifact) {
+        // getLog().debug("startProcessChildren: " + artifact);
+        Node node = (Node) artifacts.get(artifact.getDependencyConflictId());
+        if (parents.isEmpty()) {
             rootNode = node;
         }
-        parents.push( node );
+        parents.push(node);
     }
 
-    public void endProcessChildren( Artifact artifact )
-    {
-        //getLog().debug("endProcessChildren: " + artifact);
+    public void endProcessChildren(Artifact artifact) {
+        // getLog().debug("endProcessChildren: " + artifact);
         Node check = (Node) parents.pop();
-        assert artifact.equals( check.artifact );
+        assert artifact.equals(check.artifact);
     }
 
-    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() );
+    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.artifact = kept;
     }
 
-    public void omitForCycle( Artifact artifact )
-    {
-        //getLog().debug("omitForCycle: " + artifact);
+    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() );
+    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 );
+            artifacts.put(artifact.getDependencyConflictId(), node);
         }
         node.artifact = artifact;
-        if ( !parents.isEmpty() )
-        {
+        if (!parents.isEmpty()) {
             Node parent = (Node) parents.peek();
-            parent.children.add( node );
-            node.parents.add( parent );
+            parent.children.add(node);
+            node.parents.add(parent);
         }
         if (rootNode != null) {
-            //print(rootNode, "");
+            // print(rootNode, "");
         }
     }
-    
-    protected void print(Node rootNode, String string) {
-        //getLog().debug(string + rootNode.getArtifact());
-        for (Iterator iter = rootNode.getChildren().iterator(); iter.hasNext();) {
+
+    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.artifact.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.artifact.setVersion( replacement.getVersion() );
+    public void updateScope(Artifact artifact, String scope) {
+        // getLog().debug("updateScope: " + artifact);
+        Node node = (Node) artifacts.get(artifact.getDependencyConflictId());
+
+        node.artifact.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.artifact.setVersion(replacement.getVersion());
             }
-            if ( replacement.getScope() != null )
-            {
-                node.artifact.setScope( replacement.getScope() );
+            if (replacement.getScope() != null) {
+                node.artifact.setScope(replacement.getScope());
             }
         }
     }
 
-    public void updateScopeCurrentPom( Artifact artifact, String key )
-    {
-        
+    public void updateScopeCurrentPom(Artifact artifact, String key) {
+
         getLog().debug("updateScopeCurrentPom: " + artifact);
         // intentionally blank
     }
 
-    public void selectVersionFromRange( Artifact artifact )
-    {
-        
+    public void selectVersionFromRange(Artifact artifact) {
+
         getLog().debug("selectVersionFromRange: " + artifact);
         // intentionally blank
     }
 
-    public void restrictRange( Artifact artifact, Artifact artifact1, VersionRange versionRange )
-    {
-        
+    public void restrictRange(Artifact artifact, Artifact artifact1,
+            VersionRange versionRange) {
+
         getLog().debug("restrictRange: " + artifact);
         // intentionally blank
     }
@@ -169,25 +153,23 @@
     public Node getNode(Artifact artifact) {
         return (Node) artifacts.get(artifact.getDependencyConflictId());
     }
-    
-    public Collection getArtifacts()
-    {
+
+    public Collection getArtifacts() {
         return artifacts.values();
     }
 
-    static class Node
-    {
+    static class Node {
         private Set children = new HashSet();
+
         private Set parents = new HashSet();
+
         private Artifact artifact;
 
-        public Set getChildren()
-        {
+        public Set getChildren() {
             return children;
         }
 
-        public Artifact getArtifact()
-        {
+        public Artifact getArtifact() {
             return artifact;
         }
 
@@ -196,8 +178,7 @@
         }
     }
 
-    public Node getRootNode()
-    {
+    public Node getRootNode() {
         return rootNode;
     }
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceAssemblyDescriptorWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceAssemblyDescriptorWriter.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/JbiServiceAssemblyDescriptorWriter.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceAssemblyDescriptorWriter.java Thu Jun 28 08:47:21 2007
@@ -34,146 +34,146 @@
  * 
  */
 public class JbiServiceAssemblyDescriptorWriter extends
-		AbstractDescriptorWriter {
+        AbstractDescriptorWriter {
 
-	private final String encoding;
+    private final String encoding;
 
-	public JbiServiceAssemblyDescriptorWriter(String encoding) {
-		this.encoding = encoding;
-	}
+    public JbiServiceAssemblyDescriptorWriter(String encoding) {
+        this.encoding = encoding;
+    }
 
-	public void write(File descriptor, String name, String description,
-			List uris, List connections) throws JbiPluginException {
+    public void write(File descriptor, String name, String description,
+            List uris, List connections) throws JbiPluginException {
         PrintWriter w;
-		try {
-			w = new PrintWriter(descriptor, encoding);
-		} catch (IOException ex) {
-			throw new JbiPluginException("Exception while opening file["
-					+ descriptor.getAbsolutePath() + "]", ex);
-		}
-
-		XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
-		writer.startElement("jbi");
-		writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
-		writer.addAttribute("version", "1.0");
-
-		writer.startElement("service-assembly");
-
-		writer.startElement("identification");
-		writer.startElement("name");
-		writer.writeText(name);
-		writer.endElement();
-		writer.startElement("description");
-		writer.writeText(description);
-		writer.endElement();
-		writer.endElement();
-
-		for (Iterator it = uris.iterator(); it.hasNext();) {
-			DependencyInformation serviceUnitInfo = (DependencyInformation) it
-					.next();
-			writeServiceUnit(writer, serviceUnitInfo);
-
-		}
-
-		if (!connections.isEmpty()) {
-			writer.startElement("connections");
-
-			Map namespaceMap = buildNamespaceMap(connections);
-			for (Iterator it = connections.iterator(); it.hasNext();) {
-				GenerateServiceAssemblyDescriptorMojo.Connection connection = (GenerateServiceAssemblyDescriptorMojo.Connection) it
-						.next();
-				writeConnection(namespaceMap, writer, connection);
-
-			}
-			writer.endElement();
-		}
-
-		writer.endElement();
-		writer.endElement();
-
-		close(w);
-	}
-
-	private Map buildNamespaceMap(List connections) {
-		List consumes = new ArrayList();
-		List provides = new ArrayList();
-		for (Iterator it = connections.iterator(); it.hasNext();) {
-			GenerateServiceAssemblyDescriptorMojo.Connection connection = (GenerateServiceAssemblyDescriptorMojo.Connection) it
-					.next();
-			consumes.add(connection.getConsumes());
-			provides.add(connection.getProvides());
-		}
-
-		return getNamespaceMap(provides, consumes);
-
-	}
-
-	private void writeConnection(Map namespaceMap, XMLWriter writer,
-			Connection connection) {
-		writer.startElement("connection");
-		if (connection.getConsumes() != null) {
-			writer.startElement("consumer");
-			addQNameAttribute(writer, "interface-name", connection
-					.getConsumes().getInterfaceName(), namespaceMap);
-			addQNameAttribute(writer, "service-name", connection.getConsumes()
-					.getServiceName(), namespaceMap);
-			addStringAttribute(writer, "endpoint-name", connection
-					.getConsumes().getEndpointName());
-			writer.endElement();
-		}
-		if (connection.getProvides() != null) {
-			writer.startElement("provider");
-			addQNameAttribute(writer, "interface-name", connection
-					.getProvides().getInterfaceName(), namespaceMap);
-			addQNameAttribute(writer, "service-name", connection.getProvides()
-					.getServiceName(), namespaceMap);
-			addStringAttribute(writer, "endpoint-name", connection
-					.getProvides().getEndpointName());
-			writer.endElement();
-		}
-
-		writer.endElement();
-
-	}
-
-	private void writeServiceUnit(XMLWriter writer,
-			DependencyInformation serviceUnitInfo) throws JbiPluginException {
-		writer.startElement("service-unit");
-		writer.startElement("identification");
-		writer.startElement("name");
-		writer.writeText(serviceUnitInfo.getName());
-		writer.endElement();
-		writer.startElement("description");
+        try {
+            w = new PrintWriter(descriptor, encoding);
+        } catch (IOException ex) {
+            throw new JbiPluginException("Exception while opening file["
+                    + descriptor.getAbsolutePath() + "]", ex);
+        }
+
+        XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
+        writer.startElement("jbi");
+        writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
+        writer.addAttribute("version", "1.0");
+
+        writer.startElement("service-assembly");
+
+        writer.startElement("identification");
+        writer.startElement("name");
+        writer.writeText(name);
+        writer.endElement();
+        writer.startElement("description");
+        writer.writeText(description);
+        writer.endElement();
+        writer.endElement();
+
+        for (Iterator it = uris.iterator(); it.hasNext();) {
+            DependencyInformation serviceUnitInfo = (DependencyInformation) it
+                    .next();
+            writeServiceUnit(writer, serviceUnitInfo);
+
+        }
+
+        if (!connections.isEmpty()) {
+            writer.startElement("connections");
+
+            Map namespaceMap = buildNamespaceMap(connections);
+            for (Iterator it = connections.iterator(); it.hasNext();) {
+                GenerateServiceAssemblyDescriptorMojo.Connection connection = (GenerateServiceAssemblyDescriptorMojo.Connection) it
+                        .next();
+                writeConnection(namespaceMap, writer, connection);
+
+            }
+            writer.endElement();
+        }
+
+        writer.endElement();
+        writer.endElement();
+
+        close(w);
+    }
+
+    private Map buildNamespaceMap(List connections) {
+        List consumes = new ArrayList();
+        List provides = new ArrayList();
+        for (Iterator it = connections.iterator(); it.hasNext();) {
+            GenerateServiceAssemblyDescriptorMojo.Connection connection = (GenerateServiceAssemblyDescriptorMojo.Connection) it
+                    .next();
+            consumes.add(connection.getConsumes());
+            provides.add(connection.getProvides());
+        }
+
+        return getNamespaceMap(provides, consumes);
+
+    }
+
+    private void writeConnection(Map namespaceMap, XMLWriter writer,
+            Connection connection) {
+        writer.startElement("connection");
+        if (connection.getConsumes() != null) {
+            writer.startElement("consumer");
+            addQNameAttribute(writer, "interface-name", connection
+                    .getConsumes().getInterfaceName(), namespaceMap);
+            addQNameAttribute(writer, "service-name", connection.getConsumes()
+                    .getServiceName(), namespaceMap);
+            addStringAttribute(writer, "endpoint-name", connection
+                    .getConsumes().getEndpointName());
+            writer.endElement();
+        }
+        if (connection.getProvides() != null) {
+            writer.startElement("provider");
+            addQNameAttribute(writer, "interface-name", connection
+                    .getProvides().getInterfaceName(), namespaceMap);
+            addQNameAttribute(writer, "service-name", connection.getProvides()
+                    .getServiceName(), namespaceMap);
+            addStringAttribute(writer, "endpoint-name", connection
+                    .getProvides().getEndpointName());
+            writer.endElement();
+        }
+
+        writer.endElement();
+
+    }
+
+    private void writeServiceUnit(XMLWriter writer,
+            DependencyInformation serviceUnitInfo) throws JbiPluginException {
+        writer.startElement("service-unit");
+        writer.startElement("identification");
+        writer.startElement("name");
+        writer.writeText(serviceUnitInfo.getName());
+        writer.endElement();
+        writer.startElement("description");
         if (serviceUnitInfo.getDescription() != null) {
             writer.writeText(serviceUnitInfo.getDescription());
         } else {
             writer.writeText(serviceUnitInfo.getName());
         }
-		writer.endElement();
-		writer.endElement();
+        writer.endElement();
+        writer.endElement();
 
-		writer.startElement("target");
-		writer.startElement("artifacts-zip");
-		writer.writeText(serviceUnitInfo.getFilename());
-		writer.endElement();
-
-		writer.startElement("component-name");
-		writer.writeText(serviceUnitInfo.getComponent());
-		writer.endElement();
-
-		writer.endElement();
-
-		writer.endElement();
-	}
-
-	private void close(Writer closeable) {
-		if (closeable != null) {
-			try {
-				closeable.close();
-			} catch (Exception e) {
-				// TODO: warn
-			}
-		}
-	}
+        writer.startElement("target");
+        writer.startElement("artifacts-zip");
+        writer.writeText(serviceUnitInfo.getFilename());
+        writer.endElement();
+
+        writer.startElement("component-name");
+        writer.writeText(serviceUnitInfo.getComponent());
+        writer.endElement();
+
+        writer.endElement();
+
+        writer.endElement();
+    }
+
+    private void close(Writer closeable) {
+        if (closeable != null) {
+            try {
+                closeable.close();
+            } catch (Exception e) {
+                // TODO: warn
+            }
+        }
+    }
 
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceFileAnalyzer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceFileAnalyzer.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/JbiServiceFileAnalyzer.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceFileAnalyzer.java Thu Jun 28 08:47:21 2007
@@ -23,15 +23,16 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.servicemix.common.packaging.Consumes;
-import org.apache.servicemix.common.packaging.Provides;
-import org.apache.servicemix.common.packaging.ServiceUnitAnalyzer;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.servicemix.common.packaging.Consumes;
+import org.apache.servicemix.common.packaging.Provides;
+import org.apache.servicemix.common.packaging.ServiceUnitAnalyzer;
+
 /**
  * A dummy implementation of the ServiceUnitAnalyzer that allows you to generate
  * the consumes and provides from a simple XML file
@@ -39,73 +40,72 @@
  */
 public class JbiServiceFileAnalyzer implements ServiceUnitAnalyzer {
 
-	List consumes = new ArrayList();
+    public static final String JBI_NAMESPACE = "http://java.sun.com/xml/ns/jbi";
 
-	List provides = new ArrayList();
+    private List consumes = new ArrayList();
 
-	private static final String JBI_NAMESPACE = "http://java.sun.com/xml/ns/jbi";
+    private List provides = new ArrayList();
 
-	public List getConsumes() {
-		return consumes;
-	}
-
-	public List getProvides() {
-		return provides;
-	}
-
-	public void init(File explodedServiceUnitRoot) {
-
-	}
-
-	public void setJbiServicesFile(File jbiServicesFile)
-			throws MojoExecutionException {
-		parseXml(jbiServicesFile);
-	}
-
-	private void parseXml(File jbiServicesFile) throws MojoExecutionException {
-		try {
-			DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-			dbf.setNamespaceAware(true);
-			DocumentBuilder db = dbf.newDocumentBuilder();
-			Document doc = db.parse(jbiServicesFile);
-
-			Node servicesNode = doc.getFirstChild();
-			if (XmlDescriptorHelper.isElement(servicesNode, JBI_NAMESPACE,
-					"services")) {
-				// We will process the children
-				Element servicesElement = (Element) servicesNode;
-				NodeList children = servicesElement.getChildNodes();
-				for (int i = 0; i < children.getLength(); i++) {
-					if (children.item(i) instanceof Element) {
-						Element childElement = (Element) children.item(i);
-						if (XmlDescriptorHelper.isElement(childElement,
-								JBI_NAMESPACE, "consumes")) {
-							Consumes newConsumes = new Consumes();
-							newConsumes.setEndpointName(XmlDescriptorHelper
-									.getEndpointName(childElement));
-							newConsumes.setInterfaceName(XmlDescriptorHelper
-									.getInterfaceName(childElement));
-							newConsumes.setServiceName(XmlDescriptorHelper
-									.getServiceName(childElement));
-							consumes.add(newConsumes);
-						} else if (XmlDescriptorHelper.isElement(childElement,
-								JBI_NAMESPACE, "provides")) {
-							Provides newProvides = new Provides();
-							newProvides.setEndpointName(XmlDescriptorHelper
-									.getEndpointName(childElement));
-							newProvides.setInterfaceName(XmlDescriptorHelper
-									.getInterfaceName(childElement));
-							newProvides.setServiceName(XmlDescriptorHelper
-									.getServiceName(childElement));
-							provides.add(newProvides);
-						}
-					}
-				}
-			}
-
-		} catch (Exception e) {
-			throw new MojoExecutionException("Unable to parse "
-					+ jbiServicesFile.getAbsolutePath());
-		}
-	}
+    public List getConsumes() {
+        return consumes;
+    }
+
+    public List getProvides() {
+        return provides;
+    }
+
+    public void init(File explodedServiceUnitRoot) {
+
+    }
+
+    public void setJbiServicesFile(File jbiServicesFile) throws MojoExecutionException {
+        parseXml(jbiServicesFile);
+    }
+
+    private void parseXml(File jbiServicesFile) throws MojoExecutionException {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document doc = db.parse(jbiServicesFile);
+
+            Node servicesNode = doc.getFirstChild();
+            if (XmlDescriptorHelper.isElement(servicesNode, JBI_NAMESPACE,
+                    "services")) {
+                // We will process the children
+                Element servicesElement = (Element) servicesNode;
+                NodeList children = servicesElement.getChildNodes();
+                for (int i = 0; i < children.getLength(); i++) {
+                    if (children.item(i) instanceof Element) {
+                        Element childElement = (Element) children.item(i);
+                        if (XmlDescriptorHelper.isElement(childElement,
+                                JBI_NAMESPACE, "consumes")) {
+                            Consumes newConsumes = new Consumes();
+                            newConsumes.setEndpointName(XmlDescriptorHelper
+                                    .getEndpointName(childElement));
+                            newConsumes.setInterfaceName(XmlDescriptorHelper
+                                    .getInterfaceName(childElement));
+                            newConsumes.setServiceName(XmlDescriptorHelper
+                                    .getServiceName(childElement));
+                            consumes.add(newConsumes);
+                        } else if (XmlDescriptorHelper.isElement(childElement,
+                                JBI_NAMESPACE, "provides")) {
+                            Provides newProvides = new Provides();
+                            newProvides.setEndpointName(XmlDescriptorHelper
+                                    .getEndpointName(childElement));
+                            newProvides.setInterfaceName(XmlDescriptorHelper
+                                    .getInterfaceName(childElement));
+                            newProvides.setServiceName(XmlDescriptorHelper
+                                    .getServiceName(childElement));
+                            provides.add(newProvides);
+                        }
+                    }
+                }
+            }
+
+        } catch (Exception e) {
+            throw new MojoExecutionException("Unable to parse "
+                    + jbiServicesFile.getAbsolutePath());
+        }
+    }
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceUnitDescriptorWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceUnitDescriptorWriter.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/JbiServiceUnitDescriptorWriter.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiServiceUnitDescriptorWriter.java Thu Jun 28 08:47:21 2007
@@ -35,88 +35,93 @@
  */
 public class JbiServiceUnitDescriptorWriter extends AbstractDescriptorWriter {
 
-	private final String encoding;
+    private final String encoding;
 
-	public JbiServiceUnitDescriptorWriter(String encoding) {
-		this.encoding = encoding;
-	}
-
-	public void write(File descriptor, boolean bc, String name, String description,
-			List uris, List consumes, List provides) throws JbiPluginException {
-		PrintWriter w;
-		try {
-			w = new PrintWriter(descriptor, encoding);
-		} catch (IOException ex) {
-			throw new JbiPluginException("Exception while opening file["
-					+ descriptor.getAbsolutePath() + "]", ex);
-		}
-
-		XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
-		writer.startElement("jbi");
-		writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
-		writer.addAttribute("version", "1.0");
-
-		writer.startElement("services");
-		writer.addAttribute("binding-component", bc ? "true" : "false");
-
-		// We need to get all the namespaces into a hashmap so we
-		// can get the QName output correctly
-		Map namespaceMap = getNamespaceMap(provides, consumes);
-
-		// Set-up the namespaces
-		for (Iterator iterator = namespaceMap.keySet().iterator(); iterator
-				.hasNext();) {
-			String key = (String) iterator.next();
-			StringBuffer namespaceDecl = new StringBuffer();
-			namespaceDecl.append("xmlns:");
-			namespaceDecl.append(namespaceMap.get(key));
-			writer.addAttribute(namespaceDecl.toString(), key);
-		}
-
-		// Put in the provides
-		for (Iterator iterator = provides.iterator(); iterator.hasNext();) {
-			Provides providesEntry = (Provides) iterator.next();
-			writer.startElement("provides");
-			addQNameAttribute(writer, "interface-name", providesEntry
-					.getInterfaceName(), namespaceMap);
-			addQNameAttribute(writer, "service-name", providesEntry
-					.getServiceName(), namespaceMap);
-			addStringAttribute(writer, "endpoint-name", providesEntry
-					.getEndpointName());
-			writer.endElement();
-		}
-
-		// Put in the consumes
-		for (Iterator iterator = consumes.iterator(); iterator.hasNext();) {
-			Consumes consumesEntry = (Consumes) iterator.next();
-			writer.startElement("consumes");
-			addQNameAttribute(writer, "interface-name", consumesEntry
-					.getInterfaceName(), namespaceMap);
-			addQNameAttribute(writer, "service-name", consumesEntry
-					.getServiceName(), namespaceMap);
-			addStringAttribute(writer, "endpoint-name", consumesEntry
-					.getEndpointName());
-
-			// TODO Handling of LinkType?
-
-			writer.endElement();
-		}
-
-		writer.endElement();
-
-		writer.endElement();
-
-		close(w);
-	}
-
-	private void close(Writer closeable) {
-		if (closeable != null) {
-			try {
-				closeable.close();
-			} catch (Exception e) {
-				// TODO: warn
-			}
-		}
-	}
+    public JbiServiceUnitDescriptorWriter(String encoding) {
+        this.encoding = encoding;
+    }
+
+    public void write(File descriptor, 
+                      boolean bc, 
+                      String name,
+                      String description, 
+                      List uris, 
+                      List consumes, 
+                      List provides) throws JbiPluginException {
+        PrintWriter w;
+        try {
+            w = new PrintWriter(descriptor, encoding);
+        } catch (IOException ex) {
+            throw new JbiPluginException("Exception while opening file["
+                    + descriptor.getAbsolutePath() + "]", ex);
+        }
+
+        XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
+        writer.startElement("jbi");
+        writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
+        writer.addAttribute("version", "1.0");
+
+        writer.startElement("services");
+        writer.addAttribute("binding-component", bc ? "true" : "false");
+
+        // We need to get all the namespaces into a hashmap so we
+        // can get the QName output correctly
+        Map namespaceMap = getNamespaceMap(provides, consumes);
+
+        // Set-up the namespaces
+        for (Iterator iterator = namespaceMap.keySet().iterator(); iterator
+                .hasNext();) {
+            String key = (String) iterator.next();
+            StringBuffer namespaceDecl = new StringBuffer();
+            namespaceDecl.append("xmlns:");
+            namespaceDecl.append(namespaceMap.get(key));
+            writer.addAttribute(namespaceDecl.toString(), key);
+        }
+
+        // Put in the provides
+        for (Iterator iterator = provides.iterator(); iterator.hasNext();) {
+            Provides providesEntry = (Provides) iterator.next();
+            writer.startElement("provides");
+            addQNameAttribute(writer, "interface-name", providesEntry
+                    .getInterfaceName(), namespaceMap);
+            addQNameAttribute(writer, "service-name", providesEntry
+                    .getServiceName(), namespaceMap);
+            addStringAttribute(writer, "endpoint-name", providesEntry
+                    .getEndpointName());
+            writer.endElement();
+        }
+
+        // Put in the consumes
+        for (Iterator iterator = consumes.iterator(); iterator.hasNext();) {
+            Consumes consumesEntry = (Consumes) iterator.next();
+            writer.startElement("consumes");
+            addQNameAttribute(writer, "interface-name", consumesEntry
+                    .getInterfaceName(), namespaceMap);
+            addQNameAttribute(writer, "service-name", consumesEntry
+                    .getServiceName(), namespaceMap);
+            addStringAttribute(writer, "endpoint-name", consumesEntry
+                    .getEndpointName());
+
+            // TODO Handling of LinkType?
+
+            writer.endElement();
+        }
+
+        writer.endElement();
+
+        writer.endElement();
+
+        close(w);
+    }
+
+    private void close(Writer closeable) {
+        if (closeable != null) {
+            try {
+                closeable.close();
+            } catch (Exception e) {
+                // TODO: warn
+            }
+        }
+    }
 
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiSharedLibraryDescriptorWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiSharedLibraryDescriptorWriter.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/JbiSharedLibraryDescriptorWriter.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/JbiSharedLibraryDescriptorWriter.java Thu Jun 28 08:47:21 2007
@@ -32,64 +32,68 @@
  */
 public class JbiSharedLibraryDescriptorWriter {
 
-	private final String encoding;
+    private final String encoding;
 
-	public JbiSharedLibraryDescriptorWriter(String encoding) {
-		this.encoding = encoding;
-	}
-
-	public void write(File descriptor, String name, String description,
-			String version, String classLoaderDelegation, List uris)
-			throws JbiPluginException {
+    public JbiSharedLibraryDescriptorWriter(String encoding) {
+        this.encoding = encoding;
+    }
+
+    public void write(File descriptor, 
+                      String name, 
+                      String description,
+                      String version, 
+                      String classLoaderDelegation, 
+                      List uris) throws JbiPluginException {
         PrintWriter w;
-		try {
-			w = new PrintWriter(descriptor, encoding);
-		} catch (IOException ex) {
-			throw new JbiPluginException("Exception while opening file["
-					+ descriptor.getAbsolutePath() + "]", ex);
-		}
-
-		XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
-		writer.startElement("jbi");
-		writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
-		writer.addAttribute("version", "1.0");
-
-		writer.startElement("shared-library");
-		writer.addAttribute("class-loader-delegation", classLoaderDelegation);
-		writer.addAttribute("version", version);
-
-		writer.startElement("identification");
-		writer.startElement("name");
-		writer.writeText(name);
-		writer.endElement();
-		writer.startElement("description");
-		writer.writeText(description);
-		writer.endElement();
-		writer.endElement();
-
-		writer.startElement("shared-library-class-path");
-		for (Iterator it = uris.iterator(); it.hasNext();) {
-			DependencyInformation dependency = (DependencyInformation) it.next();
-			writer.startElement("path-element");
-			writer.writeText(dependency.getFilename());
-			writer.endElement();			
-		}
-		writer.endElement();
-
-		writer.endElement();
-		writer.endElement();
-
-		close(w);
-	}
-
-	private void close(Writer closeable) {
-		if (closeable != null) {
-			try {
-				closeable.close();
-			} catch (Exception e) {
-				// TODO: warn
-			}
-		}
-	}
+        try {
+            w = new PrintWriter(descriptor, encoding);
+        } catch (IOException ex) {
+            throw new JbiPluginException("Exception while opening file["
+                    + descriptor.getAbsolutePath() + "]", ex);
+        }
+
+        XMLWriter writer = new PrettyPrintXMLWriter(w, encoding, null);
+        writer.startElement("jbi");
+        writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
+        writer.addAttribute("version", "1.0");
+
+        writer.startElement("shared-library");
+        writer.addAttribute("class-loader-delegation", classLoaderDelegation);
+        writer.addAttribute("version", version);
+
+        writer.startElement("identification");
+        writer.startElement("name");
+        writer.writeText(name);
+        writer.endElement();
+        writer.startElement("description");
+        writer.writeText(description);
+        writer.endElement();
+        writer.endElement();
+
+        writer.startElement("shared-library-class-path");
+        for (Iterator it = uris.iterator(); it.hasNext();) {
+            DependencyInformation dependency = (DependencyInformation) it
+                    .next();
+            writer.startElement("path-element");
+            writer.writeText(dependency.getFilename());
+            writer.endElement();
+        }
+        writer.endElement();
+
+        writer.endElement();
+        writer.endElement();
+
+        close(w);
+    }
+
+    private void close(Writer closeable) {
+        if (closeable != null) {
+            try {
+                closeable.close();
+            } catch (Exception e) {
+                // TODO: warn
+            }
+        }
+    }
 
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixEmbeddedMojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixEmbeddedMojo.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/ServiceMixEmbeddedMojo.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixEmbeddedMojo.java Thu Jun 28 08:47:21 2007
@@ -37,55 +37,55 @@
  */
 public class ServiceMixEmbeddedMojo extends AbstractJbiMojo {
 
-	/**
-	 * @parameter default-value="${basedir}/src/main/resources/servicemix.xml"
-	 */
-	private File servicemixConfig;
-
-	private FileSystemXmlApplicationContext context;
-
-	private SpringJBIContainer container;
-
-	public void execute() throws MojoExecutionException, MojoFailureException {
-
-		try {
-			startServiceMix();
-
-			Object lock = new Object();
-			container.setShutdownLock(lock);
-
-			// lets wait until we're killed.
-			synchronized (lock) {
-				lock.wait();
-			}
-		} catch (Exception e) {
-			throw new MojoExecutionException(
-					"Apache ServiceMix was able to deploy project", e);
-		} finally {
-			if (context instanceof DisposableBean) {
-				try {
-					((DisposableBean) context).destroy();
-				} catch (Exception e) {
-					// Ignore
-				}
-			}
-		}
+    /**
+     * @parameter default-value="${basedir}/src/main/resources/servicemix.xml"
+     */
+    private File servicemixConfig;
+
+    private FileSystemXmlApplicationContext context;
+
+    private SpringJBIContainer container;
+
+    public void execute() throws MojoExecutionException, MojoFailureException {
+
+        try {
+            startServiceMix();
+
+            Object lock = new Object();
+            container.setShutdownLock(lock);
+
+            // lets wait until we're killed.
+            synchronized (lock) {
+                lock.wait();
+            }
+        } catch (Exception e) {
+            throw new MojoExecutionException(
+                    "Apache ServiceMix was able to deploy project", e);
+        } finally {
+            if (context instanceof DisposableBean) {
+                try {
+                    ((DisposableBean) context).destroy();
+                } catch (Exception e) {
+                    // Ignore
+                }
+            }
+        }
 
-	}
+    }
 
-	private void startServiceMix() throws MojoExecutionException {
+    private void startServiceMix() throws MojoExecutionException {
         ClassLoader old = Thread.currentThread().getContextClassLoader();
-		try {
+        try {
             Thread.currentThread().setContextClassLoader(getClassLoader());
-			context = new FileSystemXmlApplicationContext("file:///" + servicemixConfig
-					.getAbsolutePath());
-			container = (SpringJBIContainer) context.getBean("jbi");
-		} catch (Exception e) {
-			throw new MojoExecutionException(
-					"Unable to start the ServiceMix container", e);
-		} finally {
-		    Thread.currentThread().setContextClassLoader(old);      
+            context = new FileSystemXmlApplicationContext("file:///"
+                    + servicemixConfig.getAbsolutePath());
+            container = (SpringJBIContainer) context.getBean("jbi");
+        } catch (Exception e) {
+            throw new MojoExecutionException(
+                    "Unable to start the ServiceMix container", e);
+        } finally {
+            Thread.currentThread().setContextClassLoader(old);
         }
-	}
+    }
 
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixMojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixMojo.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/ServiceMixMojo.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/ServiceMixMojo.java Thu Jun 28 08:47:21 2007
@@ -39,81 +39,82 @@
  */
 public class ServiceMixMojo extends JbiProjectDeployerMojo {
 
-	private JBIContainer jbiContainer;
+    private JBIContainer jbiContainer;
 
-	/**
-	 * @parameter default-value="${project.build.directory}/servicemix/install"
-	 */
-	private String installDirectory;
-
-	/**
-	 * @parameter default-value="${project.build.directory}/servicemix/deploy"
-	 */
-	private String deploymentDirectory;
-
-	/**
-	 * @parameter default-value="${project.build.directory}/servicemix/rootDir"
-	 */
-	private String rootDirectory;
-
-	/**
-	 * @parameter default-value="true"
-	 */
-	private boolean cleanStart;
-
-	public void execute() throws MojoExecutionException, MojoFailureException {
-
-		try {
-
-			if (cleanStart) {
-				getLog().info(
-						"Cleaning ServiceMix root directory [" + rootDirectory
-								+ "]");
-				File rootDir = new File(rootDirectory);
-				FileUtils.deleteDirectory(rootDir);
-				rootDir.mkdirs();
-			}
-
-			startServiceMix();
-			deployProject();
-
-			getLog().info("Project deployed");			
-
-			while (true) {
-				Thread.sleep(1000);
-			}
-		} catch (Exception e) {
-			stopServiceMix();
-			throw new MojoExecutionException(
-					"Apache ServiceMix was unable to deploy project", e);
-		}
-
-	}
-
-	private void stopServiceMix() {
-		getLog().info("Shutting down Apache ServiceMix");
-		if (jbiContainer != null)
-			try {
-				jbiContainer.shutDown();
-			} catch (JBIException e) {
-				getLog().warn(e);
-			}
-	}
-
-	private void startServiceMix() throws MojoExecutionException {
-		try {
-			getLog().info("Starting Apache ServiceMix");
-			jbiContainer = new JBIContainer();
-			jbiContainer.setRmiPort(Integer.parseInt(port));
-			jbiContainer.setCreateMBeanServer(true);
-			jbiContainer.setInstallationDirPath(installDirectory);
-			jbiContainer.setDeploymentDirPath(deploymentDirectory);
-			jbiContainer.setRootDir(rootDirectory);
-			jbiContainer.init();
-			jbiContainer.start();
-		} catch (JBIException e) {
-			throw new MojoExecutionException(
-					"Unable to start the JBI container", e);
-		}
-	}
+    /**
+     * @parameter default-value="${project.build.directory}/servicemix/install"
+     */
+    private String installDirectory;
+
+    /**
+     * @parameter default-value="${project.build.directory}/servicemix/deploy"
+     */
+    private String deploymentDirectory;
+
+    /**
+     * @parameter default-value="${project.build.directory}/servicemix/rootDir"
+     */
+    private String rootDirectory;
+
+    /**
+     * @parameter default-value="true"
+     */
+    private boolean cleanStart;
+
+    public void execute() throws MojoExecutionException, MojoFailureException {
+
+        try {
+
+            if (cleanStart) {
+                getLog().info(
+                        "Cleaning ServiceMix root directory [" + rootDirectory
+                                + "]");
+                File rootDir = new File(rootDirectory);
+                FileUtils.deleteDirectory(rootDir);
+                rootDir.mkdirs();
+            }
+
+            startServiceMix();
+            deployProject();
+
+            getLog().info("Project deployed");
+
+            while (true) {
+                Thread.sleep(1000);
+            }
+        } catch (Exception e) {
+            stopServiceMix();
+            throw new MojoExecutionException(
+                    "Apache ServiceMix was unable to deploy project", e);
+        }
+
+    }
+
+    private void stopServiceMix() {
+        getLog().info("Shutting down Apache ServiceMix");
+        if (jbiContainer != null) {
+            try {
+                jbiContainer.shutDown();
+            } catch (JBIException e) {
+                getLog().warn(e);
+            }
+        }
+    }
+
+    private void startServiceMix() throws MojoExecutionException {
+        try {
+            getLog().info("Starting Apache ServiceMix");
+            jbiContainer = new JBIContainer();
+            jbiContainer.setRmiPort(Integer.parseInt(port));
+            jbiContainer.setCreateMBeanServer(true);
+            jbiContainer.setInstallationDirPath(installDirectory);
+            jbiContainer.setDeploymentDirPath(deploymentDirectory);
+            jbiContainer.setRootDir(rootDirectory);
+            jbiContainer.init();
+            jbiContainer.start();
+        } catch (JBIException e) {
+            throw new MojoExecutionException(
+                    "Unable to start the JBI container", e);
+        }
+    }
 }

Modified: incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/XmlDescriptorHelper.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/XmlDescriptorHelper.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/XmlDescriptorHelper.java (original)
+++ incubator/servicemix/trunk/tooling/jbi-maven-plugin/src/main/java/org/apache/servicemix/maven/plugin/jbi/XmlDescriptorHelper.java Thu Jun 28 08:47:21 2007
@@ -18,73 +18,75 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-public class XmlDescriptorHelper {
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public final class XmlDescriptorHelper {
 
-        private static final Log log = LogFactory.getLog(XmlDescriptorHelper.class);
+    private static final Log LOG = LogFactory.getLog(XmlDescriptorHelper.class);
 
-	public static QName getServiceName(Element childElement) {
-		if (childElement.hasAttribute("service-name")) {
-			String prefixAndLocalPart = childElement
-					.getAttribute("service-name");
-			String prefix = prefixAndLocalPart.substring(0, prefixAndLocalPart
-					.indexOf(':'));
-			String localPart = prefixAndLocalPart.substring(prefixAndLocalPart
-					.indexOf(':') + 1);
-			return new QName(childElement.lookupNamespaceURI(prefix), localPart);
-		}
-		return null;
-	}
-
-	public static QName getInterfaceName(Element childElement) {
-		if (childElement.hasAttribute("interface-name")) {
-			String prefixAndLocalPart = childElement
-					.getAttribute("interface-name");
-			String prefix = prefixAndLocalPart.substring(0, prefixAndLocalPart
-					.indexOf(':'));
-			String localPart = prefixAndLocalPart.substring(prefixAndLocalPart
-					.indexOf(':') + 1);
-			return new QName(childElement.lookupNamespaceURI(prefix), localPart);
-		}
-		return null;
-	}
-
-	public static boolean isElement(Node node, String namespaceUrl,
-			String localPart) {
-		if (node instanceof Element) {
-			Element element = (Element) node;
-			log.debug("Got Element nodeName:" + element.getNodeName()
-					+ " namespaceUri:" + element.getNamespaceURI()
-					+ " localName:" + element.getLocalName());
-			if (localPart.equals(element.getNodeName()))
-				return true;
-			else {
-				// Compare the namespace URI and localname
-				log.debug(namespaceUrl + "="
-						+ element.getNamespaceURI() + " is "
-						+ namespaceUrl.equals(element.getNamespaceURI()));
-				log.debug(localPart + "="
-						+ element.getLocalName() + " is "
-						+ localPart.equals(element.getLocalName()));
-				if ((namespaceUrl.equals(element.getNamespaceURI()))
-						&& (localPart.equals(element.getLocalName()))) {
-					return true;
-				}
-			}
-		}
-		return false;
-	}
-
-	public static String getEndpointName(Element childElement) {
-		if (childElement.hasAttribute("endpoint-name")) {
-			return childElement.getAttribute("endpoint-name");
-		}
-		return null;
-	}
+    private XmlDescriptorHelper() {
+    }
+    
+    public static QName getServiceName(Element childElement) {
+        if (childElement.hasAttribute("service-name")) {
+            String prefixAndLocalPart = childElement
+                    .getAttribute("service-name");
+            String prefix = prefixAndLocalPart.substring(0, prefixAndLocalPart
+                    .indexOf(':'));
+            String localPart = prefixAndLocalPart.substring(prefixAndLocalPart
+                    .indexOf(':') + 1);
+            return new QName(childElement.lookupNamespaceURI(prefix), localPart);
+        }
+        return null;
+    }
+
+    public static QName getInterfaceName(Element childElement) {
+        if (childElement.hasAttribute("interface-name")) {
+            String prefixAndLocalPart = childElement
+                    .getAttribute("interface-name");
+            String prefix = prefixAndLocalPart.substring(0, prefixAndLocalPart
+                    .indexOf(':'));
+            String localPart = prefixAndLocalPart.substring(prefixAndLocalPart
+                    .indexOf(':') + 1);
+            return new QName(childElement.lookupNamespaceURI(prefix), localPart);
+        }
+        return null;
+    }
+
+    public static boolean isElement(Node node, String namespaceUrl,
+            String localPart) {
+        if (node instanceof Element) {
+            Element element = (Element) node;
+            LOG.debug("Got Element nodeName:" + element.getNodeName()
+                    + " namespaceUri:" + element.getNamespaceURI()
+                    + " localName:" + element.getLocalName());
+            if (localPart.equals(element.getNodeName())) {
+                return true;
+            } else {
+                // Compare the namespace URI and localname
+                LOG.debug(namespaceUrl + "=" + element.getNamespaceURI()
+                        + " is "
+                        + namespaceUrl.equals(element.getNamespaceURI()));
+                LOG.debug(localPart + "=" + element.getLocalName() + " is "
+                        + localPart.equals(element.getLocalName()));
+                if ((namespaceUrl.equals(element.getNamespaceURI()))
+                        && (localPart.equals(element.getLocalName()))) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    public static String getEndpointName(Element childElement) {
+        if (childElement.hasAttribute("endpoint-name")) {
+            return childElement.getAttribute("endpoint-name");
+        }
+        return null;
+    }
 
 }