From d98ddc9ac548518910b01a6e3053457701e7b03e Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 28 Jul 2004 14:57:49 +0000 Subject: [PATCH] add static helper getNativeLibraryName --- .../src/net/hyperic/sigar/SigarLoader.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bindings/java/src/net/hyperic/sigar/SigarLoader.java b/bindings/java/src/net/hyperic/sigar/SigarLoader.java index 9f9c8d0e..8941b93d 100644 --- a/bindings/java/src/net/hyperic/sigar/SigarLoader.java +++ b/bindings/java/src/net/hyperic/sigar/SigarLoader.java @@ -8,6 +8,7 @@ import net.hyperic.jni.ArchNotSupportedException; public class SigarLoader extends ArchLoader { private static String location = null; + private static String nativeName = null; public SigarLoader(Class loaderClass) { super(loaderClass); @@ -52,4 +53,21 @@ public class SigarLoader extends ArchLoader { } return location; } + + /** + * Returns the name of the native sigar library. + */ + public synchronized static String getNativeLibraryName() { + if (nativeName == null) { + SigarLoader loader = new SigarLoader(Sigar.class); + + try { + nativeName = loader.getLibraryName(); + } catch (ArchNotSupportedException e) { + nativeName = null; + } + } + + return nativeName; + } }