org.inxar.hotswap
Class ProxyClass

java.lang.Object
  |
  +--org.inxar.hotswap.ProxyClass

public abstract class ProxyClass
extends Object

The ProxyClass is as a factory for Proxy instances and holds a reference to a Class whose implementation may change during the life of an application.

Since:
0.8.2

Method Summary
 void addClassSwapListener(ProxyEventListener l)
          Adds the given listener of ProxyClassSwapEvent notifications.
 void addCompileListener(ProxyEventListener l)
          Adds the given listener of ProxyCompileEvent notifications.
 void addHotSwapListener(ProxyEventListener l)
          Adds the given listener of ProxyHotSwapEvent notifications.
 ProxyResource getClassfile()
          Returns the Sourcefile ProxyResource for this ProxyClass.
 Class getClassInstance()
          Returns the Class instance that this ProxyClass contains.
 long getLastClassload()
          Returns the timestamp of the last successful classload or 0L if no class has been loaded.
 String getName()
          Returns the name of the class being proxied; equivalent to ProxyClass.getClassInstance().getName().
 ClassLoader getParentClassLoader()
          Returns the parent ClassLoader.
 ProxyClassLoader getProxyClassLoader()
          Returns the parent ProxyClassLoader that created this ProxyClass.
 ProxyCompiler getProxyCompiler()
          Returns the ProxyCompiler used by this class.
 ProxyResource getSourcefile()
          Returns the Sourcefile ProxyResource for this ProxyClass.
 int getStatus()
          Returns the status of this ProxyClass as determined by the ProxyCompiler.getStatus method.
 boolean hotswap()
          Executes a hotswap transaction.
 boolean isJDK13()
          Returns true if this method is a JDK1.3 proxy class.
abstract  Proxy newInstance()
          JDK1.2 or JDK1.3 Factory method; Creates a new Proxy for this ProxyClass having no constructor arguments (though arguments can be set later on the Proxy itself).
abstract  Proxy newInstance(Class[] params, Object[] args)
          JDK1.2 or JDK1.3 Factory method; Creates a new Proxy having the given constructor parameters and arguments.
abstract  Proxy newInstance(Object[] args)
          JDK1.2 or JDK1.3 Factory method; Creates a new Proxy having the given constructor arguments.
abstract  Proxy newInstanceH(Object h)
          JDK1.3 Factory method; Creates a new Proxy for this ProxyClass having no constructor arguments using the given ProxyInvocationHandler (H) instance.
abstract  Proxy newInstanceH(Object h, Class[] params, Object[] args)
          JDK1.3 Factory method; Creates a new Proxy having the given constructor parameters and arguments using the given ProxyInvocationHandler (H) instance.
abstract  Proxy newInstanceH(Object h, Object[] args)
          JDK1.3 Factory method; Creates a new Proxy having the given constructor arguments using the given ProxyInvocationHandler (H) instance.
 void removeClassSwapListener(ProxyEventListener l)
          Removes the given listener of ProxyClassSwapEvent notifications.
 void removeCompileListener(ProxyEventListener l)
          Removes the given listener of ProxyCompileEvent notifications.
 void removeHotSwapListener(ProxyEventListener l)
          Removes the given listener of ProxyHotSwapEvent notifications.
 void setParentClassLoader(ClassLoader parent)
          Sets the parent ClassLoader to be used by this class.
 void setProxyCompiler(ProxyCompiler compiler)
          Sets the ProxyCompiler to be used by this class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public abstract Proxy newInstance()
JDK1.2 or JDK1.3 Factory method; Creates a new Proxy for this ProxyClass having no constructor arguments (though arguments can be set later on the Proxy itself).

newInstance

public abstract Proxy newInstance(Object[] args)
JDK1.2 or JDK1.3 Factory method; Creates a new Proxy having the given constructor arguments. The parameters are gathered by fetching the Class for each argument.

newInstance

