org.carrot2.core
Class CachingController

java.lang.Object
  extended by org.carrot2.core.CachingController
All Implemented Interfaces:
IController

Deprecated. Please use ControllerFactory.createCachingPooling(Class...) to obtain a Controller equivalent to this one. Controllers can be further tuned with custom IProcessingComponentManagers. This class will be removed in the 3.4.0 release of Carrot2.

public final class CachingController
extends Object
implements IController

A controller implementing the life cycle described in IProcessingComponent with support for component pooling and, optionally, data caching.

Calls to process(Map, Class...) are thread-safe, although some care should be given to initialization: init(Map) should be called before other threads are allowed to see this object and dispose() should be called after all threads leave process(Map, Class...).

Notice for IProcessingComponent developers: if data caching is used (see CachingController(Class...)), values of Output attributes produced by the components whose output is to be cached (e.g., the Document instances in case IDocumentSource output is cached) may be accessed concurrently and therefore must be thread-safe.


Constructor Summary
CachingController(Class<? extends IProcessingComponent>... cachedComponentClasses)
          Deprecated. Creates a new caching controller.
CachingController(IParameterizedPool<IProcessingComponent,String> componentPool, Class<? extends IProcessingComponent>... cachedComponentClasses)
          Deprecated. Creates a new caching controller with a custom implementation of the component pool.
 
Method Summary
 void dispose()
          Deprecated. Shuts down this controller.
 void init(Map<String,Object> initAttributes)
          Deprecated. Initializes this controller.
 void init(Map<String,Object> attributes, ProcessingComponentConfiguration... configurations)
          Deprecated.  
 ProcessingResult process(Map<String,Object> attributes, Class<?>... processingComponentClasses)
          Deprecated. Performs processing according to the life cycle specified in IProcessingComponent.
 ProcessingResult process(Map<String,Object> attributes, Object... processingComponentClassesOrIds)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingController

public CachingController(Class<? extends IProcessingComponent>... cachedComponentClasses)
Deprecated. 
Creates a new caching controller.

Parameters:
cachedComponentClasses - classes of components whose output should be cached by the controller. If a superclass is provided here, e.g. IDocumentSource, all its subclasses will be subject to caching. If IProcessingComponent is provided here, output of all components will be cached.

CachingController

public CachingController(IParameterizedPool<IProcessingComponent,String> componentPool,
                         Class<? extends IProcessingComponent>... cachedComponentClasses)
Deprecated. 
Creates a new caching controller with a custom implementation of the component pool.

Parameters:
componentPool - the component pool to be used by the controller
cachedComponentClasses - classes of components whose output should be cached by the controller. If a superclass is provided here, e.g. IDocumentSource, all its subclasses will be subject to caching. If IProcessingComponent is provided here, output of all components will be cached.
Method Detail

init

public void init(Map<String,Object> initAttributes)
          throws ComponentInitializationException
Deprecated. 
Description copied from interface: IController
Initializes this controller. This method must complete successfully before any calls are made to the IController.process(Map, Class...) method.

Specified by:
init in interface IController
Parameters:
initAttributes - Init-time attributes for components instantiated in IController.process(Map, Class...).
Throws:
ComponentInitializationException

init

public void init(Map<String,Object> attributes,
                 ProcessingComponentConfiguration... configurations)
          throws ComponentInitializationException
Deprecated. 
Specified by:
init in interface IController
Throws:
ComponentInitializationException

process

public ProcessingResult process(Map<String,Object> attributes,
                                Class<?>... processingComponentClasses)
                         throws ProcessingException
Deprecated. 
Description copied from interface: IController
Performs processing according to the life cycle specified in IProcessingComponent.

Specified by:
process in interface IController
Parameters:
attributes - attributes to be used during processing. Input attributes will be transferred from this map to the corresponding fields. Output attributes will be collected and stored in this map, so the map must be modifiable. Keys of the map are computed based on the key parameter of the Attribute annotation.
processingComponentClasses - classes of components to be involved in processing in the order they should be arranged in the pipeline.
Throws:
ProcessingException

process

public ProcessingResult process(Map<String,Object> attributes,
                                Object... processingComponentClassesOrIds)
                         throws ProcessingException
Deprecated. 
Specified by:
process in interface IController
Throws:
ProcessingException

dispose

public void dispose()
Deprecated. 
Description copied from interface: IController
Shuts down this controller. No calls to IController.process(Map, Class...) must be made after invoking this method.

Specified by:
dispose in interface IController


Copyright (c) Dawid Weiss, Stanislaw Osinski