Revision 42775 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc/JDBCServerExplorer.java
JDBCServerExplorer.java | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2007-2013 gvSIG Association. |
5 | 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.
|
|
6 |
* This program is free software; you can redistribute it and/or modify it under
|
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
|
9 |
* version. |
|
10 | 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.
|
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
14 |
* details. |
|
15 | 15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 | 19 |
* |
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
23 | 22 |
*/ |
24 | 23 |
package org.gvsig.fmap.dal.store.jdbc; |
25 | 24 |
|
... | ... | |
60 | 59 |
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCSQLException; |
61 | 60 |
import org.gvsig.tools.exception.BaseException; |
62 | 61 |
|
63 |
|
|
64 | 62 |
/** |
65 | 63 |
* @author jmvivo |
66 | 64 |
* |
67 | 65 |
*/ |
68 | 66 |
public class JDBCServerExplorer extends AbstractDBServerExplorer |
69 |
implements JDBCHelperUser {
|
|
67 |
implements JDBCHelperUser {
|
|
70 | 68 |
|
71 |
private static final Logger LOG = LoggerFactory |
|
72 |
.getLogger(JDBCServerExplorer.class); |
|
73 |
|
|
74 |
private static final String METADATA_COLUMN_TABLE_CATALOG = "TABLE_CAT"; |
|
75 |
private static final String METADATA_COLUMN_TABLE_SCHEMA = "TABLE_SCHEM"; |
|
76 |
private static final String METADATA_COLUMN_TABLE_NAME = "TABLE_NAME"; |
|
69 |
private static final Logger LOG = LoggerFactory |
|
70 |
.getLogger(JDBCServerExplorer.class); |
|
77 | 71 |
|
78 |
public static final String NAME = "JDBCServerExplorer"; |
|
79 |
protected JDBCHelper helper; |
|
72 |
private static final String METADATA_COLUMN_TABLE_CATALOG = "TABLE_CAT"; |
|
73 |
private static final String METADATA_COLUMN_TABLE_SCHEMA = "TABLE_SCHEM"; |
|
74 |
private static final String METADATA_COLUMN_TABLE_NAME = "TABLE_NAME"; |
|
80 | 75 |
|
81 |
private Boolean canAdd; |
|
76 |
public static final String NAME = "JDBCServerExplorer"; |
|
77 |
protected JDBCHelper helper; |
|
82 | 78 |
|
83 |
public JDBCServerExplorer(JDBCServerExplorerParameters parameters, |
|
84 |
DataServerExplorerProviderServices services) |
|
85 |
throws InitializeException { |
|
86 |
super(parameters, services); |
|
87 |
this.helper = createHelper(); |
|
88 |
} |
|
79 |
private Boolean canAdd; |
|
89 | 80 |
|
90 |
protected JDBCServerExplorerParameters getJDBCParameters() { |
|
91 |
return (JDBCServerExplorerParameters) getParameters(); |
|
92 |
} |
|
81 |
public JDBCServerExplorer(JDBCServerExplorerParameters parameters, |
|
82 |
DataServerExplorerProviderServices services) |
|
83 |
throws InitializeException { |
|
84 |
super(parameters, services); |
|
85 |
this.helper = createHelper(); |
|
86 |
} |
|
93 | 87 |
|
94 |
protected JDBCHelper createHelper() throws InitializeException {
|
|
95 |
return new JDBCHelper(this, getJDBCParameters());
|
|
96 |
}
|
|
88 |
protected JDBCServerExplorerParameters getJDBCParameters() {
|
|
89 |
return (JDBCServerExplorerParameters) getParameters();
|
|
90 |
}
|
|
97 | 91 |
|
98 |
protected JDBCHelper getHelper() {
|
|
99 |
return helper;
|
|
100 |
}
|
|
92 |
protected JDBCHelper createHelper() throws InitializeException {
|
|
93 |
return new JDBCHelper(this, getJDBCParameters());
|
|
94 |
}
|
|
101 | 95 |
|
96 |
protected JDBCHelper getHelper() { |
|
97 |
return helper; |
|
98 |
} |
|
102 | 99 |
|
103 |
public List list() throws DataException {
|
|
104 |
return this.list(MODE_ALL);
|
|
105 |
}
|
|
100 |
public List list() throws DataException {
|
|
101 |
return this.list(MODE_ALL);
|
|
102 |
}
|
|
106 | 103 |
|
107 |
public List list(boolean showInformationDBTables) throws DataException {
|
|
108 |
return this.list(MODE_ALL, showInformationDBTables);
|
|
109 |
}
|
|
104 |
public List list(boolean showInformationDBTables) throws DataException {
|
|
105 |
return this.list(MODE_ALL, showInformationDBTables);
|
|
106 |
}
|
|
110 | 107 |
|
111 |
public List list(int mode) throws DataException {
|
|
112 |
JDBCServerExplorerParameters parameters = getJDBCParameters();
|
|
113 |
if (parameters.getShowInformationDBTables() != null) {
|
|
114 |
return this.list(mode, parameters.getShowInformationDBTables()
|
|
115 |
.booleanValue());
|
|
116 |
}
|
|
117 |
Boolean show = (Boolean) parameters
|
|
118 |
.getDynClass()
|
|
119 |
.getDynField(
|
|
120 |
JDBCServerExplorerParameters.SHOWINFORMATIONDBTABLES_PARAMTER_NAME)
|
|
121 |
.getDefaultValue();
|
|
122 |
if (show == null){
|
|
123 |
show = Boolean.FALSE;
|
|
124 |
}
|
|
108 |
public List list(int mode) throws DataException {
|
|
109 |
JDBCServerExplorerParameters parameters = getJDBCParameters();
|
|
110 |
if (parameters.getShowInformationDBTables() != null) {
|
|
111 |
return this.list(mode, parameters.getShowInformationDBTables()
|
|
112 |
.booleanValue());
|
|
113 |
}
|
|
114 |
Boolean show = (Boolean) parameters
|
|
115 |
.getDynClass()
|
|
116 |
.getDynField(
|
|
117 |
JDBCServerExplorerParameters.SHOWINFORMATIONDBTABLES_PARAMTER_NAME)
|
|
118 |
.getDefaultValue();
|
|
119 |
if (show == null) {
|
|
120 |
show = Boolean.FALSE;
|
|
121 |
}
|
|
125 | 122 |
|
126 |
return this.list(mode, show.booleanValue());
|
|
127 |
}
|
|
123 |
return this.list(mode, show.booleanValue());
|
|
124 |
}
|
|
128 | 125 |
|
126 |
protected DataManagerProviderServices getManager() { |
|
127 |
return (DataManagerProviderServices) DALLocator.getDataManager(); |
|
128 |
} |
|
129 | 129 |
|
130 |
protected DataManagerProviderServices getManager() {
|
|
131 |
return (DataManagerProviderServices) DALLocator.getDataManager();
|
|
132 |
}
|
|
130 |
public boolean hasGeometrySupport() {
|
|
131 |
return false;
|
|
132 |
}
|
|
133 | 133 |
|
134 |
public boolean hasGeometrySupport() { |
|
135 |
return false; |
|
136 |
} |
|
134 |
public boolean closeResourceRequested(ResourceProvider resource) { |
|
135 |
try { |
|
136 |
this.helper.close(); |
|
137 |
} catch (CloseException e) { |
|
138 |
LOG.error("Exception in close Request", e); |
|
139 |
} |
|
140 |
return !this.helper.isOpen(); |
|
141 |
} |
|
137 | 142 |
|
138 |
public boolean closeResourceRequested(ResourceProvider resource) { |
|
139 |
try { |
|
140 |
this.helper.close(); |
|
141 |
} catch (CloseException e) { |
|
142 |
LOG.error("Exception in close Request", e); |
|
143 |
} |
|
144 |
return !this.helper.isOpen(); |
|
145 |
} |
|
143 |
public void resourceChanged(ResourceProvider resource) { |
|
144 |
// Nothing to do |
|
145 |
} |
|
146 | 146 |
|
147 |
public void resourceChanged(ResourceProvider resource) { |
|
148 |
// Nothing to do |
|
149 |
} |
|
147 |
public void remove(DataStoreParameters dsp) throws RemoveException { |
|
148 |
final JDBCStoreParameters dsParams = (JDBCStoreParameters) dsp; |
|
150 | 149 |
|
151 |
public void remove(DataStoreParameters dsp) throws RemoveException { |
|
152 |
final JDBCStoreParameters dsParams =(JDBCStoreParameters) dsp; |
|
150 |
TransactionalAction action = new TransactionalAction() { |
|
151 |
public boolean continueTransactionAllowed() { |
|
152 |
return false; |
|
153 |
} |
|
153 | 154 |
|
154 |
TransactionalAction action = new TransactionalAction() { |
|
155 |
public boolean continueTransactionAllowed() { |
|
156 |
return false; |
|
157 |
} |
|
158 |
public Object action(Connection conn) throws DataException { |
|
159 |
Statement st; |
|
160 |
try{ |
|
161 |
st = conn.createStatement(); |
|
162 |
} catch (SQLException e) { |
|
163 |
throw new JDBCSQLException(e); |
|
164 |
} |
|
155 |
public Object action(Connection conn) throws DataException { |
|
156 |
Statement st; |
|
157 |
try { |
|
158 |
st = conn.createStatement(); |
|
159 |
} catch (SQLException e) { |
|
160 |
throw new JDBCSQLException(e); |
|
161 |
} |
|
165 | 162 |
|
166 |
String sqlDrop = "Drop table "
|
|
167 |
+ dsParams.tableID();
|
|
163 |
String sqlDrop = "Drop table "
|
|
164 |
+ dsParams.tableID();
|
|
168 | 165 |
|
169 |
try{
|
|
170 |
try{
|
|
171 |
JDBCHelper.execute(st, sqlDrop);
|
|
172 |
} catch (SQLException e) {
|
|
173 |
throw new JDBCExecuteSQLException(sqlDrop, e);
|
|
174 |
}
|
|
166 |
try {
|
|
167 |
try {
|
|
168 |
JDBCHelper.execute(st, sqlDrop); |
|
169 |
} catch (SQLException e) {
|
|
170 |
throw new JDBCExecuteSQLException(sqlDrop, e);
|
|
171 |
}
|
|
175 | 172 |
|
176 |
} finally{ |
|
177 |
try{ st.close(); } catch (SQLException e) {}; |
|
178 |
} |
|
179 |
return null; |
|
180 |
} |
|
181 |
}; |
|
182 |
try { |
|
183 |
this.helper.doConnectionAction(action); |
|
184 |
} catch (Exception e) { |
|
185 |
throw new RemoveException(this.getProviderName(), e); |
|
186 |
} |
|
187 |
} |
|
188 |
|
|
189 |
public DataStoreParameters getOpenParameters() throws DataException { |
|
190 |
JDBCServerExplorerParameters parameters = getJDBCParameters(); |
|
191 |
JDBCStoreParameters params = new JDBCStoreParameters(); |
|
192 |
params.setHost(parameters.getHost()); |
|
193 |
params.setPort(parameters.getPort()); |
|
194 |
params.setDBName(parameters.getDBName()); |
|
195 |
params.setUser(parameters.getUser()); |
|
196 |
params.setPassword(parameters.getPassword()); |
|
197 |
params.setCatalog(parameters.getCatalog()); |
|
198 |
params.setSchema(parameters.getSchema()); |
|
199 |
params.setJDBCDriverClassName(parameters.getJDBCDriverClassName()); |
|
200 |
params.setUrl(parameters.getUrl()); |
|
201 |
return params; |
|
173 |
} finally { |
|
174 |
try { |
|
175 |
st.close(); |
|
176 |
} catch (SQLException e) { |
|
177 |
}; |
|
178 |
} |
|
179 |
return null; |
|
180 |
} |
|
181 |
}; |
|
182 |
try { |
|
183 |
this.helper.doConnectionAction(action); |
|
184 |
} catch (Exception e) { |
|
185 |
throw new RemoveException(this.getProviderName(), e); |
|
202 | 186 |
} |
187 |
} |
|
203 | 188 |
|
204 |
public NewDataStoreParameters getAddParameters() throws DataException { |
|
205 |
JDBCServerExplorerParameters parameters = getJDBCParameters(); |
|
206 |
JDBCNewStoreParameters params = new JDBCNewStoreParameters(); |
|
207 |
params.setHost(parameters.getHost()); |
|
208 |
params.setPort(parameters.getPort()); |
|
209 |
params.setDBName(parameters.getDBName()); |
|
210 |
params.setUser(parameters.getUser()); |
|
211 |
params.setPassword(parameters.getPassword()); |
|
212 |
params.setCatalog(parameters.getCatalog()); |
|
213 |
params.setSchema(parameters.getSchema()); |
|
214 |
params.setJDBCDriverClassName(parameters.getJDBCDriverClassName()); |
|
215 |
params.setUrl(parameters.getUrl()); |
|
189 |
public DataStoreParameters getOpenParameters() throws DataException { |
|
190 |
JDBCServerExplorerParameters parameters = getJDBCParameters(); |
|
191 |
JDBCStoreParameters params = new JDBCStoreParameters(); |
|
192 |
params.setHost(parameters.getHost()); |
|
193 |
params.setPort(parameters.getPort()); |
|
194 |
params.setDBName(parameters.getDBName()); |
|
195 |
params.setUser(parameters.getUser()); |
|
196 |
params.setPassword(parameters.getPassword()); |
|
197 |
params.setCatalog(parameters.getCatalog()); |
|
198 |
params.setSchema(parameters.getSchema()); |
|
199 |
params.setJDBCDriverClassName(parameters.getJDBCDriverClassName()); |
|
200 |
params.setUrl(parameters.getUrl()); |
|
201 |
return params; |
|
202 |
} |
|
216 | 203 |
|
217 |
params.setDefaultFeatureType(this.getServerExplorerProviderServices() |
|
218 |
.createNewFeatureType()); |
|
204 |
public NewDataStoreParameters getAddParameters() throws DataException { |
|
205 |
JDBCServerExplorerParameters parameters = getJDBCParameters(); |
|
206 |
JDBCNewStoreParameters params = new JDBCNewStoreParameters(); |
|
207 |
params.setHost(parameters.getHost()); |
|
208 |
params.setPort(parameters.getPort()); |
|
209 |
params.setDBName(parameters.getDBName()); |
|
210 |
params.setUser(parameters.getUser()); |
|
211 |
params.setPassword(parameters.getPassword()); |
|
212 |
params.setCatalog(parameters.getCatalog()); |
|
213 |
params.setSchema(parameters.getSchema()); |
|
214 |
params.setJDBCDriverClassName(parameters.getJDBCDriverClassName()); |
|
215 |
params.setUrl(parameters.getUrl()); |
|
219 | 216 |
|
220 |
return params;
|
|
221 |
}
|
|
217 |
params.setDefaultFeatureType(this.getServerExplorerProviderServices()
|
|
218 |
.createNewFeatureType());
|
|
222 | 219 |
|
223 |
public void closeDone() throws DataException { |
|
224 |
// Nothing to do |
|
225 |
} |
|
220 |
return params; |
|
221 |
} |
|
226 | 222 |
|
227 |
public void opendDone() throws DataException { |
|
228 |
// Nothin to do |
|
223 |
public void closeDone() throws DataException { |
|
224 |
// Nothing to do |
|
225 |
} |
|
229 | 226 |
|
230 |
} |
|
227 |
public void opendDone() throws DataException { |
|
228 |
// Nothin to do |
|
231 | 229 |
|
232 |
public DataStore open(DataStoreParameters dsp) throws DataException { |
|
233 |
checkIsMine(dsp); |
|
234 |
DataManager dataMan = DALLocator.getDataManager(); |
|
235 |
DataStore store; |
|
236 |
try { |
|
237 |
store = dataMan.openStore(dsp.getDataStoreName(), dsp); |
|
238 |
} catch (ValidateDataParametersException e) { |
|
239 |
throw new InitializeException(e); |
|
240 |
} |
|
230 |
} |
|
241 | 231 |
|
242 |
return store; |
|
243 |
} |
|
232 |
public DataStore open(DataStoreParameters dsp) throws DataException { |
|
233 |
checkIsMine(dsp); |
|
234 |
DataManager dataMan = DALLocator.getDataManager(); |
|
235 |
DataStore store; |
|
236 |
try { |
|
237 |
store = dataMan.openStore(dsp.getDataStoreName(), dsp); |
|
238 |
} catch (ValidateDataParametersException e) { |
|
239 |
throw new InitializeException(e); |
|
240 |
} |
|
244 | 241 |
|
245 |
protected void checkIsMine(DataStoreParameters dsp) { |
|
246 |
if (!(dsp instanceof JDBCConnectionParameters)) { |
|
247 |
// FIXME Exception ??? |
|
248 |
throw new IllegalArgumentException( |
|
249 |
"not instance of FilesystemStoreParameters"); |
|
250 |
} |
|
242 |
return store; |
|
243 |
} |
|
251 | 244 |
|
245 |
protected void checkIsMine(DataStoreParameters dsp) { |
|
246 |
if (!(dsp instanceof JDBCConnectionParameters)) { |
|
247 |
// FIXME Exception ??? |
|
248 |
throw new IllegalArgumentException( |
|
249 |
"not instance of FilesystemStoreParameters"); |
|
250 |
} |
|
251 |
|
|
252 | 252 |
// try { |
253 |
// dsp.validate(); |
|
254 |
// } catch (ValidateDataParametersException e) { |
|
255 |
// throw new IllegalArgumentException("check parameters", e); |
|
256 |
// } |
|
253 |
// dsp.validate(); |
|
254 |
// } catch (ValidateDataParametersException e) { |
|
255 |
// throw new IllegalArgumentException("check parameters", e); |
|
256 |
// } |
|
257 |
JDBCServerExplorerParameters parameters = getJDBCParameters(); |
|
257 | 258 |
|
258 |
JDBCServerExplorerParameters parameters = getJDBCParameters(); |
|
259 |
JDBCConnectionParameters pgp = (JDBCConnectionParameters) dsp; |
|
260 |
if (!compare(pgp.getHost(), parameters.getHost())) { |
|
261 |
throw new IllegalArgumentException("wrong explorer: Host (mine: " |
|
262 |
+ parameters.getHost() + " other:" + pgp.getHost() + ")"); |
|
263 |
} |
|
264 |
if (!compare(pgp.getPort(), parameters.getPort())) { |
|
265 |
throw new IllegalArgumentException("wrong explorer: Port (mine: " |
|
266 |
+ parameters.getPort() + " other:" + pgp.getPort() + ")"); |
|
267 |
} |
|
268 |
if (!compare(pgp.getDBName(), parameters.getDBName())) { |
|
269 |
throw new IllegalArgumentException("wrong explorer: DBName (mine: " |
|
270 |
+ parameters.getDBName() + " other:" + pgp.getDBName() |
|
271 |
+ ")"); |
|
272 |
} |
|
273 |
if (parameters.getCatalog() != null && !parameters.getCatalog().trim().equals("")) { |
|
274 |
// implicit catalog |
|
275 |
if (!compare(pgp.getCatalog(), parameters.getCatalog())) { |
|
276 |
throw new IllegalArgumentException( |
|
277 |
"wrong explorer: Catalog (mine: " |
|
278 |
+ parameters.getCatalog() + " other:" |
|
279 |
+ pgp.getCatalog() + ")"); |
|
280 |
} |
|
281 |
} |
|
282 |
if (parameters.getSchema() != null && !parameters.getSchema().trim().equals("")) { |
|
283 |
// implicit schema |
|
284 |
if (!compare(pgp.getSchema(), parameters.getSchema())) { |
|
285 |
throw new IllegalArgumentException( |
|
286 |
"wrong explorer: Schema (mine: " |
|
287 |
+ parameters.getSchema() + " other:" |
|
288 |
+ pgp.getSchema() + ")"); |
|
289 |
} |
|
290 |
} |
|
291 |
} |
|
259 | 292 |
|
260 |
JDBCConnectionParameters pgp = (JDBCConnectionParameters) dsp; |
|
261 |
if (!compare(pgp.getHost(), parameters.getHost())) { |
|
262 |
throw new IllegalArgumentException("wrong explorer: Host (mine: " |
|
263 |
+ parameters.getHost() + " other:" + pgp.getHost() + ")"); |
|
264 |
} |
|
265 |
if (!compare(pgp.getPort(), parameters.getPort())) { |
|
266 |
throw new IllegalArgumentException("wrong explorer: Port (mine: " |
|
267 |
+ parameters.getPort() + " other:" + pgp.getPort() + ")"); |
|
268 |
} |
|
269 |
if (!compare(pgp.getDBName(), parameters.getDBName())) { |
|
270 |
throw new IllegalArgumentException("wrong explorer: DBName (mine: " |
|
271 |
+ parameters.getDBName() + " other:" + pgp.getDBName() |
|
272 |
+ ")"); |
|
273 |
} |
|
274 |
if (parameters.getCatalog() != null && !parameters.getCatalog().trim().equals("")) { |
|
275 |
// implicit catalog |
|
276 |
if (!compare(pgp.getCatalog(), parameters.getCatalog())) { |
|
277 |
throw new IllegalArgumentException( |
|
278 |
"wrong explorer: Catalog (mine: " |
|
279 |
+ parameters.getCatalog() + " other:" |
|
280 |
+ pgp.getCatalog() + ")"); |
|
281 |
} |
|
282 |
} |
|
283 |
if (parameters.getSchema() != null && !parameters.getSchema().trim().equals("")) { |
|
284 |
// implicit schema |
|
285 |
if (!compare(pgp.getSchema(), parameters.getSchema())) { |
|
286 |
throw new IllegalArgumentException( |
|
287 |
"wrong explorer: Schema (mine: " |
|
288 |
+ parameters.getSchema() + " other:" |
|
289 |
+ pgp.getSchema() + ")"); |
|
290 |
} |
|
291 |
} |
|
292 |
} |
|
293 |
protected boolean compare(Object str1, Object str2) { |
|
294 |
if (str1 == str2) { |
|
295 |
return true; |
|
296 |
} |
|
297 |
if (str1 == null) { |
|
298 |
return false; |
|
299 |
} |
|
300 |
return str1.equals(str2); |
|
301 |
} |
|
293 | 302 |
|
294 |
protected boolean compare(Object str1, Object str2) { |
|
295 |
if (str1 == str2){ |
|
296 |
return true; |
|
297 |
} |
|
298 |
if (str1 == null){ |
|
299 |
return false; |
|
300 |
} |
|
301 |
return str1.equals(str2); |
|
302 |
} |
|
303 |
|
|
304 |
protected JDBCStoreParameters createStoreParams() |
|
305 |
throws InitializeException, ProviderNotRegisteredException { |
|
306 |
DataManagerProviderServices manager = this.getManager(); |
|
307 |
JDBCServerExplorerParameters parameters = getJDBCParameters(); |
|
308 |
JDBCStoreParameters orgParams = (JDBCStoreParameters) manager |
|
309 |
.createStoreParameters(getStoreName()); |
|
310 |
orgParams.setHost(parameters.getHost()); |
|
311 |
orgParams.setPort(parameters.getPort()); |
|
312 |
orgParams.setDBName(parameters.getDBName()); |
|
313 |
orgParams.setUser(parameters.getUser()); |
|
314 |
orgParams.setPassword(parameters.getPassword()); |
|
303 |
protected JDBCStoreParameters createStoreParams() |
|
304 |
throws InitializeException, ProviderNotRegisteredException { |
|
305 |
DataManagerProviderServices manager = this.getManager(); |
|
306 |
JDBCServerExplorerParameters parameters = getJDBCParameters(); |
|
307 |
JDBCStoreParameters orgParams = (JDBCStoreParameters) manager |
|
308 |
.createStoreParameters(getStoreName()); |
|
309 |
orgParams.setHost(parameters.getHost()); |
|
310 |
orgParams.setPort(parameters.getPort()); |
|
311 |
orgParams.setDBName(parameters.getDBName()); |
|
312 |
orgParams.setUser(parameters.getUser()); |
|
313 |
orgParams.setPassword(parameters.getPassword()); |
|
315 | 314 |
orgParams.setCatalog(parameters.getCatalog()); |
316 | 315 |
orgParams.setJDBCDriverClassName(parameters.getJDBCDriverClassName()); |
317 | 316 |
orgParams.setSchema(parameters.getSchema()); |
318 | 317 |
orgParams.setUrl(parameters.getUrl()); |
319 |
return orgParams;
|
|
320 |
}
|
|
318 |
return orgParams;
|
|
319 |
}
|
|
321 | 320 |
|
322 |
public List list(final int mode, final boolean showInformationDBTables)
|
|
323 |
throws DataException {
|
|
321 |
public List list(final int mode, final boolean showInformationDBTables)
|
|
322 |
throws DataException {
|
|
324 | 323 |
|
325 |
final JDBCStoreParameters orgParams = createStoreParams();
|
|
324 |
final JDBCStoreParameters orgParams = createStoreParams();
|
|
326 | 325 |
|
327 |
ConnectionAction action = new ConnectionAction() {
|
|
326 |
ConnectionAction action = new ConnectionAction() {
|
|
328 | 327 |
|
329 |
public Object action(Connection conn) throws DataException {
|
|
328 |
public Object action(Connection conn) throws DataException {
|
|
330 | 329 |
|
331 |
String[] tableTypes = null;
|
|
332 |
if (!showInformationDBTables) {
|
|
333 |
tableTypes = new String[] { "TABLE", "VIEW" };
|
|
334 |
}
|
|
330 |
String[] tableTypes = null;
|
|
331 |
if (!showInformationDBTables) {
|
|
332 |
tableTypes = new String[]{"TABLE", "VIEW"};
|
|
333 |
}
|
|
335 | 334 |
|
336 |
ResultSet result = null;
|
|
337 |
try {
|
|
338 |
DatabaseMetaData metadata = conn.getMetaData();
|
|
339 |
result = metadata.getTables(null, null, null,
|
|
340 |
tableTypes);
|
|
341 |
List<JDBCStoreParameters> paramList = new ArrayList<JDBCStoreParameters>();
|
|
342 |
while (result.next()) {
|
|
343 |
JDBCStoreParameters params = (JDBCStoreParameters) orgParams
|
|
344 |
.getCopy();
|
|
345 |
params.setCatalog(result
|
|
346 |
.getString(METADATA_COLUMN_TABLE_CATALOG));
|
|
347 |
params.setSchema(result
|
|
348 |
.getString(METADATA_COLUMN_TABLE_SCHEMA));
|
|
349 |
params.setTable(result
|
|
350 |
.getString(METADATA_COLUMN_TABLE_NAME));
|
|
351 |
paramList.add(params);
|
|
352 |
}
|
|
335 |
ResultSet result = null;
|
|
336 |
try {
|
|
337 |
DatabaseMetaData metadata = conn.getMetaData();
|
|
338 |
result = metadata.getTables(null, null, null,
|
|
339 |
tableTypes);
|
|
340 |
List<JDBCStoreParameters> paramList = new ArrayList<JDBCStoreParameters>();
|
|
341 |
while (result.next()) {
|
|
342 |
JDBCStoreParameters params = (JDBCStoreParameters) orgParams
|
|
343 |
.getCopy();
|
|
344 |
params.setCatalog(result
|
|
345 |
.getString(METADATA_COLUMN_TABLE_CATALOG));
|
|
346 |
params.setSchema(result
|
|
347 |
.getString(METADATA_COLUMN_TABLE_SCHEMA));
|
|
348 |
params.setTable(result
|
|
349 |
.getString(METADATA_COLUMN_TABLE_NAME));
|
|
350 |
paramList.add(params);
|
|
351 |
}
|
|
353 | 352 |
|
354 |
return paramList;
|
|
355 |
} catch (SQLException e) {
|
|
356 |
throw new JDBCSQLException(e);
|
|
357 |
} finally {
|
|
358 |
if (result != null) {
|
|
359 |
try {
|
|
360 |
result.close();
|
|
361 |
} catch (Exception e) {
|
|
362 |
LOG.error("Error closing DatabaseMetadata "
|
|
363 |
+ "getTables() Resultset", e);
|
|
364 |
}
|
|
365 |
}
|
|
366 |
}
|
|
367 |
}
|
|
353 |
return paramList;
|
|
354 |
} catch (SQLException e) {
|
|
355 |
throw new JDBCSQLException(e);
|
|
356 |
} finally {
|
|
357 |
if (result != null) {
|
|
358 |
try {
|
|
359 |
result.close();
|
|
360 |
} catch (Exception e) {
|
|
361 |
LOG.error("Error closing DatabaseMetadata "
|
|
362 |
+ "getTables() Resultset", e);
|
|
363 |
}
|
|
364 |
}
|
|
365 |
}
|
|
366 |
}
|
|
368 | 367 |
|
369 |
};
|
|
368 |
};
|
|
370 | 369 |
|
371 |
try {
|
|
372 |
return (List) helper.doConnectionAction(action);
|
|
373 |
} catch (Exception e) {
|
|
374 |
throw new ReadException(this.getProviderName(), e);
|
|
375 |
}
|
|
376 |
}
|
|
370 |
try {
|
|
371 |
return (List) helper.doConnectionAction(action);
|
|
372 |
} catch (Exception e) {
|
|
373 |
throw new ReadException(this.getProviderName(), e);
|
|
374 |
}
|
|
375 |
}
|
|
377 | 376 |
|
377 |
public void open() throws OpenException { |
|
378 |
helper.open(); |
|
379 |
} |
|
378 | 380 |
|
379 |
public void open() throws OpenException {
|
|
380 |
helper.open();
|
|
381 |
}
|
|
381 |
public void close() throws CloseException {
|
|
382 |
helper.close();
|
|
383 |
}
|
|
382 | 384 |
|
383 |
public void close() throws CloseException { |
|
384 |
helper.close(); |
|
385 |
} |
|
385 |
@Override |
|
386 |
protected void doDispose() throws BaseException { |
|
387 |
helper.dispose(); |
|
388 |
helper = null; |
|
389 |
} |
|
386 | 390 |
|
387 |
@Override |
|
388 |
protected void doDispose() throws BaseException { |
|
389 |
helper.dispose(); |
|
390 |
helper = null; |
|
391 |
} |
|
391 |
public String getProviderName() { |
|
392 |
return NAME; |
|
393 |
} |
|
392 | 394 |
|
393 |
public String getProviderName() {
|
|
394 |
return NAME;
|
|
395 |
}
|
|
395 |
public String getStoreName() {
|
|
396 |
return JDBCStoreProvider.NAME;
|
|
397 |
}
|
|
396 | 398 |
|
397 |
public String getStoreName() {
|
|
398 |
return JDBCStoreProvider.NAME;
|
|
399 |
}
|
|
399 |
public boolean canAdd() {
|
|
400 |
if (this.canAdd == null) {
|
|
401 |
ConnectionAction action = new ConnectionAction() {
|
|
400 | 402 |
|
401 |
public boolean canAdd() { |
|
402 |
if (this.canAdd == null){ |
|
403 |
ConnectionAction action = new ConnectionAction(){ |
|
403 |
public Object action(Connection conn) throws DataException { |
|
404 |
try { |
|
405 |
DatabaseMetaData metadata = conn.getMetaData(); |
|
406 |
if (metadata.isReadOnly()) { |
|
407 |
return Boolean.FALSE; |
|
408 |
} |
|
409 |
return Boolean.TRUE; |
|
410 |
} catch (SQLException e) { |
|
411 |
throw new JDBCSQLException(e); |
|
412 |
} |
|
413 |
} |
|
404 | 414 |
|
405 |
public Object action(Connection conn) throws DataException { |
|
406 |
try { |
|
407 |
DatabaseMetaData metadata = conn.getMetaData(); |
|
408 |
if (metadata.isReadOnly()) { |
|
409 |
return Boolean.FALSE; |
|
410 |
} |
|
411 |
return Boolean.TRUE; |
|
412 |
} catch (SQLException e) { |
|
413 |
throw new JDBCSQLException(e); |
|
414 |
} |
|
415 |
} |
|
415 |
}; |
|
416 | 416 |
|
417 |
}; |
|
417 |
try { |
|
418 |
this.canAdd = (Boolean) helper.doConnectionAction(action); |
|
419 |
} catch (Exception e) { |
|
420 |
// FIXME Exception |
|
421 |
throw new RuntimeException(e); |
|
422 |
} |
|
423 |
} |
|
424 |
return this.canAdd.booleanValue(); |
|
425 |
} |
|
418 | 426 |
|
419 |
try { |
|
420 |
this.canAdd = (Boolean) helper.doConnectionAction(action); |
|
421 |
} catch (Exception e) { |
|
422 |
// FIXME Exception |
|
423 |
throw new RuntimeException(e); |
|
424 |
} |
|
425 |
} |
|
426 |
return this.canAdd.booleanValue(); |
|
427 |
} |
|
427 |
public FeatureType getFeatureType(DataStoreParameters dsp) |
|
428 |
throws DataException { |
|
429 |
checkIsMine(dsp); |
|
428 | 430 |
|
429 |
public FeatureType getFeatureType(DataStoreParameters dsp) |
|
430 |
throws DataException { |
|
431 |
checkIsMine(dsp); |
|
431 |
// TODO: checks geometry columns and driver geometry supports |
|
432 |
EditableFeatureType edType = this.getServerExplorerProviderServices() |
|
433 |
.createNewFeatureType(); |
|
434 |
helper.loadFeatureType(edType, (JDBCStoreParameters) dsp); |
|
432 | 435 |
|
433 |
// TODO: checks geometry columns and driver geometry supports |
|
434 |
EditableFeatureType edType = this.getServerExplorerProviderServices() |
|
435 |
.createNewFeatureType(); |
|
436 |
helper.loadFeatureType(edType, (JDBCStoreParameters) dsp); |
|
436 |
return edType; |
|
437 | 437 |
|
438 |
return edType;
|
|
438 |
}
|
|
439 | 439 |
|
440 |
} |
|
441 |
|
|
442 |
public boolean add(String providerName, NewDataStoreParameters ndsp, boolean overwrite) |
|
443 |
throws DataException { |
|
440 |
public boolean add(String providerName, NewDataStoreParameters ndsp, boolean overwrite) |
|
441 |
throws DataException { |
|
444 | 442 |
|
445 |
/** |
|
446 |
* CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name ( |
|
447 |
* { column_name data_type [ DEFAULT default_expr ] [ column_constraint |
|
448 |
* [ ... ] ] | table_constraint | LIKE parent_table [ { INCLUDING | |
|
449 |
* EXCLUDING } DEFAULTS ] } [, ... ] ) [ INHERITS ( parent_table [, ... |
|
450 |
* ] ) ] [ WITH OIDS | WITHOUT OIDS ] [ ON COMMIT { PRESERVE ROWS | |
|
451 |
* DELETE ROWS | DROP } ] |
|
452 |
* |
|
453 |
* where column_constraint is: |
|
454 |
* |
|
455 |
* [ CONSTRAINT constraint_name ] { NOT NULL | NULL | UNIQUE | PRIMARY |
|
456 |
* KEY | CHECK (expression) | REFERENCES reftable [ ( refcolumn ) ] [ |
|
457 |
* MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON |
|
458 |
* UPDATE action ] } [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY |
|
459 |
* DEFERRED | INITIALLY IMMEDIATE ] |
|
460 |
* |
|
461 |
* and table_constraint is: |
|
462 |
* |
|
463 |
* [ CONSTRAINT constraint_name ] { UNIQUE ( column_name [, ... ] ) | |
|
464 |
* PRIMARY KEY ( column_name [, ... ] ) | CHECK ( expression ) | FOREIGN |
|
465 |
* KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... |
|
466 |
* ] ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE |
|
467 |
* action ] [ ON UPDATE action ] } [ DEFERRABLE | NOT DEFERRABLE ] [ |
|
468 |
* INITIALLY DEFERRED | INITIALLY IMMEDIATE ] |
|
469 |
*/ |
|
443 |
/** |
|
444 |
* CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name ( |
|
445 |
* { column_name data_type [ DEFAULT default_expr ] [ column_constraint |
|
446 |
* [ ... ] ] | table_constraint | LIKE parent_table [ { INCLUDING | |
|
447 |
* EXCLUDING } DEFAULTS ] } [, ... ] ) [ INHERITS ( parent_table [, ... |
|
448 |
* ] ) ] [ WITH OIDS | WITHOUT OIDS ] [ ON COMMIT { PRESERVE ROWS | |
|
449 |
* DELETE ROWS | DROP } ] |
|
450 |
* |
|
451 |
* where column_constraint is: |
|
452 |
* |
|
453 |
* [ CONSTRAINT constraint_name ] { NOT NULL | NULL | UNIQUE | PRIMARY |
|
454 |
* KEY | CHECK (expression) | REFERENCES reftable [ ( refcolumn ) ] [ |
|
455 |
* MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON |
|
456 |
* UPDATE action ] } [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY |
|
457 |
* DEFERRED | INITIALLY IMMEDIATE ] |
|
458 |
* |
|
459 |
* and table_constraint is: |
|
460 |
* |
|
461 |
* [ CONSTRAINT constraint_name ] { UNIQUE ( column_name [, ... ] ) | |
|
462 |
* PRIMARY KEY ( column_name [, ... ] ) | CHECK ( expression ) | FOREIGN |
|
463 |
* KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... |
|
464 |
* ] ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE |
|
465 |
* action ] [ ON UPDATE action ] } [ DEFERRABLE | NOT DEFERRABLE ] [ |
|
466 |
* INITIALLY DEFERRED | INITIALLY IMMEDIATE ] |
|
467 |
*/ |
|
468 |
if (!(ndsp instanceof JDBCNewStoreParameters)) { |
|
469 |
// FIXME exception |
|
470 |
throw new IllegalArgumentException(); |
|
471 |
} |
|
472 |
checkIsMine(ndsp); |
|
470 | 473 |
|
471 |
if (!(ndsp instanceof JDBCNewStoreParameters)) { |
|
472 |
// FIXME exception |
|
473 |
throw new IllegalArgumentException(); |
|
474 |
} |
|
475 |
checkIsMine(ndsp); |
|
474 |
JDBCNewStoreParameters jdbcnsp = (JDBCNewStoreParameters) ndsp; |
|
476 | 475 |
|
477 |
JDBCNewStoreParameters jdbcnsp = (JDBCNewStoreParameters) ndsp;
|
|
476 |
StringBuilder sql = new StringBuilder();
|
|
478 | 477 |
|
479 |
StringBuilder sql = new StringBuilder(); |
|
478 |
if (!jdbcnsp.isValid()) { |
|
479 |
// TODO Exception |
|
480 |
throw new InitializeException(this.getProviderName(), new Exception( |
|
481 |
"Parameters not valid")); |
|
482 |
} |
|
483 |
try { |
|
484 |
jdbcnsp.validate(); |
|
485 |
} catch (ValidateDataParametersException e1) { |
|
486 |
throw new InitializeException(this.getProviderName(), e1); |
|
487 |
} |
|
480 | 488 |
|
481 |
if (!jdbcnsp.isValid()) { |
|
482 |
// TODO Exception |
|
483 |
throw new InitializeException(this.getProviderName(), new Exception( |
|
484 |
"Parameters not valid")); |
|
485 |
} |
|
486 |
try { |
|
487 |
jdbcnsp.validate(); |
|
488 |
} catch (ValidateDataParametersException e1) { |
|
489 |
throw new InitializeException(this.getProviderName(), e1); |
|
490 |
} |
|
489 |
FeatureType fType = jdbcnsp.getDefaultFeatureType(); |
|
491 | 490 |
|
492 |
FeatureType fType = jdbcnsp.getDefaultFeatureType(); |
|
491 |
sql.append("Create table " + jdbcnsp.tableID() |
|
492 |
+ "("); |
|
493 |
Iterator attrs = fType.iterator(); |
|
494 |
String sqlAttr; |
|
495 |
List sqlAttrs = new ArrayList(); |
|
493 | 496 |
|
494 |
sql.append("Create table " + jdbcnsp.tableID() |
|
495 |
+ "("); |
|
496 |
Iterator attrs = fType.iterator(); |
|
497 |
String sqlAttr; |
|
498 |
List sqlAttrs = new ArrayList(); |
|
497 |
while (attrs.hasNext()) { |
|
498 |
sqlAttr = helper |
|
499 |
.getSqlFieldDescription((FeatureAttributeDescriptor) attrs |
|
500 |
.next()); |
|
501 |
if (sqlAttr != null) { |
|
502 |
sqlAttrs.add(sqlAttr); |
|
503 |
} |
|
504 |
} |
|
499 | 505 |
|
500 |
while (attrs.hasNext()) { |
|
501 |
sqlAttr = helper |
|
502 |
.getSqlFieldDescription((FeatureAttributeDescriptor) attrs |
|
503 |
.next()); |
|
504 |
if (sqlAttr != null) { |
|
505 |
sqlAttrs.add(sqlAttr); |
|
506 |
} |
|
507 |
} |
|
506 |
helper.stringJoin(sqlAttrs, ", ", sql); |
|
508 | 507 |
|
509 |
helper.stringJoin(sqlAttrs, ", ", sql);
|
|
508 |
sql.append(")");
|
|
510 | 509 |
|
511 |
sql.append(")"); |
|
510 |
final String sqlCreate = sql.toString(); |
|
511 |
final List sqlAdditional = helper.getAdditionalSqlToCreate(ndsp, fType); |
|
512 | 512 |
|
513 |
final String sqlCreate = sql.toString(); |
|
514 |
final List sqlAdditional = helper.getAdditionalSqlToCreate(ndsp, fType); |
|
513 |
List permissions = this.getHelper().createGrantStatements((JDBCNewStoreParameters) ndsp); |
|
514 |
if (permissions != null) { |
|
515 |
sqlAdditional.addAll(permissions); |
|
516 |
} |
|
515 | 517 |
|
516 |
List permissions = this.getHelper().createGrantStatements((JDBCNewStoreParameters) ndsp); |
|
517 |
if( permissions != null ) { |
|
518 |
sqlAdditional.addAll(permissions); |
|
518 |
if (((JDBCNewStoreParameters) ndsp).getPostCreatingStatement() != null) { |
|
519 |
sqlAdditional.add(((JDBCNewStoreParameters) ndsp).getPostCreatingStatement()); |
|
520 |
} |
|
521 |
|
|
522 |
TransactionalAction action = new TransactionalAction() { |
|
523 |
|
|
524 |
public boolean continueTransactionAllowed() { |
|
525 |
// TODO Auto-generated method stub |
|
526 |
return false; |
|
527 |
} |
|
528 |
|
|
529 |
public Object action(Connection conn) throws DataException { |
|
530 |
Statement st = null; |
|
531 |
|
|
532 |
try { |
|
533 |
st = conn.createStatement(); |
|
534 |
} catch (SQLException e1) { |
|
535 |
throw new JDBCSQLException(e1); |
|
519 | 536 |
} |
520 |
|
|
521 |
if( ((JDBCNewStoreParameters) ndsp).getPostCreatingStatement()!=null ) { |
|
522 |
sqlAdditional.add(((JDBCNewStoreParameters) ndsp).getPostCreatingStatement()); |
|
523 |
} |
|
524 |
|
|
525 |
TransactionalAction action = new TransactionalAction() { |
|
537 |
String sql = null; |
|
526 | 538 |
|
527 |
public boolean continueTransactionAllowed() { |
|
528 |
// TODO Auto-generated method stub |
|
529 |
return false; |
|
530 |
} |
|
539 |
try { |
|
540 |
sql = sqlCreate; |
|
541 |
JDBCHelper.execute(st, sql); |
|
542 |
if (sqlAdditional != null) { |
|
543 |
Iterator iter = sqlAdditional.iterator(); |
|
544 |
while (iter.hasNext()) { |
|
545 |
sql = (String) iter.next(); |
|
546 |
JDBCHelper.execute(st, sql); |
|
547 |
} |
|
548 |
} |
|
531 | 549 |
|
532 |
public Object action(Connection conn) throws DataException { |
|
533 |
Statement st = null; |
|
550 |
} catch (SQLException e) { |
|
551 |
throw new JDBCExecuteSQLException(sql, e); |
|
552 |
} finally { |
|
553 |
try { |
|
554 |
st.close(); |
|
555 |
} catch (SQLException e) { |
|
556 |
LOG.error("Exception clossing statement", e); |
|
557 |
} |
|
558 |
; |
|
559 |
} |
|
534 | 560 |
|
535 |
try { |
|
536 |
st = conn.createStatement(); |
|
537 |
} catch (SQLException e1) { |
|
538 |
throw new JDBCSQLException(e1); |
|
539 |
} |
|
540 |
String sql = null; |
|
561 |
return Boolean.TRUE; |
|
562 |
} |
|
541 | 563 |
|
542 |
try { |
|
543 |
sql = sqlCreate; |
|
544 |
JDBCHelper.execute(st, sql); |
|
545 |
if (sqlAdditional != null) { |
|
546 |
Iterator iter = sqlAdditional.iterator(); |
|
547 |
while (iter.hasNext()) { |
|
548 |
sql = (String) iter.next(); |
|
549 |
JDBCHelper.execute(st, sql); |
|
550 |
} |
|
551 |
} |
|
564 |
}; |
|
552 | 565 |
|
553 |
} catch (SQLException e) { |
|
554 |
throw new JDBCExecuteSQLException(sql, e); |
|
555 |
} finally { |
|
556 |
try { |
|
557 |
st.close(); |
|
558 |
} catch (SQLException e) { |
|
559 |
LOG.error("Exception clossing statement", e); |
|
560 |
} |
|
561 |
; |
|
562 |
} |
|
566 |
Boolean result = Boolean.FALSE; |
|
563 | 567 |
|
564 |
return Boolean.TRUE; |
|
565 |
} |
|
568 |
try { |
|
569 |
result = (Boolean) helper.doConnectionAction(action); |
|
570 |
} catch (DataException e) { |
|
571 |
throw e; |
|
572 |
} catch (Exception e) { |
|
573 |
// FIXME Exception |
|
574 |
throw new RuntimeException(e); |
|
575 |
} |
|
566 | 576 |
|
567 |
}; |
|
577 |
return result.booleanValue(); |
|
578 |
} |
|
568 | 579 |
|
569 |
Boolean result = Boolean.FALSE; |
|
580 |
public List getDataStoreProviderNames() { |
|
581 |
List x = new ArrayList(1); |
|
582 |
x.add(JDBCStoreProvider.NAME); |
|
583 |
return x; |
|
584 |
} |
|
570 | 585 |
|
571 |
try { |
|
572 |
result = (Boolean) helper.doConnectionAction(action); |
|
573 |
} catch (DataException e) { |
|
574 |
throw e; |
|
575 |
} catch (Exception e) { |
|
576 |
// FIXME Exception |
|
577 |
throw new RuntimeException(e); |
|
578 |
} |
|
586 |
public void updateTableStatistics(String tableName) throws JDBCExecuteSQLException { |
|
579 | 587 |
|
580 |
return result.booleanValue(); |
|
581 |
} |
|
588 |
} |
|
582 | 589 |
|
583 |
public List getDataStoreProviderNames() { |
|
584 |
List x = new ArrayList(1); |
|
585 |
x.add(JDBCStoreProvider.NAME); |
|
586 |
return x; |
|
587 |
} |
|
588 |
|
|
589 |
public void updateTableStatistics(String tableName) throws JDBCExecuteSQLException { |
|
590 |
|
|
591 |
} |
|
592 |
|
|
590 |
@Override |
|
591 |
public DataStoreParameters get(String name) throws DataException { |
|
592 |
JDBCStoreParameters params = this.createStoreParams(); |
|
593 |
params.setTable(name); |
|
594 |
return params; |
|
595 |
} |
|
593 | 596 |
} |
Also available in: Unified diff