org.carrot2.webapp
Class BroadcasterPushOutputComponent

java.lang.Object
  extended by org.carrot2.core.LocalComponentBase
      extended by org.carrot2.core.LocalOutputComponentBase
          extended by org.carrot2.core.profiling.ProfiledLocalOutputComponentBase
              extended by org.carrot2.webapp.BroadcasterPushOutputComponent
All Implemented Interfaces:
RawDocumentsConsumer, LocalComponent, LocalOutputComponent

final class BroadcasterPushOutputComponent
extends ProfiledLocalOutputComponentBase
implements RawDocumentsConsumer

An output component for accepting RawDocuments from the input and broadcasting them to any interested consumers.

Author:
Dawid Weiss

Field Summary
static String BROADCASTER
           
 
Fields inherited from class org.carrot2.core.profiling.ProfiledLocalOutputComponentBase
profile
 
Constructor Summary
BroadcasterPushOutputComponent()
           
 
Method Summary
 void addDocument(RawDocument doc)
          Accept new document from the input component.
 void endProcessing()
          Empty default implementation.
 void flushResources()
          Empty default implementation.
 Set getComponentCapabilities()
          Provides an implementation that has no capabilities (an empty set).
 String getName()
          The default implementation returning null.
 Set getRequiredPredecessorCapabilities()
          Provides an implementation that requires no capabilities of the predecessor component.
 Set getRequiredSuccessorCapabilities()
          Provides an implementation that requires no capabilities of the successor component.
 Object getResult()
           
 void processingErrorOccurred()
          Empty default implementation.
 void startProcessing(RequestContext requestContext)
          The default implementation checks preconditions and invokes the protected LocalOutputComponentBase.validate() method.
 
Methods inherited from class org.carrot2.core.profiling.ProfiledLocalOutputComponentBase
startTimer, stopTimer
 
Methods inherited from class org.carrot2.core.LocalOutputComponentBase
validate
 
Methods inherited from class org.carrot2.core.LocalComponentBase
getDescription, getIntFromRequestContext, getProperty, init, setProperty, toSet, toSet, toSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.carrot2.core.LocalComponent
getDescription, init, setProperty
 

Field Detail

BROADCASTER

public static final String BROADCASTER
See Also:
Constant Field Values
Constructor Detail

BroadcasterPushOutputComponent

BroadcasterPushOutputComponent()
Method Detail

startProcessing

public void startProcessing(RequestContext requestContext)
                     throws ProcessingException
Description copied from class: LocalOutputComponentBase
The default implementation checks preconditions and invokes the protected LocalOutputComponentBase.validate() method.

Specified by:
startProcessing in interface LocalComponent
Overrides:
startProcessing in class ProfiledLocalOutputComponentBase
Parameters:
requestContext - A RequestContextinterface instance passed by the container processing the query. The context may be used to retrieve parameters associated with the query (see RequestContext.getRequestParameters() method).
Throws:
ProcessingException - Thrown if the component encountered a problem in processing the query. May also be thrown from a chained successor component.

endProcessing

public void endProcessing()
                   throws ProcessingException
Description copied from class: LocalOutputComponentBase
Empty default implementation.

Specified by:
endProcessing in interface LocalComponent
Overrides:
endProcessing in class LocalOutputComponentBase
Throws:
ProcessingException - Thrown if the component encountered a problem in processing the query. May also be thrown from a chained successor component. It is allowed to throw an exception and not invoke endProcessing() method on subsequent components. In such case, all components will receive a LocalComponent.processingErrorOccurred()call.

processingErrorOccurred

public void processingErrorOccurred()
Description copied from class: LocalOutputComponentBase
Empty default implementation.

Specified by:
processingErrorOccurred in interface LocalComponent
Overrides:
processingErrorOccurred in class LocalOutputComponentBase

flushResources

public void flushResources()
Description copied from class: LocalOutputComponentBase
Empty default implementation.

Specified by:
flushResources in interface LocalComponent
Overrides:
flushResources in class ProfiledLocalOutputComponentBase

getRequiredSuccessorCapabilities

public Set getRequiredSuccessorCapabilities()
Description copied from class: LocalComponentBase
Provides an implementation that requires no capabilities of the successor component.

Specified by:
getRequiredSuccessorCapabilities in interface LocalComponent
Overrides:
getRequiredSuccessorCapabilities in class LocalComponentBase
Returns:
A Setobject with capabilities. The object returned may be empty, but should never be null.

getRequiredPredecessorCapabilities

public Set getRequiredPredecessorCapabilities()
Description copied from class: LocalComponentBase
Provides an implementation that requires no capabilities of the predecessor component.

Specified by:
getRequiredPredecessorCapabilities in interface LocalComponent
Overrides:
getRequiredPredecessorCapabilities in class LocalComponentBase
Returns:
A Setobject with capabilities. The object returned may be empty, but should never be null.

getComponentCapabilities

public Set getComponentCapabilities()
Description copied from class: LocalComponentBase
Provides an implementation that has no capabilities (an empty set).

Specified by:
getComponentCapabilities in interface LocalComponent
Overrides:
getComponentCapabilities in class LocalComponentBase
Returns:
A Setobject with capabilities. The object returned may be empty, but should never be null.

getName

public String getName()
Description copied from class: LocalComponentBase
The default implementation returning null. In concrete implementations override this method to provide the appropriate name.

Specified by:
getName in interface LocalComponent
Overrides:
getName in class LocalComponentBase
Returns:
null name

getResult

public Object getResult()
Specified by:
getResult in interface LocalOutputComponent
Returns:
Returns the value, which is considered the "result" of query processing. This value is then returned from LocalProcess.query(RequestContext, String) method of LocalProcess interface that initiated query processing.

addDocument

public void addDocument(RawDocument doc)
                 throws ProcessingException
Accept new document from the input component.

Specified by:
addDocument in interface RawDocumentsConsumer
Parameters:
doc - A new RawDocument object passed from the predecessor component.
Throws:
ProcessingException - Thrown if this component cannot accept the document reference for some reason.


Copyright (c) Dawid Weiss, Stanislaw Osinski