org.apache.cayenne.project
Class ProjectDataSourceFactory

java.lang.Object
  extended by org.apache.cayenne.project.ProjectDataSourceFactory
All Implemented Interfaces:
DataSourceFactory

public class ProjectDataSourceFactory
extends Object
implements DataSourceFactory

Factory of DataSource objects used by the project model. Always tries to locate file with direct connection info.


Field Summary
protected  boolean loadFromXML
           
protected  Configuration parentConfiguration
           
protected  File projectDir
           
 
Constructor Summary
ProjectDataSourceFactory(File projectDir)
           
ProjectDataSourceFactory(File projectDir, boolean loadFromXML)
           
 
Method Summary
 DataSource getDataSource(String location)
          Returns DataSource object corresponding to location.
protected  DataSourceInfo getDriverInfo(String location)
          Returns a DataSourceInfo object, loading it from XML file if the factory is configured to do so.
 void initializeWithParentConfiguration(Configuration parentConfiguration)
          Initializes factory with the parent configuration object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

projectDir

protected File projectDir

loadFromXML

protected boolean loadFromXML

parentConfiguration

protected Configuration parentConfiguration
Constructor Detail

ProjectDataSourceFactory

public ProjectDataSourceFactory(File projectDir)

ProjectDataSourceFactory

public ProjectDataSourceFactory(File projectDir,
                                boolean loadFromXML)
Method Detail

initializeWithParentConfiguration

public void initializeWithParentConfiguration(Configuration parentConfiguration)
Description copied from interface: DataSourceFactory
Initializes factory with the parent configuration object.

Specified by:
initializeWithParentConfiguration in interface DataSourceFactory

getDataSource

public DataSource getDataSource(String location)
                         throws Exception
Description copied from interface: DataSourceFactory
Returns DataSource object corresponding to location. Concrete implementations may treat location differently - as a file path, JNDI location, etc.

Specified by:
getDataSource in interface DataSourceFactory
Throws:
Exception

getDriverInfo

protected DataSourceInfo getDriverInfo(String location)
                                throws Exception
Returns a DataSourceInfo object, loading it from XML file if the factory is configured to do so.

Throws:
Exception


Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.