make sigar.jar name configurable

This commit is contained in:
Doug MacEachern 2007-01-19 19:31:40 +00:00
parent 6586fa8bd2
commit 5087f2d84b
1 changed files with 16 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import org.hyperic.jni.ArchName;
import org.hyperic.jni.ArchNotSupportedException; import org.hyperic.jni.ArchNotSupportedException;
public class SigarLoader extends ArchLoader { public class SigarLoader extends ArchLoader {
public static final String PROP_SIGAR_JAR_NAME = "sigar.jar.name";
private static String location = null; private static String location = null;
private static String nativeName = null; private static String nativeName = null;
@ -57,6 +58,20 @@ public class SigarLoader extends ArchLoader {
System.load(name); 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. * Returns the path where sigar.jar is located.
*/ */
@ -64,7 +79,7 @@ public class SigarLoader extends ArchLoader {
if (location == null) { if (location == null) {
SigarLoader loader = new SigarLoader(Sigar.class); SigarLoader loader = new SigarLoader(Sigar.class);
try { try {
location = loader.findJarPath("sigar.jar"); location = loader.findJarPath(getSigarJarName());
} catch (ArchLoaderException e) { } catch (ArchLoaderException e) {
location = "."; location = ".";
} }