public void process(String exepath, String[] params) throws Exception {
log.debug("entered");
if (helpRequested()) {
PrintWriter out = new PrintWriter(new BufferWriter(getStdOut()));
out.print("Usage: filefilter [--help] [-ex] type=dir\n");
out.print(" The FileInfo objects are acquired from the pipeline, filtered and the ones remaining are sent forward.\n");
out.print(" --help : this help\n");
out.close();
log.debug("done");
return;
}
BufferObjectReader oin = new BufferObjectReader(getStdIn());
BufferObjectWriter oout = new BufferObjectWriter(getStdOut());
// if no params, just let through everything
// if type param, do some filtering.
if (params.length == 0) {
log.info("No parameters specified. Just piping through.");
while (!oin.isFinished()) {
oout.writeObject(oin.readObject());
}
oout.close();
log.debug("done");
return;
}
HashMap typemap = new HashMap();
typemap.put("type", "string");
// filterparser mora pripraviti pogoje - Filter objekte. Filter objekt zna za vrednost dolo�enega tipa pogledati ali izpolnjuje set pogojev.
// Seveda je normalno pogoj vezan na neko polje v neki podatkovni strukturi. Treba je samo ta field vedno posredovati temu filtru.
// Treba je torej vedeti kateri field je vezan na kateri filter.
// smiselno je enumerirati list filtrov. Vsak filter vpra�ati na kateri field se nana�a in ta field posredovati v preverjanje.
FilterParser p = null;
Filter[] filters = null;
try {
p = new MyFilterParser(typemap, params);
filters = p.getFilters();
} catch (Exception e) {
if (canThrowEx()) {
throw e;
} else {
PrintWriter err = new PrintWriter(new BufferWriter(getStdOut()));
err.println("" + e);
}
}
// now we do ...