org.knopflerfish.framework
Class ClassPatcherWrappers

java.lang.Object
  extended by org.knopflerfish.framework.ClassPatcherWrappers

public class ClassPatcherWrappers
extends java.lang.Object

Class containing static wrapper methods used by ClassPatcher. These methods are typically referenced from the patcher.conf file.

Each wrapper must have the exact same signature as the original method, plus one extra long argument representing the bundle id and one object argument representing the caller's context (this) The context object may be null when called from a static context

See Also:
ClassPatcher

Constructor Summary
ClassPatcherWrappers()
           
 
Method Summary
static java.lang.Class forName1Wrapper(java.lang.String name, long bid, java.lang.Object context)
          Use bundle class loader at Class.forName(String) calls
static java.lang.Class forName3Wrapper(java.lang.String name, boolean initialize, java.lang.ClassLoader cl, long bid, java.lang.Object context)
          Use bundle class loader at Class.forName(String, boolean, ClassLoader) calls.
protected static BundleClassLoader getBundleClassLoader(long bid)
           
static java.lang.ClassLoader getSystemClassLoaderWrapper(long bid, java.lang.Object context)
          Get bundle class loader at Class.getSystemClassLoader() calls.
static void systemExitWrapper(int code, long bid, java.lang.Object context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassPatcherWrappers

public ClassPatcherWrappers()
Method Detail

getBundleClassLoader

protected static BundleClassLoader getBundleClassLoader(long bid)

systemExitWrapper

public static void systemExitWrapper(int code,
                                     long bid,
                                     java.lang.Object context)

getSystemClassLoaderWrapper

public static java.lang.ClassLoader getSystemClassLoaderWrapper(long bid,
                                                                java.lang.Object context)
Get bundle class loader at Class.getSystemClassLoader() calls.


forName1Wrapper

public static java.lang.Class forName1Wrapper(java.lang.String name,
                                              long bid,
                                              java.lang.Object context)
                                       throws java.lang.ClassNotFoundException
Use bundle class loader at Class.forName(String) calls

First, try Class.forName(String). If this fails, try the context's class loader. If this fails too, explicitly try the bundle class loader.

Throws:
java.lang.ClassNotFoundException

forName3Wrapper

public static java.lang.Class forName3Wrapper(java.lang.String name,
                                              boolean initialize,
                                              java.lang.ClassLoader cl,
                                              long bid,
                                              java.lang.Object context)
                                       throws java.lang.ClassNotFoundException
Use bundle class loader at Class.forName(String, boolean, ClassLoader) calls.

First, try the supplied class loader. If this failes, try the bundle class loader instead.

Throws:
java.lang.ClassNotFoundException