org.objectweb.proactive.core.mop
Class MOP

java.lang.Object
  extended by org.objectweb.proactive.core.mop.MOP

public abstract class MOP
extends java.lang.Object

A place where static methods go


Field Summary
protected static java.lang.Class[] EMPTY_CLASS_ARRAY
          Class array representing no parameters
static java.lang.Object[] EMPTY_OBJECT_ARRAY
          Empty object array
protected static java.util.HashMap<java.lang.String,java.lang.Class<?>> loadedClass
          As this class is center to the API, its static initializer is a good place to initialize general stuff.
protected static java.lang.Class[] PROXY_CONSTRUCTOR_PARAMETERS_TYPES_ARRAY
          Class array representing (Constructor Call, Object[])
protected static java.util.Hashtable<java.lang.String,java.lang.reflect.Constructor> proxyTable
          A Hashtable to cache (proxy class, proxy class constructor) couples
protected static java.util.Hashtable secondProxyTable
          A Hashtable to cache (Class name, proxy class name) couples this is meant for class-based reification
protected static MOPClassLoader singleton
           
protected static java.lang.Class<?> STUB_OBJECT_INTERFACE
           
protected static java.lang.String STUB_OBJECT_INTERFACE_NAME
          The name of the interface that caracterizes all stub classes
protected static java.util.Hashtable<org.objectweb.proactive.core.mop.MOP.GenericStubKey,java.lang.reflect.Constructor> stubTable
          A Hashtable to cache (reified class, stub class constructor) couples.
 
Constructor Summary
MOP()
           
 
Method Summary
protected static void addClassToCache(java.lang.String name, java.lang.Class cl)
           
static ConstructorCall buildTargetObjectConstructorCall(java.lang.Class targetClass, java.lang.Object[] constructorParameters)
           
static void checkClassIsReifiable(java.lang.Class cl)
           
protected static boolean checkNoArgsConstructor(java.lang.Class cl)
          Checks if class c has a noargs constructor
static Proxy createProxyObject(java.lang.String nameOfProxy, java.lang.Object[] proxyParameters, ConstructorCall reifiedCall)
           
static java.lang.Class forName(java.lang.String s)
          Loads a class using standard classloader or a hashtable
static boolean isReifiedObject(java.lang.Object o)
          Checks if an object is a stub object Being a stub object is equivalent to implementing the StubObject interface
static java.lang.Class loadClass(java.lang.String name)
           
static java.lang.Object newInstance(java.lang.Class clazz, java.lang.Object[] constructorParameters, java.lang.String nameOfProxy, java.lang.Object[] proxyParameters)
           
static java.lang.Object newInstance(java.lang.Class stubClass, java.lang.String nameOfClass, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters, java.lang.String nameOfProxy, java.lang.Object[] proxyParameters)
           
static java.lang.Object newInstance(java.lang.String nameOfClass, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters, java.lang.String nameOfProxy, java.lang.Object[] proxyParameters)
          Creates an instance of an object
static java.lang.Object newInstance(java.lang.String nameOfStubClass, java.lang.String nameOfClass, java.lang.Class[] genericParameters, java.lang.Object[] constructorParameters, java.lang.String nameOfProxy, java.lang.Object[] proxyParameters)
          Creates an instance of an object
static java.lang.Object turnReified(java.lang.String nameOfProxyClass, java.lang.Object[] proxyParameters, java.lang.Object target, java.lang.Class[] genericParameters)
          Reifies an object
static java.lang.Object turnReified(java.lang.String nameOfStubClass, java.lang.String nameOfProxyClass, java.lang.Object[] proxyParameters, java.lang.Object target, java.lang.Class[] genericParameters)
          Reifies an object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STUB_OBJECT_INTERFACE_NAME

protected static java.lang.String STUB_OBJECT_INTERFACE_NAME
The name of the interface that caracterizes all stub classes


STUB_OBJECT_INTERFACE

protected static java.lang.Class<?> STUB_OBJECT_INTERFACE

EMPTY_CLASS_ARRAY

protected static final java.lang.Class[] EMPTY_CLASS_ARRAY
Class array representing no parameters


EMPTY_OBJECT_ARRAY

