@Activate protected void activate(ComponentContext ctx) throws ConfigurationException { languageConfig.setConfiguration(ctx.getProperties()); } @Deactivate
/** * Activate and read the properties. Configures and initialises a POSTagger for each language configured in * CONFIG_LANGUAGES. * * @param ce the {@link org.osgi.service.component.ComponentContext} */ @Activate protected void activate(ComponentContext ce) throws ConfigurationException { log.info("activating POS tagging engine"); super.activate(ce); @SuppressWarnings("unchecked") Dictionary<String, Object> properties = ce.getProperties(); languageConfig.setConfiguration(properties); }
/** * Activate and read the properties. Configures and initialises a POSTagger for each language configured in * CONFIG_LANGUAGES. * * @param ce the {@link org.osgi.service.component.ComponentContext} */ @Activate protected void activate(ComponentContext ce) throws ConfigurationException { log.info("activating POS tagging engine"); super.activate(ce); @SuppressWarnings("unchecked") Dictionary<String, Object> properties = ce.getProperties(); languageConfig.setConfiguration(properties); }
/** * Activate and read the properties. Configures and initialises a POSTagger for each language configured in * CONFIG_LANGUAGES. * * @param ce the {@link org.osgi.service.component.ComponentContext} */ @Activate protected void activate(ComponentContext ce) throws ConfigurationException { log.info("activating POS tagging engine"); super.activate(ce); @SuppressWarnings("unchecked") Dictionary<String, Object> properties = ce.getProperties(); languageConfig.setConfiguration(properties); }
@Override public void modifiedService(ServiceReference reference, Object service) { if(managerServicePid.equals(reference.getProperty(Constants.SERVICE_PID))){ return; //ignore this service! } LanguageConfiguration langConf = new LanguageConfiguration(SUPPORTED_LANUAGES, DEFAULT_LANG_CONF); try { langConf.setConfiguration(reference); ref2LangConfig.put(reference, langConf); langTokenizers.clear(); } catch (ConfigurationException e) { log.error("Unable to track ServiceReference {} becuase of invalid LanguageConfiguration(" + SUPPORTED_LANUAGES+"="+reference.getProperty(SUPPORTED_LANUAGES)+")!",e); if(ref2LangConfig.remove(reference) != null){ langTokenizers.clear(); } } }
@Override public void modifiedService(ServiceReference reference, Object service) { if(managerServicePid.equals(reference.getProperty(Constants.SERVICE_PID))){ return; //ignore this service! } LanguageConfiguration langConf = new LanguageConfiguration(SUPPORTED_LANUAGES, DEFAULT_LANG_CONF); try { langConf.setConfiguration(reference); ref2LangConfig.put(reference, langConf); langTokenizers.clear(); } catch (ConfigurationException e) { log.error("Unable to track ServiceReference {} becuase of invalid LanguageConfiguration(" + SUPPORTED_LANUAGES+"="+reference.getProperty(SUPPORTED_LANUAGES)+")!",e); if(ref2LangConfig.remove(reference) != null){ langTokenizers.clear(); } } }
@Override public Object addingService(ServiceReference reference) { if(managerServicePid.equals(reference.getProperty(Constants.SERVICE_PID))){ return null; //do not track this manager! } LanguageConfiguration langConf = new LanguageConfiguration(SUPPORTED_LANUAGES, DEFAULT_LANG_CONF); try { langConf.setConfiguration(reference); } catch (ConfigurationException e) { log.error("Unable to track ServiceReference {} becuase of invalid LanguageConfiguration(" + SUPPORTED_LANUAGES+"="+reference.getProperty(SUPPORTED_LANUAGES)+")!",e); return null; } Object service = bundleContext.getService(reference); if(service != null){ ref2LangConfig.put(reference, langConf); langTokenizers.clear(); } return service; }
@Override public Object addingService(ServiceReference reference) { if(managerServicePid.equals(reference.getProperty(Constants.SERVICE_PID))){ return null; //do not track this manager! } LanguageConfiguration langConf = new LanguageConfiguration(SUPPORTED_LANUAGES, DEFAULT_LANG_CONF); try { langConf.setConfiguration(reference); } catch (ConfigurationException e) { log.error("Unable to track ServiceReference {} becuase of invalid LanguageConfiguration(" + SUPPORTED_LANUAGES+"="+reference.getProperty(SUPPORTED_LANUAGES)+")!",e); return null; } Object service = bundleContext.getService(reference); if(service != null){ ref2LangConfig.put(reference, langConf); langTokenizers.clear(); } return service; }
@Override @Activate protected void activate(ComponentContext ctx) throws IOException, ConfigurationException { super.activate(ctx); Dictionary<String, Object> properties = ctx.getProperties(); this.licenseKey = Utils.getLicenseKey(properties, ctx.getBundleContext()); String url = (String) properties.get(SERVICE_URL); if (url == null || url.isEmpty()) { throw new ConfigurationException(SERVICE_URL, String.format("%s : please configure the URL of the CELI Web Service (e.g. by" + "using the 'Configuration' tab of the Apache Felix Web Console).", getClass().getSimpleName())); } this.serviceURL = new URL(url); //parse the parsed language configuration languageConfig.setConfiguration(properties); int conTimeout = Utils.getConnectionTimeout(properties, ctx.getBundleContext()); this.client = new LemmatizerClientHTTP(this.serviceURL, this.licenseKey,conTimeout); }
langaugeConfig.setConfiguration(properties);
languageConfiguration.setConfiguration(properties);
languageConfiguration.setConfiguration(properties);
+ "configuration MUST BE present!"); langConf.setConfiguration(ctx.getProperties());
+ "configuration MUST BE present!"); langConf.setConfiguration(ctx.getProperties());
languageConfig.setConfiguration(config);
fstConfig.setConfiguration(properties);
+ "! Users need to use String[] or Collection<?> instead!"); tpc.languages.setConfiguration(configuration); Map<String,String> defaultConfig = tpc.languages.getDefaultParameters();
+ "! Users need to use String[] or Collection<?> instead!"); tpc.languages.setConfiguration(configuration); Map<String,String> defaultConfig = tpc.languages.getDefaultParameters();