View Javadoc

1   /*
2    ORDI - Ontology Repository and Data Integration
3   
4    Copyright (c) 2004-2007, OntoText Lab. / SIRMA
5   
6    This library is free software; you can redistribute it and/or modify it under
7    the terms of the GNU Lesser General Public License as published by the Free
8    Software Foundation; either version 2.1 of the License, or (at your option)
9    any later version.
10   This library is distributed in the hope that it will be useful, but WITHOUT
11   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13   details.
14   You should have received a copy of the GNU Lesser General Public License along
15   with this library; if not, write to the Free Software Foundation, Inc.,
16   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17   */
18  package com.ontotext.ordi;
19  
20  import java.util.Map;
21  
22  import com.ontotext.ordi.exception.ORDIException;
23  
24  /**
25   * A factory for connections to the physical data source that this
26   * {@link DataSource} represents. An object that implements the DataSource
27   * interface will typically be registered with a naming service based on the
28   * JavaTM Naming and Directory (JNDI) API.
29   * 
30   * @author vassil
31   * 
32   */
33  public interface DataSource extends Wrapper, WarningAware {
34  
35      /**
36       * Retrieves the meta-data properties used to create this {@link DataSource}.
37       * 
38       * @return collection of key/values
39       */
40      public abstract Map<Object, Object> getMetaData();
41  
42      /**
43       * Creates new connection with default values.
44       * 
45       * @return connection to the physical data source.
46       * @throws ORDIException
47       */
48      public abstract Connection getConnection() throws ORDIException;
49  
50      /**
51       * Creates a new connection with specified user name and password.
52       * 
53       * @param user
54       *            name to be used.
55       * @param pass
56       *            of the specified user.
57       * @return connection to the physical data source.
58       * @throws ORDIException
59       */
60      public abstract Connection getConnection(String user, String pass)
61              throws ORDIException;
62  
63      /**
64       * Sends a signal to the server for shutdown. There is no strict definition
65       * how the different implementation have to process it.
66       */
67      public void shutdown();
68      
69      /**
70       *  Verifies whether the server instance is shutdown.
71       * @return
72       */
73      public boolean isShutdown();
74  }