Merge branch 'sigar-1.6'

Conflicts:
	bindings/java/src/org/hyperic/sigar/cmd/Shell.java
This commit is contained in:
Doug MacEachern 2010-04-07 21:27:57 -07:00
commit c431fc185c
5 changed files with 16 additions and 10 deletions

View File

@ -12,10 +12,6 @@ The following components are included without modification:
Information: http://logging.apache.org/ Information: http://logging.apache.org/
License: http://www.apache.org/licenses/LICENSE-2.0 License: http://www.apache.org/licenses/LICENSE-2.0
- junit -
Information: http://www.junit.org/index.htm
License: http://www.opensource.org/licenses/cpl.php
The following components are included with modification: The following components are included with modification:
- cpptasks - - cpptasks -

View File

@ -56,6 +56,7 @@
<path id="alljars"> <path id="alljars">
<path refid="libjars"/> <path refid="libjars"/>
<fileset dir="${sigar-bin}/lib" includes="${sigar.jar}"/> <fileset dir="${sigar-bin}/lib" includes="${sigar.jar}"/>
<fileset dir="${env.ANT_HOME}/lib" includes="junit*.jar"/>
</path> </path>
<target name="javadoc_check"> <target name="javadoc_check">
@ -91,14 +92,19 @@
<target name="compile"> <target name="compile">
<mkdir dir="${build}/classes"/> <mkdir dir="${build}/classes"/>
<available classname="junit.framework.TestCase" property="junit.present">
<classpath refid="alljars"/>
</available>
<javac destdir="${build}/classes" <javac destdir="${build}/classes"
source="1.4" target="1.4" source="1.4" target="1.4"
sourcepath=""
debug="true" debug="true"
classpathref="libjars"> classpathref="libjars">
<src path="${src}"/> <src path="${src}"/>
<src path="${build}/src"/> <src path="${build}/src"/>
<src path="${jni.src.java}"/> <src path="${jni.src.java}"/>
<include name="**/*.java"/> <include name="**/*.java"/>
<exclude name="**/test/*.java" unless="junit.present"/>
</javac> </javac>
</target> </target>
@ -413,7 +419,6 @@
<include name="lib/*.lib"/> <include name="lib/*.lib"/>
</fileset> </fileset>
<fileset dir="."> <fileset dir=".">
<include name="lib/junit.jar"/>
<include name="lib/log4j.jar"/> <include name="lib/log4j.jar"/>
</fileset> </fileset>
</copy> </copy>

Binary file not shown.

Binary file not shown.

View File

@ -20,6 +20,7 @@ package org.hyperic.sigar.cmd;
import java.io.IOException; import java.io.IOException;
import java.io.File; import java.io.File;
import java.lang.reflect.Constructor;
import org.hyperic.sigar.Sigar; import org.hyperic.sigar.Sigar;
import org.hyperic.sigar.SigarException; import org.hyperic.sigar.SigarException;
@ -36,9 +37,6 @@ import org.hyperic.sigar.shell.ShellCommandHandler;
import org.hyperic.sigar.shell.ShellCommandInitException; import org.hyperic.sigar.shell.ShellCommandInitException;
import org.hyperic.sigar.shell.ShellCommandUsageException; import org.hyperic.sigar.shell.ShellCommandUsageException;
import org.hyperic.sigar.test.SigarTestCase;
import org.hyperic.sigar.test.SigarTestRunner;
import org.hyperic.sigar.util.Getline; import org.hyperic.sigar.util.Getline;
/** /**
@ -112,14 +110,21 @@ public class Shell extends ShellBase {
} }
try { try {
//requires junit.jar //requires junit.jar
registerCommandHandler("test", new SigarTestRunner(this)); registerCommandHandler("test", "org.hyperic.sigar.test.SigarTestRunner");
} catch (NoClassDefFoundError e) { } } catch (NoClassDefFoundError e) { }
catch (Exception e) { }
try { try {
//requires jre 1.5+ or mx4j //requires jre 1.5+ or mx4j
registerCommandHandler("mx", new Mx(this)); registerCommandHandler("mx", new Mx(this));
} catch (NoClassDefFoundError e) { } } catch (NoClassDefFoundError e) { }
} }
private void registerCommandHandler(String name, String className) throws Exception {
Class cls = Class.forName(className);
Constructor con = cls.getConstructor(new Class[] { this.getClass() });
registerCommandHandler(name, (ShellCommandHandler)con.newInstance(new Object[] { this }));
}
public void processCommand(ShellCommandHandler handler, String args[]) public void processCommand(ShellCommandHandler handler, String args[])
throws ShellCommandUsageException, ShellCommandExecException throws ShellCommandUsageException, ShellCommandExecException
{ {
@ -201,7 +206,7 @@ public class Shell extends ShellBase {
this.sigar.close(); this.sigar.close();
//avoid possible Class Not Found: junit/framework/TestCase //avoid possible Class Not Found: junit/framework/TestCase
if (System.getProperty("jni.dmalloc") != null) { if (System.getProperty("jni.dmalloc") != null) {
SigarTestCase.closeSigar(); //shutup dmalloc //org.hyperic.sigar.test.SigarTestCase.closeSigar(); //shutup dmalloc
} }
super.shutdown(); super.shutdown();
} }