Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## php.java.bridge
Class DynamicClassLoader

    java.lang.Object
      java.lang.ClassLoader
          java.security.SecureClassLoader
              php.java.bridge.DynamicClassLoader

Direct Known Subclasses:
  DynamicJavaBridgeClassLoader

    public class DynamicClassLoader

extends java.security.SecureClassLoader

Title: php-java-bridge

This class implements a class loader, which keeps track of a dynamic list of other delegate URLClassLoaders It is possible to change the list of these Classloaders during execution. The classloaders themselves, as well as their corresponding classes are globally cached.

In case of file:// URLs, this classloader also handles reloading of Jar-Files once they are modified. This is possible without restarting the JVM It keeps track of the latest file modification times, and reloads Jar files if neccessary. It is also possible to add an URL pointing to a directory of simple class files. This is slow, though, and only recommended for quick and dirty development use since it will *always* reload

Copyright: PHP-License

http://sourceforge.net/projects/php-java-bridge

Version:
  2.06
Author:
  Kai Londenberg

Field Summary
`static long` | `defaultCacheTimeout`
`static boolean` | `defaultLazy`

Constructor Summary
`DynamicClassLoader()`
`DynamicClassLoader(java.lang.ClassLoader parent)`

Method Summary
`void` | `addURL(java.net.URL url)`
`void` | `addURL(java.net.URL url, boolean lazy)`
`void` | `addURLs(java.lang.String urlClassPath)`
`void` | `addURLs(java.lang.String urlClassPath, boolean lazy)`
`void` | `addURLs(java.net.URL[] urls)`
`void` | `addURLs(java.net.URL[] urls, boolean lazy)`
`static void` | `clearCache()`
`static void` | `debugMsg(java.lang.String str)`
`java.net.URL` | `findResource(java.lang.String name)`
`java.util.Enumeration` | `findResources(java.lang.String name)`
`static java.lang.String` | `getStringFromURLArray(java.net.URL[] urls)`
`static java.net.URL[]` | `getURLArrayFromString(java.lang.String cp)`
`static void` | `invalidate(java.lang.String classpath)` Invalidates a given classpath, so that the corresponding classloader gets reloaded.
`static void` | `invalidate(java.net.URL[] urls)` Invalidates a given classpath, so that the corresponding classloader gets reloaded.
`java.lang.Class` | `loadClass(java.lang.String name)` I have decided to override loadClass instead of findClass, so that this method will actually get to re-load classes if neccessary.
`void` | `setCacheTimeout(long cacheTimeoutMilliseconds)`
`void` | `setLazy(boolean lazy)`
`void` | `setUrlClassLoaderFactory(php.java.bridge.DynamicClassLoader.URLClassLoaderFactory factory)`

Methods inherited from class java.lang.ClassLoader
`clearAssertionStatus, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### defaultCacheTimeout

    public static long defaultCacheTimeout

### defaultLazy

    public static boolean defaultLazy

Constructor Detail

### DynamicClassLoader

    public DynamicClassLoader(java.lang.ClassLoader parent)

### DynamicClassLoader

    public DynamicClassLoader()

Method Detail

### debugMsg

    public static void debugMsg(java.lang.String str)

### clearCache

    public static void clearCache()

### invalidate

    public static void invalidate(java.net.URL[] urls)

  Invalidates a given classpath, so that the corresponding classloader gets reloaded.

  Parameters:
    `urls` - The urls.

### invalidate

    public static void invalidate(java.lang.String classpath)

  Invalidates a given classpath, so that the corresponding classloader gets reloaded. This method should be called from PHP to signal that a given codebase has been modified.

  Parameters:
    `classpath` -

### getStringFromURLArray

    public static final java.lang.String getStringFromURLArray(java.net.URL[] urls)

### getURLArrayFromString

    public static final java.net.URL[] getURLArrayFromString(java.lang.String cp)
                                                      throws java.net.MalformedURLException

  Throws:
    `java.net.MalformedURLException`

### setLazy

    public void setLazy(boolean lazy)

### setCacheTimeout

    public void setCacheTimeout(long cacheTimeoutMilliseconds)

### addURLs

    public void addURLs(java.net.URL[] urls)

### addURLs

    public void addURLs(java.net.URL[] urls,
                        boolean lazy)

### addURLs

    public void addURLs(java.lang.String urlClassPath)
                 throws java.net.MalformedURLException

  Throws:
    `java.net.MalformedURLException`

### addURLs

    public void addURLs(java.lang.String urlClassPath,
                        boolean lazy)
                 throws java.net.MalformedURLException

  Throws:
    `java.net.MalformedURLException`

### addURL

    public void addURL(java.net.URL url,
                       boolean lazy)

### addURL

    public void addURL(java.net.URL url)

### setUrlClassLoaderFactory

    public void setUrlClassLoaderFactory(php.java.bridge.DynamicClassLoader.URLClassLoaderFactory factory)

### loadClass

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

  I have decided to override loadClass instead of findClass, so that this method will actually get to re-load classes if neccessary. Otherwise, the Java system would call the final method "getLoadedClass(name)", (i.e. use it's own caching) without dynamically re-loading classes if neccessary.

  Overrides:
    `loadClass` in class `java.lang.ClassLoader`
  Throws:
    `java.lang.ClassNotFoundException`

### findResources

    public java.util.Enumeration findResources(java.lang.String name)
                                        throws java.io.IOException

  Overrides:
    `findResources` in class `java.lang.ClassLoader`
  Throws:
    `java.io.IOException`

### findResource

    public java.net.URL findResource(java.lang.String name)

  Overrides:
    `findResource` in class `java.lang.ClassLoader`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD