com.jenkov.mrpersister.impl
Class PersistenceConfigurationFactory

java.lang.Object
  extended by com.jenkov.mrpersister.impl.PersistenceConfigurationFactory
All Implemented Interfaces:
IPersistenceConfigurationFactory

public class PersistenceConfigurationFactory
extends java.lang.Object
implements IPersistenceConfigurationFactory

Author:
Jakob Jenkov - Copyright 2005 Jenkov Development

Field Summary
protected  java.util.Map configurations
           
protected  PersistenceManager persistenceManager
           
 
Constructor Summary
PersistenceConfigurationFactory(PersistenceManager persistenceManager)
           
 
Method Summary
 IPersistenceConfiguration createConfiguration()
          Creates a new persistence configuration targeted at the default database (any JDBC compliant database).
 IPersistenceConfiguration createConfiguration(Database database)
          Creates a new persistence configuration.
 IPersistenceConfiguration getConfiguration(java.lang.Object configurationKey)
          Returns the IPersistenceConfiguration stored by the given key.
 IPersistenceConfiguration getOrCreateConfiguration(java.lang.Object configurationKey)
          Returns the IPersistenceConfiguration instance stored by the given key.
 IPersistenceConfiguration getOrCreateConfiguration(java.lang.Object configurationKey, Database database)
          Returns the IPersistenceConfiguration instance stored by the given key.
 void removeConfiguration(java.lang.Object configurationKey)
          Removes the IPersistenceConfiguration stored by the given key.
 void storeConfiguration(java.lang.Object configurationKey, IPersistenceConfiguration configuration)
          Stores the IPersistenceConfiguration by given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configurations

protected java.util.Map configurations

persistenceManager

protected PersistenceManager persistenceManager
Constructor Detail

PersistenceConfigurationFactory

public PersistenceConfigurationFactory(PersistenceManager persistenceManager)
Method Detail

createConfiguration

public IPersistenceConfiguration createConfiguration()
Description copied from interface: IPersistenceConfigurationFactory
Creates a new persistence configuration targeted at the default database (any JDBC compliant database).

Specified by:
createConfiguration in interface IPersistenceConfigurationFactory
Returns:
a new persistence configuration targeted at the default database.

createConfiguration

public IPersistenceConfiguration createConfiguration(Database database)
Description copied from interface: IPersistenceConfigurationFactory
Creates a new persistence configuration. Used internally by Mr. Persister.

Specified by:
createConfiguration in interface IPersistenceConfigurationFactory
Parameters:
database - The database is the database the configuration should be targeted at.
Returns:
A new persistence configuration.

getOrCreateConfiguration

public IPersistenceConfiguration getOrCreateConfiguration(java.lang.Object configurationKey)
Description copied from interface: IPersistenceConfigurationFactory
Returns the IPersistenceConfiguration instance stored by the given key. If none is stored a new will be created and stored by the key for later use.

Specified by:
getOrCreateConfiguration in interface IPersistenceConfigurationFactory
Parameters:
configurationKey - The key of the persistence configuration to get, or to store it by if a new instance is created.
Returns:
The persistence configuration stored by the given key.

getOrCreateConfiguration

public IPersistenceConfiguration getOrCreateConfiguration(java.lang.Object configurationKey,
                                                          Database database)
Description copied from interface: IPersistenceConfigurationFactory
Returns the IPersistenceConfiguration instance stored by the given key. If none is stored a new will be created and stored by the key for later use.

Specified by:
getOrCreateConfiguration in interface IPersistenceConfigurationFactory
Parameters:
configurationKey - The key of the persistence configuration to get, or to store it by if a new instance is created.
database - The database to target this configuration for.
Returns:
The persistence configuration stored by the given key.

getConfiguration

public IPersistenceConfiguration getConfiguration(java.lang.Object configurationKey)
Description copied from interface: IPersistenceConfigurationFactory
Returns the IPersistenceConfiguration stored by the given key.

Specified by:
getConfiguration in interface IPersistenceConfigurationFactory
Parameters:
configurationKey - The key of the configuration instance to get.
Returns:
the IPersistenceConfiguration stored by the given key.

storeConfiguration

public void storeConfiguration(java.lang.Object configurationKey,
                               IPersistenceConfiguration configuration)
Description copied from interface: IPersistenceConfigurationFactory
Stores the IPersistenceConfiguration by given key.

Specified by:
storeConfiguration in interface IPersistenceConfigurationFactory
Parameters:
configurationKey - The key to store the configuration instance by.
configuration - The configuration to store.

removeConfiguration

public void removeConfiguration(java.lang.Object configurationKey)
Description copied from interface: IPersistenceConfigurationFactory
Removes the IPersistenceConfiguration stored by the given key.

Specified by:
removeConfiguration in interface IPersistenceConfigurationFactory
Parameters:
configurationKey - The key of the persistence configuration to remove.