PropertyDataSourceFactory (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.configuration.runtime, class: PropertyDataSourceFactory

# Class PropertyDataSourceFactory

java.lang.Object
org.apache.cayenne.configuration.runtime.PropertyDataSourceFactory

All Implemented Interfaces:
  `DataSourceFactory`

public class PropertyDataSourceFactory extends Object implements DataSourceFactory
A DataSourceFactrory that creates a DataSource based on system properties. Properties can be set per domain/node name or globally, applying to all nodes without explicit property set. The following properties are supported:

- cayenne.jdbc.driver[.domain_name.node_name]
- cayenne.jdbc.url[.domain_name.node_name]
- cayenne.jdbc.username[.domain_name.node_name]
- cayenne.jdbc.password[.domain_name.node_name]
- cayenne.jdbc.min.connections[.domain_name.node_name]
- cayenne.jdbc.max.conections[.domain_name.node_name]

At least url and driver properties must be specified for this factory to return a valid DataSource.

Since:
  3.1

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected RuntimeProperties`
  `properties`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PropertyDataSourceFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DataSource`
  `getDataSource(DataNodeDescriptor nodeDescriptor)`
  Returns DataSource object based on the configuration provided in the "nodeDescriptor".
  `protected int`
  `getIntProperty(String propertyName, String suffix, int defaultValue)`
  `protected String`
  `getProperty(String propertyName, String suffix)`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### properties

    protected RuntimeProperties properties

- ## Constructor Details

  - ### PropertyDataSourceFactory

    public PropertyDataSourceFactory()

- ## Method Details

  - ### getDataSource

    public DataSource getDataSource(DataNodeDescriptor nodeDescriptor)
    Description copied from interface: `DataSourceFactory`
    Returns DataSource object based on the configuration provided in the "nodeDescriptor".
    Specified by:
      `getDataSource` in interface `DataSourceFactory`

  - ### getIntProperty

    protected int getIntProperty(String propertyName, String suffix, int defaultValue)

  - ### getProperty

    protected String getProperty(String propertyName, String suffix)