com.sun.jdmk
Class MBeanInstantiatorImpl

java.lang.Object
  extended by com.sun.jdmk.MBeanInstantiatorImpl
All Implemented Interfaces:
MBeanInstantiator

Deprecated. This class is kept as a utility class, though it is no longer used. It may not be supported in future releases.

public class MBeanInstantiatorImpl
extends Object
implements MBeanInstantiator

Implements the MBeanInstantiator interface. Provides methods for instantiating objects, finding the class given its name and using different class loaders, deserializing objects in the context of a given class loader.

Since:
Java DMK 5.0

Constructor Summary
MBeanInstantiatorImpl(ModifiableClassLoaderRepository clr)
          Deprecated.  
 
Method Summary
 Attribute checkTransferAttribute(ClassLoader dest, Attribute attribute)
          Deprecated. Check whether the attribute value needs to be transferred in the destination class loader.
 AttributeList checkTransferAttributeList(ClassLoader dest, AttributeList attributes)
          Deprecated. Check whether the attribute values needs to be transferred in the destination class loader.
 Object checkTransferObject(ClassLoader targetLoader, Object value)
          Deprecated. Check whether the given value need to be transferred into the target class loader.
 Object[] checkTransferParameters(ClassLoader dest, Object[] params)
          Deprecated. Check whether the given parameters need to be transferred into the target class loader.
 ObjectInputStream deserialize(ObjectName name, byte[] data)
          Deprecated. De-serializes a byte array in the context of the class loader of an MBean.
 ObjectInputStream deserialize(String className, byte[] data)
          Deprecated. De-serializes a byte array in the context of a given MBean class loader.
 ObjectInputStream deserialize(String className, ObjectName loaderName, byte[] data, ClassLoader loader)
          Deprecated. De-serializes a byte array in the context of a given MBean class loader.
 Class findClass(String className, ClassLoader loader)
          Deprecated. Gets the class for the specified class name using the MBean Interceptor's classloader
 Class findClass(String className, ObjectName aLoader)
          Deprecated. Gets the class for the specified class name using the specified class loader
 Class findClassWithDefaultLoaderRepository(String className)
          Deprecated. Loads the class with the specified name using this object's Default Loader Repository.
 Class[] findSignatureClasses(String[] signature, ClassLoader loader)
          Deprecated. Return an array of Class corresponding to the given signature, using the specified class loader.
 ModifiableClassLoaderRepository getClassLoaderRepository()
          Deprecated. Return the Default Loader Repository used by this instantiator object.
 Object instantiate(Class theClass)
          Deprecated. Instantiates an object given its class, using its empty constructor.
 Object instantiate(Class theClass, Object[] params, String[] signature, ClassLoader loader)
          Deprecated. Instantiates an object given its class, the parameters and signature of its constructor The call returns a reference to the newly created object.
 Object instantiate(String className)
          Deprecated. Instantiates an object using the list of all class loaders registered in the MBean Interceptor (using its ClassLoaderRepository).
 Object instantiate(String className, Object[] params, String[] signature, ClassLoader loader)
          Deprecated. Instantiates an object using the list of all class loaders registered in the MBean server (using its ClassLoaderRepository).
 Object instantiate(String className, ObjectName loaderName, ClassLoader loader)
          Deprecated. Instantiates an object using the class Loader specified by its ObjectName.
 Object instantiate(String className, ObjectName loaderName, Object[] params, String[] signature, ClassLoader loader)
          Deprecated. Instantiates an object.
 void testCreation(Class c)
          Deprecated. This methods tests if the MBean class makes it possible to instantiate an MBean of this class in the MBeanServer.
 Object transferObject(Object obj, ClassLoader aloader)
          Deprecated. Transfer a given object into the context of a different class loader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBeanInstantiatorImpl

public MBeanInstantiatorImpl(ModifiableClassLoaderRepository clr)
Deprecated. 
Method Detail

testCreation

public void testCreation(Class c)
                  throws NotCompliantMBeanException
