/** * Constructor. * * @param client The Memcached client to support this cache */ public MemDataCache(MemcachedClient client) { // validate expiration value if (EXPIRATION > EXPIRATION_MAX_VALUE) { throw new SystemConfigException("memcached_expiration_seconds exceeds " + EXPIRATION_MAX_VALUE); } this.client = client; }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * * @return requestedPropertyValue The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default int getIntProperty(@NotNull String key) throws SystemConfigException { try { return getMasterConfiguration().getInt(key); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * * @return requestedPropertyValue The value for the requested key, false if null * * @throws SystemConfigException A system exception if any errors occurred */ default boolean getBooleanProperty(@NotNull String key) throws SystemConfigException { try { return getMasterConfiguration().getBoolean(key); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * * @return requestedPropertyValue The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default String getStringProperty(@NotNull String key) throws SystemConfigException { try { return getMasterConfiguration().getString(key); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * * @return requestedPropertyValue The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default String getStringProperty(@NotNull String key) throws SystemConfigException { try { return getMasterConfiguration().getString(key); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * * @return requestedPropertyValue The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default int getIntProperty(@NotNull String key) throws SystemConfigException { try { return getMasterConfiguration().getInt(key); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * * @return requestedPropertyValue The value for the requested key, false if null * * @throws SystemConfigException A system exception if any errors occurred */ default boolean getBooleanProperty(@NotNull String key) throws SystemConfigException { try { return getMasterConfiguration().getBoolean(key); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * @param defaultValue The value to return if there is no configured value * * @return requestedPropertyValue The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default String getStringProperty(@NotNull String key, String defaultValue) throws SystemConfigException { try { return getMasterConfiguration().getString(key, defaultValue); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * @param defaultValue The value to return if there is no configured value * * @return requestedPropertyValue The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default boolean getBooleanProperty(@NotNull String key, boolean defaultValue) throws SystemConfigException { try { return getMasterConfiguration().getBoolean(key, defaultValue); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Remove property from the user-defined runtime configuration. * If value is null, clear the property, otherwise set property to value. * * @param key The key of the property to remove. * @param value The value to reset to (if not null) */ default void resetProperty(@NotNull String key, String value) { try { if (value == null) { getRuntimeProperties().remove(key); } else { getRuntimeProperties().setProperty(key, value); } } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * * @return The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default float getFloatProperty(@NotNull String key) throws SystemConfigException { try { return getMasterConfiguration().getFloat(key); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * * @return The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default long getLongProperty(@NotNull String key) throws SystemConfigException { try { return getMasterConfiguration().getLong(key); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * @param defaultValue The value to return if there is no configured value * * @return The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default long getLongProperty(@NotNull String key, long defaultValue) throws SystemConfigException { try { return getMasterConfiguration().getLong(key, defaultValue); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * @param defaultValue The value to return if there is no configured value * * @return The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default float getFloatProperty(@NotNull String key, float defaultValue) throws SystemConfigException { try { return getMasterConfiguration().getFloat(key, defaultValue); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * * @return The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default double getDoubleProperty(@NotNull String key) throws SystemConfigException { try { return getMasterConfiguration().getDouble(key); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * @param defaultValue The value to return if there is no configured value * * @return The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default double getDoubleProperty(@NotNull String key, double defaultValue) throws SystemConfigException { try { return getMasterConfiguration().getDouble(key, defaultValue); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Find the prioritized stream of configurations for a given module (inclusive of the module itself). * * @param nodeName The name of the initial module whose dependency should be resolved * * @return A list of modules returned in the order of increasing precedence * * @throws SystemConfigException if the graph can't be resolved */ public Stream<String> preOrderRightToLeftTraversal(String nodeName) throws SystemConfigException { if (!moduleConfigurations.containsKey(nodeName)) { LOG.error(NO_SUCH_MODULE.logFormat(nodeName)); throw new SystemConfigException(NO_SUCH_MODULE.format(nodeName)); } return preOrderRightToLeftTraversal(nodeName, new ArrayList<>()); }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * * @return The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default float getFloatProperty(@NotNull String key) throws SystemConfigException { try { return getMasterConfiguration().getFloat(key); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Get property value for a key. * * @param key The key for which value needs to be fetched, not null * * @return The value for the requested key * * @throws SystemConfigException A system exception if any errors occurred */ default double getDoubleProperty(@NotNull String key) throws SystemConfigException { try { return getMasterConfiguration().getDouble(key); } catch (Exception e) { throw new SystemConfigException(e); } }
/** * Find the prioritized stream of configurations for a given module (inclusive of the module itself). * * @param nodeName The name of the initial module whose dependency should be resolved * * @return A list of modules returned in the order of increasing precedence * * @throws SystemConfigException if the graph can't be resolved */ public Stream<String> preOrderRightToLeftTraversal(String nodeName) throws SystemConfigException { if (!moduleConfigurations.containsKey(nodeName)) { LOG.error(NO_SUCH_MODULE.logFormat(nodeName)); throw new SystemConfigException(NO_SUCH_MODULE.format(nodeName)); } return preOrderRightToLeftTraversal(nodeName, new ArrayList<>()); }