Author: gnodet
Date: Wed Oct 25 04:07:19 2006
New Revision: 467603
URL: http://svn.apache.org/viewvc?view=rev&rev=467603
Log:
Fix some mbeans / add minor functions
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/RegistryMBean.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SharedLibrary.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SharedLibraryMBean.java
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java?view=diff&rev=467603&r1=467602&r2=467603
==============================================================================
---
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java
(original)
+++
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java
Wed Oct 25 04:07:19 2006
@@ -522,8 +522,9 @@
public MBeanOperationInfo[] getOperationInfos() throws JMException {
OperationInfoHelper helper = new OperationInfoHelper();
ParameterHelper ph = helper.addOperation(getObjectToManage(),
- "installComponent", 1, "install a component");
- ph.setDescription(0, "file", "location of JBI Component to
install");
+ "installComponent", 2, "install a component");
+ ph.setDescription(0, "file", "location of JBI Component to install");
+ ph.setDescription(1, "deferExceptions", "true if exceptions due to
missing dependencies should be differed");
ph = helper.addOperation(getObjectToManage(),
"uninstallComponent", 1,
"uninstall a component");
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java?view=diff&rev=467603&r1=467602&r2=467603
==============================================================================
---
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java
(original)
+++
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java
Wed Oct 25 04:07:19 2006
@@ -24,6 +24,16 @@
*/
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";
+
+ /**
+ * Get the name of this component
+ * @return the name of this component
+ */
+ public String getName();
+
/**
* Is MessageExchange sender throttling enabled ?
* @return true if throttling enabled
@@ -39,7 +49,7 @@
/**
* Get the throttling timeout
- * @return throttling tomeout (ms)
+ * @return throttling timeout (ms)
*/
public long getThrottlingTimeout();
@@ -67,4 +77,9 @@
* @return the ObjectName for the stats MBean for this Component - or null
if it doesn't exist
*/
public ObjectName getStatsMBeanName();
+
+ /**
+ * @return the component type (service-engine, binding-component)
+ */
+ public String getComponentType();
}
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java?view=diff&rev=467603&r1=467602&r2=467603
==============================================================================
---
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java
(original)
+++
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java
Wed Oct 25 04:07:19 2006
@@ -525,6 +525,7 @@
*/
public MBeanAttributeInfo[] getAttributeInfos() throws JMException {
AttributeInfoHelper helper = new AttributeInfoHelper();
+ helper.addAttribute(getObjectToManage(), "componentType", "the type of
this component (BC, SE, POJO)");
helper.addAttribute(getObjectToManage(), "inboundQueueCapacity",
"capacity of the inbound queue");
helper.addAttribute(getObjectToManage(), "exchangeThrottling", "apply
throttling");
helper.addAttribute(getObjectToManage(), "throttlingTimeout", "timeout
for throttling");
@@ -665,6 +666,13 @@
*/
public String[] getSharedLibraries() {
return sharedLibraries;
+ }
+
+ /**
+ * @return the component type
+ */
+ public String getComponentType() {
+ return isBinding() ? "binding-component" : isEngine() ?
"service-engine" : "pojo";
}
}
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java?view=diff&rev=467603&r1=467602&r2=467603
==============================================================================
---
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
(original)
+++
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
Wed Oct 25 04:07:19 2006
@@ -210,12 +210,17 @@
File
tmpDir=AutoDeploymentService.unpackLocation(environmentContext.getTmpDir(),aSharedLibURI);
if(tmpDir!=null){
Descriptor root=DescriptorFactory.buildDescriptor(tmpDir);
+ if (root == null) {
+ throw new DeploymentException("Could not find JBI
descriptor");
+ }
SharedLibrary sl=root.getSharedLibrary();
if(sl!=null){
result=doInstallSharedLibrary(tmpDir,sl);
+ } else {
+ throw new DeploymentException("JBI descriptor is not a
SharedLibrary descriptor");
}
}else{
- log.warn("location: "+aSharedLibURI+" isn't valid");
+ throw new DeploymentException("Could not find JBI descriptor");
}
}catch(DeploymentException e){
log.error("Deployment failed",e);
@@ -269,12 +274,15 @@
if (tmpDir != null) {
Descriptor root = DescriptorFactory.buildDescriptor(tmpDir);
if (root != null) {
+ if (root.getComponent() == null) {
+ throw new DeploymentException("JBI descriptor is not a
component descriptor");
+ }
install(tmpDir, props, root, autoStart);
- }else{
- log.error("Could not find Descriptor from: " + location);
+ } else {
+ throw new DeploymentException("Could not find JBI descriptor");
}
- }else{
- log.warn("location: "+location+" isn't valid");
+ } else {
+ throw new DeploymentException("Could not find JBI descriptor");
}
}
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java?view=diff&rev=467603&r1=467602&r2=467603
==============================================================================
---
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
(original)
+++
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
Wed Oct 25 04:07:19 2006
@@ -29,6 +29,7 @@
import javax.jbi.management.DeploymentException;
import javax.jbi.servicedesc.ServiceEndpoint;
import javax.management.JMException;
+import javax.management.MBeanAttributeInfo;
import javax.management.ObjectName;
import javax.xml.namespace.QName;
@@ -42,6 +43,7 @@
import org.apache.servicemix.jbi.container.SubscriptionSpec;
import org.apache.servicemix.jbi.deployment.ServiceAssembly;
import org.apache.servicemix.jbi.deployment.ServiceUnit;
+import org.apache.servicemix.jbi.management.AttributeInfoHelper;
import org.apache.servicemix.jbi.management.BaseSystemService;
import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
import org.apache.servicemix.jbi.servicedesc.AbstractServiceEndpoint;
@@ -570,7 +572,6 @@
result = new ObjectName[tmpList.size()];
tmpList.toArray(result);
return result;
-
}
/**
@@ -697,6 +698,19 @@
}
/**
+ * Return a list of all service units.
+ *
+ * @return list of all service units
+ */
+ public Collection getServiceUnits() {
+ return serviceUnits.values();
+ }
+
+ public Collection getServiceAssemblies() {
+ return serviceAssemblyRegistry.getServiceAssemblies();
+ }
+
+ /**
* Returns a list of Service Assemblies deployed to the JBI enviroment.
*
* @return list of Service Assembly Name's.
@@ -899,6 +913,67 @@
ComponentMBeanImpl comp = (ComponentMBeanImpl) iter.next();
// TODO: restore component state if
}
+ }
+
+ public ObjectName[] getComponentNames() {
+ List tmpList = new ArrayList();
+ for (Iterator i = getComponents().iterator(); i.hasNext();){
+ ComponentMBeanImpl lcc = (ComponentMBeanImpl) i.next();
+
tmpList.add(container.getManagementContext().createObjectName(lcc));
+ }
+ return (ObjectName[]) tmpList.toArray(new ObjectName[tmpList.size()]);
+ }
+
+ public ObjectName[] getEndpointNames() {
+ List tmpList = new ArrayList();
+ for (Iterator i =
container.getRegistry().getEndpointRegistry().getEndpointMBeans().iterator();
i.hasNext();){
+ Endpoint ep = (Endpoint) i.next();
+ tmpList.add(container.getManagementContext().createObjectName(ep));
+ }
+ return (ObjectName[]) tmpList.toArray(new ObjectName[tmpList.size()]);
+ }
+
+ public ObjectName[] getServiceAssemblyNames() {
+ List tmpList = new ArrayList();
+ for (Iterator i = getServiceAssemblies().iterator(); i.hasNext();){
+ ServiceAssemblyLifeCycle sa = (ServiceAssemblyLifeCycle) i.next();
+ tmpList.add(container.getManagementContext().createObjectName(sa));
+ }
+ return (ObjectName[]) tmpList.toArray(new ObjectName[tmpList.size()]);
+ }
+
+ public ObjectName[] getServiceUnitNames() {
+ List tmpList = new ArrayList();
+ for (Iterator i = serviceUnits.values().iterator(); i.hasNext();){
+ ServiceUnitLifeCycle su = (ServiceUnitLifeCycle) i.next();
+ tmpList.add(container.getManagementContext().createObjectName(su));
+ }
+ return (ObjectName[]) tmpList.toArray(new ObjectName[tmpList.size()]);
+ }
+
+ public ObjectName[] getSharedLibraryNames() {
+ List tmpList = new ArrayList();
+ for (Iterator i = sharedLibraries.values().iterator(); i.hasNext();){
+ SharedLibrary sl = (SharedLibrary) i.next();
+ tmpList.add(container.getManagementContext().createObjectName(sl));
+ }
+ return (ObjectName[]) tmpList.toArray(new ObjectName[tmpList.size()]);
+ }
+
+ /**
+ * Get an array of MBeanAttributeInfo
+ *
+ * @return array of AttributeInfos
+ * @throws JMException
+ */
+ public MBeanAttributeInfo[] getAttributeInfos() throws JMException {
+ AttributeInfoHelper helper = new AttributeInfoHelper();
+ helper.addAttribute(getObjectToManage(), "componentNames", "list of
components");
+ helper.addAttribute(getObjectToManage(), "serviceUnitNames", "list of
service units");
+ helper.addAttribute(getObjectToManage(), "serviceAssemblyNames", "list
of service assemblies");
+ helper.addAttribute(getObjectToManage(), "endpointNames", "list of
endpoints");
+ helper.addAttribute(getObjectToManage(), "sharedLibraryNames", "list
of shared libraries");
+ return AttributeInfoHelper.join(super.getAttributeInfos(),
helper.getAttributeInfos());
}
}
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/RegistryMBean.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/RegistryMBean.java?view=diff&rev=467603&r1=467602&r2=467603
==============================================================================
---
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/RegistryMBean.java
(original)
+++
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/RegistryMBean.java
Wed Oct 25 04:07:19 2006
@@ -17,7 +17,18 @@
package org.apache.servicemix.jbi.framework;
import javax.jbi.management.LifeCycleMBean;
+import javax.management.ObjectName;
public interface RegistryMBean extends LifeCycleMBean {
+ ObjectName[] getComponentNames();
+
+ ObjectName[] getServiceUnitNames();
+
+ ObjectName[] getServiceAssemblyNames();
+
+ ObjectName[] getSharedLibraryNames();
+
+ ObjectName[] getEndpointNames();
+
}
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java?view=diff&rev=467603&r1=467602&r2=467603
==============================================================================
---
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java
(original)
+++
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java
Wed Oct 25 04:07:19 2006
@@ -17,6 +17,7 @@
package org.apache.servicemix.jbi.framework;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -232,6 +233,15 @@
}
}
return result;
+ }
+
+ /**
+ * Returns a list of service assemblies.
+ *
+ * @return list of service assemblies
+ */
+ public Collection getServiceAssemblies() {
+ return serviceAssemblies.values();
}
}
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SharedLibrary.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SharedLibrary.java?view=diff&rev=467603&r1=467602&r2=467603
==============================================================================
---
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SharedLibrary.java
(original)
+++
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SharedLibrary.java
Wed Oct 25 04:07:19 2006
@@ -87,14 +87,19 @@
return library.getIdentification().getName();
}
+ public String getVersion() {
+ return library.getVersion();
+ }
+
public Object getObjectToManage() {
return this;
}
public MBeanAttributeInfo[] getAttributeInfos() throws JMException {
AttributeInfoHelper helper = new AttributeInfoHelper();
- helper.addAttribute(getObjectToManage(), "name", "name of the service
unit");
- helper.addAttribute(getObjectToManage(), "description", "description
of the service unit");
+ helper.addAttribute(getObjectToManage(), "name", "name of the shared
library");
+ helper.addAttribute(getObjectToManage(), "description", "description
of this shared library");
+ helper.addAttribute(getObjectToManage(), "version", "version of this
shared library");
return helper.getAttributeInfos();
}
@@ -114,5 +119,5 @@
// We do not fire property events, so need to keep
// a reference
}
-
+
}
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SharedLibraryMBean.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SharedLibraryMBean.java?view=diff&rev=467603&r1=467602&r2=467603
==============================================================================
---
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SharedLibraryMBean.java
(original)
+++
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SharedLibraryMBean.java
Wed Oct 25 04:07:19 2006
@@ -18,4 +18,9 @@
public interface SharedLibraryMBean {
+ public String getName();
+
+ public String getDescription();
+
+ public String getVersion();
}