while( true ){
try{
Thread.sleep(1000);
SearchInitiator si = plugin_interface.getUtilities().getSearchInitiator();
SearchProvider[] providers = si.getProviders();
System.out.println( "search providers=" + providers.length );
if ( providers.length > 0 ){
Map<String,String> properties = new HashMap<String,String>();
properties.put( SearchInitiator.PR_SEARCH_TERM, "monkey" );
properties.put( SearchInitiator.PR_MATURE, "true" );
/*
*
final boolean[] complete = {false};
Search s =
si.createSearch(
providers,
properties,
new SearchListener()
{
public void
receivedResults(
SearchProviderResults[] results )
{
System.out.println( "received results" );
for ( SearchProviderResults result: results ){
System.out.println( " " + result.getProvider().getProperty( SearchProvider.PR_NAME ) + ": comp=" + result.isComplete() + ", error=" + result.getError());
SearchResult[] srs = result.getResults();
for ( SearchResult sr: srs ){
System.out.println( " " + sr.getProperty( SearchResult.PR_NAME ));
}
}
}
public void
completed()
{
System.out.println( "received completed" );
complete[0] = true;
}
});
while( !complete[0] ){
Thread.sleep(1000);
System.out.println( "waiting for results" );
}
*/
Search s = si.createSearch( providers, properties, null );
while( !s.isComplete()){
Thread.sleep(1000);