public abstract Proxy newInstance(Class[] params,
                                  Object[] args)
JDK1.2 or JDK1.3 Factory method; Creates a new Proxy having the given constructor parameters and arguments.

newInstanceH

public abstract Proxy newInstanceH(Object h)
JDK1.3 Factory method; Creates a new Proxy for this ProxyClass having no constructor arguments using the given ProxyInvocationHandler (H) instance.
Throws:
UnsupportedOperationException - if this is not a JDK1.3 proxy class.

newInstanceH

public abstract Proxy newInstanceH(Object h,
                                   Object[] args)
JDK1.3 Factory method; Creates a new Proxy having the given constructor arguments using the given ProxyInvocationHandler (H) instance. The parameters are gathered by fetching the Class for each argument.
Throws:
UnsupportedOperationException - if this is not a JDK1.3 proxy class.

newInstanceH

public abstract Proxy newInstanceH(Object h,
                                   Class[] params,
                                   Object[] args)
JDK1.3 Factory method; Creates a new Proxy having the given constructor parameters and arguments using the given ProxyInvocationHandler (H) instance. This invocation handler will be passed to the java.lang.reflect.Proxy.newProxyInstance method and MUST be assignable to org.inxar.hotswap.ProxyInvocationHandler.

The parameter type is given here as Object rather than ProxyInvocationHandler in order to avoid classloading of JDK1.3 dependent classes in a JDK1.2 environment.

Throws:
UnsupportedOperationException - if this is not a JDK1.3 proxy class.

getProxyClassLoader

public ProxyClassLoader getProxyClassLoader()
Returns the parent ProxyClassLoader that created this ProxyClass.

getParentClassLoader

public ClassLoader getParentClassLoader()
Returns the parent ClassLoader. If none has been explicitly set, the return values is getProxyClassLoader().getDefaultParentClassLoader().

setParentClassLoader

public void setParentClassLoader(ClassLoader parent)
Sets the parent ClassLoader to be used by this class. This ClassLoader is used as the

getProxyCompiler

public ProxyCompiler getProxyCompiler()
Returns the ProxyCompiler used by this class.

setProxyCompiler

public void setProxyCompiler(ProxyCompiler compiler)
Sets the ProxyCompiler to be used by this class.

isJDK13

public boolean isJDK13()
Returns true if this method is a JDK1.3 proxy class.

getLastClassload

public long getLastClassload()
Returns the timestamp of the last successful classload or 0L if no class has been loaded.

getSourcefile

public ProxyResource getSourcefile()
Returns the Sourcefile ProxyResource for this ProxyClass.

getClassfile

public ProxyResource getClassfile()
Returns the Sourcefile ProxyResource for this ProxyClass.

getName

public String getName()
Returns the name of the class being proxied; equivalent to ProxyClass.getClassInstance().getName().

getStatus

public int getStatus()
Returns the status of this ProxyClass as determined by the ProxyCompiler.getStatus method.

getClassInstance

public Class getClassInstance()
Returns the Class instance that this ProxyClass contains.

addHotSwapListener

public void addHotSwapListener(ProxyEventListener l)
Adds the given listener of ProxyHotSwapEvent notifications.

removeHotSwapListener

public void removeHotSwapListener(ProxyEventListener l)
Removes the given listener of ProxyHotSwapEvent notifications.

addCompileListener

public void addCompileListener(ProxyEventListener l)
Adds the given listener of ProxyCompileEvent notifications.

removeCompileListener

public void removeCompileListener(ProxyEventListener l)
Removes the given listener of ProxyCompileEvent notifications.

addClassSwapListener

public void addClassSwapListener(ProxyEventListener l)
Adds the given listener of ProxyClassSwapEvent notifications.

removeClassSwapListener

public void removeClassSwapListener(ProxyEventListener l)
Removes the given listener of ProxyClassSwapEvent notifications.

hotswap

public boolean hotswap()
Executes a hotswap transaction. See the package description for more details.