/** * 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 smartcn tokenizing engine"); super.activate(ce); }
/** * 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 smartcn tokenizing engine"); super.activate(ce); }
/** * Activate and read the properties. Configures and initialises a ChunkerHelper 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(); //TODO: read configuration }
/** * Activate and read the properties * * @param ce * the {@link ComponentContext} */ @Activate protected void activate(ComponentContext ce) throws ConfigurationException { try { super.activate(ce); } catch (IOException e) { // log log.error("Failed to update the configuration", e); } @SuppressWarnings("unchecked") Dictionary<String,Object> properties = ce.getProperties(); // update the service URL if it is defined // if (properties.get(FORMCEPT_SERVICE_URL) != null) { // this.serviceURL = (String) properties.get(FORMCEPT_SERVICE_URL); // } }
/** * 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); }
@Activate protected void activate(ComponentContext ce) throws IOException,ConfigurationException { super.activate(ce); bundleContext = ce.getBundleContext(); key = (String)ce.getProperties().get(API_KEY_PROPERTY); checkConfig(); //init the LiteralFactory literalFactory = LiteralFactory.getInstance(); }
/** * Initialize the language identifier model and load the prop length bound if * provided as a property. * * @param ce * the {@link ComponentContext} */ protected void activate(ComponentContext ce) throws ConfigurationException, IOException { super.activate(ce); if (ce != null) { @SuppressWarnings("unchecked") Dictionary<String, String> properties = ce.getProperties(); String lengthVal = properties.get(PROBE_LENGTH_PROP); probeLength = lengthVal == null ? PROBE_LENGTH_DEFAULT : Integer.parseInt(lengthVal); } LanguageIdentifier.initProfiles(); }
@Override @Activate protected void activate(ComponentContext ctx) throws ConfigurationException { log.info(" activate {} with config {}",getClass().getSimpleName(),ctx.getProperties()); super.activate(ctx); //should we write sentiment values for the document Object value = ctx.getProperties().get(PROPERTY_DOCUMENT_SENTIMENT_STATE); this.writeDocumentSentiment = value == null ? DEFAULT_DOCUMENT_SENTIMENT_STATE : value instanceof Boolean ? ((Boolean)value).booleanValue() : Boolean.parseBoolean(value.toString()); //should we write sentiment values for sentences value = ctx.getProperties().get(PROPERTY_SENTENCE_SENTIMENT_STATE); this.writeSentencesSentimet = value == null ? DEFAULT_SENTENCE_SENTIMENT_STATE : value instanceof Boolean ? ((Boolean)value).booleanValue() : Boolean.parseBoolean(value.toString()); //should we write sentiment values for phrases value = ctx.getProperties().get(PROPERTY_PHRASE_SENTIMENT_STATE); this.writeSentimentPhrases = value == null ? DEFAULT_PHRASE_SENTIMENT_STATE : value instanceof Boolean ? ((Boolean)value).booleanValue() : Boolean.parseBoolean(value.toString()); }
@Override @Activate protected void activate(ComponentContext ctx) throws IOException, ConfigurationException { super.activate(ctx); @SuppressWarnings("unchecked") 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); int conTimeout = Utils.getConnectionTimeout(properties, ctx.getBundleContext()); this.client = new ClassificationClientHTTP(this.serviceURL, this.licenseKey, conTimeout); }
@Override protected void activate(ComponentContext ctx) throws ConfigurationException, RuntimeException { super.activate(ctx); Object value = ctx.getProperties().get(PROPERTY_PREFIX_SUFFIX_SIZE); if(value instanceof Number){ prefixSuffixSize = ((Number)value).intValue(); } else if (value != null){ try { prefixSuffixSize = Integer.parseInt(value.toString()); } catch (NumberFormatException e) { throw new ConfigurationException(PROPERTY_PREFIX_SUFFIX_SIZE, "The value MUST be an Integer", e); } } else { prefixSuffixSize = DEFAULT_PREFIX_SUFFIX_SIZE; } if(prefixSuffixSize < EnhancementEngineHelper.MIN_PREFIX_SUFFIX_SIZE){ throw new ConfigurationException(PROPERTY_PREFIX_SUFFIX_SIZE, "The prefixSuffixSize MUST BE >= " + EnhancementEngineHelper.MIN_PREFIX_SUFFIX_SIZE); } }
/** * Initialize all parameters from the configuration panel, or with their * default values * * @param ce * the {@link ComponentContext} */ @SuppressWarnings("unchecked") protected void activate(ComponentContext ce) throws ConfigurationException, IOException { super.activate(ce); Dictionary<String, Object> properties = ce.getProperties(); spotlightUrl = SpotlightEngineUtils.parseSpotlightServiceURL(properties); connectionTimeout = SpotlightEngineUtils.getConnectionTimeout(properties); //also set the spotter to null if an empty string is parsed Object spotterConfig = properties.get(PARAM_SPOTTER); spotlightSpotter = spotterConfig != null && !spotterConfig.toString().isEmpty() ? spotterConfig.toString() : null; }
@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); }
protected void activate(ComponentContext ce) throws ConfigurationException, IOException { super.activate(ce); this.bundleContext = ce.getBundleContext(); BundleURIResolver.BUNDLE = this.bundleContext.getBundle(); String htmlExtractors = DEFAULT_HTML_EXTRACTOR_REGISTRY; Dictionary<String, Object> properties = ce.getProperties(); String confFile = (String)properties.get(HTML_EXTRACTOR_REGISTRY); if (confFile != null && confFile.trim().length() > 0) { htmlExtractors = confFile; } try { this.htmlExtractorRegistry = new HtmlExtractionRegistry(htmlExtractors); } catch (InitializationException e) { LOG.error("Registry Initialization Error: " + e.getMessage()); throw new IOException(e.getMessage()); } this.htmlParser = new HtmlParser(); }
@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); try { this.completeMorphoAnalysis = (Boolean) properties.get(MORPHOLOGICAL_ANALYSIS); } catch (Exception e) { this.completeMorphoAnalysis = false; } int conTimeout = Utils.getConnectionTimeout(properties, ctx.getBundleContext()); this.client = new LemmatizerClientHTTP(this.serviceURL, this.licenseKey, conTimeout); }
/** * The activate method. * * @param ce the {@link ComponentContext} */ protected void activate(ComponentContext ce) throws ConfigurationException { super.activate(ce); this.bundleContext = ce.getBundleContext(); //TODO initialize Extractor Dictionary<String, Object> properties = ce.getProperties(); String license = (String)properties.get(LICENSE_KEY); String url = (String)properties.get(CALAIS_URL_KEY); calaisTypeMapFile = (String)properties.get(CALAIS_TYPE_MAP_KEY); String standAlone = (String)properties.get(CALAIS_NER_ONLY_MODE_KEY); setLicenseKey(license); setCalaisUrl(url); calaisTypeMap = new HashMap<IRI,IRI>(); loadTypeMap(calaisTypeMapFile); onlyNERMode = Boolean.parseBoolean(standAlone); // this.tcManager = TcManager.getInstance(); }
protected void activate(ComponentContext ce) throws ConfigurationException, IOException { super.activate(ce); this.bundleContext = ce.getBundleContext(); BundleURIResolver.BUNDLE = this.bundleContext.getBundle(); String htmlExtractors = DEFAULT_HTML_EXTRACTOR_REGISTRY; Dictionary<String, Object> properties = ce.getProperties(); String confFile = (String)properties.get(HTML_EXTRACTOR_REGISTRY); if (confFile != null && confFile.trim().length() > 0) { htmlExtractors = confFile; } try { this.htmlExtractorRegistry = new HtmlExtractionRegistry(htmlExtractors); } catch (InitializationException e) { LOG.error("Registry Initialization Error: " + e.getMessage()); throw new IOException(e.getMessage()); } this.htmlParser = new HtmlParser(); }
@Override protected void activate(ComponentContext ctx) throws ConfigurationException { super.activate(ctx); Dictionary<String, Object> props = ctx.getProperties(); this.uimaUri = (String) props.get(UIMA_CONTENTPART_URIREF); this.uimaSourceName = (String) props.get(UIMA_SOURCENAME); this.uimaDescriptorPath = (String) props.get(UIMA_DESCRIPTOR_PATH); SUPPORTED_MIMETYPES = Collections.unmodifiableSet(new HashSet<String>( Arrays.asList((String[]) props.get(UIMA_SUPPORTED_MIMETYPES)))); aeProvider = AEProviderFactory.getInstance().getAEProvider(uimaSourceName, uimaDescriptorPath, new HashMap<String, Object>()); try { AnalysisEngine ae = aeProvider.getAE(); TypeDescription[] aeTypes = ae.getAnalysisEngineMetaData().getTypeSystem().getTypes(); uimaTypeNames = new ArrayList<String>(); for (TypeDescription aeType : aeTypes) { String aeTypeName = aeType.getName(); logger.info("Configuring Analysis Engine Type:" + aeTypeName); uimaTypeNames.add(aeTypeName); } } catch (ResourceInitializationException ex) { logger.error("Cannot retrieve AE from AEProvider. ", ex); throw new ConfigurationException(uimaDescriptorPath, "Cannot retreive AE from AEProvider", ex); } }
/** * Activate and read the properties. Configures and initialises a ChunkerHelper 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> props = ce.getProperties(); writeHierary = getState(props, PROP_HIERARCHY_LINKS_STATE, DEFAULT_HIERARCHY_LINKS_STATE); writePrevNext = getState(props, PROP_PREVIOUSE_NEXT_LINKS_STATE, DEFAULT_PREVIOUSE_NEXT_LINKS_STATE); writeSelectors = getState(props, PROP_SELECTOR_STATE, DEFAULT_SELECTOR_STATE); contextOnlyUriScheme = getState(props, PROP_CONTEXT_ONLY_URI_SCHEME, DEFAULT_CONTEXT_ONLY_URI_SCHEME); writeStringType = getState(props, PROP_WRITE_STRING_TYPE, DEFAULT_WRITE_STRING_TYPE); }