org.jboss.mx.util
Class MBeanProxyExt

java.lang.Object
  extended by org.jboss.mx.util.MBeanProxyExt
All Implemented Interfaces:
Externalizable, Serializable, InvocationHandler, MBeanProxyInstance

public class MBeanProxyExt
extends Object
implements InvocationHandler, MBeanProxyInstance, Externalizable

A factory for producing MBean proxies.

Created proxies will also implement MBeanProxyInstance allowing access to the proxies configuration.

Version:
$Revision: 1.6.4.5 $
Author:
Rickard Oberg., Jason Dillon., Adrian Brock., Dimitris Andreadis.
See Also:
Serialized Form

Field Summary
static MBeanServerConnection remote
          The remote MBeanServerConnection
 
Constructor Summary
MBeanProxyExt()
          For externalizable
 
Method Summary
static Object create(Class intf, ObjectName name)
          Create an MBean proxy.
static Object create(Class intf, ObjectName name, MBeanServer server)
          Create an MBean proxy.
static Object create(Class intf, ObjectName name, MBeanServer server, boolean lazyInit)
          Create an MBean proxy.
static Object create(Class intf, String name)
          Create an MBean proxy.
static Object create(Class intf, String name, MBeanServer server)
          Create an MBean proxy.
 boolean equals(Object that)
          We need to override this because by default equals returns false when called on the proxy object and then relayed here.
 MBeanServer getMBeanProxyMBeanServer()
          Return the MBeanServer for this proxy.
 MBeanServerConnection getMBeanProxyMBeanServerConnection()
           
 ObjectName getMBeanProxyObjectName()
          Return the ObjectName for this proxy.
 int hashCode()
          As with equals, use the MBeanServer + ObjectName to calculate the hashCode
 Object invoke(Object proxy, Method method, Object[] args)
          Invoke the configured MBean via the target MBeanServer and decode any resulting JMX exceptions that are thrown.
 void readExternal(ObjectInput in)
           
 String toString()
          avoid the default printout, e.g.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

remote

public static MBeanServerConnection remote
The remote MBeanServerConnection

Constructor Detail

MBeanProxyExt

public MBeanProxyExt()
For externalizable

Method Detail

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Invoke the configured MBean via the target MBeanServer and decode any resulting JMX exceptions that are thrown.

Specified by:
invoke in interface InvocationHandler
Throws:
Throwable

getMBeanProxyObjectName

public final ObjectName getMBeanProxyObjectName()
Description copied from interface: MBeanProxyInstance
Return the ObjectName for this proxy.

Specified by:
getMBeanProxyObjectName in interface MBeanProxyInstance
Returns:
The ObjectName for this proxy.

getMBeanProxyMBeanServer

public final MBeanServer getMBeanProxyMBeanServer()
Description copied from interface: MBeanProxyInstance
Return the MBeanServer for this proxy.

Specified by:
getMBeanProxyMBeanServer in interface MBeanProxyInstance
Returns:
The ObjectName for this proxy.

getMBeanProxyMBeanServerConnection

public final MBeanServerConnection getMBeanProxyMBeanServerConnection()

equals

public boolean equals(Object that)
We need to override this because by default equals returns false when called on the proxy object and then relayed here.

Overrides:
equals in class Object

hashCode

public int hashCode()
As with equals, use the MBeanServer + ObjectName to calculate the hashCode

Overrides:
hashCode in class Object

toString

public String toString()
avoid the default printout, e.g. org.jboss.mx.util.MBeanProxyExt@120540c

Overrides:
toString in class Object

create

public static Object create(Class intf,
                            String name)
                     throws MalformedObjectNameException
Create an MBean proxy.

Parameters:
intf - The interface which the proxy will implement.
name - A string used to construct the ObjectName of the MBean to proxy to.
Returns:
A MBean proxy.
Throws:
MalformedObjectNameException - Invalid object name.

create

public static Object create(Class intf,
                            String name,
                            MBeanServer server)
                     throws MalformedObjectNameException
Create an MBean proxy.

Parameters:
intf - The interface which the proxy will implement.
name - A string used to construct the ObjectName of the MBean to proxy to.
server - The MBeanServer that contains the MBean to proxy to.
Returns:
A MBean proxy.
Throws:
MalformedObjectNameException - Invalid object name.

create

public static Object create(Class intf,
                            ObjectName name)
Create an MBean proxy.

Parameters:
intf - The interface which the proxy will implement.
name - The name of the MBean to proxy invocations to.
Returns:
A MBean proxy.

create

public static Object create(Class intf,
                            ObjectName name,
                            MBeanServer server)
Create an MBean proxy.

Parameters:
intf - The interface which the proxy will implement.
name - The name of the MBean to proxy invocations to.
server - The MBeanServer that contains the MBean to proxy to.
Returns:
A MBean proxy.

create

public static Object create(Class intf,
                            ObjectName name,
                            MBeanServer server,
                            boolean lazyInit)
Create an MBean proxy.

Parameters:
intf - The interface which the proxy will implement.
name - The name of the MBean to proxy invocations to.
server - The MBeanServer that contains the MBean to proxy to.
lazyInit - - a flag indicating if the mbean attribute info should be retrieved when the proxy is created.
Returns:
A MBean proxy.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.