org.apache.stanbol.enhancer.jobmanager.event.impl
Class EnhancementJobHandler

java.lang.Object
  extended by org.apache.stanbol.enhancer.jobmanager.event.impl.EnhancementJobHandler
All Implemented Interfaces:
org.osgi.service.event.EventHandler

public class EnhancementJobHandler
extends java.lang.Object
implements org.osgi.service.event.EventHandler


Constructor Summary
EnhancementJobHandler(org.osgi.service.event.EventAdmin eventAdmin, EnhancementEngineManager engineManager)
           
 
Method Summary
 void close()
          Closes this Handler and notifies all components that wait for still running jobs
protected  void executeNextNodes(EnhancementJob job)
          triggers the execution of the next nodes or if EnhancementJob.isFinished() notifies the one who registered the EnhancementJob with this component.
 void handleEvent(org.osgi.service.event.Event event)
           
 java.lang.Object register(EnhancementJob enhancementJob)
          Registers an EnhancementJob and will start the enhancement process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnhancementJobHandler

public EnhancementJobHandler(org.osgi.service.event.EventAdmin eventAdmin,
                             EnhancementEngineManager engineManager)
Method Detail

close

public void close()
Closes this Handler and notifies all components that wait for still running jobs


register

public java.lang.Object register(EnhancementJob enhancementJob)
Registers an EnhancementJob and will start the enhancement process. When the process is finished or this service is deactivated the returned oject will be notified. Therefore callers that need to wait for the completion of the parsed job will want to
   Object object = enhancementJobHandler.register();
   while(!job.isFinished() & enhancementJobHandler != null){
       synchronized (object) {
           try {
               object.wait();
           } catch (InterruptedException e) {}
       }
   }
 

Parameters:
enhancementJob - the enhancement job to register
Returns:
An object that will get Object.notifyAll() as soon as EnhancementJob.isFinished() or this instance is deactivated

handleEvent

public void handleEvent(org.osgi.service.event.Event event)
Specified by:
handleEvent in interface org.osgi.service.event.EventHandler

executeNextNodes

protected void executeNextNodes(EnhancementJob job)
triggers the execution of the next nodes or if EnhancementJob.isFinished() notifies the one who registered the EnhancementJob with this component.

Parameters:
job - the enhancement job to process


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.