| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cayenne.conf.Configuration
public abstract class Configuration
This class is an entry point to Cayenne. It loads all configuration files and
 instantiates main Cayenne objects. Used as a singleton via the
 getSharedConfiguration()method.
 
 To use a custom subclass of Configuration, Java applications must call
 initializeSharedConfiguration()with the subclass as argument. This will create
 and initialize a Configuration singleton instance of the specified class. By default
 DefaultConfigurationis instantiated.
 
| Field Summary | |
|---|---|
| protected  org.apache.cayenne.conf.Configuration.ConfigurationShutdownHook | configurationShutdownHook | 
| protected  SortedMap<String,DataDomain> | dataDomainsLookup map that stores DataDomains with names as keys. | 
| protected  Map<String,String> | dataViewLocations | 
| static Class<DefaultConfiguration> | DEFAULT_CONFIGURATION_CLASS | 
| static String | DEFAULT_DOMAIN_FILE | 
| protected  String | domainConfigurationName | 
| protected  EventManager | eventManager | 
| protected  boolean | ignoringLoadFailures | 
| protected  ConfigLoaderDelegate | loaderDelegate | 
| protected  ConfigStatus | loadStatus | 
| protected  DataSourceFactory | overrideFactory | 
| protected  SchemaUpdateStrategy | overrideStrategy | 
| protected  String | projectVersion | 
| protected  ConfigSaverDelegate | saverDelegate | 
| protected static Configuration | sharedConfiguration | 
| Constructor Summary | |
|---|---|
| protected  | Configuration()Default constructor for new Configuration instances. | 
| protected  | Configuration(String domainConfigurationName)Default constructor for new Configuration instances using the given resource name as the main domain file. | 
| Method Summary | |
|---|---|
|  void | addDomain(DataDomain domain)Adds new DataDomain to the list of registered domains. | 
|  boolean | canInitialize()Deprecated. since 3.0 - this method is redundant, as subclasses can prevent initialization by overriding initialize()and throwing an
             exception. | 
|  void | didInitialize()Deprecated. since 3.0 subclasses are recommended to override initialize(). | 
|  DataSourceFactory | getDataSourceFactory()Deprecated. since 3.0 this method is no longer called when configuration is loaded. Instead getDataSourceFactory(String)is invoked, and this is
             the method that should be overriden. | 
|  DataSourceFactory | getDataSourceFactory(String userFactoryName)Returns a DataSourceFactory that should override a given factory specified by caller. | 
|  Map<String,String> | getDataViewLocations()See 'https://svn.apache.org/repos/asf/cayenne/dataviews/trunk' for DataViews code, which is not a part of Cayenne since 3.0. | 
|  DataDomain | getDomain()Returns default domain of this configuration. | 
|  DataDomain | getDomain(String name)Returns registered domain matching nameornullif no
 such domain is found. | 
| protected  InputStream | getDomainConfiguration()Deprecated. since 3.0 This method is specific to subclass, so it should not be in the superclass. | 
|  String | getDomainConfigurationName()Returns the name of the main domain configuration resource. | 
|  Collection<DataDomain> | getDomains()Returns an unmodifiable collection of registered DataDomains sorted by domain name. | 
|  EventManager | getEventManager()Returns EventManager used by this configuration. | 
|  ConfigLoaderDelegate | getLoaderDelegate()Returns a delegate used for controlling the loading of configuration elements. | 
|  ConfigStatus | getLoadStatus()Returns the load status. | 
| protected  InputStream | getMapConfiguration(String name)Returns a DataMap with the given name or nullif it cannot be found. | 
|  String | getProjectVersion() | 
| protected abstract  ResourceFinder | getResourceFinder()Returns ResourceFinderassociated with this Configuration that is to be
 used for config files lookup. | 
| protected  ResourceLocator | getResourceLocator()Deprecated. since 3.0 use/override getResourceFinder(). | 
|  ConfigSaverDelegate | getSaverDelegate() | 
|  SchemaUpdateStrategy | getSchemaUpdateStrategy() | 
| static Configuration | getSharedConfiguration()Use this method as an entry point to all Cayenne access objects. | 
| protected  InputStream | getViewConfiguration(String location)Deprecated. since 3.0 as Cayenne no longer cares to read view config files. | 
| abstract  void | initialize()Initializes the new instance. | 
| static void | initializeSharedConfiguration()Creates and initializes shared Configuration object. | 
| static void | initializeSharedConfiguration(Class<? extends Configuration> configurationClass)Creates and initializes a shared Configuration object of a custom Configuration subclass. | 
| static void | initializeSharedConfiguration(Configuration conf)Sets the shared Configuration object to a new Configuration object. | 
|  void | installConfigurationShutdownHook() | 
|  boolean | isIgnoringLoadFailures()Returns whether to ignore any failures during map loading or not. | 
|  void | removeDomain(String name)Unregisters DataDomain matching name | 
|  void | setDataSourceFactory(DataSourceFactory overrideFactory) | 
|  void | setDataViewLocations(Map<String,String> dataViewLocations)Initializes configuration with the location of data views. | 
| protected  void | setDomainConfigurationName(String domainConfigurationName)Sets the name of the main domain configuration resource. | 
|  void | setEventManager(EventManager eventManager)Sets EventManager used by this configuration. | 
| protected  void | setIgnoringLoadFailures(boolean ignoringLoadFailures)Sets whether to ignore any failures during map loading or not. | 
|  void | setLoaderDelegate(ConfigLoaderDelegate loaderDelegate) | 
| protected  void | setLoadStatus(ConfigStatus status)Sets the load status. | 
|  void | setProjectVersion(String projectVersion) | 
|  void | setSaverDelegate(ConfigSaverDelegate saverDelegate) | 
|  void | setSchemaUpdateStrategy(SchemaUpdateStrategy overrideStrategy) | 
|  void | shutdown()Shutdowns all owned domains. | 
|  void | uninstallConfigurationShutdownHook() | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final String DEFAULT_DOMAIN_FILE
public static final Class<DefaultConfiguration> DEFAULT_CONFIGURATION_CLASS
protected static Configuration sharedConfiguration
protected SortedMap<String,DataDomain> dataDomains
protected DataSourceFactory overrideFactory
protected SchemaUpdateStrategy overrideStrategy
protected ConfigStatus loadStatus
protected String domainConfigurationName
protected boolean ignoringLoadFailures
protected ConfigLoaderDelegate loaderDelegate
protected ConfigSaverDelegate saverDelegate
protected org.apache.cayenne.conf.Configuration.ConfigurationShutdownHook configurationShutdownHook
protected Map<String,String> dataViewLocations
protected String projectVersion
protected EventManager eventManager
| Constructor Detail | 
|---|
protected Configuration()
Configuration(String).
Configuration(String)protected Configuration(String domainConfigurationName)
| Method Detail | 
|---|
public static Configuration getSharedConfiguration()
 Note that if you want to provide a custom Configuration, make sure you call one of
 the initializeSharedConfiguration()methods before your application code has
 a chance to call this method.
public EventManager getEventManager()
public void setEventManager(EventManager eventManager)
public static void initializeSharedConfiguration()
DefaultConfigurationwill be instantiated and assigned to a singleton
 instance of Configuration.
public static void initializeSharedConfiguration(Class<? extends Configuration> configurationClass)
public static void initializeSharedConfiguration(Configuration conf)
canInitialize()and - if permitted -initialize()followed by
 didInitialize().
public boolean canInitialize()
initialize() and throwing an
             exception.
initialize()can be called. Returning false
 allows new instances to delay or refuse the initialization process. This
 impementation returns true unconditionally.
public abstract void initialize()
                         throws Exception
Exceptionpublic void didInitialize()
initialize().
initialize(). This implementation is
 a noop.
protected ResourceLocator getResourceLocator()
getResourceFinder().
protected abstract ResourceFinder getResourceFinder()
ResourceFinder associated with this Configuration that is to be
 used for config files lookup.
protected InputStream getDomainConfiguration()
null if it cannot be found.
protected InputStream getMapConfiguration(String name)
null if it cannot be found.
protected InputStream getViewConfiguration(String location)
public String getDomainConfigurationName()
DEFAULT_DOMAIN_FILE.
protected void setDomainConfigurationName(String domainConfigurationName)
domainConfigurationName - the name of the resource that contains this
            Configuration's domain(s).public String getProjectVersion()
public void setProjectVersion(String projectVersion)
public DataSourceFactory getDataSourceFactory(String userFactoryName)
public SchemaUpdateStrategy getSchemaUpdateStrategy()
public void setSchemaUpdateStrategy(SchemaUpdateStrategy overrideStrategy)
public DataSourceFactory getDataSourceFactory()
getDataSourceFactory(String) is invoked, and this is
             the method that should be overriden.
public void setDataSourceFactory(DataSourceFactory overrideFactory)
public void addDomain(DataDomain domain)
public DataDomain getDomain(String name)
name or null if no
 such domain is found.
public DataDomain getDomain()
null is returned. If more than one domain exists in this
 configuration, a CayenneRuntimeException is thrown, indicating that the domain name
 must be explicitly specified. In such cases getDomain(String name)must be
 used instead.
public void removeDomain(String name)
name from
 this Configuration object. Note that any domain database
 connections remain open, and it is a responsibility of a
 caller to clean it up.
- 
 
public Collection<DataDomain> getDomains()
public boolean isIgnoringLoadFailures()
protected void setIgnoringLoadFailures(boolean ignoringLoadFailures)
ignoringLoadFailures - true or falsepublic ConfigStatus getLoadStatus()
protected void setLoadStatus(ConfigStatus status)
public ConfigLoaderDelegate getLoaderDelegate()
public void setLoaderDelegate(ConfigLoaderDelegate loaderDelegate)
public ConfigSaverDelegate getSaverDelegate()
public void setSaverDelegate(ConfigSaverDelegate saverDelegate)
public void setDataViewLocations(Map<String,String> dataViewLocations)
dataViewLocations - Map of DataView locations.public Map<String,String> getDataViewLocations()
public void shutdown()
public void installConfigurationShutdownHook()
public void uninstallConfigurationShutdownHook()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||