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 com.ontotext.ordi.exception.ORDIException;
21  
22  /**
23   * A connection (session) to specific data provider. The {@link Connection}
24   * interface define common functionality to be supported by specific data
25   * provider.
26   * 
27   * @author vassil
28   * 
29   */
30  public interface Connection extends Wrapper, WarningAware {
31  
32      /**
33       * Checks if the the current session is in auto-commit mode.
34       * 
35       * @return true if it is auto-commit mode.
36       */
37      public boolean isAutoCommit();
38  
39      /**
40       * Sets the commit mode of the current transaction.
41       * 
42       * @param mode
43       *            true for auto-commit, otherwise false
44       * @throws ORDIException
45       */
46      public void setAutoCommit(boolean mode) throws ORDIException;
47  
48      /**
49       * Rollbacks all operations part of the current transaction.
50       * 
51       * @throws ORDIException
52       */
53      public void rollback() throws ORDIException;
54  
55      /**
56       * Commits all operations part of the current transaction.
57       * 
58       * @throws ORDIException
59       */
60      public void commit() throws ORDIException;
61  
62      /**
63       * Gets the isolation level of the current transaction.
64       * 
65       * @return isolation level
66       */
67      public IsolationLevel getTransactionIsolationLevel();
68  
69      /**
70       * Sets the isolation level of the current transaction.
71       * 
72       * @param isolationLevel
73       *            to be used
74       */
75      public void setTransactionIsolationLevel(IsolationLevel isolationLevel)
76              throws ORDIException;
77  
78      /**
79       * Checks if the current session to data provider is read-only.
80       * 
81       * @return true if read-only
82       */
83      public boolean isReadOnly();
84  
85      /**
86       * Checks if this session is opened.
87       * 
88       * @return true if closed, false otherwise.
89       */
90      public boolean isOpen();
91  
92      /**
93       * Releases all resources hold by this instance.
94       * 
95       * @throws ORDIException
96       */
97      public void close() throws ORDIException;
98  
99      /**
100      * Gets the {@link DataSource} this session is using.
101      * 
102      * @return data source that created this sessions
103      */
104     public DataSource getDataSource();
105 }