use of org.osgi.service.component.ComponentContext in project stanbol by apache.
the class WeightedChain method addingService.
@Override
public Object addingService(ServiceReference reference) {
invalidateExecutionPlan();
ComponentContext context = this.context;
if (context != null) {
return context.getBundleContext().getService(reference);
} else {
log.warn("Unable to get EnhancementEngine for Reference {} because" + "this {} seams already be deactivated -> return null", reference.getProperty(EnhancementEngine.PROPERTY_NAME), toString());
return null;
}
}
use of org.osgi.service.component.ComponentContext in project stanbol by apache.
the class WeightedChain method removedService.
@Override
public void removedService(ServiceReference reference, Object service) {
invalidateExecutionPlan();
ComponentContext context = this.context;
if (context != null) {
context.getBundleContext().ungetService(reference);
}
}
use of org.osgi.service.component.ComponentContext in project stanbol by apache.
the class TokenizerAndTokenFIlterTest method init.
@BeforeClass
public static void init() throws ConfigurationException {
Dictionary<String, Object> config = new Hashtable<String, Object>();
config.put(LuceneLabelTokenizer.PROPERTY_TOKENIZER_FACTORY, TOKENIZER_FACTORY_CLASS);
config.put(LuceneLabelTokenizer.PROPERTY_TOKEN_FILTER_FACTORY, TOKEN_FILTER_FACTORY_CLASSES);
config.put(LabelTokenizer.SUPPORTED_LANUAGES, "zh");
ComponentContext cc = new MockComponentContext(config);
luceneLabelTokenizer = new LuceneLabelTokenizer();
luceneLabelTokenizer.activate(cc);
}
use of org.osgi.service.component.ComponentContext in project stanbol by apache.
the class LuceneLabelTokenizerTest method init.
@BeforeClass
public static void init() throws ConfigurationException {
Dictionary<String, Object> config = new Hashtable<String, Object>();
config.put(LuceneLabelTokenizer.PROPERTY_TOKENIZER_FACTORY, TOKENIZER_FACTORY_CLASS);
config.put(LabelTokenizer.SUPPORTED_LANUAGES, "en");
ComponentContext cc = new MockComponentContext(config);
luceneLabelTokenizer = new LuceneLabelTokenizer();
luceneLabelTokenizer.activate(cc);
}
use of org.osgi.service.component.ComponentContext in project stanbol by apache.
the class OpenNlpLabelTokenizerTest method init.
@BeforeClass
public static final void init() throws ConfigurationException {
Dictionary<String, Object> config = new Hashtable<String, Object>();
config.put(LabelTokenizer.SUPPORTED_LANUAGES, "*");
ComponentContext cc = new MockComponentContext(config);
tokenizer = new OpenNlpLabelTokenizer();
tokenizer.openNlp = new OpenNLP(new ClasspathDataFileProvider(null));
tokenizer.activate(cc);
}
Aggregations