org.carrot2.core
Class ControllerUtils

java.lang.Object
  extended by org.carrot2.core.ControllerUtils

public final class ControllerUtils
extends Object

Static life cycle and controller utilities (for use within the core package).

This code is refactored to make sure the tests can perform exactly the same sequence of actions without using the controller as a whole.


Method Summary
static void afterProcessing(IProcessingComponent processingComponent, Map<String,Object> attributes)
          Perform all life cycle actions after processing is completed.
static void beforeProcessing(IProcessingComponent processingComponent, Map<String,Object> attributes)
          Performs all life cycle actions required before processing starts.
static void init(IProcessingComponent processingComponent, Map<String,Object> attributes, boolean checkRequiredAttributes, IControllerContext context)
          Performs all life cycle actions required upon initialization.
static void performProcessing(IProcessingComponent processingComponent, Map<String,Object> attributes)
          Perform all life cycle required to do processing.
static void performProcessing(IProcessingComponent processingComponent, Map<String,Object> attributes, boolean measureTime)
          Performs processing with the provided IProcessingComponent, including IProcessingComponent.beforeProcessing() and IProcessingComponent.afterProcessing() hooks.
static void performProcessing(Map<String,Object> attributes, boolean measureTime, IProcessingComponent... processingComponents)
          Perform processing on the provided IProcessingComponents, including IProcessingComponent.beforeProcessing() and IProcessingComponent.afterProcessing() hooks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

init

public static void init(IProcessingComponent processingComponent,
                        Map<String,Object> attributes,
                        boolean checkRequiredAttributes,
                        IControllerContext context)
                 throws ProcessingException
Performs all life cycle actions required upon initialization.

Throws:
ProcessingException

beforeProcessing

public static void beforeProcessing(IProcessingComponent processingComponent,
                                    Map<String,Object> attributes)
                             throws ProcessingException
Performs all life cycle actions required before processing starts.

Throws:
ProcessingException

performProcessing

public static void performProcessing(IProcessingComponent processingComponent,
                                     Map<String,Object> attributes)
                              throws ProcessingException
Perform all life cycle required to do processing.

Throws:
ProcessingException

performProcessing

public static void performProcessing(Map<String,Object> attributes,
                                     boolean measureTime,
                                     IProcessingComponent... processingComponents)
Perform processing on the provided IProcessingComponents, including IProcessingComponent.beforeProcessing() and IProcessingComponent.afterProcessing() hooks. If requested, stores processing times in the attributes map on return.

Parameters:
measureTime - if true, processing time will be measured and stored in the attributes map
See Also:
AttributeNames.PROCESSING_TIME_ALGORITHM, AttributeNames.PROCESSING_TIME_SOURCE, AttributeNames.PROCESSING_TIME_TOTAL

performProcessing

public static void performProcessing(IProcessingComponent processingComponent,
                                     Map<String,Object> attributes,
                                     boolean measureTime)
Performs processing with the provided IProcessingComponent, including IProcessingComponent.beforeProcessing() and IProcessingComponent.afterProcessing() hooks. If requested, stores processing times in the attributes map.

Parameters:
measureTime - if true, processing time will be measured and stored in the attributes map
See Also:
AttributeNames.PROCESSING_TIME_ALGORITHM, AttributeNames.PROCESSING_TIME_SOURCE, AttributeNames.PROCESSING_TIME_TOTAL

afterProcessing

public static void afterProcessing(IProcessingComponent processingComponent,
                                   Map<String,Object> attributes)
Perform all life cycle actions after processing is completed.



Copyright (c) Dawid Weiss, Stanislaw Osinski