All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.day.commons.datasource.poolservice.DataSourcePool Maven / Gradle / Ivy

/* Copyright 1997-2006 Day Management AG
 * Barfuesserplatz 6, 4001 Basel, Switzerland
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * Day Management AG, ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Day.
 */
package com.day.commons.datasource.poolservice;

import java.util.Collection;

/**
 * Combines multiple DataSourcePoolProvider services into a single service that
 * gives access to preconfigured data sources.
 */
public interface DataSourcePool {

    /**
     * Return the named data source, if available
     *
     * @param name Configured name of the data source
     * @param desiredType, expected type (for example DataSource.class for a
     *            j2ee DataSource).
     * @return a data source object of the desired type, which must be properly
     *         closed or disposed of to be returned to the pool, according to
     *         the semantics of that data source type.
     * @throws DataSourceNotFoundException no data source found with supplied
     *             name.
     * @throws TypeNotAvailableException data source found but not compatible
     *             with desired type
     */
     AdapterType getDataSource(String name,
            Class desiredType) throws DataSourceNotFoundException,
            TypeNotAvailableException;

    /**
     * Return the named data source, if available, as an Object. Useful in
     * scripting languages where the actual type is checked by the language, for
     * other cases it is recommended to use the  getDataSource
     * method.
     *
     * @param name name of the data source
     * @return the datasource
     * @throws DataSourceNotFoundException if the data source is not found
     */
    Object getDataSource(String name) throws DataSourceNotFoundException;

    /**
     * Return the collection of all JNDI data sources available with the system.
     * Useful for tooling which wants to show all datasources in the system
     *
     * @return Collection of all JNDI Data Sources that are register with this
     *         Pool
     */
    Collection getAllJndiDataSourceNames();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy