org.ow2.weblab.service.gate
Class Configuration

java.lang.Object
  extended by org.ow2.weblab.service.gate.Configuration

public class Configuration
extends java.lang.Object

This class is a singleton to be used to let the configurable and the analyser service communicate. It holds the mapping between usageContext and gapp file path, and also usageContext and corpuscontroller.

Author:
ymombrun
To do:
Add a pool handler to have more than one Controller per usageContext. (Since the process is synchronized on each Controller instance).
Date:
2010-08-31

Method Summary
 void configure(java.lang.String usageContext, java.lang.String gappFilePath)
           
 gate.CorpusController getController(java.lang.String gappFilePath)
           
 java.lang.String getGappFilePathForUsageContext(java.lang.String usageContext)
           
static Configuration getInstance()
           
 boolean isConfigured(java.lang.String usageContext)
           
 boolean isControllerInitialised(java.lang.String gappFilePath)
           
 void resetConfiguration()
          Removes every mappings in this object ; moreover it deletes the singleton.
 void resetConfiguration(java.lang.String usageContext)
          Remove entries in the two map that where associated with this usageContext.
 void setControllerForUsageContextAndGapp(java.lang.String usageContext, gate.CorpusController pipeline)
           
 void setGappFileForUsageContext(java.lang.String usageContext, java.lang.String filePath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Configuration getInstance()
Returns:
The singleton instance of Configuration

configure

public void configure(java.lang.String usageContext,
                      java.lang.String gappFilePath)
Parameters:
usageContext - The usageContext to be used as key. May be empty but not null.
gappFilePath - The gappFile to be mapped with the usageContext. Shall not be null.

resetConfiguration

public void resetConfiguration()
Removes every mappings in this object ; moreover it deletes the singleton.


isConfigured

public boolean isConfigured(java.lang.String usageContext)
Parameters:
usageContext - The usageContext to be used as key. May be empty but not null.
Returns:
If the map contains an entry for this value

isControllerInitialised

public boolean isControllerInitialised(java.lang.String gappFilePath)
Parameters:
gappFilePath - The gappFilePath to be used as key.
Returns:
true, if a controller (may be the default one not already configured usageContext) has been initialised.

getController

public gate.CorpusController getController(java.lang.String gappFilePath)
Parameters:
gappFilePath - The gappFilePath to be used as key.
Returns:
The controller that has been instanced for this gappFilePath.

getGappFilePathForUsageContext

public java.lang.String getGappFilePathForUsageContext(java.lang.String usageContext)
Parameters:
usageContext - The usageContext to be used as key. May be empty but not null.
Returns:
The gapp file path

setGappFileForUsageContext

public void setGappFileForUsageContext(java.lang.String usageContext,
                                       java.lang.String filePath)
Parameters:
usageContext - The usageContext to be used as key. May be empty but not null.
filePath - The gapp file path

setControllerForUsageContextAndGapp

public void setControllerForUsageContextAndGapp(java.lang.String usageContext,
                                                gate.CorpusController pipeline)
Parameters:
usageContext - The usageContext to be used as key. May be empty but not null.
pipeline - The controller

resetConfiguration

public void resetConfiguration(java.lang.String usageContext)
Remove entries in the two map that where associated with this usageContext.

Parameters:
usageContext - The usageContext that shall not be null


Copyright © 2004-2011. All Rights Reserved.