|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.inxar.hotswap.ProxyClassLoader
The ProxyClassLoader
acts as a factory of
ProxyClass
instances. It is the "top-level" object in
the library. Note that the name of this class means "a thing that
loads ProxyClass
instances" and not "a thing that is a
ClassLoader
". This class does not extend
java.lang.ClassLoader
.
| |
|
Constructor Summary | |
ProxyClassLoader()
|
|
ProxyClassLoader(String propertiesFileName)
|
Method Summary | |
ClassLoader |
getDefaultParentClassLoader()
Returns the default parent ClassLoader instance. |
ProxyCompiler |
getDefaultProxyCompiler()
Returns the default ProxyCompiler instance. |
ProxyClass |
getJDK12(String className)
Returns the ProxyClass having the given name or
null if no such ProxyClass exists; if
the given classname is a JDK13 ProxyClass , a
ProxyRuntimeException will be thrown. |
ProxyClass |
getJDK13(String className)
Returns the ProxyClass having the given name or
null if no such ProxyClass exists; if
the given classname is NOT a JDK13 ProxyClass , a
ProxyRuntimeException will be thrown. |
Collection |
getLoadedClasses()
Returns the Collection of ProxyClass
instances in this compiler instance. |
ProxyLog |
getLog()
Returns the ProxyLog or null if one
has not been explicitly set. |
Properties |
getProperties()
Returns the configuration Properties object. |
String |
getVersion()
Returns the version number for this release. |
boolean |
hasLog()
Returns true if there is a non-null
log instance, false otherwise. |
ProxyClass |
load(String className)
JDK1.3 Factory method; Convenience method that uses the published list of interfaces on the Class object. |
ProxyClass |
load(String className,
Class[] interfaces)
JDK1.3 Factory method; Creates a new ProxyClass
for the given className that will use the
JDK1.3 dynamic proxy class mechanism. |
ProxyClass |
loadJDK12(String className)
JDK1.2 Factory method; Creates a new ProxyClass
for the given className . |
ProxyClass |
remove(ProxyClass cls)
Removes the given ProxyClass instance from this
cache and returns the cached instance or null if
no such ProxyClass exists in this cache. |
void |
setDefaultParentClassLoader(ClassLoader parent)
Sets the default parent ClassLoader instance. |
void |
setDefaultProxyCompiler(ProxyCompiler compiler)
Sets the default parent ProxyCompiler instance. |
void |
setLog(ProxyLog master)
Sets the ProxyLog for this
ProxyClassLoader and her daughter
ProxyClass instances. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ProxyClassLoader() throws ProxyException
public ProxyClassLoader(String propertiesFileName) throws ProxyException
Method Detail |
public String getVersion()
public void setLog(ProxyLog master)
ProxyLog
for this
ProxyClassLoader
and her daughter
ProxyClass
instances. Pass an instance that
implements the ProxyLog
interface to hook HotSwap
into the logging system in your application.public ProxyLog getLog()
ProxyLog
or null
if one
has not been explicitly set.public boolean hasLog()
true
if there is a non-null
log instance, false
otherwise.public ClassLoader getDefaultParentClassLoader()
ClassLoader
instance.public void setDefaultParentClassLoader(ClassLoader parent)
ClassLoader
instance.public ProxyCompiler getDefaultProxyCompiler()
ProxyCompiler
instance.public void setDefaultProxyCompiler(ProxyCompiler compiler)
ProxyCompiler
instance.public Properties getProperties()
public Collection getLoadedClasses()
Collection
of ProxyClass
instances in this compiler instance.public ProxyClass loadJDK12(String className)
ProxyClass
for the given className
. If a
ProxyClass
having the given name already exists it
will be returned instead. This is in contrast to the
load
methods in this class that use dynamic proxy
classes.public ProxyClass load(String className, Class[] interfaces)
ProxyClass
for the given className
that will use the
JDK1.3
dynamic proxy class mechanism. The
ProxyClass will be a factory for Proxy
instances
having the given interfaces IN ADDITION TO the
Proxy
interface. If a ProxyClass
having the given name already exists it will be returned
instead.
If this method is chosen to construct the
ProxyClass
, new Proxy
instances will
be assignable to the given interfaces. Therefore, not only
will the return argument of proxyClass.newProxy() be assignable
to class Proxy
, it will also be assignable
to Foo
. Therefore, the following idiom works:
| |
|
This Foo
instance will transparently monitor
implementation changes and hotswap itself behind the scenes as
necessary.
public ProxyClass load(String className)
load(className,
Class.forName(className).getInterfaces())
.public ProxyClass remove(ProxyClass cls)
ProxyClass
instance from this
cache and returns the cached instance or null
if
no such ProxyClass
exists in this cache.public ProxyClass getJDK13(String className)
ProxyClass
having the given name or
null
if no such ProxyClass
exists; if
the given classname is NOT a JDK13 ProxyClass
, a
ProxyRuntimeException
will be thrown.public ProxyClass getJDK12(String className)
ProxyClass
having the given name or
null
if no such ProxyClass
exists; if
the given classname is a JDK13 ProxyClass
, a
ProxyRuntimeException
will be thrown.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |