From 5087f2d84b1c0dc06c9d790ef619d091b61684f9 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 19 Jan 2007 19:31:40 +0000 Subject: [PATCH] make sigar.jar name configurable --- .../java/src/org/hyperic/sigar/SigarLoader.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bindings/java/src/org/hyperic/sigar/SigarLoader.java b/bindings/java/src/org/hyperic/sigar/SigarLoader.java index 39097cb3..4e238360 100644 --- a/bindings/java/src/org/hyperic/sigar/SigarLoader.java +++ b/bindings/java/src/org/hyperic/sigar/SigarLoader.java @@ -24,6 +24,7 @@ import org.hyperic.jni.ArchName; import org.hyperic.jni.ArchNotSupportedException; public class SigarLoader extends ArchLoader { + public static final String PROP_SIGAR_JAR_NAME = "sigar.jar.name"; private static String location = null; private static String nativeName = null; @@ -57,6 +58,20 @@ public class SigarLoader extends ArchLoader { System.load(name); } + public String getJarName() { + return System.getProperty(PROP_SIGAR_JAR_NAME, + super.getJarName()); + } + + public static void setSigarJarName(String jarName) { + System.setProperty(PROP_SIGAR_JAR_NAME, jarName); + } + + public static String getSigarJarName() { + return System.getProperty(PROP_SIGAR_JAR_NAME, + "sigar.jar"); + } + /** * Returns the path where sigar.jar is located. */ @@ -64,7 +79,7 @@ public class SigarLoader extends ArchLoader { if (location == null) { SigarLoader loader = new SigarLoader(Sigar.class); try { - location = loader.findJarPath("sigar.jar"); + location = loader.findJarPath(getSigarJarName()); } catch (ArchLoaderException e) { location = "."; }