View Javadoc

1   package org.apache.torque.dsfactory;
2   
3   /*
4    * Copyright 2001-2004 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import javax.sql.DataSource;
20  import org.apache.commons.configuration.Configuration;
21  import org.apache.torque.TorqueException;
22  
23  /***
24   * A factory that returns a DataSource.
25   *
26   * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
27   * @version $Id: DataSourceFactory.java,v 1.2.4.2 2004/05/20 04:35:14 seade Exp $
28   */
29  public interface DataSourceFactory
30  {
31      
32      /***
33       * @return the <code>DataSource</code> configured by the factory.
34       * @throws TorqueException if the source can't be returned
35       */
36      DataSource getDataSource() throws TorqueException;
37  
38      /***
39       * Initialize the factory.
40       *
41       * @param configuration where to load the factory settings from
42       * @throws TorqueException Any exceptions caught during processing will be
43       *         rethrown wrapped into a TorqueException.
44       */
45      void initialize(Configuration configuration) 
46          throws TorqueException;
47  }