I had a couple of questions today about the gt-process module and the use of 
the Processors class. It is similar to DataStoreFinder; and if it makes things 
easier we could call it ProcessFinder :-) It does do a little more then look up 
factories and create Process instances; since it can also create a default 
ProcessExecutor for your application.

In anycase I have updated the first example in this page:

ProcessExecutor backgroundExecutor = Processors.newProcessExecutor( 3, null );


Process buffer = Processors.createProcess( new NameImpl("gt","buffer") );
Map<String,Object> input = new KVP("features", inputFeatureCollection, 
"buffer", 0.01 );

Progress progress = backgroundExecutor.schedule( buffer, input );

// checking progress of a running process
//
if( progress.getProgress() == Progress.WORKING ){
  System.out.println( "Progress: Working");
else {
  System.out.println( "Progress:"+progress.getProgress() + "percent complete" );
}

// getting a value out (will block current thread if progress is not complete
Map<String,Object> result = progress.get();
SimpleFeatureCollection resultFeatureCollection = (SimpleFeatureCollection) 
result.get("features");

I also noticed a problem with the Processor interface; I can no longer 
determine the input and result descriptions; I will go sort that out in a bit. 
I have some other ideas about making things easier to write; but thought I 
should share the main value proposition of the process api.

Jody


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to