summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common
Commit message (Collapse)AuthorAgeFilesLines
* Implement Bug #598 - JOGL ALL JAR File Change incl. it's Native Jar URL ↵Sven Gothel2012-06-265-240/+458
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Derivation +++ JNILibLoaderBase.addNativeJarLibs(..): Add API doc JNILibLoaderBase: "addNativeJarLibs(Class<?> classFromJavaJar, String allNativeJarBaseName, String[] atomicNativeJarBaseNames)" -> "addNativeJarLibs(Class<?>[] classesFromJavaJars, String singleJarMarker, String[] stripBasenameSuffixes)" Derive the 'all' (1st choice) native JAR URL solely on the given class's JAR URL. Examples: JOCL: // only: jocl.jar -> jocl-natives-'os.and.arch'.jar addNativeJarLibs(new Class<?>[] { JOCLJNILibLoader.class }, null, null ); JOGL: final ClassLoader cl = GLProfile.class.getClassLoader(); // either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar] -> jogl-all-natives-<os.and.arch>.jar // or: nativewindow-core.jar -> nativewindow-natives-<os.and.arch>.jar, // jogl-core.jar -> jogl-natives-<os.and.arch>.jar, // (newt-core.jar -> newt-natives-<os.and.arch>.jar)? (if available) final String newtFactoryClassName = "com.jogamp.newt.NewtFactory"; final Class<?>[] classesFromJavaJars = new Class<?>[] { NWJNILibLoader.class, GLProfile.class, null }; if( ReflectionUtil.isClassAvailable(newtFactoryClassName, cl) ) { classesFromJavaJars[2] = ReflectionUtil.getClass(newtFactoryClassName, false, cl); } JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core" } ); Efficiency / Performance: - Reduced JAR URL lookup calls JarUtil.getJarURL(..) - JNILibLoaderBase, Platform, JarUtil - Attempt loading Jar files (native, class, ..) only once - TempJarCache Code Cleanup (IOUtil, JarUtil, : - IOException if not found - IllegalArgumentException if null argument +++ jogamp.android-launcher.jar -> jogamp-android-launcher.jar +++
* Fix Bug 591: Fix 'jnlp.' aliasing of PropertyAccess.getProperty(..):Sven Gothel2012-06-211-17/+30
| | | | | | | | | | | | | | | | | | | Usually you set a property like jogamp.debug.IOUtil jogamp.debug=all to enable either IOUtil debugging or all debugging. In case you use Applets or JNLP you cannot use above property namespace, since it's considered insecure. GlueGen would allow you to use an 'jnlp.' alias, e.g.: jnlp.jogamp.debug.IOUtil jnlp.jogamp.debug=all The latter are secure properties and will be passed to the invoked JVM. All properties requested by PropertyAccess.getProperty(..) shall be aliased w/ 'jnlp.' (prepend 'jnlp.'), if no value could be found with the given key.
* Fix IOUtil: Query FileOutputStream constructor for each use (don't cache), ↵Sven Gothel2012-06-211-9/+28
| | | | utilizing default SecurityManager validation.
* Fix TempFileCache/LauncherTempFileCache (regression commit: ↵v2.0-rc9Sven Gothel2012-06-204-35/+47
| | | | | | | | | | | | | | | | | | | | 1468286bf569a493e4fdb887d5f3732f88c8cec3) 'update' scenario in same JVM instance. TempFileCache/LauncherTempFileCache were using the system property 'jnlp.jogamp.tmp.cache.root', if set. However, in case one JVM launched an old GlueGen (Applet) and then launching a new GlueGen (Applet) w/ a new tmpDir location, the property is still set but the tmpRootDir location does not exist. This patch tolerates this situation and cont. setting a new tmpRootDir. Example: JVM1.GlueGen1 tmpDir: /tmp/, tmpRootDir: /tmp/jogamp.tmp.cache_000000/ JVM1.GlueGen2 tmpDir: /tmp/jogamp_0000/, tmpRootDir: /tmp/jogamp_0000/file_cache/ Misc: - IOUtil: Always use 'jogamp_xxxx' as the sys-temp subfolder for tmpDir - JNILibLoaderBase: Remove unised import - TempJarCache.validateCertificates(): Add OK DEBUG output.
* Fix Platform static initialization interdependencies w/ GlueGen native ↵Sven Gothel2012-06-187-308/+73
| | | | | | | | | | | | library loading Some Platform field declarations and it's static initialization has been delegated to it's new abstract super class PlatformPropsImpl to solve static initialization interdependencies w/ the GlueGen native library loading and it's derived information {@link #getMachineDescription()}, {@link #is32Bit()}, ..<br> This mechanism is preferred in this case to avoid synchronization and locking and allow better performance accessing the mentioned fields/methods.
* Fix Bug 587: Use alternative storage location if platform's temp directory ↵Sven Gothel2012-06-162-93/+333
| | | | | | | | | | | | | | | | | | | | | is mounted w/ noexec ; IOUtil API change! Test whether executable files can be launched in temporary folder by trying to run an empty executable file - if !( WINDOWS | OPENKODE ) TempDir: 1) ${java.io.tmpdir}/jogamp 2) $XDG_CACHE_HOME/jogamp - if !( ANDROID | MACOS | WINDOWS | OPENKODE ) 3) $HOME/.jogamp $XDG_CACHE_HOME defaults to $HOME/.cache - TempFileCache: ${TempDir}/file_cache -> ${java.io.tmpdir}/jogamp/file_cache - LauncherTempFileCache: ${TempDir}/file_cache -> ${java.io.tmpdir}/jogamp/file_cache +++ AndroidUtils*.getTempRoot(): Remove unused AccessControlContext param
* Fix Bug 583: Remove Android compile-time dependencies and exclude Android ↵Sven Gothel2012-06-043-38/+48
| | | | | | | | | | | | | specific classes for non Android platforms. Android specifics are delegated via class AndroidUtils, which uses reflection to call AndroidUtilsImpl if platform is Android. Android code is confined to the packages: jogamp.common.os.android.* jogamp.android.launcher.* and only included when compiled for the Android platform.
* DynamicLibraryBundle: API doc refinement, mention the ClassLoader role.Sven Gothel2012-05-042-5/+16
|
* Fix commit cc76889a6fe96cffb91c9a3aa7934878c0ecd97e: ↵Sven Gothel2012-05-041-1/+1
| | | | System.loadLibrary(libraryPath) -> System.load(libraryPath)
* Use ClassLoader to find JNI native libraries. ClassLoader was only used for ↵Sven Gothel2012-05-044-40/+75
| | | | | | | | | | | tool native libraries. NativeLibrary: Expose 'String findLibrary(String libName, ClassLoader loader)', allowing utilization of System.load(loader.findLibrary(libName)). JNILibLoaderBase.loadLibrary(): Add optional ClassLoader argument, used to locate the library DynamicLibraryBundle: Use DynamicLibraryInfo's ClassLoader to find native libraries (tool + jni)
* PropertyAccess: Cleanup code, adding comment.v2.0-rc8v2.0-rc7Sven Gothel2012-04-251-7/+6
|
* Platform: Need priviledge read access for property 'java.awt.headless'Sven Gothel2012-04-251-9/+13
|
* StringBuffer -> StringBuilder (Local objects, no concurrency)Sven Gothel2012-04-162-2/+2
|
* Buffers: Add generic slice2Float(..) method from JOGL's ProjectFloat/FloatUtilSven Gothel2012-04-092-5/+46
|
* IOUtil: Add fail-safe getFileOutputStream(..) (inspired by pngj helper class)Sven Gothel2012-04-071-0/+36
|
* Fix IOUtil: Handle all '../' and './' cases by reducing the path.Sven Gothel2012-04-022-26/+46
|
* Add support for armhf/gnueabihf resulting in new 'os.and.arch' := [ ↵Sven Gothel2012-03-283-36/+98
| | | | | | | | | | | | | | | | 'android-armv7hf' and 'linux-armv7hf' ] - Platform gets new ABIType [ GENERIC, ARMEL, ARMHF ] - Platform impl. needs to guess ABIType in case of ARM, since no Java system property ('os.arch' ..) reflects the new EABI. I consider this a bug, since this will also hinder JNLP to work. The latter also uses 'os.arch' sys property to determine the nativelib resource! (See Platform.guessABITypeImpl(..) for details how we guess the type.) - Adding symbolic links to ubuntu's gnueabihf cross tool chain - Adding armhf crossbuild script
* To help analyzing Bug 566, we allow overwriting the 'workaround' with sys ↵Sven Gothel2012-03-271-1/+5
| | | | prop -Djogamp.debug.NativeLibrary.UseCurrentThreadLibLoader
* Platform: Add AWT_AVAILABLE 'knowledge'; RunnableExecutor: Add AWTEDT impl. ↵Sven Gothel2012-03-266-5/+52
| | | | / API doc cleanup; DynamicLibraryBundle: Add getDefaultRunnableExecutor()
* RunnableExecutor: Add (c) headerSven Gothel2012-03-261-0/+27
|
* DynamicLibraryBundle*: Allow DynamicLibraryBundleInfo impl. to designate a ↵Sven Gothel2012-03-263-2/+31
| | | | | | | | | | | | thread to load native libraries. (Fix Bug 566) Due to requirements of native libraries using tls_model("global-dynamic") a thread can be designated to load the 'tool' native libraries. In case the tool lib uses tls_model("global-dynamic"), an implementation shall try to let the early most thread load it. For example, AWT-EDT shall load Mesa8 (Ubuntu-TLS) libGL.so.1
* Minor edits: Fix API doc / Remove Thread.dumpStack()Sven Gothel2012-03-222-3/+1
|
* Add 'asset' URLConnection; IOUtil uses URLConnection / incr. effeciency; ↵Sven Gothel2012-03-1710-97/+719
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android ClassLoaderUtil cleanup; - Add 'asset' URLConnection - Please read API doc 'PiggybackURLConnection' and 'AssetURLConnection' - Solves generic resource handling where platform locations may differ, ie ClassLoader lookup on Android in the 'assets/' subfolder. - New Android 'AssetDexClassLoader' uses 'assets/' folder for findResource(..) - aapt.signed (our APK ant task) - uses 'assets/' folder - adds the 'assetsdir' attribute allowing to copy other assets into the APK - IOUtil uses URLConnection / incr. effeciency - using URLConnection on all getResource(..) since URL is connected anyways for validation and URLConnection can be used by caller right away - String getRelativeOf(URL, String) -> URL getRelativeOf(URL, String) - preserves scheme, authority, etc - simple parentOf handling, more efficient - reusing new 'asset' protocol impl. - Android ClassLoaderUtil cleanup; - Use createClassLoader(..) impl for build-in static jogamp and user APKs, which removes code redundancy Tests: New code path, especially 'assets' are covered by new unit tests, no regressions on Linux.
* PropertyAccess: Push down 'isPropertyDefined(final String property, final ↵Sven Gothel2012-03-132-6/+2
| | | | | | boolean jnlpAlias)' for trusted properties The method shall be called by the respective Debug specialization, which registers the trusted property prefix.
* SecurityUtil: Generalize cert validation and AccessControlContext query; ↵Sven Gothel2012-03-139-94/+374
| | | | | | | | | | | | | | | | | | PropertyAccess: Fix security code, grant access to common 'trusted' properties - SecurityUtil - Generalize cert validation for JAR and property access - Grant access to common AccessControlContext for 'same' cert - PropertyAccess: - Fix security code: Passing the current AccessControlContext from the caller didn't include priviledges. - Grant access to common 'trusted' properties, which removes the need of passing the AccessControlContext for general properties like 'jnlp.', 'jogamp.' .. - Enable registering 'trusted' properties, when caller's cert is 'same'
* Intro.: PropertyAccess ; Added safe PropertyAccess for JNILibLoaderBase, ↵Sven Gothel2012-03-134-12/+15
| | | | | | | | | | | | | | | | | Platform, IOUtil, .. - Intro.: PropertyAccess - Base class of all Debug impl, reduces redundancies. - jnlpAlias'ed trusted property is queried within local AccessControlContext to avoid 'JRE' implementation differences (should not be required). - throw NPE and IllegalArgumentException for invalid property key - Added safe PropertyAccess - JNILibLoaderBase: sun.jnlp.applet.launcher - Platform: jogamp.gluegen.UseTempJarCache - IOUtil: java.io.tmpdir
* Stabilize open InputStream's / Closeable's: Decorate w/ try-finally and ↵Sven Gothel2012-03-102-2/+26
| | | | close within the latter
* TempJarCache: Check for NULL jarURL and reuse contains queriesSven Gothel2012-03-071-6/+15
|
* Fix NIO Buffers<T> .put<Type1>(<Type2>) - Add appropriate source -> ↵Sven Gothel2012-03-051-0/+25
| | | | destination handling (Float/Long/Double/..)
* Fix ARM gluegen-rt-natives-linux-"amdv7, amdv5".jar name lookup typo.Xerxes Rånby2012-02-181-4/+4
| | | | Signed-off-by: Xerxes Rånby <[email protected]>
* Platform: Add Java VersionNumberSven Gothel2012-02-131-2/+11
|
* DynamicLibraryBundle (enhancement)Sven Gothel2012-02-124-30/+31
| | | | | | | - Hold DEBUG, DEBUG_LOOKUP in DynamicLookupHelper - Tool complete only if named tool's GetProcAddressFunc is avail - Allow no tool/glue lib's - Use DEBUG_LOCKUP for lockup symbol trace
* Further fix for bug 537 - Catch IllegalArgumentException in ↵Sven Gothel2012-01-053-32/+65
| | | | Platform.loadGlueGenRTImpl(), Reuse JarUtil (same methodology) to determine whether we run from JarURL
* Fix JAR cache to allow running from class filesWade Walker2011-12-291-1/+17
| | | | | | | If the Platform class is coming from a .class file (instead of from a JAR), disables use of the temp JAR cache. This allows apps to run against JOGL class files as well as JAR files, which is useful when running from within an IDE like Eclipse.
* Fix regression of commit b669435d277a10e6163034aba286ecccce013f69, which ↵Sven Gothel2011-12-181-7/+14
| | | | removed the lib-base-name search for OSX
* JNILibLoaderBaser.addNativeJarLibs(..): Catch all Exception (also ↵Sven Gothel2011-12-181-7/+11
| | | | IllegalArgumentException) - solves case using plain class instead of JAR file
* RecursiveThreadGroupLock: New recursive lock interface and impl, allowing ↵Sven Gothel2011-12-112-1/+146
| | | | | | | | | | | | 'spawn off' process to become the lock owner. To avoid complicated synchronization via synchronized, wait and notify between one thread and a 'spawn' off thread which temporarly requires the hold lock, RecursiveThreadGroupLock allows to add and remove other threads to become owners of the lock as if they were the original holder. This simplifies some rare locking use cases, eg. in JOGL's GLProfile initialization sequence where a SharedResourceRunner thread is taking over initialization of shared resources.
* Cleanup Lock Package: API doc, complete throws declaration, interface ↵Sven Gothel2011-12-113-3/+14
| | | | | | RecursiveLockImpl01Unfairish.Sync RecursiveLockImpl01Unfairish changes are in preparation of RecursiveGroupThreadLock.
* NativeLibrary DEBUG: stack trace @ close()Sven Gothel2011-12-011-0/+1
|
* TempJarCache/JNILibLoaderBase: Identify the Jar files by their URL within ↵Sven Gothel2011-12-013-44/+63
| | | | our lifecycle. JarFile's hash almost always differs.
* Minor edits / Put gluegen-rt 'libBaseName' static.Sven Gothel2011-12-011-10/+10
|
* DynamicLibraryBundle/NativeLibrary: Add destroy() to bundle, causing ↵Sven Gothel2011-12-012-11/+42
| | | | unloading of native library.
* Refine TempJarCache/JNILibLoaderBase ; Add TempFileCache destroy() for instance.Sven Gothel2011-12-013-33/+88
| | | | | | | | JNILibLoaderBase's 'addNativeJarLibs(Class<?> classFromJavaJar, String allNativeJarBaseName, String[] atomicNativeJarBaseNames)' now just attempts to load the 'all' variant, and will continue w/ atomics if not successful (ie not available). It skips the validation of a 'allJavaJarPrefix', ie validating the 'classFromJavaJar holding JAR file, which allows GLUEGEN/JOGL classes to be contained in JAR files other than the original.
* Fix regression (#2) of commit 04391a3f417e10e1b6dafbd8becc63659af633c30 ↵Sven Gothel2011-11-291-1/+1
| | | | (remove isDirectory(), which requires extra permissions)
* Fix TempJarCache's Multi-User Bug (Reported by Martin Hegedus)Sven Gothel2011-11-293-134/+211
| | | | | | | | | | | | | | | | | | | | | | It turns out that Java's File mkdir() only makes the directory writable for the current user, I have missed this fact. Great catch. 1. Fix TempJarCache.isInitialized(): Return false if not successfully initialized. It merely returned if it has passed 'initSingleton()' and ignored the staticInitError. 2. Fix TempFileCache pattern of determining the temp base directory We cannot just use a static directory name, due to the multi user environment and user write permissions on File.mkdir(). IOUtil has a new 'getTempDir(..)' methods, which iterates through integers [000000-999999] until a writeable directory could be found or created. TempFileCache initializes this temp base dir in the static block ensuring the value is final for the JVM / ClassLoader. Updated comments/docs in TempFileCache.
* Fix regresseion of commit 04391a3f417e10e1b6dafbd8becc63659af633c3 (forced ↵Sven Gothel2011-11-291-1/+1
| | | | pending '/' to filename)
* JarUtil (Fix Bug 522): Handle case where given URL doesn't contain any '/' ↵Sven Gothel2011-11-291-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (eg. Eclipse 'rsrc:' case) - Use ':' as 'path' delimiter in case no path via '/' is given. +++ Manual tested w/ Eclipse: Preparations: =============== 1) Set up a vanilla eclipse (3.7.0) workspace 2) Add the JOGL User Library: - Window.Preference - Java.Build_Path.User_Libraries: + JOGL + gluegen-rt.jar + jogl.all.jar + gluegen-rt-natives-linux-amd64.jar + jogl-all-natives-linux-amd64.jar You may add all other native JARs here. Note that these are not required in the CLASSPATH by JOGL, however, they are required by Eclipse to export your project as a Runnable JAR File. 3) New test project - Right-click your project in the Package Explorer and click "Properties". - Select "Java Build Path" and click the "Libraries" tab. + JOGL - Add some simple code .. - Run as Java Application .. Test-1: ========= Export - Right-click your project in the Package Explorer and click "Export" - Select Java.Runnable_JAR_file + Launch configuration + some destination path + Library handling: Copy required libraries into a sub-folder next to the generated JAR Result: Works! ./lala01.jar ./lala01_lib/jogl.all.jar ./lala01_lib/jogl-all-natives-linux-amd64.jar ./lala01_lib/... etc .. Test-2: ========= Export - Right-click your project in the Package Explorer and click "Export" - Select Java.Runnable_JAR_file + Launch configuration + some destination path + Library handling: Package required libraries into generated JAR Result: Works! ./lala02.jar: Manifest-Version: 1.0 Rsrc-Class-Path: ./ gluegen-rt-natives-linux-amd64.jar gluegen-rt.jar jogl-all-natives-linux-amd64.jar jogl.all.jar Class-Path: . Rsrc-Main-Class: Test01 Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
* JarUtil: Improve Robustness (Bug 522) and API doc, prepare for Jar-In-Jar. ↵Sven Gothel2011-11-295-49/+228
| | | | | | | | Add unit test. Misc.: - IOUtil: Add toURL* methods - TempJarCache: Add 'URL getResource(String)'
* Move TRACE_LOCK from RecursiveLock -> LockSven Gothel2011-11-262-9/+4
|
* ReflectionUtil: Catch NoClassDefFoundError @ getMethod() for robustnessSven Gothel2011-11-241-3/+11
|