[prev in list] [next in list] [prev in thread] [next in thread]
List: jboss-cvs-commits
Subject: [jboss-cvs] jmx/src/main/org/jboss/mx/server AbstractMBeanInvoker.java
From: Scott M Stark <starksm () users ! sourceforge ! net>
Date: 2004-10-31 19:26:59
Message-ID: E1COLLv-0008GK-Lo () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]
User: starksm
Date: 04/10/31 11:26:59
Modified: src/main/org/jboss/mx/server Tag: Branch_4_0
AbstractMBeanInvoker.java
Log:
Add support for injecting jmx kernel types into the underlying xmbean resource \
based on the xmbean descriptors/injection metadata. This generalizes the previous \
single hard coded injection of the MBeanServer if the resource supported a \
setMBeanServer(MBeanServer) method.
Revision Changes Path
No revision
No revision
1.34.2.1 +245 -183 jmx/src/main/org/jboss/mx/server/AbstractMBeanInvoker.java
Index: AbstractMBeanInvoker.java
===================================================================
RCS file: /cvsroot/jboss/jmx/src/main/org/jboss/mx/server/AbstractMBeanInvoker.java,v
retrieving revision 1.34
retrieving revision 1.34.2.1
diff -u -r1.34 -r1.34.2.1
--- AbstractMBeanInvoker.java 11 Sep 2004 16:57:54 -0000 1.34
+++ AbstractMBeanInvoker.java 31 Oct 2004 19:26:59 -0000 1.34.2.1
@@ -36,6 +36,7 @@
import javax.management.RuntimeMBeanException;
import javax.management.RuntimeOperationsException;
import javax.management.modelmbean.ModelMBeanInfoSupport;
+import javax.management.modelmbean.ModelMBeanInfo;
import org.jboss.logging.Logger;
import org.jboss.mx.interceptor.AttributeDispatcher;
@@ -46,17 +47,18 @@
import org.jboss.mx.server.registry.MBeanEntry;
-/** A base MBeanInvoker class that provides common state as well as
- *
- * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>.
+/**
+ * A base MBeanInvoker class that provides common state as well as
+ * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>.
* @author Scott.Stark@jboss.org
- * @version $Revision: 1.34 $
- *
+ * @version $Revision: 1.34.2.1 $
*/
public abstract class AbstractMBeanInvoker
implements MBeanInvoker
{
- /** Used to propagate the MBeanEntry during the preRegister callback */
+ /**
+ * Used to propagate the MBeanEntry during the preRegister callback
+ */
static ThreadLocal preRegisterInfo = new ThreadLocal();
// Attributes ----------------------------------------------------
@@ -64,48 +66,56 @@
/**
* The target object for this invoker.
*/
- private Object resource = null;
- /** The mbean server register entry used for the TCL */
- protected MBeanEntry resourceEntry = null;
+ private Object resource = null;
+ /**
+ * The mbean server register entry used for the TCL
+ */
+ protected MBeanEntry resourceEntry = null;
- /** Whether this is a dynamic resource */
+ /**
+ * Whether this is a dynamic resource
+ */
protected boolean dynamicResource = true;
/**
* The metadata describing this MBean.
*/
- protected MBeanInfo info = null;
+ protected MBeanInfo info = null;
- protected Map attributeContextMap = new HashMap();
- protected Map operationContextMap = new HashMap();
- protected Map constructorContextMap = new HashMap();
-
- protected InvocationContext getMBeanInfoCtx = null;
- protected InvocationContext preRegisterCtx = null;
- protected InvocationContext postRegisterCtx = null;
- protected InvocationContext preDeregisterCtx = null;
- protected InvocationContext postDeregisterCtx = null;
+ protected Map attributeContextMap = new HashMap();
+ protected Map operationContextMap = new HashMap();
+ protected Map constructorContextMap = new HashMap();
+
+ protected InvocationContext getMBeanInfoCtx = null;
+ protected InvocationContext preRegisterCtx = null;
+ protected InvocationContext postRegisterCtx = null;
+ protected InvocationContext preDeregisterCtx = null;
+ protected InvocationContext postDeregisterCtx = null;
// TODO: allow to config invoker specific logs
// : multitarget mbean for invoker + log?
- protected Logger log = \
Logger.getLogger(AbstractMBeanInvoker.class); + protected Logger log = \
Logger.getLogger(AbstractMBeanInvoker.class);
- /** The MBeanServer passed in to preRegister */
+ /**
+ * The MBeanServer passed in to preRegister
+ */
private MBeanServer server;
- /** Set the MBeanEntry thread local value.
- *
- * @param entry - the entry that will be used on successful registration
- */
+ /**
+ * Set the MBeanEntry thread local value.
+ * @param entry - the entry that will be used on successful registration
+ */
public static void setMBeanEntry(MBeanEntry entry)
{
preRegisterInfo.set(entry);
}
- /** An accessor for the MBeanEntry thread local
+
+ /**
+ * An accessor for the MBeanEntry thread local
* @return
- */
+ */
public static MBeanEntry getMBeanEntry()
{
return (MBeanEntry) preRegisterInfo.get();
@@ -126,9 +136,11 @@
{
this.resource = resource;
}
- /** Constructs an invoker with the target resource entry.
+
+ /**
+ * Constructs an invoker with the target resource entry.
* @param resourceEntry
- */
+ */
public AbstractMBeanInvoker(MBeanEntry resourceEntry)
{
this.resourceEntry = resourceEntry;
@@ -147,19 +159,17 @@
* Invokes the target resource. The default invocation used by this invoker
* implement sends the invocation through a stack of interceptors before
* reaching the target method.
- *
- * @param operationName name of the target method
- * @param args argumetns for the target method
- * @param signature signature of the target method
- *
+ * @param operationName name of the target method
+ * @param args argumetns for the target method
+ * @param signature signature of the target method
* @throws MBeanException if the target method raised a hecked exception
* @throws ReflectionException if there was an error trying to resolve or
- * invoke the target method
+ * invoke the target method
* @throws RuntimeMBeanException if the target method raised an unchecked
- * exception
+ * exception
*/
public Object invoke(String operationName, Object[] args, String[] signature)
- throws MBeanException, ReflectionException
+ throws MBeanException, ReflectionException
{
// TODO: __JBOSSMX_INVOCATION
@@ -175,13 +185,13 @@
if (dot != -1)
{
if (dot < operationName.length() - 1)
- opName = operationName.substring(dot + 1);
+ opName = operationName.substring(dot + 1);
}
}
// get the server side invocation context
OperationKey key = new OperationKey(opName, signature);
- InvocationContext ctx = (InvocationContext)operationContextMap.get(key);
+ InvocationContext ctx = (InvocationContext) operationContextMap.get(key);
// if the server does not contain this context, we do not have the operation
if (ctx == null)
@@ -200,14 +210,11 @@
}
}
if (operationExists)
- throw new ReflectionException(new NoSuchMethodException(
- "Unable to find operation " + operationName +
- getSignatureString(signature)));
- }
- throw new ReflectionException(new IllegalArgumentException(
- "Unable to find operation " + operationName +
- getSignatureString(signature))
- );
+ throw new ReflectionException(new NoSuchMethodException("Unable to \
find operation " + operationName + + \
getSignatureString(signature))); + }
+ throw new ReflectionException(new IllegalArgumentException("Unable to \
find operation " + operationName + + getSignatureString(signature)));
}
// create the invocation object
@@ -226,11 +233,11 @@
invocation.setArgs(args);
override(invocation);
-
+
ClassLoader mbeanTCL = resourceEntry.getClassLoader();
final ClassLoader ccl = TCLAction.UTIL.getContextClassLoader();
boolean setCl = ccl != mbeanTCL && mbeanTCL != null;
- if(setCl)
+ if (setCl)
{
TCLAction.UTIL.setContextClassLoader(mbeanTCL);
}
@@ -259,7 +266,7 @@
return null;
}
- // TODO: should be fixed by adding invocation return value object
+ // TODO: should be fixed by adding invocation return value object
finally
{
Descriptor descriptor = invocation.getDescriptor();
@@ -276,7 +283,7 @@
invocation.setDescriptor(null);
invocation.setDispatcher(null);
- if(setCl)
+ if (setCl)
{
TCLAction.UTIL.setContextClassLoader(ccl);
}
@@ -285,22 +292,19 @@
}
/**
- * Returns an attribte value. The request for the value is forced through
- * a set of interceptors before the value is returned.
- *
- * @param attribute attribute name
- *
- * @return attribute value
- *
- * @throws AttributeNotFoundException if the requested attribute is not
- * part of the MBean's management interface
+ * Returns an attribte value. The request for the value is forced through a
+ * set of interceptors before the value is returned.
+ * @param attribute attribute name
+ * @return attribute value
+ * @throws AttributeNotFoundException if the requested attribute is not part
+ * of the MBean's management interface
* @throws MBeanException if retrieving the attribute value causes an
- * application exception
- * @throws ReflectionException if there was an error trying to retrieve
- * the attribute value
+ * application exception
+ * @throws ReflectionException if there was an error trying to retrieve the
+ * attribute value
*/
public Object getAttribute(String attribute)
- throws AttributeNotFoundException, MBeanException, ReflectionException
+ throws AttributeNotFoundException, MBeanException, ReflectionException
{
// TODO: __JBOSSMX_INVOCATION
@@ -308,7 +312,7 @@
throw new RuntimeOperationsException(new IllegalArgumentException("Cannot \
get null attribute"));
// lookup the server side invocation context
- InvocationContext ctx = \
(InvocationContext)attributeContextMap.get(attribute); + InvocationContext ctx \
= (InvocationContext) attributeContextMap.get(attribute);
// if we don't have a server side invocation context for the attribute,
// it does not exist as far as we are concerned
@@ -333,7 +337,7 @@
ClassLoader mbeanTCL = resourceEntry.getClassLoader();
final ClassLoader ccl = TCLAction.UTIL.getContextClassLoader();
boolean setCl = ccl != mbeanTCL && mbeanTCL != null;
- if(setCl)
+ if (setCl)
{
TCLAction.UTIL.setContextClassLoader(mbeanTCL);
}
@@ -364,14 +368,14 @@
return null;
}
- // TODO: should be fixed by adding invocation return value object
+ // TODO: should be fixed by adding invocation return value object
finally
{
Descriptor attrDesc = invocation.getDescriptor();
ctx.setDescriptor(attrDesc);
updateAttributeInfo(attrDesc);
- if(setCl)
+ if (setCl)
{
TCLAction.UTIL.setContextClassLoader(ccl);
}
@@ -381,20 +385,18 @@
/**
* Sets an attribute value. The operation is forced through a set of
* interceptors before the new value for the attribute is set.
- *
- * @param attribute new attribute value
- *
+ * @param attribute new attribute value
* @throws AttributeNotFoundException if the requested attribute is not part
- * of the MBean's management interface
+ * of the MBean's management interface
* @throws InvalidAttributeValueException if the attribute contains a value
- * not suitable for the attribute
- * @throws MBeanException if setting the attribute value causes an application
- * exception
+ * not suitable for the attribute
+ * @throws MBeanException if setting the attribute value causes an
+ * application exception
* @throws ReflectionException if there was an error trying to set the
- * attribute value.
+ * attribute value.
*/
public void setAttribute(Attribute attribute) throws \
AttributeNotFoundException,
- InvalidAttributeValueException, MBeanException, ReflectionException
+ InvalidAttributeValueException, MBeanException, ReflectionException
{
// TODO: __JBOSSMX_INVOCATION
@@ -403,16 +405,16 @@
// lookup the server side invocation context
String name = attribute.getName();
- InvocationContext ctx = (InvocationContext)attributeContextMap.get(name);
+ InvocationContext ctx = (InvocationContext) attributeContextMap.get(name);
// if we don't have a server side invocation context for the attribute,
// it does not exist as far as we are concerned
if (ctx == null)
throw new AttributeNotFoundException("not found: " + name);
- else if( ctx.isWritable() == false )
+ else if (ctx.isWritable() == false)
{
throw new AttributeNotFoundException("Attribute '" + name
- + "' is not writable");
+ + "' is not writable");
}
// create the invocation object
@@ -425,14 +427,14 @@
invocation.setType(InvocationContext.OP_SETATTRIBUTE);
// set the attribute value as the argument
- invocation.setArgs(new Object[] { attribute.getValue() });
+ invocation.setArgs(new Object[]{attribute.getValue()});
override(invocation);
ClassLoader mbeanTCL = resourceEntry.getClassLoader();
final ClassLoader ccl = TCLAction.UTIL.getContextClassLoader();
boolean setCl = ccl != mbeanTCL && mbeanTCL != null;
- if(setCl)
+ if (setCl)
{
TCLAction.UTIL.setContextClassLoader(mbeanTCL);
}
@@ -468,7 +470,7 @@
rethrowAsMBeanException(t);
}
- // TODO: should be fixed by adding invocation return value object
+ // TODO: should be fixed by adding invocation return value object
finally
{
/* Obtain the updated attribute descriptor and propagate to the
@@ -479,7 +481,7 @@
ctx.setDescriptor(attrDesc);
updateAttributeInfo(attrDesc);
- if(setCl)
+ if (setCl)
{
TCLAction.UTIL.setContextClassLoader(ccl);
}
@@ -494,19 +496,19 @@
// set the invocation's access point as getMBeanInfo()
invocation.setType(InvocationContext.OP_GETMBEANINFO);
- if( resourceEntry == null )
+ if (resourceEntry == null)
resourceEntry = getMBeanEntry();
ClassLoader mbeanTCL = resourceEntry.getClassLoader();
final ClassLoader ccl = TCLAction.UTIL.getContextClassLoader();
boolean setCl = ccl != mbeanTCL && mbeanTCL != null;
- if(setCl)
+ if (setCl)
{
TCLAction.UTIL.setContextClassLoader(mbeanTCL);
}
try
{
- MBeanInfo info = (MBeanInfo)invocation.invoke();
+ MBeanInfo info = (MBeanInfo) invocation.invoke();
return info;
}
catch (JMRuntimeException e)
@@ -520,7 +522,7 @@
}
finally
{
- if(setCl)
+ if (setCl)
{
TCLAction.UTIL.setContextClassLoader(ccl);
}
@@ -555,11 +557,11 @@
throw new IllegalArgumentException("null list");
AttributeList results = new AttributeList();
- Iterator it = attributes.iterator();
+ Iterator it = attributes.iterator();
while (it.hasNext())
{
- Attribute attr = (Attribute)it.next();
+ Attribute attr = (Attribute) it.next();
try
{
setAttribute(attr);
@@ -580,23 +582,47 @@
// MBeanRegistration implementation ------------------------------
/**
- * Initializes this invoker. At the registration time we can be sure that
- * all of the metadata is available and initialize the invoker and cache
- * the data accordingly. <p>
+ * Initializes this invoker. At the registration time we can be sure that all
+ * of the metadata is available and initialize the invoker and cache the data
+ * accordingly. <p>
*
* Subclasses that override the <tt>preRegister</tt> method must make sure
- * they call <tt>super.preRegister()</tt> in their implementation to
- * ensure proper initialization of the invoker.
+ * they call <tt>super.preRegister()</tt> in their implementation to ensure
+ * proper initialization of the invoker.
*/
public ObjectName preRegister(MBeanServer server, ObjectName name) throws \
Exception {
this.resourceEntry = (MBeanEntry) preRegisterInfo.get();
this.server = server;
+ ObjectName mbeanName = null;
+ Descriptor mbeanDescriptor = null;
+ if( info instanceof ModelMBeanInfo )
+ {
+ ModelMBeanInfo minfo = (ModelMBeanInfo) info;
+ try
+ {
+ mbeanDescriptor = minfo.getDescriptor("",
+ ModelMBeanConstants.MBEAN_DESCRIPTOR);
+ String type = (String) mbeanDescriptor.getFieldValue(
+ ModelMBeanConstants.MBEAN_SERVER_INJECTION_TYPE);
+ if( type != null )
+ {
+ inject(ModelMBeanConstants.MBEAN_SERVER_INJECTION_TYPE,
+ type, MBeanServer.class, getServer());
+ }
+ }
+ catch (MBeanException e)
+ {
+ log.warn("Failed to obtain descriptor: \
"+ModelMBeanConstants.MBEAN_DESCRIPTOR, e); + }
+
+ }
+
ClassLoader mbeanTCL = resourceEntry.getClassLoader();
final ClassLoader ccl = TCLAction.UTIL.getContextClassLoader();
boolean setCl = ccl != mbeanTCL && mbeanTCL != null;
- if(setCl)
+ if (setCl)
{
TCLAction.UTIL.setContextClassLoader(mbeanTCL);
}
@@ -607,39 +633,51 @@
initOperationContexts(info.getOperations());
- if( resource != null )
+ if (resource != null)
initDispatchers();
- return invokePreRegister(server, name);
+ mbeanName = invokePreRegister(server, name);
+ if( mbeanDescriptor != null )
+ {
+ Object value = mbeanDescriptor.getFieldValue(
+ ModelMBeanConstants.OBJECT_NAME_INJECTION_TYPE);
+ String type = (String) value;
+ if( type != null )
+ {
+ inject(ModelMBeanConstants.OBJECT_NAME_INJECTION_TYPE,
+ type, ObjectName.class, mbeanName);
+ }
+ }
}
finally
{
- if(setCl)
+ if (setCl)
{
TCLAction.UTIL.setContextClassLoader(ccl);
}
}
+ return mbeanName;
}
/**
*/
public void postRegister(Boolean registrationSuccessful)
{
- invokePostRegister(registrationSuccessful);
+ invokePostRegister(registrationSuccessful);
}
/**
*/
public void preDeregister() throws Exception
{
- invokePreDeregister();
+ invokePreDeregister();
}
/**
*/
public void postDeregister()
{
- invokePostDeregister();
+ invokePostDeregister();
this.server = null;
}
@@ -647,89 +685,78 @@
// NotificationEmitter implementation ------------------------
public void addNotificationListener(NotificationListener listener,
- NotificationFilter filter, Object handback)
+ NotificationFilter filter, Object handback)
{
addNotificationListenerToResource(listener, filter, handback);
}
- protected void addNotificationListenerToResource(
- NotificationListener listener, NotificationFilter filter, Object handback
- )
+ protected void addNotificationListenerToResource(NotificationListener listener, \
NotificationFilter filter, Object handback) {
if (resource instanceof NotificationBroadcaster)
{
- ((NotificationBroadcaster)resource).addNotificationListener(
- listener, filter, handback
- );
+ ((NotificationBroadcaster) resource).addNotificationListener(listener, \
filter, handback); }
else
{
- throw new RuntimeMBeanException(new IllegalArgumentException(
- "Target XXX is not a notification broadcaster"
+ throw new RuntimeMBeanException(new IllegalArgumentException("Target XXX \
is not a notification broadcaster"
- // FIXME: add the XXX object name, store from registration
+ // FIXME: add the XXX object name, store from registration
));
}
}
public void removeNotificationListener(NotificationListener listener)
- throws ListenerNotFoundException
+ throws ListenerNotFoundException
{
removeNotificationListenerFromResource(listener);
}
protected void removeNotificationListenerFromResource(NotificationListener \
listener)
- throws ListenerNotFoundException
+ throws ListenerNotFoundException
{
if (resource instanceof NotificationBroadcaster)
{
- ((NotificationBroadcaster)resource).removeNotificationListener(
- listener
- );
+ ((NotificationBroadcaster) \
resource).removeNotificationListener(listener); }
else
{
- throw new RuntimeMBeanException(new IllegalArgumentException(
- "Target XXX is not a notification broadcaster"
+ throw new RuntimeMBeanException(new IllegalArgumentException("Target XXX \
is not a notification broadcaster"
- // FIXME: add the XXX object name, store from registration
+ // FIXME: add the XXX object name, store from registration
));
}
}
public void removeNotificationListener(NotificationListener listener,
- NotificationFilter filter,
- Object handback)
- throws ListenerNotFoundException
+ NotificationFilter filter,
+ Object handback)
+ throws ListenerNotFoundException
{
removeNotificationListenerFromResource(listener, filter, handback);
}
protected void removeNotificationListenerFromResource(NotificationListener \
listener,
- NotificationFilter filter,
- Object handback)
- throws ListenerNotFoundException
+ NotificationFilter filter,
+ Object handback)
+ throws ListenerNotFoundException
{
if (resource instanceof NotificationEmitter)
{
- ((NotificationEmitter)resource).removeNotificationListener(
- listener, filter, handback
- );
+ ((NotificationEmitter) resource).removeNotificationListener(listener, \
filter, handback); }
else if (resource instanceof NotificationBroadcaster)
{
- //JGH NOTE: looks like a listener against the MBeanServer is
- //wrapped as a XMBean which has a broadcaster that is an \
NotificationEmitter
- //but this resource target is a NotificationBroadcaster, in which case,
- //w/o this .. you'll get a resource failure below
- removeNotificationListener(listener);
+ //JGH NOTE: looks like a listener against the MBeanServer is
+ //wrapped as a XMBean which has a broadcaster that is an \
NotificationEmitter + //but this resource target is a \
NotificationBroadcaster, in which case, + //w/o this .. you'll get a \
resource failure below + removeNotificationListener(listener);
}
else
{
- throw new RuntimeMBeanException(new IllegalArgumentException(
- "Target XXX is not a notification emitter"
+ throw new RuntimeMBeanException(new IllegalArgumentException("Target XXX \
is not a notification emitter"
- // FIXME: add the XXX object name, store from registration
+ // FIXME: add the XXX object name, store from registration
));
}
}
@@ -743,10 +770,10 @@
{
if (resource instanceof NotificationBroadcaster)
{
- return ((NotificationBroadcaster)resource).getNotificationInfo();
+ return ((NotificationBroadcaster) resource).getNotificationInfo();
}
else
- return new MBeanNotificationInfo[] {};
+ return new MBeanNotificationInfo[]{};
}
@@ -757,25 +784,17 @@
return resource;
}
+ /**
+ * Sets the XMBean resource and optionally allows the resource to interact
+ * with the jmx microkernel via the following injection points:
+ * #ModelMBeanConstants.MBEAN_SERVER_INJECTION_TYPE
+ * #ModelMBeanConstants.MBEAN_INFO_INJECTION_TYPE
+ * #ModelMBeanConstants.OBJECT_NAME_INJECTION_TYPE
+ * @param resource - the model mbean resource
+ */
public void setResource(Object resource)
{
this.resource = resource;
- // Allow the resource to interact with the XMBean via \
setMBeanInfo(MBeanInfo)
- try
- {
- Class resClass = resource.getClass();
- Class[] sig = {MBeanInfo.class};
- Object[] args = {info};
- Method setMBeanInfo = resClass.getDeclaredMethod("setMBeanInfo", sig);
- setMBeanInfo.invoke(resource, args);
- }
- catch(NoSuchMethodException ignore)
- {
- }
- catch(Exception e)
- {
- log.trace("Failed to invoke setMBeanInfo", e);
- }
}
public MBeanInfo getMetaData()
@@ -790,22 +809,36 @@
else
return resourceEntry.getObjectName();
}
-
- public void suspend() {}
- public void suspend(long wait) throws TimeoutException {}
+ public void suspend()
+ {
+ }
- public void suspend(boolean force) {}
+ public void suspend(long wait) throws TimeoutException
+ {
+ }
- public boolean isSuspended() { return false; }
+ public void suspend(boolean force)
+ {
+ }
- public void setInvocationTimeout(long time) {}
+ public boolean isSuspended()
+ {
+ return false;
+ }
- public long getInvocationTimeout() { return 0l; }
+ public void setInvocationTimeout(long time)
+ {
+ }
- public void resume() {}
+ public long getInvocationTimeout()
+ {
+ return 0l;
+ }
- //Method that my interceptor needs....(david j)
+ public void resume()
+ {
+ }
public MBeanServer getServer()
{
@@ -815,11 +848,38 @@
// Protected -----------------------------------------------------
+ /**
+ * Inject context from the xmbean layer to the resource
+ * @param type - the type of injection
+ * @param name - the setter method name of the resource
+ * @param argType - the injection data type
+ * @param value - the injection data value to pass to the setter
+ */
+ protected void inject(String type, String name, Class argType, Object value)
+ {
+ try
+ {
+ Class resClass = resource.getClass();
+ Class[] sig = {argType};
+ Method setter = resClass.getMethod(name, sig);
+ Object[] args = {value};
+ setter.invoke(resource, args);
+ }
+ catch(NoSuchMethodException e)
+ {
+ log.debug("Setter not found: "+name+"("+argType+")", e);
+ }
+ catch(Exception e)
+ {
+ log.warn("Failed to inject type: "+type+" using setter: "+name, e);
+ }
+ }
+
protected ObjectName invokePreRegister(MBeanServer server, ObjectName name)
- throws Exception
+ throws Exception
{
if (resource instanceof MBeanRegistration)
- return ((MBeanRegistration)resource).preRegister(server, name);
+ return ((MBeanRegistration) resource).preRegister(server, name);
return name;
}
@@ -827,19 +887,19 @@
protected void invokePostRegister(Boolean b)
{
if (resource instanceof MBeanRegistration)
- ((MBeanRegistration)resource).postRegister(b);
+ ((MBeanRegistration) resource).postRegister(b);
}
protected void invokePreDeregister() throws Exception
{
if (resource instanceof MBeanRegistration)
- ((MBeanRegistration)resource).preDeregister();
+ ((MBeanRegistration) resource).preDeregister();
}
protected void invokePostDeregister()
{
if (resource instanceof MBeanRegistration)
- ((MBeanRegistration)resource).postDeregister();
+ ((MBeanRegistration) resource).postDeregister();
}
protected void initAttributeContexts(MBeanAttributeInfo[] attributes)
@@ -872,9 +932,9 @@
InvocationContext ctx = new InvocationContext();
// extract operation name + signature
- String opName = operations[i].getName();
+ String opName = operations[i].getName();
MBeanParameterInfo[] signature = operations[i].getSignature();
- String returnType = operations[i].getReturnType();
+ String returnType = operations[i].getReturnType();
// name is unchanged, fill in the context
ctx.setName(opName);
@@ -911,11 +971,11 @@
{
MBeanOperationInfo op = operations[i];
OperationKey opKey = new OperationKey(op.getName(), op.getSignature());
- InvocationContext ctx = \
(InvocationContext)operationContextMap.get(opKey); + InvocationContext ctx = \
(InvocationContext) operationContextMap.get(opKey);
Interceptor dispatcher = ctx.getDispatcher();
// Reconfigure if we have a Null or Reflected dispatcher
- if (dispatcher instanceof NullDispatcher || ( dispatcher instanceof \
ReflectedDispatcher)) + if (dispatcher instanceof NullDispatcher || \
(dispatcher instanceof ReflectedDispatcher)) {
Object target = null;
dispatcher = null;
@@ -930,7 +990,10 @@
dispatcher = new ReflectedDispatcher(m, dynamicResource);
}
else
+ {
+ // What is this late binding attempt and should there be a \
warning?
dispatcher = new ReflectedDispatcher(dynamicResource);
+ }
}
else
{
@@ -948,7 +1011,7 @@
{
MBeanAttributeInfo attribute = attributes[i];
String name = attribute.getName();
- InvocationContext ctx = (InvocationContext)attributeContextMap.get(name);
+ InvocationContext ctx = (InvocationContext) \
attributeContextMap.get(name);
Method getter = mmap.lookupGetter(attribute);
Method setter = mmap.lookupSetter(attribute);
@@ -959,14 +1022,13 @@
/**
* Placeholder to allow subclasses to override the invocation
- *
* @param invocation the invocation
* @throws MBeanException for any error
*/
protected void override(Invocation invocation) throws MBeanException
{
}
-
+
protected String getSignatureString(String[] signature)
{
if (signature == null)
@@ -993,7 +1055,7 @@
protected final class OperationKey
{
String[] keys = null;
- int hash = 0;
+ int hash = 0;
public OperationKey(final String name, final String type)
{
@@ -1009,7 +1071,7 @@
else
{
- keys = new String[] { name };
+ keys = new String[]{name};
hash = name.hashCode();
}
}
@@ -1029,7 +1091,7 @@
else
{
- keys = new String[] { name };
+ keys = new String[]{name};
hash = name.hashCode();
}
}
@@ -1063,7 +1125,7 @@
public boolean equals(Object o)
{
- OperationKey target = (OperationKey)o;
+ OperationKey target = (OperationKey) o;
if (target.keys.length != keys.length)
return false;
@@ -1082,13 +1144,13 @@
StringBuffer buffer = new StringBuffer(50);
buffer.append(keys[0]).append("(");
- for (int i = 1; i < keys.length-1; ++i)
+ for (int i = 1; i < keys.length - 1; ++i)
{
buffer.append(keys[i]);
}
if (keys.length > 1)
- buffer.append(keys[keys.length-1]);
+ buffer.append(keys[keys.length - 1]);
buffer.append(")");
return buffer.toString();
}
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic