private static ConfigurationKey<?> createKey(final ApplicationId applicationId) { return ConfigurationKeyContextManager.INSTANCE.context() .configurationKeyFactory().createKey(applicationId); }
/** * Default constructor. */ private ConfigurationKeyContextManager() { this.context = createContext(); }
/** * Default constructor. * * @param registry the registry to resolve property descriptors. * @param decrypter the helper to decrypt secured property values. * @throws NullArgumentException if {@code registry} or {@code decrypter} is * <code>null</code>. */ public BootConfigurationProperties(final PropertyDescriptorRegistry registry, final PropertyValueSecurity decrypter) throws NullArgumentException { super(ConfigurationKeyContextManager.INSTANCE.context() .configurationKeyFactory().createUniqueKey("smartics-boot"), registry, decrypter); }
@Override public final ConfigurationPropertiesManagement createDefaultManagement() { final ConfigurationKey<?> key = ConfigurationKeyContextManager.INSTANCE.context() .configurationKeyFactory().createDefaultKey(); return createManagement(key); }
/** * Expected to be called with write lock acquired. */ private ConfigurationPropertiesManagement constructConfigurationWithDefaults( final ConfigurationKey<?> key) { final KeyListBuilder builder = ConfigurationKeyContextManager.INSTANCE.context().keyListBuilder(); final List<ConfigurationKey<?>> keySet = builder.createKeyList(key); final List<ConfigurationPropertiesManagement> defaults = new ArrayList<ConfigurationPropertiesManagement>(keySet.size()); for (final ConfigurationKey<?> current : keySet) { final ConfigurationPropertiesManagement config = getCachedOrCreate(current); if (config != null) { defaults.add(config); } } if (defaults.isEmpty()) { return null; } if (defaults.size() == 1) { return defaults.get(0); } return new ConfigurationPropertiesManagementWithDefaults(defaults); }
@Override public final T createDefault() { final ConfigurationKey<?> key = ConfigurationKeyContextManager.INSTANCE.context() .configurationKeyFactory().createDefaultKey(); return create(key); }
/** * Returns the definition information for the given class loader. * * @param context the class loader and the root folder to read the * <code>{@value de.smartics.properties.api.core.domain.PropertiesContext#DEFINITION_FILE_NAME}</code> * . * @return the definition helper if there is a * <code>{@value de.smartics.properties.api.core.domain.PropertiesContext#DEFINITION_FILE_NAME}</code> * or at least * {@value de.smartics.properties.api.core.domain.PropertiesContext#META_INF_HOME} * , <code>null</code> otherwise. */ @CheckForNull DefinitionKeyHelper getDefinition(final ClassPathContext context) { DefinitionKeyHelper definition = definitionCache.get(context); if (definition == null) { final DefinitionConfigParser<?> parser = ConfigurationKeyContextManager.INSTANCE.context() .definitionConfigParser(); final PropertiesDefinitionContext definitionContext = parser.parse(context); definition = ConfigurationKeyContextManager.INSTANCE.context() .definitionKeyHelper(definitionContext); definitionCache.put(context, definition); } return definition; }
/** * Convenience constructor allowing to control the need of existing properties * files on the classpath, using its own registry and an artificial key. * * @param requiresDefaultOnClassPath the flag controls the behavior on not * finding default properties on the classpath. If the value is * <code>true</code> not finding the properties file on the class * path signals an exception, if set to <code>false</code> the * properties are not required to exist. In the latter case the * properties may be set purely programatically. * @param decrypter the helper to decrypt secured property values. * @throws NullArgumentException if {@code decrypter} is <code>null</code>. */ public ClasspathConfigurationProperties( final boolean requiresDefaultOnClassPath, final PropertyValueSecurity decrypter) throws NullArgumentException { super(ConfigurationKeyContextManager.INSTANCE.context() .configurationKeyFactory().createDefaultKey(), new InMemoryPropertyDescriptorRegistry(), requiresDefaultOnClassPath, decrypter); }
@Override public void clear() throws TransferException { try { FileUtils.cleanDirectory(targetFolder); } catch (final IOException e) { final ConfigurationKey<?> key = ConfigurationKeyContextManager.INSTANCE.context() .configurationKeyFactory().createDefaultKey(); throw new TransferException(new TransferMessageBean( TransferFileCode.FAILED_TO_CLEAN, e, key, targetFolder)); } }
private static void initialize() { final ConfigurationPropertiesFactory factory = ConfigurationPropertiesFactoryFactory .createFactory(PropertiesConfigurationPropertiesFactory.class); final ConfigurationKey<?> key = ConfigurationKeyContextManager.INSTANCE.context() .configurationKeyFactory().createDefaultKey(); final ConfigurationPropertiesManagement propertiesConfiguration = factory.createManagement(key); INSTANCE = propertiesConfiguration .getProperties(ResourceRepositoryProperties.class); }
private ConfigurationKey<?> parseKey(final String key) { final ConfigurationKeyFactory<?> factory = ConfigurationKeyContextManager.INSTANCE.context() .configurationKeyFactory(); try { final ConfigurationKey<?> configurationKey = factory.createKeyFromString(key); return configurationKey; } catch (final IllegalArgumentException e) { final DataSourceConfigurationMessageBean message = new DataSourceConfigurationMessageBean( DataSourceCode.INVALID_CONFIGURATION_KEY, e, manager.getDataSourceId(), null); throw new DataSourceException(message); // NOPMD } }
return ConfigurationKeyContextManager.INSTANCE.context() .configurationKeyFactory().createDefaultKey();
return ConfigurationKeyContextManager.INSTANCE.context() .configurationKeyFactory().createDefaultKey();