com.neeve.config
Interface IConfigRepository


public interface IConfigRepository

Represents a configuration repository.

This interface is the core interface through which all X Platform entities access the an X Platform configuration repository. It embodies the model and mechanisms by which configuration artifacts are stored and manipulated.

Threading:
This class is not safe for concurrent access by multiple threads

Method Summary
 void close()
          Close the repository
 void commit()
          Commit changes made to the repository to durable storage
 IConfigComplexEntityContainer createComplexEntityContainer(String addr)
          Create a new configuration complex entity container in the repository.
 IConfigSimpleEntityContainer createSimpleEntityContainer(String addr)
          Create a new configuration simple entity container in the repository.
 void deserialize(String str, boolean markAsDirty)
          Deserialize a repository from a string
 IConfigComplexEntity getComplexEntity(String addr)
          Get a complex configuration entity in the repository
 IConfigComplexEntityContainer getComplexEntityContainer(String addr)
          Get a configuration complex entity container in the repository
 String getDescriptor()
          Get the descriptor used to create a repository
 IConfigSimpleEntity getSimpleEntity(String addr)
          Get a simple configuration entity in the repository
 IConfigSimpleEntityContainer getSimpleEntityContainer(String addr)
          Get a configuration simple entity container in the repository
 IConfigComplexEntityContainer removeComplexEntityContainer(String addr)
          Remove a configuration complex entity container from the repository.
 IConfigSimpleEntityContainer removeSimpleEntityContainer(String addr)
          Remove a configuration simple entity container from the repository.
 void serialize(StringBuilder builder)
          Serialize the repository into a string
 void traverse(String filter, IConfigTraversalCallback callback)
          Perform a depth first traveral of a configuration repository.
 

Method Detail

getDescriptor

String getDescriptor()
Get the descriptor used to create a repository

Returns:
The descriptor. A value of null indicates the repository was not created using a descriptor.

createSimpleEntityContainer

IConfigSimpleEntityContainer createSimpleEntityContainer(String addr)
                                                         throws EConfigException
Create a new configuration simple entity container in the repository.

Parameters:
addr - The address of the entity container. The address must start with '/'. An IllegalArgumentException is thrown in otherwise.
Returns:
Returns the created container.
Throws:
EConfigException - Thrown in case the repository already has a content object at the supplied address.
Threading:
This method is not safe for concurrent access by multiple threads.

createComplexEntityContainer

IConfigComplexEntityContainer createComplexEntityContainer(String addr)
                                                           throws EConfigException
Create a new configuration complex entity container in the repository.

Parameters:
addr - The address of the entity container. The address must start with '/'. An IllegalArgumentException is thrown in otherwise.
Returns:
Returns the created container.
Throws:
EConfigException - Thrown in case the repository already has a content object at the supplied address.
Threading:
This method is not safe for concurrent access by multiple threads.

getSimpleEntityContainer

IConfigSimpleEntityContainer getSimpleEntityContainer(String addr)
Get a configuration simple entity container in the repository

Parameters:
addr - The address of the entity container.
Returns:
Returns null if the address does not refer to a valid entity container.
Threading:
This method is not safe for concurrent access by multiple threads.

getComplexEntityContainer

IConfigComplexEntityContainer getComplexEntityContainer(String addr)
Get a configuration complex entity container in the repository

Parameters:
addr - The address of the entity container.
Returns:
Returns null if the address does not refer to a valid entity container.
Threading:
This method is not safe for concurrent access by multiple threads.

getSimpleEntity

IConfigSimpleEntity getSimpleEntity(String addr)
Get a simple configuration entity in the repository

Parameters:
addr - The address of the entity.
Returns:
Returns null if the address does not refer to a valid simple entity.
Threading:
This method is not safe for concurrent access by multiple threads.

getComplexEntity

IConfigComplexEntity getComplexEntity(String addr)
Get a complex configuration entity in the repository

Parameters:
addr - The address of the entity.
Returns:
Returns null if the address does not refer to a valid simple entity.
Threading:
This method is not safe for concurrent access by multiple threads.

removeSimpleEntityContainer

IConfigSimpleEntityContainer removeSimpleEntityContainer(String addr)
Remove a configuration simple entity container from the repository.

Parameters:
addr - The address of the entity container to remove.
Returns:
Returns the removed container or null if a simple container with the supplied address does not exist.
Threading:
This method is not safe for concurrent access by multiple threads.

removeComplexEntityContainer

IConfigComplexEntityContainer removeComplexEntityContainer(String addr)
Remove a configuration complex entity container from the repository.

Parameters:
addr - The address of the entity container to remove.
Returns:
Returns the removed container or null if a complex container with the supplied address does not exist.
Threading:
This method is not safe for concurrent access by multiple threads.

traverse

void traverse(String filter,
              IConfigTraversalCallback callback)
Perform a depth first traveral of a configuration repository.

Parameters:
filter - The address filter. The '*' character matches one or more characters. "..." is a level wilcard i.e. it matches everything at and below the level at which "..." appears. For example, "a*\/b*" will match "aa/ba" and "ab/bb" while "a*\/b*\/..." will match "aa/bb/c/d/e/f" and "ab/bb/c".
callback - The callback notified for each of the config objects encountered during the traversal.
Threading:
This method is not safe for concurrent access by multiple threads

serialize

void serialize(StringBuilder builder)
Serialize the repository into a string

Threading:
This method is not safe for concurrent access by multiple threads

deserialize

void deserialize(String str,
                 boolean markAsDirty)
                 throws EConfigException
Deserialize a repository from a string

Parameters:
str - The string to derialize from.
markAsDirty - Indicates whether the created entity and entity container objects are marked as dirty or not.
Throws:
EConfigException
Threading:
This method is not safe for concurrent access by multiple threads

This method creates entity containers and entities encoded in the supplied string. The encoding format is private and therefore only repositories serialized using serialize(java.lang.StringBuilder) should be supplied here.


commit

void commit()
            throws EConfigException
Commit changes made to the repository to durable storage

Throws:
EConfigException - Thrown in case an error was encountered in committing the changes to storage.

This method commits any changes made to the repository to durable storage (determined by parameters passed to the configuration provider during repository open). The method walks through each entity and entity container that has changed since the repository was opened or last committed and delegates the commit for each one of them to the configuration provider.

Threading:
This method is not safe for concurrent access by multiple threads.

close

void close()
           throws EConfigException
Close the repository

Throws:
EConfigException - Thrown in case an error was encountered in closing the repository

This method closes the respository. This method should be the last call made to the respository.

Threading:
This method is not safe for concurrent access by multiple threads.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.