Package com.jogamp.common.util.cache
Class TempJarCache
- java.lang.Object
-
- com.jogamp.common.util.cache.TempJarCache
-
public class TempJarCache extends Object
Static Jar file cache handler using an underlying instance ofTempFileCache, seegetTempFileCache().Lifecycle: Concurrently running JVMs and ClassLoader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTempJarCache.LoadState
-
Constructor Summary
Constructors Constructor Description TempJarCache()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddAll(Class<?> certClass, Uri jarUri)Adds all types, native libraries, class files and other files (resources) if not yet added.static voidaddClasses(Class<?> certClass, Uri jarUri)Adds native classes, if not yet added.static booleanaddNativeLibs(Class<?> certClass, Uri jarUri, String nativeLibraryPath)Adds native libraries, if not yet added.static voidaddResources(Class<?> certClass, Uri jarUri)Adds native resources, if not yet added.static booleancheckClasses(Uri jarUri, TempJarCache.LoadState exp)static booleancheckNativeLibs(Uri jarUri, TempJarCache.LoadState exp)static booleancheckResources(Uri jarUri, TempJarCache.LoadState exp)static StringfindLibrary(String libName)IfisInitialized(true)is false due to lack of executable support only, this method always returns false.static StringfindResource(String name)Similar toClassLoader.getResource(String).static UrigetResourceUri(String name)Similar toClassLoader.getResource(String).static TempFileCachegetTempFileCache()static booleaninitSingleton()Documented way to kick off static initialization.static booleanisInitialized(boolean forExecutables)
-
-
-
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(boolean forExecutables)
- Parameters:
forExecutables- iftrue, method also tests whether the underlying cache is suitable to load native libraries or launch executables- Returns:
- true if this class has been properly initialized, ie. is in use. Otherwise returns false.
-
getTempFileCache
public static TempFileCache getTempFileCache()
- Returns:
- the underlying
TempFileCache - Throws:
JogampRuntimeException- if notisInitialized(false)
-
checkNativeLibs
public static boolean checkNativeLibs(Uri jarUri, TempJarCache.LoadState exp) throws IOException
- Parameters:
jarUri-exp-- Returns:
- Throws:
IOExceptionJogampRuntimeException- if notisInitialized(false)
-
checkClasses
public static boolean checkClasses(Uri jarUri, TempJarCache.LoadState exp) throws IOException
- Parameters:
jarUri-exp-- Returns:
- Throws:
IOExceptionJogampRuntimeException- if notisInitialized(false)
-
checkResources
public static boolean checkResources(Uri jarUri, TempJarCache.LoadState exp) throws IOException
- Parameters:
jarUri-exp-- Returns:
- Throws:
IOExceptionJogampRuntimeException- if notisInitialized(false)
-
addNativeLibs
public static final boolean addNativeLibs(Class<?> certClass, Uri jarUri, String nativeLibraryPath) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException
Adds native libraries, if not yet added.- Parameters:
certClass- if class is certified, the JarFile entries needs to have the same certificatejarUri-nativeLibraryPath- if not null, only extracts native libraries within this path.- Returns:
- true if native libraries were added or previously loaded from given jarUri, otherwise false
- Throws:
IOException- if thejarUricould not be loaded or a previous load attempt failedSecurityExceptionURISyntaxExceptionIllegalArgumentExceptionJogampRuntimeException- if notisInitialized(true)
-
addClasses
public static final void addClasses(Class<?> certClass, Uri jarUri) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException
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 certificatejarUri-- Throws:
IOException- if thejarUricould not be loaded or a previous load attempt failedSecurityExceptionURISyntaxExceptionIllegalArgumentExceptionJogampRuntimeException- if notisInitialized(false)
-
addResources
public static final void addResources(Class<?> certClass, Uri jarUri) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException
Adds native resources, if not yet added.- Parameters:
certClass- if class is certified, the JarFile entries needs to have the same certificatejarUri-- Throws:
IOException- if thejarUricould not be loaded or a previous load attempt failedSecurityExceptionURISyntaxExceptionIllegalArgumentExceptionJogampRuntimeException- if notisInitialized(false)
-
addAll
public static final void addAll(Class<?> certClass, Uri jarUri) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException
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 certificatejarUri-- Throws:
IOException- if thejarUricould not be loaded or a previous load attempt failedSecurityExceptionURISyntaxExceptionIllegalArgumentExceptionJogampRuntimeException- if notisInitialized(false)
-
findLibrary
public static final String findLibrary(String libName)
IfisInitialized(true)is false due to lack of executable support only, this method always returns false.- Parameters:
libName-- Returns:
- the found native library path within this cache or null if not found
- Throws:
JogampRuntimeException- if notisInitialized(false)
-
findResource
public static final String findResource(String name)
Similar toClassLoader.getResource(String).- Parameters:
name-- Returns:
- Throws:
JogampRuntimeException- if notisInitialized(false)
-
getResourceUri
public static final Uri getResourceUri(String name) throws URISyntaxException
Similar toClassLoader.getResource(String).- Parameters:
name-- Returns:
- Throws:
URISyntaxExceptionJogampRuntimeException- if notisInitialized(false)
-
-