pyx4j-native

Overview

The pyx4j-native project is a collection of java wrappers for windows functions like time and beep. Now only works on windows.

  • NativeThreadDump - Send CtrlBreak Event to current process
  • Beep - Make a sound using PC speaker
  • FileUtil - Access and modify file creation time. Used in com.pyx4j.log.RollingFileAppender
  • NativeTimer - System high-resolution performance counter used before Java 5

Usage

This ant build.xml fragment that is executed by cruisecontrol when our build fails.

    <target name="pyx4j.onfailure" depends="sos"/>

    <target name="sos">
        <echo level="info" message="Execute SOS beep"/>
        <java classname="com.pyx4j.jni.Beep" fork="false">
             <classpath>
                <pathelement path="${java.class.path}"/>
                <pathelement location="${env.BUILD_HOME}/libs/pyx4j-native-1.0.0.jar"/>
             </classpath>
             <!-- SOS: di-di-di-dah-dah-dah-di-di-dit -->
             <arg line="1500 100  0 100 1500 100  0 100 1500 100  0 100 1500 200 0 100 1500 200 0 100 1500 200 0 100 1500 100  0 100 1500 100  0 100 1500 200 -3 15000"/>
        </java>
    </target>

This the fragment from our cruisecontrol.xml that will call ant in case of failure

    <project name="pyx4j" buildafterfailed="false">
            .....
            <onfailure>
                <antpublisher antscript="${antscript5}"
                              antworkingdir="${env.BUILD_HOME}/conf"
                              buildfile="build.xml"
                              target="${project.name}.onfailure"
                              usedebug="false"/>
            </onfailure>
        </publishers>
    </project>