public static final java.lang.Object[] EMPTY_OBJECT_ARRAY
Empty object array


PROXY_CONSTRUCTOR_PARAMETERS_TYPES_ARRAY

protected static java.lang.Class[] PROXY_CONSTRUCTOR_PARAMETERS_TYPES_ARRAY
Class array representing (Constructor Call, Object[])


stubTable

protected static java.util.Hashtable<org.objectweb.proactive.core.mop.MOP.GenericStubKey,java.lang.reflect.Constructor> stubTable
A Hashtable to cache (reified class, stub class constructor) couples.


proxyTable

protected static java.util.Hashtable<java.lang.String,java.lang.reflect.Constructor> proxyTable
A Hashtable to cache (proxy class, proxy class constructor) couples


secondProxyTable

protected static java.util.Hashtable secondProxyTable
A Hashtable to cache (Class name, proxy class name) couples this is meant for class-based reification


singleton

protected static MOPClassLoader singleton

loadedClass

protected static java.util.HashMap<java.lang.String,java.lang.Class<?>> loadedClass
As this class is center to the API, its static initializer is a good place to initialize general stuff.

Constructor Detail

MOP

public MOP()
Method Detail

forName

public static java.lang.Class forName(java.lang.String s)
                               throws java.lang.ClassNotFoundException
Loads a class using standard classloader or a hashtable

Parameters:
s - the name of the class to fetch
Returns:
the Class object representing class s
Throws:
java.lang.ClassNotFoundException

newInstance

public static java.lang.Object newInstance(java.lang.String nameOfClass,
                                           java.lang.Class[] genericParameters,
                                           java.lang.Object[] constructorParameters,
                                           java.lang.String nameOfProxy,
                                           java.lang.Object[] proxyParameters)
                                    throws java.lang.ClassNotFoundException,
                                           ClassNotReifiableException,
                                           InvalidProxyClassException,
                                           ConstructionOfProxyObjectFailedException,
                                           ConstructionOfReifiedObjectFailedException
Creates an instance of an object

Parameters:
nameOfClass - The class to instantiate
genericParameters - the types of the generic parameters for the class (if any, otherwise this parameter may be null)
constructorParameters - Array of the constructor's parameters [wrapper]
nameOfProxy - The name of its proxy class
proxyParameters - The array holding the proxy parameter
Throws:
java.lang.ClassNotFoundException
ClassNotReifiableException
InvalidProxyClassException
ConstructionOfProxyObjectFailedException
ConstructionOfReifiedObjectFailedException

newInstance

public static java.lang.Object newInstance(java.lang.Class clazz,
                                           java.lang.Object[] constructorParameters,
                                           java.lang.String nameOfProxy,
                                           java.lang.Object[] proxyParameters)
                                    throws java.lang.ClassNotFoundException,
                                           ClassNotReifiableException,
                                           InvalidProxyClassException,
                                           ConstructionOfProxyObjectFailedException,
                                           ConstructionOfReifiedObjectFailedException
Throws:
java.lang.ClassNotFoundException
ClassNotReifiableException
InvalidProxyClassException
ConstructionOfProxyObjectFailedException
ConstructionOfReifiedObjectFailedException

newInstance

public static java.lang.Object newInstance(java.lang.String nameOfStubClass,
                                           java.lang.String nameOfClass,
                                           java.lang.Class[] genericParameters,
                                           java.lang.Object[] constructorParameters,
                                           java.lang.String nameOfProxy,
                                           java.lang.Object[] proxyParameters)
                                    throws java.lang.ClassNotFoundException,
                                           ClassNotReifiableException,
                                           ReifiedCastException,
                                           InvalidProxyClassException,
                                           ConstructionOfProxyObjectFailedException,
                                           ConstructionOfReifiedObjectFailedException
Creates an instance of an object

Parameters:
nameOfStubClass - The name of the Stub class corresponding to the object
nameOfClass - The class to instantiate
genericParameters - the types of the generic parameters for the class (if any, otherwise this parameter may be null)
constructorParameters - Array of the constructor's parameters [wrapper]
nameOfProxy - The name of its proxy class
proxyParameters - The array holding the proxy parameter
Throws:
java.lang.ClassNotFoundException
ClassNotReifiableException
ReifiedCastException
InvalidProxyClassException
ConstructionOfProxyObjectFailedException
ConstructionOfReifiedObjectFailedException

