Create caches of WordNet to speed up matching.

@param componentKey a key to the component in the configuration
@param properties   configuration
@throws SMatchException SMatchException
432843
public static void createWordNetCaches(String componentKey, Properties properties) throws SMatchException {
        properties = getComponentProperties(makeComponentPrefix(componentKey, WordNet.class.getSimpleName()), properties);
        if (properties.containsKey(JWNL_PROPERTIES_PATH_KEY)) {
            // initialize JWNL (this must be done before JWNL library can be used)
            try {
                final String configPath = properties.getProperty(JWNL_PROPERTIES_PATH_KEY);
                log.info("Initializing JWNL from " + configPath);

                boolean useInternalFiles = true;

                if (properties.containsKey(USE_INTERNAL_FILES)) {
                    useInternalFiles = Boolean.parseBoolean(properties.getProperty(USE_INTERNAL_FILES));
                }

                if (useInternalFiles == true) {
                    log.info("Using internal files.");

                    InputStream propertiesStream = Thread.currentThread().getContextClassLoader().getResource(configPath).openStream();
                    String dictionaryPath = Thread.currentThread().getContextClassLoader().getResource("data").toString();
                    dictionaryPath = dictionaryPath.replace("file:/", "");
                    dictionaryPath = "/" + dictionaryPath + "/";
                    log.info("dictionaryPath: " + dictionaryPath);
                    String propertiesFromStream = getTextFromStream(propertiesStream);
                    propertiesFromStream = propertiesFromStream.replace(DEFAULT_FILE_DICTIONARY_PATH, dictionaryPath);
                    InputStream is = new ByteArrayInputStream(propertiesFromStream.getBytes());
                    JWNL.initialize(is);
                } else {
                    JWNL.initialize(new FileInputStream(configPath));
                }
                log.info("Creating WordNet caches...");
                writeMultiwords(properties);
                log.info("Done");
            } catch (JWNLException e) {
                final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
                log.error(errMessage, e);
                throw new SMatchException(errMessage, e);
            } catch (FileNotFoundException e) {
                final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
                log.error(errMessage, e);
                throw new SMatchException(errMessage, e);
            } catch (IOException ex) {
                java.util.logging.Logger.getLogger(WordNet.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            final String errMessage = "Cannot find configuration key " + JWNL_PROPERTIES_PATH_KEY;
            log.error(errMessage);
            throw new SMatchException(errMessage);
        }
    }
465215
@SuppressWarnings("unchecked")
    private <T> T jndiLookup(PropertyKey propertyKey) {
        String property = properties.getProperty(propertyKey.getKey());
        if (property != null) {
            return isJndiLazyLookup() ?
                    (T) LazyJndiResolver.newInstance(property, DataSource.class) :
                    (T) JndiUtils.lookup(property);
        }
        return null;
    }
513917
public static void set(PropertyKey key, Object value) {
    set(key, String.valueOf(value), Source.RUNTIME);
  }
232909
public void removeProp(String key) {
    this.specProperties.remove(key);
    if (this.commonProperties.containsKey(key)) {
      // This case should not happen.
      Properties commonPropsCopy = new Properties();
      commonPropsCopy.putAll(this.commonProperties);
      commonPropsCopy.remove(key);
      this.commonProperties = commonPropsCopy;
    }
  }
1156377
@Override
  public Schema getSchemaByKey(String key) throws SchemaRegistryException {
    try {
      return cachedSchemasByKeys.get(key);
    } catch (ExecutionException e) {
      throw new SchemaRegistryException(String.format("Schema with key %s cannot be retrieved", key), e);
    }
  }
1149381
public void setCachedConsumerProps(CachedSessionProperties props)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setCachedConsumerProps", props);
        this.cachedProps = props;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setCachedConsumerProps");
    }
17350
protected void initializeJawrContext(Properties props) throws ServletException {

		// Initialize config
		initializeJawrConfig(props);

		// initialize the cache manager
		initializeApplicationCacheManager();

		// initialize the Application config manager
		JawrApplicationConfigManager appConfigMgr = initApplicationConfigManager();

		JmxUtils.initJMXBean(appConfigMgr, servletContext, resourceType,
				props.getProperty(JawrConstant.JAWR_JMX_MBEAN_PREFIX));
	}
1021203
private static String getStringKey(String propertyKey) {
        if (WCCustomProperties.FullyQualifiedPropertiesMap.containsKey(propertyKey)) {
            return WCCustomProperties.FullyQualifiedPropertiesMap.get(propertyKey).toLowerCase();
        } else {
            return propertyKey;
        }
    }
605722
private void copyToCache(SchemaConcept schemaConcept) {
        schemaConcept.subs().forEach(concept -> keyspaceCache.cacheLabel(concept.label(), concept.labelId()));
    }
63591
public void setPartitionKeys(List<FieldSchema> partitionKeys) {
    this.setProp(HIVE_PARTITION_KEYS, GSON.toJson(partitionKeys, FIELD_SCHEMA_TYPE));
  }
391266
@Override
	public <V> Iterator<VertexProperty<V>> properties(String... propertyKeys) {
        ArrayList<VertexProperty<V>> ans = new ArrayList<VertexProperty<V>>();

        if (propertyKeys.length == 0) {
        	if (this.properties == null) return Collections.emptyIterator();
        	propertyKeys = this.properties.getPropertyKeys();
        }

        for (String key : propertyKeys) {
        	VertexProperty<V> prop = property(key);
            if (prop.isPresent()) ans.add(prop);
        }
        return ans.iterator();
	}
1347153
public String getProperty(final String key) {
        if (hasProperty(key)) {
            return properties.getProperty(key);
        } else {
            throw new PropertyLookupException("property not found: " + key);
        }
    }
912841
Set<String> searchInstancesContainingKey(String searchKey)
            throws KnowledgeSourceReadException {
        return getFromProtege(searchKey,
                new ProtegeCommand<Set<String>, String>(
                        "search instance in a given  slot") {
                    @Override
                    Set<String> get(String matchString) {
                        Set<String> searchResults = new HashSet<>();
                        try {
                            Collection<Frame> displayNameMatches = protegeKnowledgeBase
                                    .getMatchingFrames(protegeKnowledgeBase
                                            .getSlot("displayName"), null, false,
                                            "*" + matchString.trim() + "*", -1);
                            Collection<Frame> nameMatches = protegeKnowledgeBase
                                    .getMatchingFrames(protegeKnowledgeBase
                                            .getSlot(":NAME"), null, false, "*"
                                            + matchString.trim() + "*", -1);
                            Slot nameSlot = protegeKnowledgeBase.getSlot(":NAME");
                            Cls propositionCls = protegeKnowledgeBase.getCls("Proposition");
                            if (displayNameMatches != null) {
                                for (Frame match : displayNameMatches)
                                    if (match instanceof Instance) {
                                        Instance temp = (Instance) match;
                                        if (temp.hasType(propositionCls)) {
                                            searchResults.add((String) getOwnSlotValue(match, nameSlot));
                                        }
                                    }
                            }
                            if (nameMatches != null) {
                                for (Frame match : nameMatches) {
                                    if (match instanceof Instance) {
                                        Instance temp = (Instance) match;
                                        if (temp.hasType(propositionCls)) {
                                            String result = (String) getOwnSlotValue(match, nameSlot);
                                            if (!searchResults.contains(result))
                                                searchResults.add(result);
                                        }
                                    }
                                }
                            }
                        } catch (KnowledgeSourceReadException e) {
                            e.printStackTrace();
                        }
                        return searchResults;
                    }
                });
    }
449147
@SuppressWarnings("unchecked")
    protected <E extends R> List<E> buildComponentList(final UniqueKey<E> uniqueKey) throws CoreException {

        // Build a new instance of the component
        final List<E> readyObjectList = globalFacade().componentFactory().buildComponents(uniqueKey.classField());

        for (final E readyObject : readyObjectList) {
            // Retrieve the right event type to track
            JRebirthEventType type = JRebirthEventType.NONE;
            if (readyObject instanceof Model) {
                type = JRebirthEventType.CREATE_MODEL;
            } else if (readyObject instanceof Service) {
                type = JRebirthEventType.CREATE_SERVICE;
            } else if (readyObject instanceof Command) {
                type = JRebirthEventType.CREATE_COMMAND;
            }

            // Track this instantiation event
            globalFacade().trackEvent(type, this.getClass(), readyObject.getClass());

            // Attach the local facade
            // Already Done by register method
            readyObject.localFacade(this);

            UniqueKey<E> readyKey = null;
            if (uniqueKey instanceof MultitonKey) {
                final Object keyPart = ((MultitonKey<?>) uniqueKey).value();
                readyKey = (UniqueKey<E>) Key.createMulti(readyObject.getClass(),
                                                          keyPart instanceof List ? ((List<?>) keyPart).toArray() : new Object[] { keyPart },
                                                          uniqueKey.optionalData().toArray());
            } else if (uniqueKey instanceof ClassKey) {
                readyKey = (UniqueKey<E>) Key.createSingle(readyObject.getClass(), uniqueKey.optionalData().toArray());
            }
            readyKey.registrationKey(uniqueKey);

            // Create the unique key
            readyObject.key((UniqueKey<R>) readyKey);

        }

        // EnhancedComponent Ready !
        return readyObjectList;
    }
551285
public Set<String> getCustomBundlePropertyAsSet(String bundleName, String key) {
		Set<String> propertiesSet = new HashSet<>();
		StringTokenizer tk = new StringTokenizer(getCustomBundleProperty(bundleName, key, ""), ",");
		while (tk.hasMoreTokens())
			propertiesSet.add(tk.nextToken().trim());
		return propertiesSet;
	}
1343859
public void updateProperties(ResourceBundle bundle, Properties props, Charset charset) {

		Enumeration<String> keys = bundle.getKeys();

		while (keys.hasMoreElements()) {
			String key = keys.nextElement();

			if (matchesFilter(key)) {
				String value = bundle.getString(key);
				props.put(key, value);
			}
		}
	}
165815
@Inject
   protected void injectDependencies(Cache cache) {
      this.queryCache = cache.getCacheManager().getGlobalComponentRegistry().getComponent(QueryCache.class);
      ComponentRegistry componentRegistry = cache.getAdvancedCache().getComponentRegistry();
      matcher = componentRegistry.getComponent(matcherImplClass);
      if (matcher == null) {
         throw new CacheException("Expected component not found in registry: " + matcherImplClass.getName());
      }
   }