Search in sources :

Example 1 with Parameter

use of org.apache.uima.resource.Parameter in project dkpro-lab by dkpro.

the class TaskContextProvider method initialize.

@Override
public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams) throws ResourceInitializationException {
    if (!super.initialize(aSpecifier, aAdditionalParams)) {
        return false;
    }
    // Create synthetic context to be able to use InitializeUtil.
    UimaContextAdmin context = UIMAFramework.newUimaContext(UIMAFramework.getLogger(), UIMAFramework.newDefaultResourceManager(), UIMAFramework.newConfigurationManager());
    ConfigurationManager cfgMgr = context.getConfigurationManager();
    cfgMgr.setSession(context.getSession());
    CustomResourceSpecifier spec = (CustomResourceSpecifier) aSpecifier;
    for (Parameter p : spec.getParameters()) {
        cfgMgr.setConfigParameterValue(context.getQualifiedContextName() + p.getName(), p.getValue());
    }
    ConfigurationParameterInitializer.initialize(this, context);
    return true;
}
Also used : CustomResourceSpecifier(org.apache.uima.resource.CustomResourceSpecifier) UimaContextAdmin(org.apache.uima.UimaContextAdmin) ConfigurationParameter(org.apache.uima.fit.descriptor.ConfigurationParameter) Parameter(org.apache.uima.resource.Parameter) ConfigurationManager(org.apache.uima.resource.ConfigurationManager)

Aggregations

UimaContextAdmin (org.apache.uima.UimaContextAdmin)1 ConfigurationParameter (org.apache.uima.fit.descriptor.ConfigurationParameter)1 ConfigurationManager (org.apache.uima.resource.ConfigurationManager)1 CustomResourceSpecifier (org.apache.uima.resource.CustomResourceSpecifier)1 Parameter (org.apache.uima.resource.Parameter)1