I use filters quite a lot, filters as supplied by the language (Perl and Shell), or filter frameworks written by me (Python). From what I have learned, your design is far too ambitious - you don't need an XML schema to store information about objects. You want your filters to comply to a simple, common interface - don't try to make filters optimize their connections, simply build optimized filter-pairs if you need them.
The filter pipeline setup can be well stored in an XML file, but if your interface is as simple as I recommend, there is not much difference between an XML file and your program, as most of your programming becomes declarative. To illustrate this, here is a small module/program, that filters a list out of one of our hosts into a csv file (Python code ahead) :
if __name__ == '__main__': InputFilename = sys.argv[1] output= Pipeline( FileFilter(), WVS19502Filter(), Date(["Valuta","DD.MM.YYYY"]), apply(Kommazahl,columns), SimpleCSVOutputFilter(["Broker","Valuta","Waehrung"]+c +olumns,","), ).run(files(InputFilename)) OutputFilename = "../OUTPUT/"+os.path.basename(InputFilename)+ +".csv" out = open(OutputFilename,"w") out.write(string.join(["Broker","Valuta","Waehrung"]+columns," +,")+"\n") for i in output: out.write(i["line"]+"\n") out.close
As you see, except for the setup and the output, everything is declarative. The interface each filter supports is simply two methods :
As for the language of implementation, this concept can be implemented in almost any language, as it neither requires reflection nor multiple inheritance. If you're looking for a resource-eating multithreaded parallel implementation, you will feel at home in both languages, but as the interface is so simplicistic, the type-enforcement of Java will buy you nothing.
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
In reply to Re: Filter objects?
by Corion
in thread Filter objects?
by matth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |