com.jogamp.common.util.cache
Class TempJarCache

java.lang.Object
  extended by com.jogamp.common.util.cache.TempJarCache

public class TempJarCache
extends Object


Constructor Summary
TempJarCache()
           
 
Method Summary
static boolean addAll(Class<?> certClass, JarFile jarFile)
          Adds all types, native libraries, class files and other files (resources) if not yet added.
static boolean addClasses(Class<?> certClass, JarFile jarFile)
          Adds native classes, if not yet added.
static boolean addNativeLibs(Class<?> certClass, JarFile jarFile)
          Adds native libraries, if not yet added.
static boolean addResources(Class<?> certClass, JarFile jarFile)
          Adds native resources, if not yet added.
static boolean bootstrapNativeLib(Class<?> certClass, String libBaseName, JarFile jarFile)
          Bootstrapping version extracting the JAR files root entry containing libBaseName, assuming it's a native library.
static boolean contains(JarFile jarFile)
           
static String findLibrary(String libName)
           
static String findResource(String name)
          TODO class access pending needs Classloader.defineClass(..) access, ie.
static TempFileCache getTempFileCache()
           
static boolean initSingleton()
          Documented way to kick off static initialization.
static boolean isInitialized()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TempJarCache

public TempJarCache()
Method Detail

initSingleton

public static boolean initSingleton()
Documented way to kick off static initialization.

Returns:
true is static initialization was successful

isInitialized

public static boolean isInitialized()
Returns:
true if this class has been initialized, ie. used, otherwise not.

getTempFileCache

public static TempFileCache getTempFileCache()

contains

public static boolean contains(JarFile jarFile)
                        throws IOException
Throws:
IOException

addNativeLibs

public static final boolean addNativeLibs(Class<?> certClass,
                                          JarFile jarFile)
                                   throws IOException,
                                          SecurityException
Adds native libraries, if not yet added.

Parameters:
certClass - if class is certified, the JarFile entries needs to have the same certificate
jarFile -
Returns:
Throws:
IOException
SecurityException

addClasses

public static final boolean addClasses(Class<?> certClass,
                                       JarFile jarFile)
                                throws IOException,
                                       SecurityException
Adds native classes, if not yet added. TODO class access pending needs Classloader.defineClass(..) access, ie. own derivation - will do when needed ..

Parameters:
certClass - if class is certified, the JarFile entries needs to have the same certificate
jarFile -
Returns:
Throws:
IOException
SecurityException

addResources

public static final boolean addResources(Class<?> certClass,
                                         JarFile jarFile)
                                  throws IOException,
                                         SecurityException
Adds native resources, if not yet added.

Parameters:
certClass - if class is certified, the JarFile entries needs to have the same certificate
jarFile -
Returns:
Throws:
IOException
SecurityException

addAll

public static final boolean addAll(Class<?> certClass,
                                   JarFile jarFile)
                            throws IOException,
                                   SecurityException
Adds all types, native libraries, class files and other files (resources) if not yet added. TODO class access pending needs Classloader.defineClass(..) access, ie. own derivation - will do when needed ..

Parameters:
certClass - if class is certified, the JarFile entries needs to have the same certificate
jarFile -
Returns:
Throws:
IOException
SecurityException

findLibrary

public static final String findLibrary(String libName)

findResource

public static final String findResource(String name)
TODO class access pending needs Classloader.defineClass(..) access, ie. own derivation - will do when needed .. public static Class findClass(String name, ClassLoader cl) throws IOException, ClassFormatError { checkInitialized(); final File f = new File(nativeTmpFileCache.getTempDir(), IOUtil.getClassFileName(name)); if(f.exists()) { Class.forName(fname, initialize, loader) URL url = new URL(f.getAbsolutePath()); byte[] b = IOUtil.copyStream2ByteArray(new BufferedInputStream( url.openStream() )); MyClassLoader mcl = new MyClassLoader(cl); return mcl.defineClass(name, b, 0, b.length); } return null; }


bootstrapNativeLib

public static final boolean bootstrapNativeLib(Class<?> certClass,
                                               String libBaseName,
                                               JarFile jarFile)
                                        throws IOException,
                                               SecurityException
Bootstrapping version extracting the JAR files root entry containing libBaseName, assuming it's a native library. This is used to get the 'gluegen-rt' native library, hence bootstrapping.

Parameters:
certClass - if class is certified, the JarFile entries needs to have the same certificate
Throws:
IOException
SecurityException