Class AbstractDataSourceFactory

    • Constructor Detail

      • AbstractDataSourceFactory

        public AbstractDataSourceFactory()
    • Method Detail

      • setProperty

        protected void setProperty​(String property,
                                   org.apache.commons.configuration2.Configuration c,
                                   Object ds)
                            throws Exception
        Encapsulates setting configuration properties on DataSource objects.
        Parameters:
        property - the property to read from the configuration
        c - the configuration to read the property from
        ds - the DataSource instance to write the property to
        Throws:
        Exception - if anything goes wrong
      • applyConfiguration

        protected void applyConfiguration​(org.apache.commons.configuration2.Configuration c,
                                          Object o)
                                   throws TorqueException
        Iterate over a Configuration subset and apply all properties to a passed object which must contain Bean setter and getter
        Parameters:
        c - The configuration subset
        o - The object to apply the properties to
        Throws:
        TorqueException - if a property set fails
      • initCPDS

        protected void initCPDS​(org.apache.commons.configuration2.Configuration configuration,
                                ConnectionPoolDataSource cpds)
                         throws TorqueException
        Initializes the ConnectionPoolDataSource.
        Parameters:
        configuration - where to read the settings from
        cpds - data source to configure
        Throws:
        TorqueException - if a property set fails
      • initJdbc2Pool

        protected void initJdbc2Pool​(DataSource dataSource,
                                     org.apache.commons.configuration2.Configuration configuration)
                              throws TorqueException
        Initializes the Jdbc2PoolDataSource.
        Parameters:
        dataSource - the dataSource to initialize, not null.
        configuration - where to read the settings from, not null.
        Throws:
        TorqueException - if a property set fails.
      • initialize

        public abstract void initialize​(org.apache.commons.configuration2.Configuration configuration)
                                 throws TorqueException
        Initialize the factory.
        Specified by:
        initialize in interface DataSourceFactory
        Parameters:
        configuration - where to load the factory settings from
        Throws:
        TorqueException - Any exceptions caught during processing will be rethrown wrapped into a TorqueException.