newInstance

public static java.lang.Object newInstance(java.lang.Class stubClass,
                                           java.lang.String nameOfClass,
                                           java.lang.Class[] genericParameters,
                                           java.lang.Object[] constructorParameters,
                                           java.lang.String nameOfProxy,
                                           java.lang.Object[] proxyParameters)
                                    throws java.lang.ClassNotFoundException,
                                           ClassNotReifiableException,
                                           ReifiedCastException,
                                           InvalidProxyClassException,
                                           ConstructionOfProxyObjectFailedException,
                                           ConstructionOfReifiedObjectFailedException
Throws:
java.lang.ClassNotFoundException
ClassNotReifiableException
ReifiedCastException
InvalidProxyClassException
ConstructionOfProxyObjectFailedException
ConstructionOfReifiedObjectFailedException

turnReified

public static java.lang.Object turnReified(java.lang.String nameOfProxyClass,
                                           java.lang.Object[] proxyParameters,
                                           java.lang.Object target,
                                           java.lang.Class[] genericParameters)
                                    throws java.lang.ClassNotFoundException,
                                           ClassNotReifiableException,
                                           InvalidProxyClassException,
                                           ConstructionOfProxyObjectFailedException
Reifies an object

Parameters:
nameOfProxyClass - the name of the object's proxy
proxyParameters - Array holding the proxy parameters
target - the object to reify
genericParameters - * @param genericParameters the types of the generic parameters for the class (if any, otherwise this parameter may be null)
Throws:
java.lang.ClassNotFoundException
ClassNotReifiableException
InvalidProxyClassException
ConstructionOfProxyObjectFailedException

turnReified

public static java.lang.Object turnReified(java.lang.String nameOfStubClass,
                                           java.lang.String nameOfProxyClass,
                                           java.lang.Object[] proxyParameters,
                                           java.lang.Object target,
                                           java.lang.Class[] genericParameters)
                                    throws java.lang.ClassNotFoundException,
                                           ReifiedCastException,
                                           ClassNotReifiableException,
                                           InvalidProxyClassException,
                                           ConstructionOfProxyObjectFailedException
Reifies an object

Parameters:
nameOfProxyClass - the name of the object's proxy
nameOfStubClass - The name of the object's stub class
proxyParameters - Array holding the proxy parameters
target - the object to reify
Throws:
java.lang.ClassNotFoundException
ReifiedCastException
ClassNotReifiableException
InvalidProxyClassException
ConstructionOfProxyObjectFailedException

checkClassIsReifiable

public static void checkClassIsReifiable(java.lang.Class cl)
                                  throws ClassNotReifiableException
Throws:
ClassNotReifiableException

checkNoArgsConstructor

protected static boolean checkNoArgsConstructor(java.lang.Class cl)
Checks if class c has a noargs constructor


isReifiedObject

public static boolean isReifiedObject(java.lang.Object o)
Checks if an object is a stub object Being a stub object is equivalent to implementing the StubObject interface

Parameters:
o - the object to check
Returns:
true if it is a stub object, false otherwise

addClassToCache

protected static void addClassToCache(java.lang.String name,
                                      java.lang.Class cl)

createProxyObject

public static Proxy createProxyObject(java.lang.String nameOfProxy,
                                      java.lang.Object[] proxyParameters,
                                      ConstructorCall reifiedCall)
                               throws ConstructionOfProxyObjectFailedException,
                                      java.lang.ClassNotFoundException,
                                      InvalidProxyClassException
Throws:
ConstructionOfProxyObjectFailedException
java.lang.ClassNotFoundException
InvalidProxyClassException

buildTargetObjectConstructorCall

public static ConstructorCall buildTargetObjectConstructorCall(java.lang.Class targetClass,
                                                               java.lang.Object[] constructorParameters)
                                                        throws ConstructionOfReifiedObjectFailedException
Throws:
ConstructionOfReifiedObjectFailedException

loadClass

public static java.lang.Class loadClass(java.lang.String name)
                                 throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException


Copyright 2001-2007 INRIA All Rights Reserved.