com.ail.core.configure
Class EJBConfigurationLoader

java.lang.Object
  extended by com.ail.core.configure.AbstractConfigurationLoader
      extended by com.ail.core.configure.EJBConfigurationLoader

public class EJBConfigurationLoader
extends AbstractConfigurationLoader

This configuration loader acts as a facade to the the configuration server services. It is intended to be used by remote clients (e.g. web start apps) which don't have direct access to loader being used by the server side. In effect the remote client's requests for configuration information are relayed to the server side configuration server, which in turn relays them to whatever mechanism the server is using (e.g. JDBC).

Version:
$Revision: 1.4 $

Constructor Summary
EJBConfigurationLoader()
           
 
Method Summary
 void deleteConfigurationRepository()
          Delete the repository holding configuration information.
 EJBLoader getLoaderEJB()
          Fetch an instance of the remote facade that will perform the configuration operations for us.
 java.util.Collection<java.lang.String> getNamespaces()
          Return a list of all the namespaces in the database which have a validTo date of 0.
 java.util.Collection<ConfigurationSummary> getNamespacesHistorySummary(java.lang.String namespace)
          Build and return a list of the details of a namespaces versions.
 java.util.Collection<ConfigurationSummary> getNamespacesSummary()
          Build and return a list of the details of the namespaces currently being used.
 Configuration loadConfiguration(java.lang.String namespace, VersionEffectiveDate date)
          Load a namespace's configuration.
 void purgeAllConfigurations()
          Delete ALL configuration information.
 void reset()
          When the configuration handler is asked to "reset", it passes that request onto the loader currently in user.
 void saveConfiguration(java.lang.String namespace, Configuration config)
          Save a configuration into the database.
 
Methods inherited from class com.ail.core.configure.AbstractConfigurationLoader
getLoaderParams, loadLoader
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EJBConfigurationLoader

public EJBConfigurationLoader()
Method Detail

getLoaderEJB

public EJBLoader getLoaderEJB()
Fetch an instance of the remote facade that will perform the configuration operations for us.

Returns:
Instance of the facade EJB.

loadConfiguration

public Configuration loadConfiguration(java.lang.String namespace,
                                       VersionEffectiveDate date)
Load a namespace's configuration.

Specified by:
loadConfiguration in class AbstractConfigurationLoader
Parameters:
namespace - The namespace to load.
date - The date to load the namespace for.
Returns:
The configuration.
Throws:
UnknownNamespaceError - if the namespace does not exist, or is not valid for the date specificed.

saveConfiguration

public void saveConfiguration(java.lang.String namespace,
                              Configuration config)
Save a configuration into the database. All namespace records have a validfrom and a validto date stamp. A record with validto set to zero indicates the latest config. This method will update the current latest record, setting its validto to now. It will then insert a new record with validFrom set to now+1ms, and validTo set to zero.

If either the database or table specified in loader.properties does not exist on the first attempt to save a configuration, this method will attempt to create both. For this to work the db user specified in loader.properties must have the necessary 'GRANTS' for table and database creation.

Specified by:
saveConfiguration in class AbstractConfigurationLoader
Parameters:
namespace - The namespace the configuration is associated with.
config - The configuration to be saved.
Throws:
BootstrapConfigurationError - if the configuration cannot be serialized, or the database access fails.

getNamespaces

public java.util.Collection<java.lang.String> getNamespaces()
Return a list of all the namespaces in the database which have a validTo date of 0.

Specified by:
getNamespaces in class AbstractConfigurationLoader
Returns:
A list of currently defined namespaces as Strings

getNamespacesSummary

public java.util.Collection<ConfigurationSummary> getNamespacesSummary()
Description copied from class: AbstractConfigurationLoader
Build and return a list of the details of the namespaces currently being used. More specifically this includes only those that are stored and are current.

Specified by:
getNamespacesSummary in class AbstractConfigurationLoader
Returns:
A collection of instances of ConfigurationSummary..

getNamespacesHistorySummary

public java.util.Collection<ConfigurationSummary> getNamespacesHistorySummary(java.lang.String namespace)
Description copied from class: AbstractConfigurationLoader
Build and return a list of the details of a namespaces versions.

Specified by:
getNamespacesHistorySummary in class AbstractConfigurationLoader
Parameters:
namespace - The namespace to fetch the history for.
Returns:
A collection of instances of ConfigurationSummary..

reset

public void reset()
When the configuration handler is asked to "reset", it passes that request onto the loader currently in user. The loader should reset any internal state in this method.

Specified by:
reset in class AbstractConfigurationLoader

purgeAllConfigurations

public void purgeAllConfigurations()
Delete ALL configuration information. This will include all historical configuration information.

NOTE: ALL CONFIGURATION INFORMATION WILL BE LOST!

Specified by:
purgeAllConfigurations in class AbstractConfigurationLoader

deleteConfigurationRepository

public void deleteConfigurationRepository()
Delete the repository holding configuration information. This not only removes all configuration information purgeAllConfigurations() but also removes the repository itself.

NOTE: ALL CONFIGURATION INFORMATION WILL BE LOST!

Specified by:
deleteConfigurationRepository in class AbstractConfigurationLoader