Statistics
| Revision:

svn-gvsig-desktop / 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 / jdbc2 / spi / JDBCServerExplorerBase.java @ 46277

History | View | Annotate | Download (39.2 KB)

1 43020 jjdelcerro
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4 45065 jjdelcerro
 * Copyright (C) 2007-2020 gvSIG Association.
5 43020 jjdelcerro
 *
6 45065 jjdelcerro
 * 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 43020 jjdelcerro
 *
11 45065 jjdelcerro
 * 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 43020 jjdelcerro
 *
16 45065 jjdelcerro
 * 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.
20 43020 jjdelcerro
 *
21 45065 jjdelcerro
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23 43020 jjdelcerro
 */
24
package org.gvsig.fmap.dal.store.jdbc2.spi;
25
26 45773 jjdelcerro
import org.gvsig.tools.resourcesstorage.CompoundResourcesStorage;
27 43377 jjdelcerro
import java.io.File;
28 43020 jjdelcerro
import java.util.ArrayList;
29
import java.util.Arrays;
30 45152 fdiaz
import java.util.Collections;
31 45578 jjdelcerro
import java.util.HashMap;
32 43020 jjdelcerro
import java.util.List;
33 45152 fdiaz
import java.util.Map;
34 45578 jjdelcerro
import javax.json.JsonObject;
35
import javax.json.JsonString;
36
import javax.json.JsonValue;
37 45152 fdiaz
import org.apache.commons.codec.binary.Hex;
38
import org.apache.commons.collections.map.LRUMap;
39 43020 jjdelcerro
import org.apache.commons.lang3.BooleanUtils;
40
import org.apache.commons.lang3.ObjectUtils;
41
import org.apache.commons.lang3.StringUtils;
42
import org.apache.commons.lang3.tuple.ImmutablePair;
43
import org.apache.commons.lang3.tuple.Pair;
44 45578 jjdelcerro
import org.gvsig.expressionevaluator.ExpressionBuilder;
45
import org.gvsig.expressionevaluator.ExpressionUtils;
46 43020 jjdelcerro
import org.gvsig.fmap.dal.DALLocator;
47 44328 jjdelcerro
import org.gvsig.fmap.dal.DataManager;
48 43020 jjdelcerro
import org.gvsig.fmap.dal.DataStore;
49
import org.gvsig.fmap.dal.DataStoreParameters;
50 44346 jjdelcerro
import org.gvsig.fmap.dal.DatabaseWorkspaceManager;
51 45578 jjdelcerro
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.FIELD_CONFIGURATION_NAME;
52
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.FIELD_CONFIGURATION_VALUE;
53
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_CONFIGURATION_NAME;
54 44304 jjdelcerro
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_RESOURCES_NAME;
55 43020 jjdelcerro
import org.gvsig.fmap.dal.NewDataStoreParameters;
56 45614 fdiaz
import org.gvsig.fmap.dal.SQLBuilder;
57
import org.gvsig.fmap.dal.SQLBuilder.Privilege;
58 43020 jjdelcerro
import org.gvsig.fmap.dal.exception.CloseException;
59
import org.gvsig.fmap.dal.exception.DataException;
60
import org.gvsig.fmap.dal.exception.InitializeException;
61
import org.gvsig.fmap.dal.exception.OpenException;
62
import org.gvsig.fmap.dal.exception.RemoveException;
63 45614 fdiaz
import org.gvsig.fmap.dal.feature.EditableFeature;
64 43020 jjdelcerro
import org.gvsig.fmap.dal.feature.EditableFeatureType;
65 45578 jjdelcerro
import org.gvsig.fmap.dal.feature.Feature;
66
import org.gvsig.fmap.dal.feature.FeatureStore;
67 45614 fdiaz
import org.gvsig.fmap.dal.feature.FeatureType;
68 44328 jjdelcerro
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
69 43020 jjdelcerro
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
70
import org.gvsig.fmap.dal.serverexplorer.db.spi.AbstractDBServerExplorer;
71 43377 jjdelcerro
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
72 43020 jjdelcerro
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
73
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
74
import org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters;
75
import org.gvsig.fmap.dal.store.jdbc.JDBCNewStoreParameters;
76
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters;
77
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters;
78
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCExecuteSQLException;
79
import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper;
80 45614 fdiaz
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer;
81 43020 jjdelcerro
import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory;
82
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.CanCreateTablesOperation;
83
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.CreateTableOperation;
84 45614 fdiaz
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.DropTableOperation;
85
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.ExecuteOperation;
86 43020 jjdelcerro
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.FetchFeatureTypeOperation;
87
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.ListTablesOperation;
88
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.UpdateTableStatisticsOperation;
89 45578 jjdelcerro
import org.gvsig.json.Json;
90
import org.gvsig.json.JsonObjectBuilder;
91
import org.gvsig.tools.dispose.DisposeUtils;
92 43020 jjdelcerro
import org.gvsig.tools.exception.BaseException;
93 44297 jjdelcerro
import org.gvsig.tools.resourcesstorage.EmptyResourcesStorage;
94
import org.gvsig.tools.resourcesstorage.ResourcesStorage;
95 45152 fdiaz
import org.gvsig.tools.util.CachedValue;
96 43020 jjdelcerro
import org.slf4j.Logger;
97
import org.slf4j.LoggerFactory;
98
99 44297 jjdelcerro
@SuppressWarnings("UseSpecificCatch")
100 43020 jjdelcerro
public class JDBCServerExplorerBase extends AbstractDBServerExplorer implements JDBCServerExplorer {
101
102
    private static final Logger LOG = LoggerFactory.getLogger(JDBCServerExplorerBase.class);
103 45578 jjdelcerro
    private static final String CONFIG_NAME_CUSTOM_RESOURCES = "CUSTOM_RESOURCES";
104 43020 jjdelcerro
105
    protected JDBCHelper helper = null;
106 45578 jjdelcerro
107 43020 jjdelcerro
    private Boolean canAdd;
108 45578 jjdelcerro
109 45156 jjdelcerro
    private static final Map<String, CachedValue<List<JDBCStoreParameters>>> CACHED_TABLES = Collections.synchronizedMap(new LRUMap(10));
110 45578 jjdelcerro
    private static final Map<String, CachedValue<CustomResourcesConfig>> CACHED_CUSTOM_RESOURCES_CONFIG = Collections.synchronizedMap(new LRUMap(10));
111
112
    private static class CustomResourcesConfig {
113
114 45581 fdiaz
        private static final String CUSTOM_RESOURCES_CACHETIME = "CacheTime";
115
        private static final String CUSTOM_RESOURCES_MAPPING = "Mapping";
116 45697 jjdelcerro
        private static final String CUSTOM_RESOURCES_READONLY = "ResourcesReadonly";
117 45581 fdiaz
118
119 45578 jjdelcerro
        private int cacheTime;
120
        private Map<String, String> mapping;
121 45697 jjdelcerro
        private Map<String,Boolean> resourcesReadonly;
122
123 45578 jjdelcerro
        public CustomResourcesConfig(String jsonConfig) {
124
            this.cacheTime = 30*60*1000; // 30min
125
            this.mapping = new HashMap<>();
126 45697 jjdelcerro
            this.resourcesReadonly = new HashMap<>();
127
128 45578 jjdelcerro
            if (StringUtils.isNotBlank(jsonConfig)) {
129
                try {
130
                    JsonObject config = Json.createObject(jsonConfig);
131 45581 fdiaz
                    this.cacheTime = config.getInt(CUSTOM_RESOURCES_CACHETIME, this.cacheTime);
132 45697 jjdelcerro
                    if (config.containsKey(CUSTOM_RESOURCES_MAPPING)) {
133 45581 fdiaz
                        JsonObject m = config.getJsonObject(CUSTOM_RESOURCES_MAPPING);
134 45578 jjdelcerro
                        for (Map.Entry<String, JsonValue> entry : m.entrySet()) {
135
                            String key = entry.getKey();
136
                            JsonValue value = entry.getValue();
137
                            if (value instanceof JsonString) {
138
                                this.mapping.put(key, ((JsonString) value).getString());
139
                            }
140
                        }
141
                    }
142 45697 jjdelcerro
                    if (config.containsKey(CUSTOM_RESOURCES_READONLY)) {
143
                        JsonObject resreadonly = config.getJsonObject(CUSTOM_RESOURCES_READONLY);
144
                        for (Map.Entry<String, JsonValue> entry : resreadonly.entrySet()) {
145
                            String key = entry.getKey();
146
                            JsonValue value = entry.getValue();
147
                            if (value == JsonValue.TRUE) {
148
                                this.resourcesReadonly.put(key, true);
149
                            } else if (value == JsonValue.FALSE) {
150
                                this.resourcesReadonly.put(key, false);
151
                            }
152
                        }
153
                    }
154 45578 jjdelcerro
                } catch (Exception ex) {
155
                    LOG.debug("Can't parse json from "+CONFIG_NAME_CUSTOM_RESOURCES+" variable", ex);
156
                    // Do nothing.
157
                }
158
            }
159
        }
160
161
        public String toJsonString() {
162
            JsonObjectBuilder builder = Json.createObjectBuilder();
163 45697 jjdelcerro
            builder.add(CUSTOM_RESOURCES_CACHETIME, this.cacheTime);
164 45578 jjdelcerro
            JsonObjectBuilder m = Json.createObjectBuilder();
165 45697 jjdelcerro
            for (Map.Entry<String, String> entry : this.mapping.entrySet()) {
166 45578 jjdelcerro
                String key = entry.getKey();
167
                String value = entry.getValue();
168
                m.add(key, value);
169
            }
170 45581 fdiaz
            builder.add(CUSTOM_RESOURCES_MAPPING, m);
171 45697 jjdelcerro
            JsonObjectBuilder resreadonly = Json.createObjectBuilder();
172
            for (Map.Entry<String, Boolean> entry : this.resourcesReadonly.entrySet()) {
173
                String key = entry.getKey();
174
                Boolean readonly = entry.getValue();
175
                resreadonly.add(key,readonly);
176
            }
177
            builder.add(CUSTOM_RESOURCES_READONLY, resreadonly);
178 45578 jjdelcerro
            return builder.build().toString();
179
        }
180
181
        public int getCacheExpireTimeInMillis() {
182
            return cacheTime;
183
        }
184
185
        public String getResourcesTablename(String tablename) {
186
            String resourceTablename = mapping.get(tablename);
187 45764 jjdelcerro
//            LOG.info("Resource of table "+tablename+" = "+resourceTablename);
188 45578 jjdelcerro
            return resourceTablename;
189
        }
190
191
        public void addResourceMapping(String tablename, String resourcesTablename) {
192
            this.mapping.put(tablename, resourcesTablename);
193
        }
194
195
        private boolean isInternalTable(String storeName) {
196
            if (DatabaseWorkspaceManager.isInternalTable(storeName)) {
197
                return true;
198
            }
199
            for (String resourcesTablename : this.mapping.values()) {
200
                if( StringUtils.equals(storeName, resourcesTablename) ) {
201
                    return true;
202
                }
203
            }
204
            return false;
205
        }
206 45697 jjdelcerro
207
        public void setResourcesReadOnly(String resourcesTableName, boolean readonly) {
208
            this.resourcesReadonly.put(resourcesTableName,readonly);
209
        }
210
211
        public boolean isResourcesReadOnly(String resourcesTableName) {
212
            return this.resourcesReadonly.getOrDefault(resourcesTableName,false);
213
        }
214 45578 jjdelcerro
    }
215 45152 fdiaz
216 45578 jjdelcerro
    private static class CachedCustomResourcesConfig extends CachedValue<CustomResourcesConfig> {
217
218
        private final JDBCStoreParameters openParameters;
219
220
        private CachedCustomResourcesConfig(JDBCStoreParameters openParameters) {
221
            this.openParameters = openParameters;
222
            this.setExpireTime(30*60*1000); // 30min
223
        }
224
225
        @Override
226
        protected void reload() {
227
            String jsonConfig = getConfigValue(this.openParameters, CONFIG_NAME_CUSTOM_RESOURCES);
228
            CustomResourcesConfig config = new CustomResourcesConfig(jsonConfig);
229
            this.setExpireTime(config.getCacheExpireTimeInMillis());
230
            this.setValue(config);
231
        }
232
233
    }
234
235 45481 fdiaz
    private static class CachedTablesValue extends CachedValue<List<JDBCStoreParameters>> {
236 45578 jjdelcerro
237 45152 fdiaz
        private final int mode;
238 45165 jjdelcerro
        private final JDBCServerExplorerParameters serverParameters;
239 45152 fdiaz
        private final boolean informationTables;
240 45614 fdiaz
        private JDBCHelper helper;
241 45627 fdiaz
        private final int tablesOrViews;
242 45578 jjdelcerro
243 45627 fdiaz
        public CachedTablesValue(JDBCHelper helper, int mode, JDBCServerExplorerParameters serverParameters, boolean informationTables, int tablesOrViews) {
244 45152 fdiaz
            this.mode = mode;
245 45165 jjdelcerro
            this.serverParameters = serverParameters;
246 45152 fdiaz
            this.informationTables = informationTables;
247 45481 fdiaz
            this.helper = helper;
248 45627 fdiaz
            this.tablesOrViews = tablesOrViews;
249 45152 fdiaz
        }
250 45578 jjdelcerro
251 45627 fdiaz
        public CachedTablesValue(JDBCHelper helper, int mode, JDBCServerExplorerParameters serverParameters, boolean informationTables, long expireTime, int tablesOrViews) {
252 45152 fdiaz
            this.mode = mode;
253
            this.setExpireTime(expireTime);
254 45165 jjdelcerro
            this.serverParameters = serverParameters;
255 45152 fdiaz
            this.informationTables = informationTables;
256 45481 fdiaz
            this.helper = helper;
257 45627 fdiaz
            this.tablesOrViews = tablesOrViews;
258 45152 fdiaz
        }
259 45578 jjdelcerro
260 45152 fdiaz
        @Override
261
        protected void reload() {
262 45156 jjdelcerro
            List<JDBCStoreParameters> tables = null;
263 45614 fdiaz
            if(helper == null){
264
                this.setValue(tables);
265
                return;
266
            }
267 45481 fdiaz
            OperationsFactory operations = helper.getOperations();
268 45578 jjdelcerro
            if (operations == null) {
269 45481 fdiaz
                this.setValue(null);
270
                LOG.debug("Sets tables to null to force reload tables from new ServerExplorar.");
271
                return;
272
            }
273 45156 jjdelcerro
            try {
274 45481 fdiaz
                ListTablesOperation listTables = operations.createListTables(
275 45627 fdiaz
                        this.mode, serverParameters, informationTables, tablesOrViews
276 45156 jjdelcerro
                );
277
                tables = (List<JDBCStoreParameters>) listTables.perform();
278 45578 jjdelcerro
            } catch (Exception ex) {
279 45481 fdiaz
                LOG.debug("Can't reload cached list of tables.", ex);
280 45156 jjdelcerro
            }
281 45152 fdiaz
            this.setValue(tables);
282
        }
283 45614 fdiaz
284
        public JDBCHelper getHelper(){
285
            return this.helper;
286
        }
287
288
        public void dispose() {
289
            this.helper = null;
290
        }
291 45152 fdiaz
    }
292
293 43020 jjdelcerro
    public JDBCServerExplorerBase(
294
            JDBCServerExplorerParameters parameters,
295
            DataServerExplorerProviderServices services,
296
            JDBCHelper helper
297 45578 jjdelcerro
    ) throws InitializeException {
298 43020 jjdelcerro
        super(parameters, services);
299
        this.helper = helper;
300
    }
301
302
    @Override
303
    public String getProviderName() {
304
        return this.getHelper().getProviderName();
305
    }
306
307
    @Override
308
    public String getStoreName() {
309
        return this.getHelper().getProviderName();
310
    }
311
312
    protected DataManagerProviderServices getManager() {
313
        return (DataManagerProviderServices) DALLocator.getDataManager();
314
    }
315 45578 jjdelcerro
316 43020 jjdelcerro
    @Override
317
    public JDBCServerExplorerParameters getParameters() {
318
        return (JDBCServerExplorerParameters) super.getParameters();
319
    }
320 45578 jjdelcerro
321 43020 jjdelcerro
    @Override
322
    public boolean closeResourceRequested(ResourceProvider resource) {
323
        this.getHelper().getResulSetControler().pack();
324
        return true;
325
    }
326
327
    @Override
328
    public void resourceChanged(ResourceProvider resource) {
329
        // Nothing to do
330
    }
331
332
    protected JDBCHelper getHelper() {
333
        return helper;
334
    }
335 45578 jjdelcerro
336 43020 jjdelcerro
    protected OperationsFactory getOperations() {
337
        return this.getHelper().getOperations();
338
    }
339
340
    @Override
341
    public DataStore open(DataStoreParameters params) throws DataException {
342
        checkIsMine(params);
343
        DataStore store = super.open(params);
344
        return store;
345
    }
346
347
    @Override
348 46208 jjdelcerro
    public DataStore open(String tableName) throws DataException {
349
        JDBCStoreParameters params = this.get(tableName);
350
        DataStore store = super.open(params);
351
        return store;
352
    }
353
354
    @Override
355 43020 jjdelcerro
    public List list(int mode) throws DataException {
356 45627 fdiaz
        return list(mode, SHOW_TABLES_AND_VIEWS);
357
    }
358
359
    @Override
360
    public List list(int mode, int tablesOrViews) throws DataException {
361 43020 jjdelcerro
        boolean informationTables = BooleanUtils.isTrue(
362
                this.getParameters().getShowInformationDBTables()
363
        );
364 45578 jjdelcerro
365 45165 jjdelcerro
        JDBCServerExplorerParameters serverParams = this.getParameters();
366 45152 fdiaz
367 45627 fdiaz
        String key = buildKeyForCachedTables(mode, serverParams, informationTables, tablesOrViews);
368 45156 jjdelcerro
        CachedValue<List<JDBCStoreParameters>> tablesValue = CACHED_TABLES.get(key);
369
        List<JDBCStoreParameters> tables = null;
370 45578 jjdelcerro
        if (tablesValue != null) {
371 45156 jjdelcerro
            tables = tablesValue.get();
372 45152 fdiaz
        }
373 45578 jjdelcerro
        if (tables != null) {
374 45156 jjdelcerro
            return tables;
375
        }
376 45627 fdiaz
        tablesValue = new CachedTablesValue(this.helper, mode, serverParams, informationTables, 60000, tablesOrViews); //60"
377 45156 jjdelcerro
        CACHED_TABLES.put(key, tablesValue);
378
        tables = tablesValue.get();
379
        return tables;
380 43020 jjdelcerro
    }
381
382 45627 fdiaz
    public String buildKeyForCachedTables(int mode, JDBCServerExplorerParameters params, boolean informationTables, int tablesOrViews) {
383 45165 jjdelcerro
        JDBCServerExplorerParameters clonedParams = (JDBCServerExplorerParameters) params.getCopy();
384 45152 fdiaz
        clonedParams.setSchema(null); //ListTableOperation no usa el schema
385 45578 jjdelcerro
386 45152 fdiaz
        StringBuilder builder = new StringBuilder();
387
        builder.append(String.valueOf(mode));
388
        builder.append(Hex.encodeHex(clonedParams.toByteArray()));
389
        builder.append(String.valueOf(informationTables));
390 45627 fdiaz
        builder.append(String.valueOf(tablesOrViews));
391 45152 fdiaz
        String key = builder.toString();
392
        return key;
393
    }
394 45578 jjdelcerro
395 43020 jjdelcerro
    @Override
396
    public void remove(DataStoreParameters theParams) throws RemoveException {
397
        JDBCStoreParameters params = (JDBCStoreParameters) theParams;
398
        DropTableOperation removeTable = this.getOperations().createDropTable(
399 44058 jjdelcerro
                this.getOperations().createTableReference(params)
400 43020 jjdelcerro
        );
401 45578 jjdelcerro
        if ((Boolean) removeTable.perform()) {
402 45165 jjdelcerro
            this.dropCachedTables();
403 45152 fdiaz
        }
404 43020 jjdelcerro
    }
405
406
    @Override
407
    public JDBCStoreParameters getOpenParameters() throws DataException {
408 45165 jjdelcerro
        JDBCStoreParameters params = this.helper.createOpenStoreParameters(this.getParameters());
409 43020 jjdelcerro
        return params;
410
    }
411
412
    @Override
413 44304 jjdelcerro
    public NewDataStoreParameters getAddParameters(String storeName)
414
            throws DataException {
415
        JDBCNewStoreParameters params = this.getAddParameters();
416
        params.setTable(storeName);
417
        return params;
418
    }
419
420
    @Override
421 43020 jjdelcerro
    public JDBCNewStoreParameters getAddParameters() throws DataException {
422
        JDBCServerExplorerParameters parameters = getParameters();
423
        JDBCNewStoreParameters params = this.helper.createNewStoreParameters();
424
        params.setHost(parameters.getHost());
425
        params.setPort(parameters.getPort());
426
        params.setDBName(parameters.getDBName());
427
        params.setUser(parameters.getUser());
428
        params.setPassword(parameters.getPassword());
429
        params.setCatalog(parameters.getCatalog());
430
        params.setSchema(parameters.getSchema());
431
        params.setJDBCDriverClassName(parameters.getJDBCDriverClassName());
432
        params.setUrl(parameters.getUrl());
433 45578 jjdelcerro
        if (parameters instanceof FilesystemStoreParameters) {
434 43377 jjdelcerro
            File f = ((FilesystemStoreParameters) parameters).getFile();
435
            ((FilesystemStoreParameters) params).setFile(f);
436
        }
437 43020 jjdelcerro
438
        params.setDefaultFeatureType(this.getServerExplorerProviderServices()
439
                .createNewFeatureType());
440
441
        return params;
442
    }
443
444
    protected void checkIsMine(DataStoreParameters dsp) {
445
        if (!(dsp instanceof JDBCConnectionParameters)) {
446
            throw new IllegalArgumentException(
447
                    "not instance of FilesystemStoreParameters");
448
        }
449
        JDBCServerExplorerParameters parameters = getParameters();
450
451
        JDBCConnectionParameters pgp = (JDBCConnectionParameters) dsp;
452 45578 jjdelcerro
        if (!StringUtils.equals(pgp.getHost(), parameters.getHost())) {
453 43020 jjdelcerro
            throw new IllegalArgumentException("wrong explorer: Host (mine: "
454
                    + parameters.getHost() + " other:" + pgp.getHost() + ")");
455
        }
456 45578 jjdelcerro
        if (!ObjectUtils.equals(pgp.getPort(), parameters.getPort())) {
457 43020 jjdelcerro
            throw new IllegalArgumentException("wrong explorer: Port (mine: "
458
                    + parameters.getPort() + " other:" + pgp.getPort() + ")");
459
        }
460 45578 jjdelcerro
        if (!StringUtils.equals(pgp.getDBName(), parameters.getDBName())) {
461 43020 jjdelcerro
            throw new IllegalArgumentException("wrong explorer: DBName (mine: "
462
                    + parameters.getDBName() + " other:" + pgp.getDBName()
463
                    + ")");
464
        }
465 45578 jjdelcerro
        if (!StringUtils.isEmpty(parameters.getCatalog())) {
466
            if (!StringUtils.equals(pgp.getCatalog(), parameters.getCatalog())) {
467 43020 jjdelcerro
                throw new IllegalArgumentException(
468
                        "wrong explorer: Catalog (mine: "
469
                        + parameters.getCatalog() + " other:"
470
                        + pgp.getCatalog() + ")");
471
            }
472
        }
473 45578 jjdelcerro
        if (!StringUtils.isEmpty(parameters.getSchema())) {
474
            if (!StringUtils.equals(pgp.getSchema(), parameters.getSchema())) {
475 43020 jjdelcerro
                throw new IllegalArgumentException(
476
                        "wrong explorer: Schema (mine: "
477
                        + parameters.getSchema() + " other:"
478
                        + pgp.getSchema() + ")");
479
            }
480
        }
481
    }
482
483
    @Override
484
    public void open() throws OpenException {
485
486
    }
487
488
    @Override
489
    public void close() throws CloseException {
490
491
    }
492
493
    @Override
494
    protected void doDispose() throws BaseException {
495 45614 fdiaz
        synchronized (CACHED_TABLES) {
496
            List<String> toRemove = new ArrayList<>();
497
            for (Map.Entry<String, CachedValue<List<JDBCStoreParameters>>> entry : CACHED_TABLES.entrySet()) {
498
                CachedTablesValue value = (CachedTablesValue) entry.getValue();
499
                if (value.getHelper() == this.helper) {
500
                    toRemove.add(entry.getKey());
501
                    value.dispose();
502
                }
503
            }
504
            for (String key : toRemove) {
505
                CACHED_TABLES.remove(key);
506
            }
507
            helper.dispose();
508
            helper = null;
509
        }
510 43020 jjdelcerro
    }
511
512
    @Override
513
    public boolean canAdd() {
514
        if (this.canAdd == null) {
515 44058 jjdelcerro
            CanCreateTablesOperation canAdd_ = this.getOperations().createCanCreateTables();
516
            this.canAdd = (Boolean) canAdd_.perform();
517 43020 jjdelcerro
        }
518
        return this.canAdd;
519
    }
520
521
    @Override
522
    public FeatureType getFeatureType(DataStoreParameters theParams)
523
            throws DataException {
524 45578 jjdelcerro
525
        JDBCStoreParameters params = (JDBCStoreParameters) theParams;
526
527 43020 jjdelcerro
        checkIsMine(params);
528
529 45578 jjdelcerro
        EditableFeatureType fetureType
530
                = this.getServerExplorerProviderServices().createNewFeatureType();
531
532 43020 jjdelcerro
        List<String> primaryKeys = null;
533 45578 jjdelcerro
        if (params.getPkFields() != null) {
534 43020 jjdelcerro
            primaryKeys = Arrays.asList(params.getPkFields());
535
        }
536 45578 jjdelcerro
537 43020 jjdelcerro
        FetchFeatureTypeOperation fetch = this.getOperations().createFetchFeatureType(
538 45578 jjdelcerro
                fetureType,
539 44058 jjdelcerro
                this.getOperations().createTableReference(params),
540 43020 jjdelcerro
                primaryKeys,
541
                params.getDefaultGeometryField(),
542
                params.getCRS()
543
        );
544
        fetch.perform();
545
        return fetureType;
546
    }
547
548
    @Override
549
    public boolean add(String providerName, NewDataStoreParameters theParams, boolean overwrite)
550
            throws DataException {
551
552
        List<Pair<String, Privilege>> userAndPrivileges = new ArrayList<>();
553 45578 jjdelcerro
        JDBCNewStoreParameters params = (JDBCNewStoreParameters) theParams;
554
        if (!StringUtils.isEmpty(params.getAllRole())) {
555
            userAndPrivileges.add(
556
                    new ImmutablePair<>(params.getAllRole(), Privilege.ALL)
557 43020 jjdelcerro
            );
558
        }
559 45578 jjdelcerro
        if (!StringUtils.isEmpty(params.getDeleteRole())) {
560
            userAndPrivileges.add(
561
                    new ImmutablePair<>(params.getDeleteRole(), Privilege.DELETE)
562 43020 jjdelcerro
            );
563
        }
564 45578 jjdelcerro
        if (!StringUtils.isEmpty(params.getInsertRole())) {
565
            userAndPrivileges.add(
566
                    new ImmutablePair<>(params.getInsertRole(), Privilege.INSERT)
567 43020 jjdelcerro
            );
568
        }
569 45578 jjdelcerro
        if (!StringUtils.isEmpty(params.getReferenceRole())) {
570
            userAndPrivileges.add(
571
                    new ImmutablePair<>(params.getReferenceRole(), Privilege.REFERENCE)
572 43020 jjdelcerro
            );
573
        }
574 45578 jjdelcerro
        if (!StringUtils.isEmpty(params.getSelectRole())) {
575
            userAndPrivileges.add(
576
                    new ImmutablePair<>(params.getSelectRole(), Privilege.SELECT)
577 43020 jjdelcerro
            );
578
        }
579 45578 jjdelcerro
        if (!StringUtils.isEmpty(params.getTriggerRole())) {
580
            userAndPrivileges.add(
581
                    new ImmutablePair<>(params.getTriggerRole(), Privilege.TRIGGER)
582 43020 jjdelcerro
            );
583
        }
584 45578 jjdelcerro
        if (!StringUtils.isEmpty(params.getTruncateRole())) {
585
            userAndPrivileges.add(
586
                    new ImmutablePair<>(params.getTruncateRole(), Privilege.TRUNCATE)
587 43020 jjdelcerro
            );
588
        }
589 45578 jjdelcerro
        if (!StringUtils.isEmpty(params.getUpdateRole())) {
590
            userAndPrivileges.add(
591
                    new ImmutablePair<>(params.getUpdateRole(), Privilege.UPDATE)
592 43020 jjdelcerro
            );
593
        }
594 45578 jjdelcerro
        List<String> additionalSQLs = new ArrayList<>();
595
        if (!StringUtils.isEmpty(params.getPostCreatingStatement())) {
596 43020 jjdelcerro
            additionalSQLs.add(params.getPostCreatingStatement());
597
        }
598
        CreateTableOperation createTable = this.getOperations().createTable(
599 44058 jjdelcerro
                this.getOperations().createTableReference(params),
600 43020 jjdelcerro
                params.getDefaultFeatureType(),
601 45578 jjdelcerro
                userAndPrivileges,
602 43020 jjdelcerro
                additionalSQLs
603
        );
604 45152 fdiaz
605 44328 jjdelcerro
        boolean isOk = (boolean) createTable.perform();
606 45578 jjdelcerro
        if (!isOk) {
607 44328 jjdelcerro
            return false;
608
        }
609 45578 jjdelcerro
610 45152 fdiaz
        // We collect the featureType of the operation because
611
        // the provider has been able to make changes to it
612
        params.setDefaultFeatureType(createTable.getType());
613
614 45578 jjdelcerro
        if (theParams instanceof NewFeatureStoreParameters) {
615 44328 jjdelcerro
            DataManager dataManager = DALLocator.getDataManager();
616
            ResourcesStorage resources = this.getResourcesStorage(theParams);
617
            dataManager.writeDALResource(resources, ((NewFeatureStoreParameters) theParams).getDefaultFeatureType());
618
        }
619 45165 jjdelcerro
        this.dropCachedTables();
620 44328 jjdelcerro
        return true;
621 43020 jjdelcerro
    }
622 45578 jjdelcerro
623 45165 jjdelcerro
    private void dropCachedTables() {
624
        boolean informationTables = BooleanUtils.isTrue(
625 45578 jjdelcerro
                this.getParameters().getShowInformationDBTables()
626 45165 jjdelcerro
        );
627 45614 fdiaz
        synchronized(CACHED_TABLES){
628 45627 fdiaz
            CACHED_TABLES.remove(buildKeyForCachedTables(MODE_ALL, this.getParameters(), informationTables, SHOW_TABLES_AND_VIEWS));
629
            CACHED_TABLES.remove(buildKeyForCachedTables(MODE_FEATURE, this.getParameters(), informationTables, SHOW_TABLES_AND_VIEWS));
630
            CACHED_TABLES.remove(buildKeyForCachedTables(MODE_GEOMETRY, this.getParameters(), informationTables, SHOW_TABLES_AND_VIEWS));
631
            CACHED_TABLES.remove(buildKeyForCachedTables(MODE_ALL, this.getParameters(), informationTables, SHOW_TABLES));
632
            CACHED_TABLES.remove(buildKeyForCachedTables(MODE_FEATURE, this.getParameters(), informationTables, SHOW_TABLES));
633
            CACHED_TABLES.remove(buildKeyForCachedTables(MODE_GEOMETRY, this.getParameters(), informationTables, SHOW_TABLES));
634
            CACHED_TABLES.remove(buildKeyForCachedTables(MODE_ALL, this.getParameters(), informationTables, SHOW_VIEWS));
635
            CACHED_TABLES.remove(buildKeyForCachedTables(MODE_FEATURE, this.getParameters(), informationTables, SHOW_VIEWS));
636
            CACHED_TABLES.remove(buildKeyForCachedTables(MODE_GEOMETRY, this.getParameters(), informationTables, SHOW_VIEWS));
637 45614 fdiaz
        }
638 45165 jjdelcerro
    }
639 43020 jjdelcerro
640
    @Override
641
    public List getDataStoreProviderNames() {
642
        List x = new ArrayList(1);
643
        x.add(this.getProviderName());
644
        return x;
645
    }
646
647
    @Override
648
    public void updateTableStatistics(String database, String schema, String table) throws JDBCExecuteSQLException {
649
        UpdateTableStatisticsOperation updateStatistics = this.getOperations().createUpdateTableStatistics(
650 44058 jjdelcerro
                this.getOperations().createTableReference(database, schema, table, null)
651 43020 jjdelcerro
        );
652
        updateStatistics.perform();
653
    }
654
655
    @Override
656 45425 jjdelcerro
    public Object execute(String sql) {
657 43377 jjdelcerro
        ExecuteOperation execute = this.getOperations().createExecute(sql);
658 45425 jjdelcerro
        return execute.perform();
659 43377 jjdelcerro
    }
660
661
    @Override
662 44297 jjdelcerro
    public JDBCStoreParameters get(String name) throws DataException {
663 43020 jjdelcerro
        JDBCStoreParameters params = this.getOpenParameters();
664
        params.setTable(name);
665
        return params;
666
    }
667
668
    @Override
669
    public SQLBuilder createSQLBuilder() {
670 44632 jjdelcerro
        JDBCSQLBuilderBase builder = this.getHelper().createSQLBuilder();
671
        return builder;
672 43020 jjdelcerro
    }
673 44297 jjdelcerro
674 45578 jjdelcerro
    private CustomResourcesConfig getCustomResourcesConfig() {
675
        JDBCServerExplorerParameters serverParams = this.getParameters();
676 45627 fdiaz
        String key = buildKeyForCachedTables(MODE_ALL, serverParams, false, SHOW_TABLES_AND_VIEWS); //???
677 45578 jjdelcerro
        CachedValue<CustomResourcesConfig> cachedConfig = CACHED_CUSTOM_RESOURCES_CONFIG.get(key);
678
        if (cachedConfig != null) {
679
            CustomResourcesConfig config = cachedConfig.get();
680 45764 jjdelcerro
//            LOG.info("Return custom resource from CACHE.");
681 45578 jjdelcerro
            return config;
682
        }
683
        JDBCStoreParameters params = this.helper.createOpenStoreParameters(this.getParameters());
684
        cachedConfig = new CachedCustomResourcesConfig(params);
685
        CACHED_CUSTOM_RESOURCES_CONFIG.put(key, cachedConfig);
686
        return cachedConfig.get();
687
    }
688 45697 jjdelcerro
689
    private void refreshCustomResourcesConfig() {
690
        JDBCServerExplorerParameters serverParams = this.getParameters();
691
        String key = buildKeyForCachedTables(MODE_ALL, serverParams, false, SHOW_TABLES_AND_VIEWS); //???
692
        CachedValue<CustomResourcesConfig> cachedConfig = CACHED_CUSTOM_RESOURCES_CONFIG.get(key);
693
        if (cachedConfig != null) {
694
            cachedConfig.expired();
695
        }
696
    }
697 45578 jjdelcerro
698 44328 jjdelcerro
    private ResourcesStorage getResourcesStorage(DataStoreParameters parameters, String storeName) {
699 45578 jjdelcerro
        if (DatabaseWorkspaceManager.isInternalTable(storeName)) {
700
            EmptyResourcesStorage resourcesStorage = new EmptyResourcesStorage();
701
            return resourcesStorage;
702
        }
703
        String resourcesTablename = null;
704
        try {
705 44346 jjdelcerro
            ResourcesStorage alternateResourcesStorage = null;
706 45578 jjdelcerro
            DataManager dataManager = DALLocator.getDataManager();
707
            DatabaseWorkspaceManager workspace = dataManager.getDatabaseWorkspace(parameters);
708
            if (workspace != null) {
709
                alternateResourcesStorage = workspace.getAlternativeResourcesStorage(storeName);
710
            }
711
712 45773 jjdelcerro
            ResourcesStorage defaultResourcesStorage = null;
713
            ResourcesStorage customResourcesStorage = null;
714
715 45578 jjdelcerro
            // TODO: Habria que ver de localizar los parametros sin tener que hacer un list.
716
            resourcesTablename = TABLE_RESOURCES_NAME;
717
            List<JDBCStoreParameters> tables = this.list();
718
            for (JDBCStoreParameters params : tables) {
719
                String theTableName = params.getTable();
720
                if (StringUtils.equals(theTableName, resourcesTablename)) {
721 45773 jjdelcerro
                    defaultResourcesStorage = new JDBCResourcesStorage(
722 46277 jjdelcerro
                            this.helper,
723 45578 jjdelcerro
                            alternateResourcesStorage,
724
                            params,
725
                            storeName
726
                    );
727 45773 jjdelcerro
                    break;
728 44346 jjdelcerro
                }
729
            }
730 45773 jjdelcerro
            CustomResourcesConfig config = getCustomResourcesConfig();
731
            if( config!=null ) {
732
                if( config.isInternalTable(storeName) ) {
733
                    defaultResourcesStorage = new EmptyResourcesStorage();
734
                } else {
735
                    resourcesTablename = config.getResourcesTablename(storeName);
736
                    if( StringUtils.isNotBlank(resourcesTablename) ) {
737
                        JDBCStoreParameters params = this.getOpenParameters();
738
                        params.setTable(resourcesTablename);
739
                        customResourcesStorage = new JDBCResourcesStorage(
740 46277 jjdelcerro
                                this.helper,
741 45773 jjdelcerro
                                alternateResourcesStorage,
742
                                params,
743
                                storeName,
744
                                config.isResourcesReadOnly(resourcesTablename)
745
                        );
746
                    }
747
                }
748
            }
749
            return new CompoundResourcesStorage(defaultResourcesStorage, customResourcesStorage);
750 45578 jjdelcerro
        } catch (Throwable ex) {
751
            LOG.warn("Can't retrieve reources storage for table '" + storeName + "' in '" + this.getParameters().getUrl() + " ("+resourcesTablename+").", ex);
752 44297 jjdelcerro
        }
753 44328 jjdelcerro
        EmptyResourcesStorage theResourcesStorage = new EmptyResourcesStorage();
754 45578 jjdelcerro
        return theResourcesStorage;
755 44297 jjdelcerro
    }
756 45578 jjdelcerro
757 44632 jjdelcerro
    @Override
758 44419 jjdelcerro
    public ResourcesStorage getResourcesStorage() {
759
        JDBCStoreParameters params;
760
        try {
761
            params = this.getOpenParameters();
762 44439 jjdelcerro
            params.setTable(DatabaseWorkspaceManager.TABLE_RESOURCES_NAME);
763 44419 jjdelcerro
            JDBCResourcesStorage theResourcesStorage = new JDBCResourcesStorage(
764 46277 jjdelcerro
                    this.helper,
765 44419 jjdelcerro
                    null,
766
                    params,
767 44750 jjdelcerro
                    "$ServerExplorer"
768 44419 jjdelcerro
            );
769
            return theResourcesStorage;
770
        } catch (DataException ex) {
771
            return null;
772
        }
773
    }
774 45578 jjdelcerro
775 44328 jjdelcerro
    @Override
776
    public ResourcesStorage getResourcesStorage(DataStoreParameters parameters) {
777 45578 jjdelcerro
        if (parameters == null) {
778 44328 jjdelcerro
            throw new IllegalArgumentException("null is a valid value for parameters.");
779
        }
780
        String tableName;
781 45578 jjdelcerro
        if (parameters instanceof JDBCNewStoreParameters) {
782
            tableName = ((JDBCNewStoreParameters) parameters).getTable();
783
        } else if (parameters instanceof JDBCStoreParameters) {
784
            tableName = ((JDBCStoreParameters) parameters).getTable();
785 44328 jjdelcerro
        } else {
786 45578 jjdelcerro
            throw new IllegalArgumentException("Required a JDBCStoreParameters or JDBCNewStoreParameters parameters, received " + parameters.getClass().getName() + ".");
787 44328 jjdelcerro
        }
788
        return this.getResourcesStorage(parameters, tableName);
789
    }
790 45578 jjdelcerro
791 44328 jjdelcerro
    @Override
792
    public ResourcesStorage getResourcesStorage(DataStore dataStore) {
793
        return this.getResourcesStorage(
794 45578 jjdelcerro
                (JDBCStoreParameters) dataStore.getParameters(),
795 44328 jjdelcerro
                dataStore.getName()
796
        );
797
    }
798 44329 jjdelcerro
799
    @Override
800
    public boolean exists(DataStoreParameters parameters) throws DataException {
801
        JDBCStoreParameters params = (JDBCStoreParameters) parameters;
802
        JDBCSQLBuilderBase builder = this.getHelper().createSQLBuilder();
803
        SQLBuilder.TableNameBuilder searchTable = builder.createTableNameBuilder()
804
                .database(params.getDBName())
805
                .schema(params.getSchema())
806
                .name(params.getTable());
807
        SQLBuilder.TableNameBuilder table = builder.createTableNameBuilder();
808 45578 jjdelcerro
809 44329 jjdelcerro
        List<JDBCStoreParameters> l = this.list();
810
        for (JDBCStoreParameters current : l) {
811
            table.database(current.getDBName())
812 45578 jjdelcerro
                    .schema(current.getSchema())
813
                    .name(current.getTable());
814
            if (table.equals(searchTable)) {
815 44329 jjdelcerro
                return true;
816
            }
817
        }
818
        return false;
819
    }
820
821 45578 jjdelcerro
    @Override
822
    public void setCustomResources(String tableName, String resourcesTableName) {
823 45697 jjdelcerro
        this.setCustomResources(tableName, resourcesTableName, false);
824
    }
825
826
    @Override
827
    public void setCustomResources(String tableName, String resourcesTableName, boolean readonly) {
828 45578 jjdelcerro
        CustomResourcesConfig config = getCustomResourcesConfig();
829
        if( config==null ) {
830
            throw new RuntimeException("Can't retrieve alternative resources configuration");
831
        }
832
        config.addResourceMapping(tableName, resourcesTableName);
833 45697 jjdelcerro
        config.setResourcesReadOnly(resourcesTableName,readonly);
834 45578 jjdelcerro
        JDBCStoreParameters params = this.helper.createOpenStoreParameters(this.getParameters());
835 45767 fdiaz
        if(!setConfigValue(params, CONFIG_NAME_CUSTOM_RESOURCES, config.toJsonString())) {
836
            throw new RuntimeException("Can't save custom resources configuration");
837
        }
838 45697 jjdelcerro
        refreshCustomResourcesConfig();
839 45736 fdiaz
840
841
        if (StringUtils.isNotBlank(resourcesTableName)) {
842
            try {
843
                params = this.getOpenParameters();
844
                params.setTable(resourcesTableName);
845
                JDBCResourcesStorage resourcesStorage = new JDBCResourcesStorage(
846 46277 jjdelcerro
                        this.helper,
847 45736 fdiaz
                        null,
848
                        params,
849
                        tableName,
850
                        config.isResourcesReadOnly(resourcesTableName)
851
                );
852
                resourcesStorage.clearCache();
853
            } catch (Exception ex) {
854
                LOG.debug("Can't remove local cache for table "+tableName, ex);
855
            }
856
        }
857
858
859 45578 jjdelcerro
    }
860
861
    private static boolean setConfigValue(JDBCStoreParameters params, String name, String value) {
862
        FeatureStore store = null;
863
        try {
864
            DataManager dataManager = DALLocator.getDataManager();
865
            params.setTable(TABLE_CONFIGURATION_NAME);
866
            store = (FeatureStore) dataManager.openStore(
867
                    params.getProviderName(),
868
                    params
869
            );
870
        } catch (Exception ex) {
871
            LOG.trace("Can't read configuration value '"+name+"'", ex);
872
            // Do noting
873 45581 fdiaz
//        } finally {
874
//            DisposeUtils.disposeQuietly(store);
875 45578 jjdelcerro
        }
876
        if( store == null ) {
877
            return false;
878
        }
879
        try {
880
            store.edit();
881
            ExpressionBuilder builder = ExpressionUtils.createExpressionBuilder();
882
            String filter = builder.eq(
883
                    builder.column(FIELD_CONFIGURATION_NAME),
884
                    builder.constant(name)
885
            ).toString();
886
            Feature feature = store.findFirst(filter);
887
            EditableFeature efeature;
888
            if (feature == null) {
889
                efeature = store.createNewFeature();
890
                efeature.set(FIELD_CONFIGURATION_NAME, name);
891
                efeature.set(FIELD_CONFIGURATION_VALUE, value);
892
                store.insert(efeature);
893
            } else {
894
                efeature = feature.getEditable();
895
                efeature.set(FIELD_CONFIGURATION_VALUE, value);
896
                store.update(efeature);
897
            }
898
            store.finishEditing();
899
            return true;
900
        } catch (Exception ex) {
901 45581 fdiaz
            LOG.debug("Can't write configuration value for '"+name+"'", ex);
902 45578 jjdelcerro
            return false;
903
        } finally {
904
            DisposeUtils.disposeQuietly(store);
905
        }
906
    }
907
908
    private static String getConfigValue(JDBCStoreParameters params, String name) {
909
        FeatureStore store = null;
910
        try {
911
            DataManager dataManager = DALLocator.getDataManager();
912
            params.setTable(TABLE_CONFIGURATION_NAME);
913
            store = (FeatureStore) dataManager.openStore(
914
                    params.getProviderName(),
915
                    params
916
            );
917
        } catch (Exception ex) {
918
            LOG.trace("Can't read configuration value '"+name+"'", ex);
919
            // Do noting
920 45581 fdiaz
//        } finally {
921
//            DisposeUtils.disposeQuietly(store);
922 45578 jjdelcerro
        }
923
        if( store == null ) {
924
            return null;
925
        }
926
        try {
927
            ExpressionBuilder builder = ExpressionUtils.createExpressionBuilder();
928
            String filter = builder.eq(
929
                    builder.column(FIELD_CONFIGURATION_NAME),
930
                    builder.constant(name)
931
            ).toString();
932
            Feature feature = store.findFirst(filter);
933
            if( feature == null ) {
934
                return null;
935
            }
936
            String value = feature.getString(FIELD_CONFIGURATION_VALUE);
937
            return value;
938
939
        } catch (Exception ex) {
940 45581 fdiaz
            LOG.debug("Can't read configuration value '"+name+"'", ex);
941 45578 jjdelcerro
            return null;
942
        } finally {
943
            DisposeUtils.disposeQuietly(store);
944
        }
945
    }
946 45867 jjdelcerro
947
    @Override
948
    public boolean exists() {
949
        try {
950
            JDBCServerExplorerParameters serverParameters = this.getParameters();
951
            OperationsFactory operations = helper.getOperations();
952
            ListTablesOperation listTables = operations.createListTables(
953
                    MODE_ALL, serverParameters, false, SHOW_TABLES
954
            );
955
            List<JDBCStoreParameters> tables = (List<JDBCStoreParameters>) listTables.perform();
956
            return true;
957
        } catch(Throwable th) {
958
            return false;
959
        }
960
    }
961
962 46120 jjdelcerro
    @Override
963
    public String getConnectionProviderStatus() {
964
        return this.helper.getConnectionProviderStatus();
965
    }
966
967 45578 jjdelcerro
968 43020 jjdelcerro
}