01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.project.internal.impl;
16:
17: import java.io.IOException;
18:
19: import net.refractions.udig.project.internal.Messages;
20:
21: import org.geotools.data.DefaultTransaction;
22: import org.geotools.data.Transaction;
23:
24: /**
25: * This class helps protect the system from others trying to commit or close the transaction
26: * programmatically rather than working through the EditManager API.
27: *
28: * @author jones
29: * @since 1.0.0
30: */
31: public class UDIGTransaction extends DefaultTransaction implements
32: Transaction {
33: @Override
34: public void commit() throws IOException {
35: throw new RuntimeException(
36: Messages.UDIGTransaction_commitException);
37: }
38:
39: @Override
40: public void rollback() throws IOException {
41: super .rollback();
42: }
43:
44: @Override
45: public synchronized void close() {
46: throw new RuntimeException(
47: Messages.UDIGTransaction_closeException);
48: }
49:
50: public void commitInternal() throws IOException {
51: super .commit();
52: }
53:
54: public void rollbackInternal() throws IOException {
55: super .rollback();
56: }
57:
58: synchronized void closeInternal() {
59: super.close();
60: }
61: }
|