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/08/09 22:33:52 UTC

svn commit: r564374 [5/7] - in /incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix: ./ client/ components/util/ components/util/xstream/ components/varscheduler/ expression/ jbi/ jbi/container/ jbi/deployment/ jbi/event...

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java?view=diff&rev=564374&r1=564373&r2=564374
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java Thu Aug  9 13:33:26 2007
@@ -32,567 +32,493 @@
 import org.apache.servicemix.jbi.management.OperationInfoHelper;
 import org.apache.servicemix.jbi.management.ParameterHelper;
 
-public class AdminCommandsService extends BaseSystemService implements
-		AdminCommandsServiceMBean {
+public class AdminCommandsService extends BaseSystemService implements AdminCommandsServiceMBean {
 
-	/**
-	 * @return a description of this
-	 */
-	public String getDescription() {
-		return "Admin Commands Service";
-	}
-
-	protected Class getServiceMBean() {
-		return AdminCommandsServiceMBean.class;
-	}
-
-	/**
-	 * Install a JBI component (a Service Engine or Binding Component)
-	 * 
-	 * @param file
-	 *            jbi component archive to install
-	 * @param props
-	 *            installation properties
-	 * @return
-	 */
-	public String installComponent(String file, Properties props,
-			boolean deferException) throws Exception {
-		try {
-			if (deferException) {
-				container.updateExternalArchive(file);
-			} else {
-				container.getInstallationService().install(file, props, false);
-			}
-			return ManagementSupport.createSuccessMessage("installComponent",
-					file);
-		} catch (Exception e) {
-			throw ManagementSupport.failure("installComponent", file, e);
-		}
-	}
-
-	/**
-	 * Uninstalls a previously install JBI Component (a Service Engine or
-	 * Binding Component)
-	 * 
-	 * @param name
-	 * @return
-	 */
-	public String uninstallComponent(String name) throws Exception {
-		ComponentMBeanImpl comp = container.getComponent(name);
-		if (comp == null) {
-			throw ManagementSupport.failure("uninstallComponent", "Component '"
-					+ name + "' is not installed.");
-		}
-		if (!comp.isShutDown()) {
-			throw ManagementSupport.failure("uninstallComponent", "Component '"
-					+ name + "' is not shut down.");
-		}
-		boolean success = container.getInstallationService().unloadInstaller(
-				name, true);
-		if (success) {
-			return ManagementSupport.createSuccessMessage("uninstallComponent",
-					name);
-		} else {
-			throw ManagementSupport.failure("uninstallComponent", name);
-		}
-	}
-
-	/**
-	 * Installs a Shared Library.
-	 * 
-	 * @param file
-	 * @return
-	 */
-	public String installSharedLibrary(String file, boolean deferException)
-			throws Exception {
-		if (deferException) {
-			container.updateExternalArchive(file);
-			return ManagementSupport.createSuccessMessage(
-					"installSharedLibrary", file);
-		} else {
-			return container.getInstallationService()
-					.installSharedLibrary(file);
-		}
-	}
-
-	/**
-	 * Uninstalls a previously installed Shared Library.
-	 * 
-	 * @param name
-	 * @return
-	 */
-	public String uninstallSharedLibrary(String name) throws Exception {
-		// Check that the library is installed
-		SharedLibrary sl = container.getRegistry().getSharedLibrary(name);
-		if (sl == null) {
-			throw ManagementSupport.failure("uninstallSharedLibrary",
-					"Shared library '" + name + "' is not installed.");
-		}
-		// Check that it is not used by a running component
-		Collection components = container.getRegistry().getComponents();
-		for (Iterator iter = components.iterator(); iter.hasNext();) {
-			ComponentMBeanImpl comp = (ComponentMBeanImpl) iter.next();
-			if (!comp.isShutDown()) {
-				String[] sls = comp.getSharedLibraries();
-				if (sls != null) {
-					for (int i = 0; i < sls.length; i++) {
-						if (name.equals(sls[i])) {
-							throw ManagementSupport.failure(
-									"uninstallSharedLibrary",
-									"Shared library '" + name
-											+ "' is used by component '"
-											+ comp.getName() + "'.");
-						}
-					}
-				}
-			}
-		}
-		boolean success = container.getInstallationService()
-				.uninstallSharedLibrary(name);
-		if (success) {
-			return ManagementSupport.createSuccessMessage(
-					"uninstallSharedLibrary", name);
-		} else {
-			throw ManagementSupport.failure("uninstallSharedLibrary", name);
-		}
-	}
-
-	/**
-	 * Starts a particular Component (Service Engine or Binding Component).
-	 * 
-	 * @param name
-	 * @return
-	 */
-	public String startComponent(String name) throws Exception {
-		try {
-			ComponentMBeanImpl lcc = container.getComponent(name);
-			if (lcc == null) {
-				throw new JBIException("Component " + name + " not found");
-			}
-			lcc.start();
-			return ManagementSupport.createSuccessMessage("startComponent",
-					name);
-		} catch (JBIException e) {
-			throw ManagementSupport.failure("startComponent", name, e);
-		}
-	}
-
-	/**
-	 * Stops a particular Component (Service Engine or Binding Component).
-	 * 
-	 * @param name
-	 * @return
-	 */
-	public String stopComponent(String name) throws Exception {
-		try {
-			ComponentMBeanImpl lcc = container.getComponent(name);
-			if (lcc == null) {
-				throw new JBIException("Component " + name + " not found");
-			}
-			lcc.stop();
-			return ManagementSupport
-					.createSuccessMessage("stopComponent", name);
-		} catch (JBIException e) {
-			throw ManagementSupport.failure("stopComponent", name, e);
-		}
-	}
-
-	/**
-	 * Shuts down a particular Component.
-	 * 
-	 * @param name
-	 * @return
-	 */
-	public String shutdownComponent(String name) throws Exception {
-		try {
-			ComponentMBeanImpl lcc = container.getComponent(name);
-			if (lcc == null) {
-				throw new JBIException("Component " + name + " not found");
-			}
-			lcc.shutDown();
-			return ManagementSupport.createSuccessMessage("shutdownComponent",
-					name);
-		} catch (JBIException e) {
-			throw ManagementSupport.failure("shutdownComponent", name, e);
-		}
-	}
-
-	/**
-	 * Deploys a Service Assembly.
-	 * 
-	 * @param file
-	 * @return
-	 */
-	public String deployServiceAssembly(String file, boolean deferException)
-			throws Exception {
-		if (deferException) {
-			container.updateExternalArchive(file);
-			return ManagementSupport.createSuccessMessage(
-					"deployServiceAssembly", file);
-		} else {
-			return container.getDeploymentService().deploy(file);
-		}
-	}
-
-	/**
-	 * Undeploys a previously deployed service assembly.
-	 * 
-	 * @param name
-	 * @return
-	 */
-	public String undeployServiceAssembly(String name) throws Exception {
-		return container.getDeploymentService().undeploy(name);
-	}
-
-	/**
-	 * Starts a service assembly.
-	 * 
-	 * @param name
-	 * @return
-	 */
-	public String startServiceAssembly(String name) throws Exception {
-		return container.getDeploymentService().start(name);
-	}
-
-	/**
-	 * Stops a particular service assembly.
-	 * 
-	 * @param name
-	 * @return
-	 */
-	public String stopServiceAssembly(String name) throws Exception {
-		return container.getDeploymentService().stop(name);
-	}
-
-	/**
-	 * Shuts down a particular service assembly.
-	 * 
-	 * @param name
-	 * @return
-	 */
-	public String shutdownServiceAssembly(String name) throws Exception {
-		return container.getDeploymentService().shutDown(name);
-	}
-
-	/**
-	 * load an archive from an external location and starts it The archive can
-	 * be a Component, Service Assembly or Shared Library.
-	 * 
-	 * @param location -
-	 *            can either be a url or filename (if relative - must be
-	 *            relative to the container)
-	 * @return status
-	 * @throws Exception
-	 */
-	public String installArchive(String location) throws Exception {
-		try {
-			container.updateExternalArchive(location);
-			return ManagementSupport.createSuccessMessage("installComponent",
-					location);
-		} catch (Exception e) {
-			throw ManagementSupport.failure("installComponent", location, e);
-		}
-	}
-
-	/**
-	 * Prints information about all components (Service Engine or Binding
-	 * Component) installed
-	 * 
-	 * @param serviceEngines
-	 * @param bindingComponents
-	 * @param state
-	 * @param sharedLibraryName
-	 * @param serviceAssemblyName
-	 * @return list of components in an XML blob
-	 */
-	public String listComponents(boolean excludeSEs, boolean excludeBCs,
-			boolean excludePojos, String requiredState,
-			String sharedLibraryName, String serviceAssemblyName)
-			throws Exception {
-		// validate requiredState
-		if (requiredState != null && requiredState.length() > 0) {
-			if (!LifeCycleMBean.UNKNOWN.equalsIgnoreCase(requiredState)
-					&& !LifeCycleMBean.SHUTDOWN.equalsIgnoreCase(requiredState)
-					&& !LifeCycleMBean.STOPPED.equalsIgnoreCase(requiredState)
-					&& !LifeCycleMBean.STARTED.equalsIgnoreCase(requiredState)) {
-				throw ManagementSupport.failure("listComponents",
-						"Required state '" + requiredState
-								+ "' is not a valid state.");
-			}
-		}
-		// Get components
-		Collection connectors = container.getRegistry().getComponents();
-		List<ComponentMBeanImpl> components = new ArrayList<ComponentMBeanImpl>();
-		for (Iterator iter = connectors.iterator(); iter.hasNext();) {
-			ComponentMBeanImpl component = (ComponentMBeanImpl) iter.next();
-			// Skip SEs if needed
-			if (excludeSEs && component.isService()) {
-				continue;
-			}
-			// Skip BCs if needed
-			if (excludeBCs && component.isBinding()) {
-				continue;
-			}
-			// Skip Pojos if needed
-			if (excludePojos && component.isPojo()) {
-				continue;
-			}
-			// Check status
-			if (requiredState != null
-					&& requiredState.length() > 0
-					&& !requiredState.equalsIgnoreCase(component
-							.getCurrentState())) {
-				continue;
-			}
-			// Check shared library
-			// TODO: check component dependency on SL
-			if (sharedLibraryName != null
-					&& sharedLibraryName.length() > 0
-					&& !container.getInstallationService()
-							.containsSharedLibrary(sharedLibraryName)) {
-				continue;
-			}
-			// Check deployed service assembly
-			// TODO: check SA dependency on component
-			if (serviceAssemblyName != null && serviceAssemblyName.length() > 0) {
-				String[] saNames = container.getRegistry()
-						.getDeployedServiceAssembliesForComponent(
-								component.getName());
-				boolean found = false;
-				for (int i = 0; i < saNames.length; i++) {
-					if (serviceAssemblyName.equals(saNames[i])) {
-						found = true;
-						break;
-					}
-				}
-				if (!found) {
-					continue;
-				}
-			}
-			components.add(component);
-		}
-
-		StringBuffer buffer = new StringBuffer();
-		buffer.append("<?xml version='1.0'?>\n");
-		buffer
-				.append("<component-info-list xmlns='http://java.sun.com/xml/ns/jbi/component-info-list' version='1.0'>\n");
-		for (Iterator<ComponentMBeanImpl> iter = components.iterator(); iter.hasNext();) {
-			ComponentMBeanImpl component = iter.next();
-			buffer.append("  <component-info");
-			if (!component.isBinding() && component.isService()) {
-				buffer.append(" type='service-engine'");
-			} else if (component.isBinding() && !component.isService()) {
-				buffer.append(" type='binding-component'");
-			}
-			buffer.append(" name='" + component.getName() + "'");
-			buffer.append(" state='" + component.getCurrentState() + "'>\n");
-			if (component.getDescription() != null) {
-				buffer.append("    <description>");
-				buffer.append(component.getDescription());
-				buffer.append("</description>\n");
-			}
-			buffer.append("  </component-info>\n");
-		}
-		buffer.append("</component-info-list>");
-		return buffer.toString();
-	}
-
-	/**
-	 * Prints information about shared libraries installed.
-	 * 
-	 * @param componentName
-	 * @param sharedLibraryName
-	 * @return
-	 */
-	public String listSharedLibraries(String componentName,
-			String sharedLibraryName) throws Exception {
-		Collection<SharedLibrary> libs;
-		if (sharedLibraryName != null) {
-			SharedLibrary sl = container.getRegistry().getSharedLibrary(
-					sharedLibraryName);
-			if (sl == null) {
-				libs = Collections.EMPTY_LIST;
-			} else {
-				libs = Collections.singletonList(sl);
-			}
-		} else if (componentName != null) {
-			// TODO: handle componentName
-			libs = container.getRegistry().getSharedLibraries();
-		} else {
-			libs = container.getRegistry().getSharedLibraries();
-		}
-		StringBuffer buffer = new StringBuffer();
-		buffer.append("<?xml version='1.0'?>\n");
-		buffer
-				.append("<component-info-list xmlns='http://java.sun.com/xml/ns/jbi/component-info-list' version='1.0'>\n");
-		for (Iterator<SharedLibrary> iter = libs.iterator(); iter.hasNext();) {
-			SharedLibrary sl = iter.next();
-			buffer.append("  <component-info type='shared-library' name='")
-					.append(sl.getName()).append("' state='Started'>");
-			if (sl.getDescription() != null) {
-				buffer.append("    <description>");
-				buffer.append(sl.getDescription());
-				buffer.append("</description>\n");
-			}
-			buffer.append("  </component-info>\n");
-		}
-		buffer.append("</component-info-list>");
-		return buffer.toString();
-	}
-
-	/**
-	 * Prints information about service assemblies deployed.
-	 * 
-	 * @param state
-	 * @param componentName
-	 * @param serviceAssemblyName
-	 * @return
-	 */
-	public String listServiceAssemblies(String state, String componentName,
-			String serviceAssemblyName) throws Exception {
-		String[] result = null;
-		if (null != serviceAssemblyName && serviceAssemblyName.length() > 0) {
-			result = new String[] { serviceAssemblyName };
-		} else if (null != componentName && componentName.length() > 0) {
-			result = container.getRegistry()
-					.getDeployedServiceAssembliesForComponent(componentName);
-		} else {
-			result = container.getRegistry().getDeployedServiceAssemblies();
-		}
-
-		List<ServiceAssemblyLifeCycle> assemblies = new ArrayList<ServiceAssemblyLifeCycle>();
-		for (int i = 0; i < result.length; i++) {
-			ServiceAssemblyLifeCycle sa = container.getRegistry()
-					.getServiceAssembly(result[i]);
-			if (sa != null) {
-				// Check status
-				if (state != null && state.length() > 0
-						&& !state.equals(sa.getCurrentState())) {
-					continue;
-				}
-				assemblies.add(sa);
-			}
-		}
-
-		StringBuffer buffer = new StringBuffer();
-		buffer.append("<?xml version='1.0'?>\n");
-		buffer
-				.append("<service-assembly-info-list xmlns='http://java.sun.com/xml/ns/jbi/service-assembly-info-list' version='1.0'>\n");
-		for (Iterator<ServiceAssemblyLifeCycle> iter = assemblies.iterator(); iter.hasNext();) {
-			ServiceAssemblyLifeCycle sa = iter
-					.next();
-			buffer.append("  <service-assembly-info");
-			buffer.append(" name='" + sa.getName() + "'");
-			buffer.append(" state='" + sa.getCurrentState() + "'>\n");
-			buffer.append("    <description>" + sa.getDescription()
-					+ "</description>\n");
-
-			ServiceUnitLifeCycle[] serviceUnitList = sa.getDeployedSUs();
-			for (int i = 0; i < serviceUnitList.length; i++) {
-				buffer.append("    <service-unit-info");
-				buffer.append(" name='" + serviceUnitList[i].getName() + "'");
-				buffer.append(" state='" + serviceUnitList[i].getCurrentState()
-						+ "'");
-				buffer.append(" deployed-on='"
-						+ serviceUnitList[i].getComponentName() + "'>\n");
-				buffer.append("      <description>"
-						+ serviceUnitList[i].getDescription()
-						+ "</description>\n");
-				buffer.append("    </service-unit-info>\n");
-			}
-
-			buffer.append("  </service-assembly-info>\n");
-		}
-		buffer.append("</service-assembly-info-list>");
-
-		return buffer.toString();
-	}
-
-	public MBeanOperationInfo[] getOperationInfos() throws JMException {
-		OperationInfoHelper helper = new OperationInfoHelper();
-		ParameterHelper ph = helper.addOperation(getObjectToManage(),
-				"installComponent", 3, "install a component");
+    /**
+     * @return a description of this
+     */
+    public String getDescription() {
+        return "Admin Commands Service";
+    }
+
+    protected Class getServiceMBean() {
+        return AdminCommandsServiceMBean.class;
+    }
+
+    /**
+     * Install a JBI component (a Service Engine or Binding Component)
+     * 
+     * @param file
+     *            jbi component archive to install
+     * @param props
+     *            installation properties
+     * @return
+     */
+    public String installComponent(String file, Properties props, boolean deferException) throws Exception {
+        try {
+            if (deferException) {
+                container.updateExternalArchive(file);
+            } else {
+                container.getInstallationService().install(file, props, false);
+            }
+            return ManagementSupport.createSuccessMessage("installComponent", file);
+        } catch (Exception e) {
+            throw ManagementSupport.failure("installComponent", file, e);
+        }
+    }
+
+    /**
+     * Uninstalls a previously install JBI Component (a Service Engine or
+     * Binding Component)
+     * 
+     * @param name
+     * @return
+     */
+    public String uninstallComponent(String name) throws Exception {
+        ComponentMBeanImpl comp = container.getComponent(name);
+        if (comp == null) {
+            throw ManagementSupport.failure("uninstallComponent", "Component '" + name + "' is not installed.");
+        }
+        if (!comp.isShutDown()) {
+            throw ManagementSupport.failure("uninstallComponent", "Component '" + name + "' is not shut down.");
+        }
+        boolean success = container.getInstallationService().unloadInstaller(name, true);
+        if (success) {
+            return ManagementSupport.createSuccessMessage("uninstallComponent", name);
+        } else {
+            throw ManagementSupport.failure("uninstallComponent", name);
+        }
+    }
+
+    /**
+     * Installs a Shared Library.
+     * 
+     * @param file
+     * @return
+     */
+    public String installSharedLibrary(String file, boolean deferException) throws Exception {
+        if (deferException) {
+            container.updateExternalArchive(file);
+            return ManagementSupport.createSuccessMessage("installSharedLibrary", file);
+        } else {
+            return container.getInstallationService().installSharedLibrary(file);
+        }
+    }
+
+    /**
+     * Uninstalls a previously installed Shared Library.
+     * 
+     * @param name
+     * @return
+     */
+    public String uninstallSharedLibrary(String name) throws Exception {
+        // Check that the library is installed
+        SharedLibrary sl = container.getRegistry().getSharedLibrary(name);
+        if (sl == null) {
+            throw ManagementSupport.failure("uninstallSharedLibrary", "Shared library '" + name + "' is not installed.");
+        }
+        // Check that it is not used by a running component
+        Collection components = container.getRegistry().getComponents();
+        for (Iterator iter = components.iterator(); iter.hasNext();) {
+            ComponentMBeanImpl comp = (ComponentMBeanImpl) iter.next();
+            if (!comp.isShutDown()) {
+                String[] sls = comp.getSharedLibraries();
+                if (sls != null) {
+                    for (int i = 0; i < sls.length; i++) {
+                        if (name.equals(sls[i])) {
+                            throw ManagementSupport.failure("uninstallSharedLibrary", "Shared library '" + name
+                                            + "' is used by component '" + comp.getName() + "'.");
+                        }
+                    }
+                }
+            }
+        }
+        boolean success = container.getInstallationService().uninstallSharedLibrary(name);
+        if (success) {
+            return ManagementSupport.createSuccessMessage("uninstallSharedLibrary", name);
+        } else {
+            throw ManagementSupport.failure("uninstallSharedLibrary", name);
+        }
+    }
+
+    /**
+     * Starts a particular Component (Service Engine or Binding Component).
+     * 
+     * @param name
+     * @return
+     */
+    public String startComponent(String name) throws Exception {
+        try {
+            ComponentMBeanImpl lcc = container.getComponent(name);
+            if (lcc == null) {
+                throw new JBIException("Component " + name + " not found");
+            }
+            lcc.start();
+            return ManagementSupport.createSuccessMessage("startComponent", name);
+        } catch (JBIException e) {
+            throw ManagementSupport.failure("startComponent", name, e);
+        }
+    }
+
+    /**
+     * Stops a particular Component (Service Engine or Binding Component).
+     * 
+     * @param name
+     * @return
+     */
+    public String stopComponent(String name) throws Exception {
+        try {
+            ComponentMBeanImpl lcc = container.getComponent(name);
+            if (lcc == null) {
+                throw new JBIException("Component " + name + " not found");
+            }
+            lcc.stop();
+            return ManagementSupport.createSuccessMessage("stopComponent", name);
+        } catch (JBIException e) {
+            throw ManagementSupport.failure("stopComponent", name, e);
+        }
+    }
+
+    /**
+     * Shuts down a particular Component.
+     * 
+     * @param name
+     * @return
+     */
+    public String shutdownComponent(String name) throws Exception {
+        try {
+            ComponentMBeanImpl lcc = container.getComponent(name);
+            if (lcc == null) {
+                throw new JBIException("Component " + name + " not found");
+            }
+            lcc.shutDown();
+            return ManagementSupport.createSuccessMessage("shutdownComponent", name);
+        } catch (JBIException e) {
+            throw ManagementSupport.failure("shutdownComponent", name, e);
+        }
+    }
+
+    /**
+     * Deploys a Service Assembly.
+     * 
+     * @param file
+     * @return
+     */
+    public String deployServiceAssembly(String file, boolean deferException) throws Exception {
+        if (deferException) {
+            container.updateExternalArchive(file);
+            return ManagementSupport.createSuccessMessage("deployServiceAssembly", file);
+        } else {
+            return container.getDeploymentService().deploy(file);
+        }
+    }
+
+    /**
+     * Undeploys a previously deployed service assembly.
+     * 
+     * @param name
+     * @return
+     */
+    public String undeployServiceAssembly(String name) throws Exception {
+        return container.getDeploymentService().undeploy(name);
+    }
+
+    /**
+     * Starts a service assembly.
+     * 
+     * @param name
+     * @return
+     */
+    public String startServiceAssembly(String name) throws Exception {
+        return container.getDeploymentService().start(name);
+    }
+
+    /**
+     * Stops a particular service assembly.
+     * 
+     * @param name
+     * @return
+     */
+    public String stopServiceAssembly(String name) throws Exception {
+        return container.getDeploymentService().stop(name);
+    }
+
+    /**
+     * Shuts down a particular service assembly.
+     * 
+     * @param name
+     * @return
+     */
+    public String shutdownServiceAssembly(String name) throws Exception {
+        return container.getDeploymentService().shutDown(name);
+    }
+
+    /**
+     * load an archive from an external location and starts it The archive can
+     * be a Component, Service Assembly or Shared Library.
+     * 
+     * @param location -
+     *            can either be a url or filename (if relative - must be
+     *            relative to the container)
+     * @return status
+     * @throws Exception
+     */
+    public String installArchive(String location) throws Exception {
+        try {
+            container.updateExternalArchive(location);
+            return ManagementSupport.createSuccessMessage("installComponent", location);
+        } catch (Exception e) {
+            throw ManagementSupport.failure("installComponent", location, e);
+        }
+    }
+
+    /**
+     * Prints information about all components (Service Engine or Binding
+     * Component) installed
+     * 
+     * @param serviceEngines
+     * @param bindingComponents
+     * @param state
+     * @param sharedLibraryName
+     * @param serviceAssemblyName
+     * @return list of components in an XML blob
+     */
+    public String listComponents(boolean excludeSEs, boolean excludeBCs, boolean excludePojos, String requiredState,
+                    String sharedLibraryName, String serviceAssemblyName) throws Exception {
+        // validate requiredState
+        if (requiredState != null && requiredState.length() > 0) {
+            if (!LifeCycleMBean.UNKNOWN.equalsIgnoreCase(requiredState) && !LifeCycleMBean.SHUTDOWN.equalsIgnoreCase(requiredState)
+                            && !LifeCycleMBean.STOPPED.equalsIgnoreCase(requiredState)
+                            && !LifeCycleMBean.STARTED.equalsIgnoreCase(requiredState)) {
+                throw ManagementSupport.failure("listComponents", "Required state '" + requiredState + "' is not a valid state.");
+            }
+        }
+        // Get components
+        Collection connectors = container.getRegistry().getComponents();
+        List<ComponentMBeanImpl> components = new ArrayList<ComponentMBeanImpl>();
+        for (Iterator iter = connectors.iterator(); iter.hasNext();) {
+            ComponentMBeanImpl component = (ComponentMBeanImpl) iter.next();
+            // Skip SEs if needed
+            if (excludeSEs && component.isService()) {
+                continue;
+            }
+            // Skip BCs if needed
+            if (excludeBCs && component.isBinding()) {
+                continue;
+            }
+            // Skip Pojos if needed
+            if (excludePojos && component.isPojo()) {
+                continue;
+            }
+            // Check status
+            if (requiredState != null && requiredState.length() > 0 && !requiredState.equalsIgnoreCase(component.getCurrentState())) {
+                continue;
+            }
+            // Check shared library
+            // TODO: check component dependency on SL
+            if (sharedLibraryName != null && sharedLibraryName.length() > 0
+                            && !container.getInstallationService().containsSharedLibrary(sharedLibraryName)) {
+                continue;
+            }
+            // Check deployed service assembly
+            // TODO: check SA dependency on component
+            if (serviceAssemblyName != null && serviceAssemblyName.length() > 0) {
+                String[] saNames = container.getRegistry().getDeployedServiceAssembliesForComponent(component.getName());
+                boolean found = false;
+                for (int i = 0; i < saNames.length; i++) {
+                    if (serviceAssemblyName.equals(saNames[i])) {
+                        found = true;
+                        break;
+                    }
+                }
+                if (!found) {
+                    continue;
+                }
+            }
+            components.add(component);
+        }
+
+        StringBuffer buffer = new StringBuffer();
+        buffer.append("<?xml version='1.0'?>\n");
+        buffer.append("<component-info-list xmlns='http://java.sun.com/xml/ns/jbi/component-info-list' version='1.0'>\n");
+        for (Iterator<ComponentMBeanImpl> iter = components.iterator(); iter.hasNext();) {
+            ComponentMBeanImpl component = iter.next();
+            buffer.append("  <component-info");
+            if (!component.isBinding() && component.isService()) {
+                buffer.append(" type='service-engine'");
+            } else if (component.isBinding() && !component.isService()) {
+                buffer.append(" type='binding-component'");
+            }
+            buffer.append(" name='" + component.getName() + "'");
+            buffer.append(" state='" + component.getCurrentState() + "'>\n");
+            if (component.getDescription() != null) {
+                buffer.append("    <description>");
+                buffer.append(component.getDescription());
+                buffer.append("</description>\n");
+            }
+            buffer.append("  </component-info>\n");
+        }
+        buffer.append("</component-info-list>");
+        return buffer.toString();
+    }
+
+    /**
+     * Prints information about shared libraries installed.
+     * 
+     * @param componentName
+     * @param sharedLibraryName
+     * @return
+     */
+    public String listSharedLibraries(String componentName, String sharedLibraryName) throws Exception {
+        Collection<SharedLibrary> libs;
+        if (sharedLibraryName != null) {
+            SharedLibrary sl = container.getRegistry().getSharedLibrary(sharedLibraryName);
+            if (sl == null) {
+                libs = Collections.EMPTY_LIST;
+            } else {
+                libs = Collections.singletonList(sl);
+            }
+        } else if (componentName != null) {
+            // TODO: handle componentName
+            libs = container.getRegistry().getSharedLibraries();
+        } else {
+            libs = container.getRegistry().getSharedLibraries();
+        }
+        StringBuffer buffer = new StringBuffer();
+        buffer.append("<?xml version='1.0'?>\n");
+        buffer.append("<component-info-list xmlns='http://java.sun.com/xml/ns/jbi/component-info-list' version='1.0'>\n");
+        for (Iterator<SharedLibrary> iter = libs.iterator(); iter.hasNext();) {
+            SharedLibrary sl = iter.next();
+            buffer.append("  <component-info type='shared-library' name='").append(sl.getName()).append("' state='Started'>");
+            if (sl.getDescription() != null) {
+                buffer.append("    <description>");
+                buffer.append(sl.getDescription());
+                buffer.append("</description>\n");
+            }
+            buffer.append("  </component-info>\n");
+        }
+        buffer.append("</component-info-list>");
+        return buffer.toString();
+    }
+
+    /**
+     * Prints information about service assemblies deployed.
+     * 
+     * @param state
+     * @param componentName
+     * @param serviceAssemblyName
+     * @return
+     */
+    public String listServiceAssemblies(String state, String componentName, String serviceAssemblyName) throws Exception {
+        String[] result = null;
+        if (null != serviceAssemblyName && serviceAssemblyName.length() > 0) {
+            result = new String[] {serviceAssemblyName };
+        } else if (null != componentName && componentName.length() > 0) {
+            result = container.getRegistry().getDeployedServiceAssembliesForComponent(componentName);
+        } else {
+            result = container.getRegistry().getDeployedServiceAssemblies();
+        }
+
+        List<ServiceAssemblyLifeCycle> assemblies = new ArrayList<ServiceAssemblyLifeCycle>();
+        for (int i = 0; i < result.length; i++) {
+            ServiceAssemblyLifeCycle sa = container.getRegistry().getServiceAssembly(result[i]);
+            if (sa != null) {
+                // Check status
+                if (state != null && state.length() > 0 && !state.equals(sa.getCurrentState())) {
+                    continue;
+                }
+                assemblies.add(sa);
+            }
+        }
+
+        StringBuffer buffer = new StringBuffer();
+        buffer.append("<?xml version='1.0'?>\n");
+        buffer.append("<service-assembly-info-list xmlns='http://java.sun.com/xml/ns/jbi/service-assembly-info-list' version='1.0'>\n");
+        for (Iterator<ServiceAssemblyLifeCycle> iter = assemblies.iterator(); iter.hasNext();) {
+            ServiceAssemblyLifeCycle sa = iter.next();
+            buffer.append("  <service-assembly-info");
+            buffer.append(" name='" + sa.getName() + "'");
+            buffer.append(" state='" + sa.getCurrentState() + "'>\n");
+            buffer.append("    <description>" + sa.getDescription() + "</description>\n");
+
+            ServiceUnitLifeCycle[] serviceUnitList = sa.getDeployedSUs();
+            for (int i = 0; i < serviceUnitList.length; i++) {
+                buffer.append("    <service-unit-info");
+                buffer.append(" name='" + serviceUnitList[i].getName() + "'");
+                buffer.append(" state='" + serviceUnitList[i].getCurrentState() + "'");
+                buffer.append(" deployed-on='" + serviceUnitList[i].getComponentName() + "'>\n");
+                buffer.append("      <description>" + serviceUnitList[i].getDescription() + "</description>\n");
+                buffer.append("    </service-unit-info>\n");
+            }
+
+            buffer.append("  </service-assembly-info>\n");
+        }
+        buffer.append("</service-assembly-info-list>");
+
+        return buffer.toString();
+    }
+
+    public MBeanOperationInfo[] getOperationInfos() throws JMException {
+        OperationInfoHelper helper = new OperationInfoHelper();
+        ParameterHelper ph = helper.addOperation(getObjectToManage(), "installComponent", 3, "install a component");
         ph.setDescription(0, "file", "location of JBI Component to install");
         ph.setDescription(1, "properties", "component installation properties");
         ph.setDescription(1, "deferExceptions", "true if exceptions due to missing dependencies should be differed");
 
-		ph = helper.addOperation(getObjectToManage(), "uninstallComponent", 1,
-				"uninstall a component");
-		ph.setDescription(0, "name", "component name to uninstall");
-
-		ph = helper.addOperation(getObjectToManage(), "installSharedLibrary",
-				1, "install a shared library");
-		ph.setDescription(0, "file", "location of shared library to install");
-
-		ph = helper.addOperation(getObjectToManage(), "uninstallSharedLibrary",
-				1, "uninstall a shared library");
-		ph.setDescription(0, "name", "name of shared library to uninstall");
-
-		ph = helper.addOperation(getObjectToManage(), "installArchive", 1,
-				"install an archive (component/SA etc)");
-		ph.setDescription(0, "location", "file name or url to the location");
-
-		ph = helper.addOperation(getObjectToManage(), "startComponent", 1,
-				"start a component");
-		ph.setDescription(0, "name", "name of component to start");
-
-		ph = helper.addOperation(getObjectToManage(), "stopComponent", 1,
-				"stop a component");
-		ph.setDescription(0, "name", "name of component to stop");
-
-		ph = helper.addOperation(getObjectToManage(), "shutdownComponent", 1,
-				"shutdown a component");
-		ph.setDescription(0, "name", "name of component to shutdown");
-
-		ph = helper.addOperation(getObjectToManage(), "deployServiceAssembly",
-				1, "deploy a service assembly");
-		ph.setDescription(0, "file", "location of service assembly to deploy");
-
-		ph = helper.addOperation(getObjectToManage(),
-				"undeployServiceAssembly", 1, "undeploy a service assembly");
-		ph.setDescription(0, "name", "name of service assembly to undeploy");
-
-		ph = helper.addOperation(getObjectToManage(), "startServiceAssembly",
-				1, "start a service assembly");
-		ph.setDescription(0, "name", "name of service assembly to start");
-
-		ph = helper.addOperation(getObjectToManage(), "stopServiceAssembly", 1,
-				"stop a service assembly");
-		ph.setDescription(0, "name", "name of service assembly to stop");
-
-		ph = helper.addOperation(getObjectToManage(),
-				"shutdownServiceAssembly", "shutdown a service assembly");
-		ph.setDescription(0, "name", "name of service assembly to shutdown");
-
-		ph = helper.addOperation(getObjectToManage(), "listComponents", 5,
-				"list all components installed");
-		ph.setDescription(0, "excludeSEs",
-				"if true will exclude service engines");
-		ph.setDescription(1, "excludeBCs",
-				"if true will exclude binding components");
-		ph.setDescription(1, "excludePojos",
-				"if true will exclude pojos components");
-		ph.setDescription(2, "requiredState",
-				"component state to list, if null will list all");
-		ph
-				.setDescription(3, "sharedLibraryName",
-						"shared library name to list");
-		ph.setDescription(4, "serviceAssemblyName",
-				"service assembly name to list");
-
-		ph = helper.addOperation(getObjectToManage(), "listSharedLibraries", 2,
-				"list shared library");
-		ph.setDescription(0, "componentName", "component name");
-		ph.setDescription(1, "sharedLibraryName", "shared library name");
-
-		ph = helper.addOperation(getObjectToManage(), "listServiceAssemblies",
-				3, "list service assemblies");
-		ph.setDescription(0, "state", "service assembly state to list");
-		ph.setDescription(1, "componentName", "component name");
-		ph.setDescription(2, "serviceAssemblyName", "service assembly name");
-
-		return OperationInfoHelper.join(super.getOperationInfos(), helper
-				.getOperationInfos());
-	}
+        ph = helper.addOperation(getObjectToManage(), "uninstallComponent", 1, "uninstall a component");
+        ph.setDescription(0, "name", "component name to uninstall");
+
+        ph = helper.addOperation(getObjectToManage(), "installSharedLibrary", 1, "install a shared library");
+        ph.setDescription(0, "file", "location of shared library to install");
+
+        ph = helper.addOperation(getObjectToManage(), "uninstallSharedLibrary", 1, "uninstall a shared library");
+        ph.setDescription(0, "name", "name of shared library to uninstall");
+
+        ph = helper.addOperation(getObjectToManage(), "installArchive", 1, "install an archive (component/SA etc)");
+        ph.setDescription(0, "location", "file name or url to the location");
+
+        ph = helper.addOperation(getObjectToManage(), "startComponent", 1, "start a component");
+        ph.setDescription(0, "name", "name of component to start");
+
+        ph = helper.addOperation(getObjectToManage(), "stopComponent", 1, "stop a component");
+        ph.setDescription(0, "name", "name of component to stop");
+
+        ph = helper.addOperation(getObjectToManage(), "shutdownComponent", 1, "shutdown a component");
+        ph.setDescription(0, "name", "name of component to shutdown");
+
+        ph = helper.addOperation(getObjectToManage(), "deployServiceAssembly", 1, "deploy a service assembly");
+        ph.setDescription(0, "file", "location of service assembly to deploy");
+
+        ph = helper.addOperation(getObjectToManage(), "undeployServiceAssembly", 1, "undeploy a service assembly");
+        ph.setDescription(0, "name", "name of service assembly to undeploy");
+
+        ph = helper.addOperation(getObjectToManage(), "startServiceAssembly", 1, "start a service assembly");
+        ph.setDescription(0, "name", "name of service assembly to start");
+
+        ph = helper.addOperation(getObjectToManage(), "stopServiceAssembly", 1, "stop a service assembly");
+        ph.setDescription(0, "name", "name of service assembly to stop");
+
+        ph = helper.addOperation(getObjectToManage(), "shutdownServiceAssembly", "shutdown a service assembly");
+        ph.setDescription(0, "name", "name of service assembly to shutdown");
+
+        ph = helper.addOperation(getObjectToManage(), "listComponents", 5, "list all components installed");
+        ph.setDescription(0, "excludeSEs", "if true will exclude service engines");
+        ph.setDescription(1, "excludeBCs", "if true will exclude binding components");
+        ph.setDescription(1, "excludePojos", "if true will exclude pojos components");
+        ph.setDescription(2, "requiredState", "component state to list, if null will list all");
+        ph.setDescription(3, "sharedLibraryName", "shared library name to list");
+        ph.setDescription(4, "serviceAssemblyName", "service assembly name to list");
+
+        ph = helper.addOperation(getObjectToManage(), "listSharedLibraries", 2, "list shared library");
+        ph.setDescription(0, "componentName", "component name");
+        ph.setDescription(1, "sharedLibraryName", "shared library name");
+
+        ph = helper.addOperation(getObjectToManage(), "listServiceAssemblies", 3, "list service assemblies");
+        ph.setDescription(0, "state", "service assembly state to list");
+        ph.setDescription(1, "componentName", "component name");
+        ph.setDescription(2, "serviceAssemblyName", "service assembly name");
+
+        return OperationInfoHelper.join(super.getOperationInfos(), helper.getOperationInfos());
+    }
 
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsServiceMBean.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsServiceMBean.java?view=diff&rev=564374&r1=564373&r2=564374
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsServiceMBean.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsServiceMBean.java Thu Aug  9 13:33:26 2007
@@ -16,8 +16,9 @@
  */
 package org.apache.servicemix.jbi.framework;
 
-import javax.jbi.management.LifeCycleMBean;
 import java.util.Properties;
+
+import javax.jbi.management.LifeCycleMBean;
 
 /**
  * Provides a simple interface to access ServiceMix administration commands.

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java?view=diff&rev=564374&r1=564373&r2=564374
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java Thu Aug  9 13:33:26 2007
@@ -29,6 +29,8 @@
 import java.util.Set;
 import java.util.Timer;
 import java.util.TimerTask;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.jbi.JBIException;
 import javax.jbi.management.DeploymentException;
@@ -50,9 +52,6 @@
 import org.apache.servicemix.jbi.util.FileUtil;
 import org.apache.servicemix.jbi.util.XmlPersistenceSupport;
 
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-
 /**
  * Monitors install and deploy directories to auto install/deploy archives
  * 
@@ -60,7 +59,8 @@
  */
 public class AutoDeploymentService extends BaseSystemService implements AutoDeploymentServiceMBean {
 
-    private static final Log log = LogFactory.getLog(AutoDeploymentService.class);
+    private static final Log LOG = LogFactory.getLog(AutoDeploymentService.class);
+    
     private EnvironmentContext environmentContext;
     private DeploymentService deploymentService;
     private InstallationService installationService;
@@ -73,8 +73,8 @@
     private TimerTask timerTask;
     private Map<File, ArchiveEntry> pendingComponents = new ConcurrentHashMap<File, ArchiveEntry>();
     private Map<File, ArchiveEntry> pendingSAs = new ConcurrentHashMap<File, ArchiveEntry>();
-    private Map<String, ArchiveEntry> installFileMap = null;
-    private Map<String, ArchiveEntry> deployFileMap = null;
+    private Map<String, ArchiveEntry> installFileMap;
+    private Map<String, ArchiveEntry> deployFileMap;
 
     /**
      * @return the extensions
@@ -84,7 +84,8 @@
     }
 
     /**
-     * @param extensions the extensions to set
+     * @param extensions
+     *            the extensions to set
      */
     public void setExtensions(String extensions) {
         this.extensions = extensions;
@@ -93,14 +94,14 @@
     /**
      * @return a description of this
      */
-    public String getDescription(){
+    public String getDescription() {
         return "automatically installs and deploys JBI Archives";
     }
 
     /**
      * @return Returns the monitorInstallationDirectory.
      */
-    public boolean isMonitorInstallationDirectory(){
+    public boolean isMonitorInstallationDirectory() {
         return monitorInstallationDirectory;
     }
 
@@ -108,14 +109,14 @@
      * @param monitorInstallationDirectory
      *            The monitorInstallationDirectory to set.
      */
-    public void setMonitorInstallationDirectory(boolean monitorInstallationDirectory){
-        this.monitorInstallationDirectory=monitorInstallationDirectory;
+    public void setMonitorInstallationDirectory(boolean monitorInstallationDirectory) {
+        this.monitorInstallationDirectory = monitorInstallationDirectory;
     }
 
     /**
      * @return Returns the monitorDeploymentDirectory.
      */
-    public boolean isMonitorDeploymentDirectory(){
+    public boolean isMonitorDeploymentDirectory() {
         return monitorDeploymentDirectory;
     }
 
@@ -123,14 +124,14 @@
      * @param monitorDeploymentDirectory
      *            The monitorDeploymentDirectory to set.
      */
-    public void setMonitorDeploymentDirectory(boolean monitorDeploymentDirectory){
-        this.monitorDeploymentDirectory=monitorDeploymentDirectory;
+    public void setMonitorDeploymentDirectory(boolean monitorDeploymentDirectory) {
+        this.monitorDeploymentDirectory = monitorDeploymentDirectory;
     }
 
     /**
      * @return Returns the monitorInterval (number in secs)
      */
-    public int getMonitorInterval(){
+    public int getMonitorInterval() {
         return monitorInterval;
     }
 
@@ -138,13 +139,13 @@
      * @param monitorInterval
      *            The monitorInterval to set (in secs)
      */
-    public void setMonitorInterval(int monitorInterval){
-        this.monitorInterval=monitorInterval;
+    public void setMonitorInterval(int monitorInterval) {
+        this.monitorInterval = monitorInterval;
     }
 
-    public void start() throws javax.jbi.JBIException{
+    public void start() throws javax.jbi.JBIException {
         super.start();
-        if(started.compareAndSet(false,true)){
+        if (started.compareAndSet(false, true)) {
             scheduleDirectoryTimer();
         }
     }
@@ -155,10 +156,10 @@
      * @exception javax.jbi.JBIException
      *                if the item fails to stop.
      */
-    public void stop() throws javax.jbi.JBIException{
-        if(started.compareAndSet(true,false)){
+    public void stop() throws javax.jbi.JBIException {
+        if (started.compareAndSet(true, false)) {
             super.stop();
-            if(timerTask!=null){
+            if (timerTask != null) {
                 timerTask.cancel();
             }
         }
@@ -172,32 +173,32 @@
      */
     public void init(JBIContainer container) throws JBIException {
         super.init(container);
-        this.environmentContext=container.getEnvironmentContext();
-        this.installationService=container.getInstallationService();
-        this.deploymentService=container.getDeploymentService();
-        //clean-up tmp directory
-        if(environmentContext.getTmpDir()!=null){
+        this.environmentContext = container.getEnvironmentContext();
+        this.installationService = container.getInstallationService();
+        this.deploymentService = container.getDeploymentService();
+        // clean-up tmp directory
+        if (environmentContext.getTmpDir() != null) {
             FileUtil.deleteFile(environmentContext.getTmpDir());
         }
         initializeFileMaps();
     }
-    
+
     protected Class<AutoDeploymentServiceMBean> getServiceMBean() {
         return AutoDeploymentServiceMBean.class;
     }
-    
-    
+
     /**
      * load an archive from an external location
+     * 
      * @param location
      * @param autoStart
      * @throws DeploymentException
      */
-    public ArchiveEntry updateExternalArchive(String location,boolean autoStart) throws DeploymentException {
+    public ArchiveEntry updateExternalArchive(String location, boolean autoStart) throws DeploymentException {
         ArchiveEntry entry = new ArchiveEntry();
         entry.location = location;
         entry.lastModified = new Date();
-        updateArchive(location,entry,autoStart);
+        updateArchive(location, entry, autoStart);
         return entry;
     }
 
@@ -242,109 +243,14 @@
             throw failure("deploy", "Unable to find jbi descriptor: " + location);
         }
         if (root != null) {
-            try{
+            try {
                 container.getBroker().suspend();
                 if (root.getComponent() != null) {
-                    Component comp = root.getComponent();
-                    String componentName = comp.getIdentification().getName();
-                    entry.type = "component";
-                    entry.name = componentName; 
-                    try {
-                        if (container.getRegistry().getComponent(componentName) != null) {
-                            installationService.loadInstaller(componentName);
-                            installationService.unloadInstaller(componentName, true);
-                        }
-                        // See if shared libraries are installed
-                        entry.dependencies = getSharedLibraryNames(comp);
-                        if (log.isDebugEnabled()) {
-                            log.debug("Component dependencies: " + entry.dependencies);
-                        }
-                        String missings = null;
-                        boolean canInstall = true;
-                        for (String libraryName : entry.dependencies) {
-                            if (container.getRegistry().getSharedLibrary(libraryName) == null) {
-                                canInstall = false;
-                                if (missings != null) {
-                                    missings += ", " + libraryName;
-                                } else {
-                                    missings = libraryName;
-                                }
-                            }
-                        }
-                        if (canInstall) {
-                            installationService.install(tmpDir, null, root, autoStart);
-                            checkPendingSAs();
-                        } else {
-                            entry.pending = true;
-                            log.warn("Shared libraries " + missings + " are not installed yet: the component" + componentName + 
-                                     " installation is suspended and will be resumed once the listed shared libraries are installed");
-                            pendingComponents.put(tmpDir, entry);
-                        }
-                    } catch (Exception e) {
-                        String errStr = "Failed to update Component: " + componentName;
-                        log.error(errStr, e);
-                        throw new DeploymentException(errStr, e);
-                    }
+                    updateComponent(entry, autoStart, tmpDir, root);
                 } else if (root.getSharedLibrary() != null) {
-                    String libraryName = root.getSharedLibrary().getIdentification().getName();
-                    entry.type = "library";
-                    entry.name = libraryName; 
-                    try {
-                        if (container.getRegistry().getSharedLibrary(libraryName) != null) {
-                            container.getRegistry().unregisterSharedLibrary(libraryName);
-                            environmentContext.removeSharedLibraryDirectory(libraryName);
-                        }
-                        installationService.doInstallSharedLibrary(tmpDir, root.getSharedLibrary());
-                        checkPendingComponents();
-                    } catch (Exception e) {
-                        String errStr = "Failed to update SharedLibrary: " + libraryName;
-                        log.error(errStr, e);
-                        throw new DeploymentException(errStr, e);
-                    }
+                    updateSharedLibrary(entry, tmpDir, root);
                 } else if (root.getServiceAssembly() != null) {
-                    ServiceAssembly sa = root.getServiceAssembly();
-                    String name = sa.getIdentification().getName();
-                    entry.type = "assembly";
-                    entry.name = name; 
-                    try {
-                        if (deploymentService.isSaDeployed(name)) {
-                            deploymentService.shutDown(name);
-                            deploymentService.undeploy(name);
-                        }
-                        // see if components are installed
-                        entry.dependencies = getComponentNames(sa);
-                        if (log.isDebugEnabled()) {
-                            log.debug("SA dependencies: " + entry.dependencies);
-                        }
-                        String missings = null;
-                        boolean canDeploy = true;
-                        for (String componentName : entry.dependencies) {
-                            if (container.getComponent(componentName) == null) {
-                                canDeploy = false;
-                                if (missings != null) {
-                                    missings += ", " + componentName;
-                                } else {
-                                    missings = componentName;
-                                }
-                            }
-                        }
-                        if (canDeploy) {
-                            deploymentService.deployServiceAssembly(tmpDir, sa);
-                            if (autoStart){
-                                deploymentService.start(name);
-                            }
-                        } else {
-                            // TODO: check that the assembly is not already pending
-                            entry.pending = true;
-                            log.warn("Components " + missings + " are not installed yet: the service assembly " + name + 
-                                     " deployment is suspended and will be resumed once the listed components are installed");
-                            pendingSAs.put(tmpDir, entry);
-                        }
-                    } catch (Exception e) {
-                        String errStr = "Failed to update Service Assembly: " + name;
-                        log.error(errStr, e);
-                        throw new DeploymentException(errStr, e);
-                    }
+                    updateServiceAssembly(entry, autoStart, tmpDir, root);
                 }
             } finally {
                 container.getBroker().resume();
@@ -352,6 +258,114 @@
         }
     }
 
+    protected void updateComponent(ArchiveEntry entry, boolean autoStart, File tmpDir, Descriptor root) throws DeploymentException {
+        Component comp = root.getComponent();
+        String componentName = comp.getIdentification().getName();
+        entry.type = "component";
+        entry.name = componentName;
+        try {
+            if (container.getRegistry().getComponent(componentName) != null) {
+                installationService.loadInstaller(componentName);
+                installationService.unloadInstaller(componentName, true);
+            }
+            // See if shared libraries are installed
+            entry.dependencies = getSharedLibraryNames(comp);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Component dependencies: " + entry.dependencies);
+            }
+            String missings = null;
+            boolean canInstall = true;
+            for (String libraryName : entry.dependencies) {
+                if (container.getRegistry().getSharedLibrary(libraryName) == null) {
+                    canInstall = false;
+                    if (missings != null) {
+                        missings += ", " + libraryName;
+                    } else {
+                        missings = libraryName;
+                    }
+                }
+            }
+            if (canInstall) {
+                installationService.install(tmpDir, null, root, autoStart);
+                checkPendingSAs();
+            } else {
+                entry.pending = true;
+                LOG.warn("Shared libraries " + missings + " are not installed yet: the component" + componentName
+                                + " installation is suspended and will be resumed once the listed shared libraries are installed");
+                pendingComponents.put(tmpDir, entry);
+            }
+        } catch (Exception e) {
+            String errStr = "Failed to update Component: " + componentName;
+            LOG.error(errStr, e);
+            throw new DeploymentException(errStr, e);
+        }
+    }
+
+    protected void updateSharedLibrary(ArchiveEntry entry, File tmpDir, Descriptor root) throws DeploymentException {
+        String libraryName = root.getSharedLibrary().getIdentification().getName();
+        entry.type = "library";
+        entry.name = libraryName;
+        try {
+            if (container.getRegistry().getSharedLibrary(libraryName) != null) {
+                container.getRegistry().unregisterSharedLibrary(libraryName);
+                environmentContext.removeSharedLibraryDirectory(libraryName);
+            }
+            installationService.doInstallSharedLibrary(tmpDir, root.getSharedLibrary());
+            checkPendingComponents();
+        } catch (Exception e) {
+            String errStr = "Failed to update SharedLibrary: " + libraryName;
+            LOG.error(errStr, e);
+            throw new DeploymentException(errStr, e);
+        }
+    }
+
+    protected void updateServiceAssembly(ArchiveEntry entry, boolean autoStart, File tmpDir, Descriptor root) throws DeploymentException {
+        ServiceAssembly sa = root.getServiceAssembly();
+        String name = sa.getIdentification().getName();
+        entry.type = "assembly";
+        entry.name = name;
+        try {
+            if (deploymentService.isSaDeployed(name)) {
+                deploymentService.shutDown(name);
+                deploymentService.undeploy(name);
+            }
+            // see if components are installed
+            entry.dependencies = getComponentNames(sa);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("SA dependencies: " + entry.dependencies);
+            }
+            String missings = null;
+            boolean canDeploy = true;
+            for (String componentName : entry.dependencies) {
+                if (container.getComponent(componentName) == null) {
+                    canDeploy = false;
+                    if (missings != null) {
+                        missings += ", " + componentName;
+                    } else {
+                        missings = componentName;
+                    }
+                }
+            }
+            if (canDeploy) {
+                deploymentService.deployServiceAssembly(tmpDir, sa);
+                if (autoStart) {
+                    deploymentService.start(name);
+                }
+            } else {
+                // TODO: check that the assembly is not already
+                // pending
+                entry.pending = true;
+                LOG.warn("Components " + missings + " are not installed yet: the service assembly " + name
+                                + " deployment is suspended and will be resumed once the listed components are installed");
+                pendingSAs.put(tmpDir, entry);
+            }
+        } catch (Exception e) {
+            String errStr = "Failed to update Service Assembly: " + name;
+            LOG.error(errStr, e);
+            throw new DeploymentException(errStr, e);
+        }
+    }
+
     protected DeploymentException failure(String task, String info) {
         return failure(task, info, null, null);
     }
@@ -410,31 +424,31 @@
             throw failure("deploy", "Error when deploying: " + entry.location, e);
         }
         // Standard processing
-        log.info("Attempting to remove archive at: " + entry.location);
-        try{
+        LOG.info("Attempting to remove archive at: " + entry.location);
+        try {
             container.getBroker().suspend();
             if ("component".equals(entry.type)) {
-                log.info("Uninstalling component: " + entry.name);
+                LOG.info("Uninstalling component: " + entry.name);
                 // Ensure installer is loaded
                 installationService.loadInstaller(entry.name);
                 // Uninstall and delete component
-                installationService.unloadInstaller(entry.name,true);
-            } 
+                installationService.unloadInstaller(entry.name, true);
+            }
             if ("library".equals(entry.type)) {
-                log.info("Removing shared library: " + entry.name);
+                LOG.info("Removing shared library: " + entry.name);
                 installationService.uninstallSharedLibrary(entry.name);
             }
             if ("assembly".equals(entry.type)) {
-                log.info("Undeploying service assembly " + entry.name);
-                try{
-                    if(deploymentService.isSaDeployed(entry.name)){
+                LOG.info("Undeploying service assembly " + entry.name);
+                try {
+                    if (deploymentService.isSaDeployed(entry.name)) {
                         deploymentService.shutDown(entry.name);
                         deploymentService.undeploy(entry.name);
                     }
-                } catch(Exception e) {
-                    String errStr = "Failed to update service assembly: "+ entry.name;
-                    log.error(errStr,e);
-                    throw new DeploymentException(errStr,e);
+                } catch (Exception e) {
+                    String errStr = "Failed to update service assembly: " + entry.name;
+                    LOG.error(errStr, e);
+                    throw new DeploymentException(errStr, e);
                 }
             }
         } finally {
@@ -443,9 +457,8 @@
     }
 
     /**
-     * Called when a component has been installed to see
-     * if pending service assemblies have all component
-     * installed.
+     * Called when a component has been installed to see if pending service
+     * assemblies have all component installed.
      */
     private void checkPendingSAs() {
         Set<File> deployedSas = new HashSet<File>();
@@ -467,7 +480,7 @@
                     deploymentService.start(root.getServiceAssembly().getIdentification().getName());
                 } catch (Exception e) {
                     String errStr = "Failed to update Service Assembly: " + tmp.getName();
-                    log.error(errStr, e);
+                    LOG.error(errStr, e);
                 }
             }
         }
@@ -485,7 +498,7 @@
 
     private void checkPendingComponents() {
         Set<File> installedComponents = new HashSet<File>();
-        for (Map.Entry<File,ArchiveEntry> me : pendingComponents.entrySet()) {
+        for (Map.Entry<File, ArchiveEntry> me : pendingComponents.entrySet()) {
             ArchiveEntry entry = me.getValue();
             boolean canInstall = true;
             for (String libraryName : entry.dependencies) {
@@ -502,7 +515,7 @@
                     installationService.install(tmp, null, root, true);
                 } catch (Exception e) {
                     String errStr = "Failed to update Component: " + tmp.getName();
-                    log.error(errStr, e);
+                    LOG.error(errStr, e);
                 }
             }
         }
@@ -526,17 +539,16 @@
      * @return array of AttributeInfos
      * @throws JMException
      */
-    public MBeanAttributeInfo[] getAttributeInfos() throws JMException{
-        AttributeInfoHelper helper=new AttributeInfoHelper();
-        helper.addAttribute(getObjectToManage(),"monitorInstallationDirectory",
-                        "Periodically monitor the Installation directory");
-        helper.addAttribute(getObjectToManage(),"monitorInterval","Interval (secs) before monitoring");
-        return AttributeInfoHelper.join(super.getAttributeInfos(),helper.getAttributeInfos());
+    public MBeanAttributeInfo[] getAttributeInfos() throws JMException {
+        AttributeInfoHelper helper = new AttributeInfoHelper();
+        helper.addAttribute(getObjectToManage(), "monitorInstallationDirectory", "Periodically monitor the Installation directory");
+        helper.addAttribute(getObjectToManage(), "monitorInterval", "Interval (secs) before monitoring");
+        return AttributeInfoHelper.join(super.getAttributeInfos(), helper.getAttributeInfos());
     }
 
     /**
-     * Unpack a location into a temp file directory.
-     * If the location does not contain a jbi descritor, no unpacking occurs.
+     * Unpack a location into a temp file directory. If the location does not
+     * contain a jbi descritor, no unpacking occurs.
      * 
      * @param location
      * @return tmp directory (if location contains a jbi descriptor)
@@ -547,27 +559,27 @@
         try {
             File file = new File(location);
             if (file.isDirectory()) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Deploying an exploded jar/zip, we will create a temporary jar for it.");
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Deploying an exploded jar/zip, we will create a temporary jar for it.");
                 }
                 // If we have a directory then we should move it over
                 File newFile = new File(tmpRoot.getAbsolutePath() + "/exploded.jar");
                 newFile.delete();
                 FileUtil.zipDir(file.getAbsolutePath(), newFile.getAbsolutePath());
                 file = newFile;
-                if (log.isDebugEnabled()) {
-                    log.debug("Deployment will now work from " + file.getAbsolutePath());
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Deployment will now work from " + file.getAbsolutePath());
                 }
             }
             if (!file.exists()) {
                 // assume it's a URL
-                try{
+                try {
                     URL url = new URL(location);
                     String fileName = url.getFile();
                     if (fileName == null) {
                         throw new DeploymentException("Location: " + location + " is not an archive");
                     }
-                    file = FileUtil.unpackArchive(url,tmpRoot);
+                    file = FileUtil.unpackArchive(url, tmpRoot);
                 } catch (MalformedURLException e) {
                     throw new DeploymentException(e);
                 }
@@ -575,8 +587,8 @@
             if (FileUtil.archiveContainsEntry(file, DescriptorFactory.DESCRIPTOR_FILE)) {
                 tmpDir = FileUtil.createUniqueDirectory(tmpRoot, file.getName());
                 FileUtil.unpackArchive(file, tmpDir);
-                if (log.isDebugEnabled()) {
-                    log.debug("Unpacked archive " + location + " to " + tmpDir);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Unpacked archive " + location + " to " + tmpDir);
                 }
             }
         } catch (IOException e) {
@@ -585,63 +597,57 @@
         return tmpDir;
     }
 
-    private void scheduleDirectoryTimer(){
+    private void scheduleDirectoryTimer() {
         if (!container.isEmbedded() && (isMonitorInstallationDirectory() || isMonitorDeploymentDirectory())) {
-            if(statsTimer==null){
-                statsTimer=new Timer(true);
+            if (statsTimer == null) {
+                statsTimer = new Timer(true);
             }
-            if(timerTask!=null){
+            if (timerTask != null) {
                 timerTask.cancel();
             }
-            timerTask=new TimerTask(){
-                public void run(){
-                    if(isMonitorInstallationDirectory()){
-                        monitorDirectory(environmentContext.getInstallationDir(),installFileMap);
+            timerTask = new TimerTask() {
+                public void run() {
+                    if (isMonitorInstallationDirectory()) {
+                        monitorDirectory(environmentContext.getInstallationDir(), installFileMap);
                     }
-                    if(isMonitorDeploymentDirectory()){
-                        monitorDirectory(environmentContext.getDeploymentDir(),deployFileMap);
+                    if (isMonitorDeploymentDirectory()) {
+                        monitorDirectory(environmentContext.getDeploymentDir(), deployFileMap);
                     }
                 }
             };
-            long interval=monitorInterval*1000;
-            statsTimer.scheduleAtFixedRate(timerTask,0,interval);
+            long interval = monitorInterval * 1000;
+            statsTimer.scheduleAtFixedRate(timerTask, 0, interval);
         }
     }
 
-
     private void monitorDirectory(final File root, final Map<String, ArchiveEntry> fileMap) {
         /*
-        if (log.isTraceEnabled()) {
-            if (root != null)
-                log.trace("Monitoring directory " + root.getAbsolutePath() + " for new or modified archives");
-            else
-                log.trace("No directory to monitor for new or modified archives for "
-                                + ((fileMap==installFileMap) ? "Installation" : "Deployment") + ".");
-        }
-        */
-        List<String> tmpList=new ArrayList<String>();
-        if(root!=null&&root.exists()&&root.isDirectory()){
-            File[] files=root.listFiles();
-            if(files!=null){
-                for(int i=0;i<files.length;i++){
-                    final File file=files[i];
+         * if (log.isTraceEnabled()) { if (root != null) log.trace("Monitoring
+         * directory " + root.getAbsolutePath() + " for new or modified
+         * archives"); else log.trace("No directory to monitor for new or
+         * modified archives for " + ((fileMap==installFileMap) ? "Installation" :
+         * "Deployment") + "."); }
+         */
+        List<String> tmpList = new ArrayList<String>();
+        if (root != null && root.exists() && root.isDirectory()) {
+            File[] files = root.listFiles();
+            if (files != null) {
+                for (int i = 0; i < files.length; i++) {
+                    final File file = files[i];
                     tmpList.add(file.getName());
                     if (isAllowedExtension(file.getName())) {
                         ArchiveEntry lastEntry = fileMap.get(file.getName());
-                        if(lastEntry == null || file.lastModified() > lastEntry.lastModified.getTime()){
-                            try{
+                        if (lastEntry == null || file.lastModified() > lastEntry.lastModified.getTime()) {
+                            try {
                                 final ArchiveEntry entry = new ArchiveEntry();
                                 entry.location = file.getName();
                                 entry.lastModified = new Date(file.lastModified());
                                 fileMap.put(file.getName(), entry);
-                                log.info("Directory: "+root.getName()+": Archive changed: processing "
-                                                +file.getName()+" ...");
+                                LOG.info("Directory: " + root.getName() + ": Archive changed: processing " + file.getName() + " ...");
                                 updateArchive(file.getAbsolutePath(), entry, true);
-                                log.info("Directory: "+root.getName()+": Finished installation of archive:  "
-                                        +file.getName());
-                            } catch(Exception e) {
-                                log.warn("Directory: "+root.getName()+": Automatic install of "+file
-                                                +" failed",e);
+                                LOG.info("Directory: " + root.getName() + ": Finished installation of archive:  " + file.getName());
+                            } catch (Exception e) {
+                                LOG.warn("Directory: " + root.getName() + ": Automatic install of " + file + " failed", e);
                             } finally {
                                 persistState(root, fileMap);
                             }
@@ -650,28 +656,28 @@
                 }
             }
             // now remove any locations no longer here
-            Map<String, ArchiveEntry> map=new HashMap<String, ArchiveEntry>(fileMap);
-            for(String location : map.keySet()) {
-                if(!tmpList.contains(location)){
+            Map<String, ArchiveEntry> map = new HashMap<String, ArchiveEntry>(fileMap);
+            for (String location : map.keySet()) {
+                if (!tmpList.contains(location)) {
                     ArchiveEntry entry = fileMap.remove(location);
-                    try{
-                        log.info("Location "+location+" no longer exists - removing ...");
+                    try {
+                        LOG.info("Location " + location + " no longer exists - removing ...");
                         removeArchive(entry);
                     } catch (DeploymentException e) {
-                        log.error("Failed to removeArchive: "+location,e);
+                        LOG.error("Failed to removeArchive: " + location, e);
                     }
                 }
             }
-            if (!map.equals(fileMap)){
+            if (!map.equals(fileMap)) {
                 persistState(root, fileMap);
             }
         }
     }
 
     private boolean isAllowedExtension(String file) {
-        String[] extensions = this.extensions.split(",");
-        for (int i = 0; i < extensions.length; i++) {
-            if (file.endsWith(extensions[i])) {
+        String[] ext = this.extensions.split(",");
+        for (int i = 0; i < ext.length; i++) {
+            if (file.endsWith(ext[i])) {
                 return true;
             }
         }
@@ -683,7 +689,7 @@
             File file = new File(environmentContext.getJbiRootDir(), root.getName() + ".xml");
             XmlPersistenceSupport.write(file, map);
         } catch (IOException e) {
-            log.error("Failed to persist file state to: " + root, e);
+            LOG.error("Failed to persist file state to: " + root, e);
         }
     }
 
@@ -695,29 +701,29 @@
             if (file.exists()) {
                 result = (Map<String, ArchiveEntry>) XmlPersistenceSupport.read(file);
             } else {
-                log.debug("State file doesn't exist: " + file.getPath());
+                LOG.debug("State file doesn't exist: " + file.getPath());
             }
         } catch (Exception e) {
-            log.error("Failed to read file state from: " + root, e);
+            LOG.error("Failed to read file state from: " + root, e);
         }
         return result;
     }
 
-    private void initializeFileMaps(){
+    private void initializeFileMaps() {
         if (isMonitorInstallationDirectory() && !container.isEmbedded()) {
             try {
-                installFileMap=readState(environmentContext.getInstallationDir());
+                installFileMap = readState(environmentContext.getInstallationDir());
                 removePendingEntries(installFileMap);
             } catch (Exception e) {
-                log.error("Failed to read installed state", e);
+                LOG.error("Failed to read installed state", e);
             }
         }
         if (isMonitorDeploymentDirectory() && !container.isEmbedded()) {
             try {
-                deployFileMap=readState(environmentContext.getDeploymentDir());
+                deployFileMap = readState(environmentContext.getDeploymentDir());
                 removePendingEntries(deployFileMap);
             } catch (Exception e) {
-                log.error("Failed to read deployed state", e);
+                LOG.error("Failed to read deployed state", e);
             }
         }
     }
@@ -735,11 +741,60 @@
     }
 
     public static class ArchiveEntry {
-        public String location;
-        public Date lastModified;
-        public String type;
-        public String name;
-        public boolean pending;
-        public transient Set<String> dependencies;
+        
+        private String location;
+        private Date lastModified;
+        private String type;
+        private String name;
+        private boolean pending;
+        private transient Set<String> dependencies;
+
+        public String getLocation() {
+            return location;
+        }
+
+        public void setLocation(String location) {
+            this.location = location;
+        }
+
+        public Date getLastModified() {
+            return lastModified;
+        }
+
+        public void setLastModified(Date lastModified) {
+            this.lastModified = lastModified;
+        }
+
+        public String getType() {
+            return type;
+        }
+
+        public void setType(String type) {
+            this.type = type;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public boolean isPending() {
+            return pending;
+        }
+
+        public void setPending(boolean pending) {
+            this.pending = pending;
+        }
+
+        public Set<String> getDependencies() {
+            return dependencies;
+        }
+
+        public void setDependencies(Set<String> dependencies) {
+            this.dependencies = dependencies;
+        }
     }
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java?view=diff&rev=564374&r1=564373&r2=564374
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClientFactory.java Thu Aug  9 13:33:26 2007
@@ -35,7 +35,7 @@
  */
 public class ClientFactory extends BaseSystemService implements ClientFactoryMBean, Serializable {
 
-    private static final Log logger = LogFactory.getLog(ClientFactory.class);
+    private static final Log LOG = LogFactory.getLog(ClientFactory.class);
     
     private String jndiName = DEFAULT_JNDI_NAME;
     
@@ -84,9 +84,9 @@
             getContainer().getNamingContext().bind(jndiName, this);
             super.start();
         } catch (NamingException e) {
-            logger.warn("Cound not start ClientFactory: " + e);
-            if (logger.isDebugEnabled()) {
-                logger.debug("Could not start ClientFactory", e);
+            LOG.warn("Cound not start ClientFactory: " + e);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Could not start ClientFactory", e);
             }
         }
     }
@@ -101,9 +101,9 @@
             super.stop();
             getContainer().getNamingContext().unbind(jndiName);
         } catch (NamingException e) {
-            logger.warn("Cound not stop ClientFactory: " + e);
-            if (logger.isDebugEnabled()) {
-                logger.debug("Could not stop ClientFactory", e);
+            LOG.warn("Cound not stop ClientFactory: " + e);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Could not stop ClientFactory", e);
             }
         }
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java?view=diff&rev=564374&r1=564373&r2=564374
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java Thu Aug  9 13:33:26 2007
@@ -24,13 +24,15 @@
 import javax.jbi.component.ComponentContext;
 import javax.jbi.management.MBeanNames;
 import javax.jbi.messaging.DeliveryChannel;
-import javax.jbi.messaging.MessagingException;
 import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 import javax.naming.InitialContext;
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.jbi.container.ActivationSpec;
@@ -38,8 +40,6 @@
 import org.apache.servicemix.jbi.container.JBIContainer;
 import org.apache.servicemix.jbi.container.SubscriptionSpec;
 import org.apache.servicemix.jbi.servicedesc.InternalEndpoint;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
 
 /**
  * This context provides access to data needed by all JBI components running in the JBI environment.
@@ -48,7 +48,7 @@
  */
 public class ComponentContextImpl implements ComponentContext, MBeanNames {
     
-    private static final Log log = LogFactory.getLog(ComponentContextImpl.class);
+    private static final Log LOG = LogFactory.getLog(ComponentContextImpl.class);
     
     private ComponentNameSpace componentName;
     private ComponentEnvironment environment;
@@ -72,16 +72,16 @@
     /**
      * Activate the ComponentContext
      * 
-     * @param component
+     * @param comp
      * @param channel
      * @param env
      * @param spec
      * @param installRoot
      */
-    public void activate(Component component, 
+    public void activate(Component comp, 
                          ComponentEnvironment env,
                          ActivationSpec spec) {
-        this.component = component;
+        this.component = comp;
         this.environment = env;
         this.activationSpec = spec;
         activated = true;
@@ -120,8 +120,8 @@
      */
     public ServiceEndpoint activateEndpoint(QName serviceName, String endpointName) throws JBIException {
         checkActivated();
-        if (log.isDebugEnabled()) {
-            log.debug("Component: " + componentName.getName() + " activated endpoint: " + serviceName + " : " + endpointName);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Component: " + componentName.getName() + " activated endpoint: " + serviceName + " : " + endpointName);
         }
         return container.getRegistry().activateEndpoint(this, serviceName, endpointName);
     }
@@ -280,8 +280,8 @@
      * Set the ComponentEnvironment
      * @param ce
      */
-    public void setEnvironment(ComponentEnvironment ce){
-    	  this.environment = ce;
+    public void setEnvironment(ComponentEnvironment ce) {
+        this.environment = ce;
     }
 
     /**

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java?view=diff&rev=564374&r1=564373&r2=564374
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java Thu Aug  9 13:33:26 2007
@@ -23,57 +23,57 @@
  */
 public interface ComponentMBean extends ComponentLifeCycleMBean {
     
-    public static final String TYPE_SERVICE_ENGINE = "service-engine";
-    public static final String TYPE_BINDING_COMPONENT = "binding-component";
-    public static final String TYPE_POJO = "pojo";
+    String TYPE_SERVICE_ENGINE = "service-engine";
+    String TYPE_BINDING_COMPONENT = "binding-component";
+    String TYPE_POJO = "pojo";
     
     /**
      * Get the name of this component
      * @return the name of this component
      */
-    public String getName();
+    String getName();
     
     /**
      * Is MessageExchange sender throttling enabled ?
      * @return true if throttling enabled
      */
-    public boolean isExchangeThrottling();
+    boolean isExchangeThrottling();
     
     /**
      * Set exchange throttling
      * @param value
      *
      */
-    public void setExchangeThrottling(boolean value);
+    void setExchangeThrottling(boolean value);
     
     /**
      * Get the throttling timeout
      * @return throttling timeout (ms)
      */
-    public long getThrottlingTimeout();
+    long getThrottlingTimeout();
     
     /**
      * Set the throttling timout 
      * @param value (ms)
      */
-    public void setThrottlingTimeout(long value);
+    void setThrottlingTimeout(long value);
     
     /**
      * Get the interval for throttling -
      * number of Exchanges set before the throttling timeout is applied
      * @return interval for throttling
      */
-    public int getThrottlingInterval();
+    int getThrottlingInterval();
     
     /**
      * Set the throttling interval
      * number of Exchanges set before the throttling timeout is applied
      * @param value
      */
-    public void setThrottlingInterval(int value);
+    void setThrottlingInterval(int value);
     
     /**
      * @return the component type (service-engine, binding-component)
      */
-    public String getComponentType();
+    String getComponentType();
 }