add finder methods to ProcessQuery interface

This commit is contained in:
Doug MacEachern 2007-04-22 00:24:25 +00:00
parent 4de6d48008
commit 6002e9b892
2 changed files with 8 additions and 11 deletions

View File

@ -20,7 +20,6 @@ package org.hyperic.sigar.ptql;
import org.hyperic.sigar.Sigar;
import org.hyperic.sigar.SigarException;
import org.hyperic.sigar.SigarNotImplementedException;
import org.hyperic.sigar.SigarProxy;
import org.hyperic.sigar.SigarProxyCache;
@ -50,11 +49,7 @@ public class ProcessFinder {
public long findSingleProcess(ProcessQuery query)
throws SigarException {
if (query instanceof SigarProcessQuery) {
return ((SigarProcessQuery)query).findProcess(this.sigar);
}
throw new SigarNotImplementedException();
return query.findProcess(this.sigar);
}
public static long[] find(Sigar sigar, String query)
@ -78,11 +73,7 @@ public class ProcessFinder {
public long[] find(ProcessQuery query)
throws SigarException {
if (query instanceof SigarProcessQuery) {
return ((SigarProcessQuery)query).findProcesses(this.sigar);
}
throw new SigarNotImplementedException();
return query.findProcesses(this.sigar);
}
}

View File

@ -25,4 +25,10 @@ public interface ProcessQuery {
public boolean match(Sigar sigar, long pid)
throws SigarException;
public long findProcess(Sigar sigar)
throws SigarException;
public long[] findProcesses(Sigar sigar)
throws SigarException;
}