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.tripleset.impl;
19  
20  import java.util.List;
21  
22  import com.ontotext.ordi.exception.ORDIException;
23  import com.ontotext.ordi.tripleset.ConnectionImpl;
24  import com.ontotext.ordi.tripleset.Listener;
25  import com.ontotext.ordi.tripleset.TConnection;
26  import com.ontotext.ordi.tripleset.TSource;
27  
28  public abstract class TConnectionImpl extends ConnectionImpl implements
29          TConnection {
30  
31      protected final CallMultiplexor listeners = new CallMultiplexor();
32  
33      public TConnectionImpl(TSource source) {
34          super(source);
35      }
36  
37      public void addListener(Listener listener) {
38          if (listener != null) {
39              listeners.addListener(listener);
40          }
41      }
42  
43      public void removeListener(Listener listener) {
44          listeners.removeListener(listener);
45      }
46  
47      public List<Listener> listListeners() {
48          return listeners.listListeners();
49      }
50  
51      public void close() throws ORDIException {
52          listeners.onClose();
53      }
54  
55      public void commit() throws ORDIException {
56          listeners.onCommit();
57      }
58  
59      public void rollback() throws ORDIException {
60          listeners.onRollback();
61      }
62  }