org.carrot2.core
Interface LocalController

All Known Implementing Classes:
LocalControllerBase, ProfiledLocalController

public interface LocalController

A container for local processes and local components. Local applications will use this interface to set up all necessary processes and components as well as to execute queries.

Version:
$Revision: 2122 $
Author:
Stanislaw Osinski, Dawid Weiss

Method Summary
 void addLocalComponentFactory(String componentId, LocalComponentFactory factory)
          Adds a factory that will be used to produce components associated with given componentId.
 void addProcess(String processId, LocalProcess localProcess)
          Adds a local process to the controller and associates the process with given processId.
 String getComponentName(String componentId)
          Returns the name of the component associated with given componentId.
 List getProcessIds()
          Returns a Listof identifiers of all processes that have been added and successfully initialized by this local controller.
 String getProcessName(String processId)
          Returns the name of the process associated with given processId.
 ProcessingResult query(String processId, String query, Map requestParameters)
          Requests the process identified by processId to process a query.
 

Method Detail

query

ProcessingResult query(String processId,
                       String query,
                       Map requestParameters)
                       throws MissingProcessException,
                              Exception
Requests the process identified by processId to process a query. The contents of requestParameters will be accessible for all components in the chain through the RequestContextduring processing of the query.

Parameters:
processId - Identifier of the process requested to handle the query
query - Query to be processed. Format of the query is not specified here, as it depends on what the input component of the invoked process can handle.
requestParameters - parameters to be available for components during processing of this query. Components are free to add their own properties to the context. These will be available for the caller through the returned ProcessingResultinstance.
Returns:
Results of processing
Throws:
MissingProcessException - when there is no component with given processId
Exception - if an error occurs during query processing

addLocalComponentFactory

void addLocalComponentFactory(String componentId,
                              LocalComponentFactory factory)
                              throws DuplicatedKeyException
Adds a factory that will be used to produce components associated with given componentId.

Throws:
DuplicatedKeyException - Thrown when componentId already exists in the controller.

addProcess

void addProcess(String processId,
                LocalProcess localProcess)
                throws InitializationException,
                       MissingComponentException,
                       DuplicatedKeyException
Adds a local process to the controller and associates the process with given processId.

Parameters:
processId - identifier of the new process
localProcess - instance of the local process
Throws:
InitializationException
MissingComponentException
DuplicatedKeyException

getProcessName

String getProcessName(String processId)
                      throws MissingProcessException
Returns the name of the process associated with given processId.

Throws:
MissingProcessException - when there is no process associated with processId

getComponentName

String getComponentName(String componentId)
                        throws MissingComponentException
Returns the name of the component associated with given componentId.

Throws:
MissingComponentException - when there is no component associated with given componentId

getProcessIds

List getProcessIds()
Returns a Listof identifiers of all processes that have been added and successfully initialized by this local controller.

Returns:
identifiers of all processes in this controller


Copyright (c) Dawid Weiss, Stanislaw Osinski