Class LibJ2PCSCGNULinuxFix
- java.lang.Object
-
- es.gob.jmulticard.jse.smartcardio.LibJ2PCSCGNULinuxFix
-
final class LibJ2PCSCGNULinuxFix extends java.lang.Object
Encapsulate fixes regarding the dynamic loading of the pcsclite library on GNU/Linux Systems. Statically call LibJ2PCSCGNULinuxFix.fixNativeLibrary() before using a TerminalFactory.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
LibJ2PCSCGNULinuxFix.UbuntuBitness
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
GNULINUX_OS_PROPERTY_PREFIX
private static java.lang.String
JRE_BITNESS_32_VALUE
private static java.lang.String
JRE_BITNESS_64_VALUE
private static java.lang.String
JRE_BITNESS_PROPERTY
private static java.lang.String
LIBDIR
private static java.lang.String
LIBRARY_PATH_PROPERTY
private static java.lang.String
OS_NAME_PROPERTY
private static java.lang.String
PCSC_LIBRARY_NAME
private static int
PCSC_LIBRARY_VERSION
private static java.lang.String
SMARTCARDIO_LIBRARY_PROPERTY
private static java.lang.String
UBUNTU_MULTILIB_32_SUFFIX
private static java.lang.String
UBUNTU_MULTILIB_64_SUFFIX
-
Constructor Summary
Constructors Modifier Constructor Description private
LibJ2PCSCGNULinuxFix()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
addMultiarchPath(java.lang.String libPath, java.lang.String suffix)
private static java.lang.String
extendLibraryPath(java.lang.String libPath, java.lang.String extension)
Return the path with extension appended, if it wasn't already contained in the path.private static java.io.File
findGNULinuxNativeLibrary(java.lang.String baseName, int version)
Finds.so.version
file on GNU/Linux.(package private) static void
fixNativeLibrary()
Make sure libpcsclite is found.private static java.lang.String
fixPathForUbuntuMultiLib(java.lang.String libraryPath)
Oracle Java 7,java.library.path
is severely limited as compared to the OpenJDK default and doesn't contain Ubuntu 12's MULTILIB directories.private static LibJ2PCSCGNULinuxFix.UbuntuBitness
getUbuntuBitness()
Determine Ubuntu-type multilib configuration.
-
-
-
Field Detail
-
PCSC_LIBRARY_VERSION
private static final int PCSC_LIBRARY_VERSION
- See Also:
- Constant Field Values
-
SMARTCARDIO_LIBRARY_PROPERTY
private static final java.lang.String SMARTCARDIO_LIBRARY_PROPERTY
- See Also:
- Constant Field Values
-
LIBRARY_PATH_PROPERTY
private static final java.lang.String LIBRARY_PATH_PROPERTY
- See Also:
- Constant Field Values
-
GNULINUX_OS_PROPERTY_PREFIX
private static final java.lang.String GNULINUX_OS_PROPERTY_PREFIX
- See Also:
- Constant Field Values
-
PCSC_LIBRARY_NAME
private static final java.lang.String PCSC_LIBRARY_NAME
- See Also:
- Constant Field Values
-
UBUNTU_MULTILIB_32_SUFFIX
private static final java.lang.String UBUNTU_MULTILIB_32_SUFFIX
- See Also:
- Constant Field Values
-
UBUNTU_MULTILIB_64_SUFFIX
private static final java.lang.String UBUNTU_MULTILIB_64_SUFFIX
- See Also:
- Constant Field Values
-
JRE_BITNESS_PROPERTY
private static final java.lang.String JRE_BITNESS_PROPERTY
- See Also:
- Constant Field Values
-
OS_NAME_PROPERTY
private static final java.lang.String OS_NAME_PROPERTY
- See Also:
- Constant Field Values
-
JRE_BITNESS_32_VALUE
private static final java.lang.String JRE_BITNESS_32_VALUE
- See Also:
- Constant Field Values
-
JRE_BITNESS_64_VALUE
private static final java.lang.String JRE_BITNESS_64_VALUE
- See Also:
- Constant Field Values
-
LIBDIR
private static final java.lang.String LIBDIR
- See Also:
- Constant Field Values
-
-
Method Detail
-
fixNativeLibrary
static void fixNativeLibrary()
Make sure libpcsclite is found. The libj2pcsc.so from the JRE attempts to dlopen using the linker name "libpcsclite.so" instead of the appropriate "libpcsclite.so.1". This causes libpcsclite not to be found on GNU/Linux distributions that don't have the libpcsclite.so symbolic link. This method finds the library and forces the JRE to use it instead of attempting to locate it by itself. See also: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=529339
Does nothing if not on a GNU/Linux system.
-
getUbuntuBitness
private static LibJ2PCSCGNULinuxFix.UbuntuBitness getUbuntuBitness()
Determine Ubuntu-type multilib configuration.
-
extendLibraryPath
private static java.lang.String extendLibraryPath(java.lang.String libPath, java.lang.String extension)
Return the path with extension appended, if it wasn't already contained in the path.
-
addMultiarchPath
private static java.lang.String addMultiarchPath(java.lang.String libPath, java.lang.String suffix)
-
fixPathForUbuntuMultiLib
private static java.lang.String fixPathForUbuntuMultiLib(java.lang.String libraryPath)
Oracle Java 7,java.library.path
is severely limited as compared to the OpenJDK default and doesn't contain Ubuntu 12's MULTILIB directories. Test for Ubuntu in various configs and add the required paths.
-
findGNULinuxNativeLibrary
private static java.io.File findGNULinuxNativeLibrary(java.lang.String baseName, int version)
Finds.so.version
file on GNU/Linux. avoid guessing all GNU/Linux distros' library path configurations on 32 and 64-bit when working around the buggy libj2pcsc.so implementation based on JRE implementations adding the native library paths to the end of java.library.path. Fixes the path for Oracle JRE which doesn't contain the Ubuntu MULTILIB directories.
-
-