Deprecated. 
Description copied from interface: MBeanInstantiator
This methods tests if the MBean class makes it possible to instantiate an MBean of this class in the MBeanServer. e.g. it must have a public constructor, be a concrete class...

Specified by:
testCreation in interface MBeanInstantiator
Throws:
NotCompliantMBeanException

findClassWithDefaultLoaderRepository

public Class findClassWithDefaultLoaderRepository(String className)
                                           throws ReflectionException
Deprecated. 
Description copied from interface: MBeanInstantiator
Loads the class with the specified name using this object's Default Loader Repository.

Specified by:
findClassWithDefaultLoaderRepository in interface MBeanInstantiator
Throws:
ReflectionException

findClass

public Class findClass(String className,
                       ClassLoader loader)
                throws ReflectionException
Deprecated. 
Description copied from interface: MBeanInstantiator
Gets the class for the specified class name using the MBean Interceptor's classloader

Specified by:
findClass in interface MBeanInstantiator
Throws:
ReflectionException

findClass

public Class findClass(String className,
                       ObjectName aLoader)
                throws ReflectionException,
                       InstanceNotFoundException
Deprecated. 
Description copied from interface: MBeanInstantiator
Gets the class for the specified class name using the specified class loader

Specified by:
findClass in interface MBeanInstantiator
Throws:
ReflectionException
InstanceNotFoundException

findSignatureClasses

public Class[] findSignatureClasses(String[] signature,
                                    ClassLoader loader)
                             throws ReflectionException
Deprecated. 
Description copied from interface: MBeanInstantiator
Return an array of Class corresponding to the given signature, using the specified class loader.

Specified by:
findSignatureClasses in interface MBeanInstantiator
Throws:
ReflectionException

instantiate

public Object instantiate(Class theClass)
                   throws ReflectionException,
                          MBeanException
Deprecated. 
Description copied from interface: MBeanInstantiator
Instantiates an object given its class, using its empty constructor. The call returns a reference to the newly created object.

Specified by:
instantiate in interface MBeanInstantiator
Throws:
ReflectionException
MBeanException

instantiate

public Object instantiate(Class theClass,
                          Object[] params,
                          String[] signature,
                          ClassLoader loader)
                   throws ReflectionException,
                          MBeanException
Deprecated. 
Description copied from interface: MBeanInstantiator
Instantiates an object given its class, the parameters and signature of its constructor The call returns a reference to the newly created object.

Specified by:
instantiate in interface MBeanInstantiator
Throws:
ReflectionException
MBeanException

checkTransferAttributeList

public final AttributeList checkTransferAttributeList(ClassLoader dest,
                                                      AttributeList attributes)
Deprecated. 
Description copied from interface: MBeanInstantiator
Check whether the attribute values needs to be transferred in the destination class loader. Returns an attribute list containing the transferred values.

The method checks if the context of the operation is ok, i.e if all the attribute values are coming from the same class loader. If not, the method will replace the attributes that need to be transferred by a new attribute object transferred in the target class loader.

Specified by:
checkTransferAttributeList in interface MBeanInstantiator
Parameters:
dest - the target class loader.
attributes - the attribute list to be checked.
Returns:
the attribute list, where values have been transferred as needed.

checkTransferAttribute

public Attribute checkTransferAttribute(ClassLoader dest,
                                        Attribute attribute)
Deprecated. 
Description copied from interface: MBeanInstantiator
Check whether the attribute value needs to be transferred in the destination class loader. Returns an attribute containing the transferred value.

The method checks if the context of the operation is ok, i.e if all the attribute values are coming from the same class loader. If not, the method will replace the attributes that need to be transferred by a new attribute object transferred in the target class loader.

Specified by:
checkTransferAttribute in interface MBeanInstantiator
Parameters:
dest - the target class loader.
attribute - attribute to be checked.
Returns:
attribute, or a new attribute containing the transferred value.

checkTransferParameters

