de.smartics.properties.spi.config.support
Class InMemoryConfigurationRepositoryManagement

Package class diagram package InMemoryConfigurationRepositoryManagement
java.lang.Object
  extended by de.smartics.properties.spi.config.support.InMemoryConfigurationRepositoryManagement
All Implemented Interfaces:
ConfigurationRepository, ConfigurationRepositoryManagement

@ThreadSafe
public final class InMemoryConfigurationRepositoryManagement
     
     
extends Object
implements ConfigurationRepositoryManagement

Stores all configurations in memory.


Field Summary
static String PERM_ONLY
          FIXME: Use this as boot properties.
 
Constructor Summary
InMemoryConfigurationRepositoryManagement(PropertyDescriptorRegistry registry, ConfigurationPropertiesManagementFactory factory)
          Default constructor.
 
Method Summary
 ConfigurationPropertiesManagement deregisterProperties(ConfigurationKey<?> key)
          Removes the configuration properties for the given configuration key.
 Collection<ConfigurationKey<?>> getKeys()
          Returns the list of keys with configuration properties.
 ConfigurationProperties getProperties(ConfigurationKey<?> key)
          Fetches the properties for the given configuration key.
 ConfigurationPropertiesManagement getPropertiesManagement(ConfigurationKey<?> key)
          Fetches the properties management for the given configuration key.
 ConfigurationPropertiesManagement getPropertiesManagementWithDefaults(ConfigurationKey<?> key)
          Fetches the properties management for the given configuration key.
 PropertyDescriptorRegistry getRegistry()
          Returns the registry to resolve property descriptors.
 boolean hasPropertiesManagement(ConfigurationKey<?> key)
          Checks if a properties management for the given configuration key is present.
 void registerProperties(ConfigurationKey<?> key, ConfigurationPropertiesManagement configurationProperties)
          Registers the given configuration properties for the given configuration key.
 void release()
          Releases resources acquired by this instance.
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PERM_ONLY

public static final String PERM_ONLY
FIXME: Use this as boot properties.

Constant Field Value:
"store.permonly"
Constructor Detail

InMemoryConfigurationRepositoryManagement

public InMemoryConfigurationRepositoryManagement(PropertyDescriptorRegistry registry,
                                                 ConfigurationPropertiesManagementFactory factory)
Default constructor.

Parameters:
registry - the registry to resolve property descriptors.
factory - the factory to create instance of ConfigurationPropertiesManagement on demand.
Method Detail

getRegistry

public PropertyDescriptorRegistry getRegistry()
Returns the registry to resolve property descriptors.

Specified by:
getRegistry in interface ConfigurationRepositoryManagement
Returns:
the registry to resolve property descriptors.

getProperties

public ConfigurationProperties getProperties(ConfigurationKey<?> key)
                                      throws de.smartics.util.lang.NullArgumentException,
                                             MissingConfigurationException
Description copied from interface: ConfigurationRepository
Fetches the properties for the given configuration key.

Specified by:
getProperties in interface ConfigurationRepository
Parameters:
key - the key that specifies an application in its environment.
Returns:
the requested configuration properties. Never null.
Throws:
de.smartics.util.lang.NullArgumentException - if key is null.
MissingConfigurationException - if there is no configuration for the given key.

getPropertiesManagementWithDefaults

public ConfigurationPropertiesManagement getPropertiesManagementWithDefaults(ConfigurationKey<?> key)
                                                                      throws de.smartics.util.lang.NullArgumentException,
                                                                             MissingConfigurationException
Description copied from interface: ConfigurationRepositoryManagement
Fetches the properties management for the given configuration key. The default values for partial key are also attached.

Specified by:
getPropertiesManagementWithDefaults in interface ConfigurationRepositoryManagement
Parameters:
key - the key that specifies an application in its environment.
Returns:
the requested configuration properties. Never null.
Throws:
de.smartics.util.lang.NullArgumentException - if key is null.
MissingConfigurationException - if there is no configuration for the given key.
See Also:
ConfigurationRepository.getProperties(ConfigurationKey)

getPropertiesManagement

public ConfigurationPropertiesManagement getPropertiesManagement(ConfigurationKey<?> key)
                                                          throws de.smartics.util.lang.NullArgumentException,
                                                                 MissingConfigurationException
Description copied from interface: ConfigurationRepositoryManagement
Fetches the properties management for the given configuration key.

Specified by:
getPropertiesManagement in interface ConfigurationRepositoryManagement
Parameters:
key - the key that specifies an application in its environment.
Returns:
the requested configuration properties. Never null.
Throws:
de.smartics.util.lang.NullArgumentException - if key is null.
MissingConfigurationException - if there is no configuration for the given key.
See Also:
ConfigurationRepository.getProperties(ConfigurationKey)

hasPropertiesManagement

public boolean hasPropertiesManagement(ConfigurationKey<?> key)
                                throws de.smartics.util.lang.NullArgumentException
Description copied from interface: ConfigurationRepositoryManagement
Checks if a properties management for the given configuration key is present.

Specified by:
hasPropertiesManagement in interface ConfigurationRepositoryManagement
Parameters:
key - the key that specifies an application in its environment.
Returns:
true if the configuration is present, false if not.
Throws:
de.smartics.util.lang.NullArgumentException - if key is null.

registerProperties

public void registerProperties(ConfigurationKey<?> key,
                               ConfigurationPropertiesManagement configurationProperties)
                        throws de.smartics.util.lang.NullArgumentException,
                               DuplicateConfigurationException
Description copied from interface: ConfigurationRepositoryManagement
Registers the given configuration properties for the given configuration key.

Specified by:
registerProperties in interface ConfigurationRepositoryManagement
Parameters:
key - the key that specifies an application in its environment.
configurationProperties - the configuration properties to register by the given key.
Throws:
de.smartics.util.lang.NullArgumentException - if key or configurationProperties is null.
DuplicateConfigurationException - if a configuration with the given key is already registered.

deregisterProperties

public ConfigurationPropertiesManagement deregisterProperties(ConfigurationKey<?> key)
                                                       throws de.smartics.util.lang.NullArgumentException
Description copied from interface: ConfigurationRepositoryManagement
Removes the configuration properties for the given configuration key.

Specified by:
deregisterProperties in interface ConfigurationRepositoryManagement
Parameters:
key - the key that specifies an application in its environment.
Returns:
the configuration properties that has been removed. May be null.
Throws:
de.smartics.util.lang.NullArgumentException - if key is null.

getKeys

public Collection<ConfigurationKey<?>> getKeys()
Description copied from interface: ConfigurationRepositoryManagement
Returns the list of keys with configuration properties.

Specified by:
getKeys in interface ConfigurationRepositoryManagement
Returns:
the list of keys with configuration properties.

release

public void release()
Description copied from interface: ConfigurationRepositoryManagement
Releases resources acquired by this instance.

Specified by:
release in interface ConfigurationRepository
Specified by:
release in interface ConfigurationRepositoryManagement

toString

public String toString()
Returns the string representation of the object.

Overrides:
toString in class Object
Returns:
the string representation of the object.


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.