diff --git a/bindings/java/src/net/hyperic/sigar/ptql/WindowsServiceQuery.java b/bindings/java/src/net/hyperic/sigar/ptql/WindowsServiceQuery.java new file mode 100644 index 00000000..b2909569 --- /dev/null +++ b/bindings/java/src/net/hyperic/sigar/ptql/WindowsServiceQuery.java @@ -0,0 +1,27 @@ +package net.hyperic.sigar.ptql; + +import net.hyperic.sigar.Sigar; +import net.hyperic.sigar.SigarProxy; +import net.hyperic.sigar.SigarException; + +public class WindowsServiceQuery implements ProcessQuery { + + private String name; + + public static native long getServicePid(String name); + + public WindowsServiceQuery(String name) { + this.name = name; + } + + public boolean match(SigarProxy sigar, long pid) + throws SigarException { + + return pid == getServicePid(this.name); + } + + public static void main(String[] args) throws Exception { + Sigar sigar = new Sigar(); //load the .dll + System.out.println(getServicePid(args[0])); + } +}