public Object[] checkTransferParameters(ClassLoader dest,
                                        Object[] params)
Deprecated. 
Description copied from interface: MBeanInstantiator
Check whether the given parameters need to be transferred into the target class loader.

The method checks if the context of the operation is ok, i.e if all the objects are coming from the same class loader. If not, the method will replace the parameters that need to be transferred by a new object transferred in the target class loader.

Specified by:
checkTransferParameters in interface MBeanInstantiator
Parameters:
dest - the target class loader.
params - parameters to be checked.
Returns:
params.

checkTransferObject

public Object checkTransferObject(ClassLoader targetLoader,
                                  Object value)
Deprecated. 
Description copied from interface: MBeanInstantiator
Check whether the given value need to be transferred into the target class loader.

The method checks if the context of the operation is ok, i.e if the value is coming from the target class loader. If not, the method will return a new object transferred in the target class loader.

Specified by:
checkTransferObject in interface MBeanInstantiator
Parameters:
targetLoader - the target class loader.
value - object to be checked.
Returns:
value, or the new transferred value.

transferObject

public Object transferObject(Object obj,
                             ClassLoader aloader)
Deprecated. 
Description copied from interface: MBeanInstantiator
Transfer a given object into the context of a different class loader

Specified by:
transferObject in interface MBeanInstantiator

deserialize

public ObjectInputStream deserialize(ObjectName name,
                                     byte[] data)
                              throws InstanceNotFoundException,
                                     OperationsException
Deprecated. 
Description copied from interface: MBeanInstantiator
De-serializes a byte array in the context of the class loader of an MBean.

Specified by:
deserialize in interface MBeanInstantiator
Parameters:
name - The name of the MBean whose class loader should be used for the de-serialization.
data - The byte array to be de-sererialized.
Returns:
The de-serialized object stream.
Throws:
InstanceNotFoundException - The MBean specified is not found.
OperationsException - Any of the usual Input/Output related exceptions.

deserialize

public ObjectInputStream deserialize(String className,
                                     byte[] data)
                              throws OperationsException,
                                     ReflectionException
Deprecated. 
Description copied from interface: MBeanInstantiator
De-serializes a byte array in the context of a given MBean class loader. The class loader is the one that loaded the class with name "className".

Specified by:
deserialize in interface MBeanInstantiator
Parameters:
className - The name of the class whose class loader should be used for the de-serialization.
data - The byte array to be de-sererialized.
Returns:
The de-serialized object stream.
Throws:
OperationsException - Any of the usual Input/Output related exceptions.
ReflectionException - The specified class could not be loaded by the default loader repository

deserialize

public ObjectInputStream deserialize(String className,
                                     ObjectName loaderName,
                                     byte[] data,
                                     ClassLoader loader)
                              throws InstanceNotFoundException,
                                     OperationsException,
                                     ReflectionException
Deprecated. 
Description copied from interface: MBeanInstantiator
De-serializes a byte array in the context of a given MBean class loader.

The class loader is the one that loaded the class with name "className".

The name of the class loader to be used for loading the specified class is specified. If null, a default one has to be provided (for a MBean Server, its own class loader will be used).

Specified by:
deserialize in interface MBeanInstantiator
Parameters:
className - The name of the class whose class loader should be used for the de-serialization.
loaderName - The name of the class loader to be used for loading the specified class. If null, a default one has to be provided (for a MBean Server, its own class loader will be used).
data - The byte array to be de-sererialized.
loader - default class loader.
Returns:
The de-serialized object stream.
Throws:
InstanceNotFoundException - The specified class loader MBean is not found.
OperationsException - Any of the usual Input/Output related exceptions.
ReflectionException - The specified class could not be loaded by the specified class loader.

instantiate

public Object instantiate(String className)
                   throws ReflectionException,
                          MBeanException
Deprecated. 
Description copied from interface: MBeanInstantiator
Instantiates an object using the list of all class loaders registered in the MBean Interceptor (using its ClassLoaderRepository).

