svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / DataTransaction.java @ 47606
History | View | Annotate | Download (3.83 KB)
1 |
/*
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2020 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18 |
*
|
19 |
* For any additional information, do not hesitate to contact us
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
21 |
*/
|
22 |
package org.gvsig.fmap.dal; |
23 |
|
24 |
import org.gvsig.fmap.dal.exception.DataException; |
25 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
26 |
import org.gvsig.tools.dispose.Disposable; |
27 |
import org.gvsig.tools.observer.Observable; |
28 |
|
29 |
/**
|
30 |
*
|
31 |
* @author gvSIG Team
|
32 |
*/
|
33 |
public interface DataTransaction extends Disposable, AutoCloseable, Observable { |
34 |
|
35 |
public static void rollbackQuietly(DataTransaction transaction) { |
36 |
if( transaction == null ) { |
37 |
return;
|
38 |
} |
39 |
transaction.rollbackQuietly(); |
40 |
} |
41 |
|
42 |
public static void close(DataTransaction transaction) { |
43 |
if( transaction == null ) { |
44 |
return;
|
45 |
} |
46 |
try {
|
47 |
transaction.close(); |
48 |
} catch (RuntimeException ex) { |
49 |
throw ex;
|
50 |
} catch (Exception ex) { |
51 |
//Por aqu? no deber?a pasar
|
52 |
throw new RuntimeException("Can't close transaction", ex); |
53 |
} |
54 |
} |
55 |
|
56 |
public static void add(DataTransaction transaction, DataServerExplorer explorer) throws DataException { |
57 |
if (transaction == null) { |
58 |
return;
|
59 |
} |
60 |
transaction.add(explorer); |
61 |
} |
62 |
|
63 |
public static void add(DataTransaction transaction, DataServerExplorer explorer, boolean local) throws DataException { |
64 |
if (transaction == null) { |
65 |
return;
|
66 |
} |
67 |
transaction.add(explorer, local); |
68 |
} |
69 |
|
70 |
public static void add(DataTransaction transaction, FeatureStore store, boolean local) throws DataException { |
71 |
if (transaction == null) { |
72 |
return;
|
73 |
} |
74 |
transaction.add(store, local); |
75 |
} |
76 |
|
77 |
public String getCode(); |
78 |
|
79 |
public void begin() throws DataException; |
80 |
|
81 |
public void commit() throws DataException; |
82 |
|
83 |
public void rollback() throws DataException; |
84 |
|
85 |
public void rollbackQuietly(); |
86 |
|
87 |
public void add(DataStore store) throws DataException; |
88 |
|
89 |
/**
|
90 |
* Add store to transaction.
|
91 |
* If local is true, the store will be disposed at finish transaction
|
92 |
*/
|
93 |
public void add(DataStore store, boolean local) throws DataException; |
94 |
|
95 |
public void add(DataServerExplorer explorer) throws DataException; |
96 |
|
97 |
public void add(DataServerExplorer explorer, boolean local) throws DataException; |
98 |
|
99 |
public void add(Disposable resource) throws DataException; |
100 |
|
101 |
public void add(DataServerExplorer explorer, String id); |
102 |
|
103 |
public void add(DataServerExplorer explorer, String id, boolean local); |
104 |
|
105 |
public void add(DataStore store, String id); |
106 |
|
107 |
public void add(DataStore store, String id, boolean local); |
108 |
|
109 |
public void add(SupportTransactions obj, boolean local) throws DataException; |
110 |
|
111 |
public void remove(DataStore store) throws DataException; |
112 |
|
113 |
public void remove(DataServerExplorer serverExplorer); |
114 |
|
115 |
public boolean isInProgress(); |
116 |
|
117 |
public boolean contains(DataServerExplorer explorer); |
118 |
|
119 |
public boolean contains(DataStore store); |
120 |
|
121 |
public FeatureStore getFeatureStore(String id); |
122 |
|
123 |
public DataServerExplorer getServerExplorer(String id); |
124 |
} |