The object's class should have a public constructor.

It returns a reference to the newly created object.

The newly created object is not registered in the MBean Interceptor.

Specified by:
instantiate in interface MBeanInstantiator
Parameters:
className - The class name of the object to be instantiated.
Returns:
The newly instantiated object.
Throws:
ReflectionException - Wraps a java.lang.ClassNotFoundException or the java.lang.Exception that occurred when trying to invoke the object's constructor.
MBeanException - The constructor of the object has thrown an exception

instantiate

public Object instantiate(String className,
                          ObjectName loaderName,
                          ClassLoader loader)
                   throws ReflectionException,
                          MBeanException,
                          InstanceNotFoundException
Deprecated. 
Description copied from interface: MBeanInstantiator
Instantiates an object using the class Loader specified by its ObjectName.

If the loader name is null, a default one has to be provided (for a MBean Server, the ClassLoader that loaded it will be used).

The object's class should have a public constructor.

It returns a reference to the newly created object.

The newly created object is not registered in the MBean Interceptor.

Specified by:
instantiate in interface MBeanInstantiator
Parameters:
className - The class name of the MBean to be instantiated.
loaderName - The object name of the class loader to be used.
Returns:
The newly instantiated object.
Throws:
ReflectionException - Wraps a java.lang.ClassNotFoundException or the java.lang.Exception that occurred when trying to invoke the object's constructor.
MBeanException - The constructor of the object has thrown an exception.
InstanceNotFoundException - The specified class loader is not registered in the MBeanInterceptor.

instantiate

public Object instantiate(String className,
                          Object[] params,
                          String[] signature,
                          ClassLoader loader)
                   throws ReflectionException,
                          MBeanException
Deprecated. 
Description copied from interface: MBeanInstantiator
Instantiates an object using the list of all class loaders registered in the MBean server (using its ClassLoaderRepository).

The object's class should have a public constructor.

The call returns a reference to the newly created object.

The newly created object is not registered in the MBean Interceptor.

Specified by:
instantiate in interface MBeanInstantiator
Parameters:
className - The class name of the object to be instantiated.
params - An array containing the parameters of the constructor to be invoked.
signature - An array containing the signature of the constructor to be invoked.
Returns:
The newly instantiated object.
Throws:
ReflectionException - Wraps a java.lang.ClassNotFoundException or the java.lang.Exception that occurred when trying to invoke the object's constructor.
MBeanException - The constructor of the object has thrown an exception

instantiate

public Object instantiate(String className,
                          ObjectName loaderName,
                          Object[] params,
                          String[] signature,
                          ClassLoader loader)
                   throws ReflectionException,
                          MBeanException,
                          InstanceNotFoundException
Deprecated. 
Description copied from interface: MBeanInstantiator
Instantiates an object. The class loader to be used is identified by its object name.

If the object name of the loader is null, a default has to be provided (for example, for a MBean Server, the ClassLoader that loaded it will be used).

The object's class should have a public constructor.

The call returns a reference to the newly created object.

The newly created object is not registered in the MBean server.

Specified by:
instantiate in interface MBeanInstantiator
Parameters:
className - The class name of the object to be instantiated.
loaderName - The object name of the class loader to be used.
params - An array containing the parameters of the constructor to be invoked.
signature - An array containing the signature of the constructor to be invoked.
Returns:
The newly instantiated object.
Throws:
ReflectionException - Wraps a java.lang.ClassNotFoundException or the java.lang.Exception that occurred when trying to invoke the object's constructor.
MBeanException - The constructor of the object has thrown an exception
InstanceNotFoundException - The specified class loader is not registered in the MBean Interceptor.

getClassLoaderRepository

public ModifiableClassLoaderRepository getClassLoaderRepository()
Deprecated. 
Description copied from interface: MBeanInstantiator
Return the Default Loader Repository used by this instantiator object.

Specified by:
getClassLoaderRepository in interface MBeanInstantiator

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.