Revision 45614 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
JDBCServerExplorerBase.java | ||
---|---|---|
24 | 24 |
package org.gvsig.fmap.dal.store.jdbc2.spi; |
25 | 25 |
|
26 | 26 |
import java.io.File; |
27 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
|
28 | 27 |
import java.util.ArrayList; |
29 | 28 |
import java.util.Arrays; |
30 | 29 |
import java.util.Collections; |
... | ... | |
53 | 52 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_CONFIGURATION_NAME; |
54 | 53 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_RESOURCES_NAME; |
55 | 54 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
55 |
import org.gvsig.fmap.dal.SQLBuilder; |
|
56 |
import org.gvsig.fmap.dal.SQLBuilder.Privilege; |
|
56 | 57 |
import org.gvsig.fmap.dal.exception.CloseException; |
57 | 58 |
import org.gvsig.fmap.dal.exception.DataException; |
58 | 59 |
import org.gvsig.fmap.dal.exception.InitializeException; |
59 | 60 |
import org.gvsig.fmap.dal.exception.OpenException; |
60 | 61 |
import org.gvsig.fmap.dal.exception.RemoveException; |
62 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
61 | 63 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
62 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
63 |
import org.gvsig.fmap.dal.SQLBuilder; |
|
64 |
import org.gvsig.fmap.dal.SQLBuilder.Privilege; |
|
65 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
66 | 64 |
import org.gvsig.fmap.dal.feature.Feature; |
67 | 65 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
66 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
68 | 67 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
69 | 68 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
70 | 69 |
import org.gvsig.fmap.dal.serverexplorer.db.spi.AbstractDBServerExplorer; |
... | ... | |
77 | 76 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
78 | 77 |
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCExecuteSQLException; |
79 | 78 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper; |
79 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
|
80 | 80 |
import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory; |
81 | 81 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.CanCreateTablesOperation; |
82 | 82 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.CreateTableOperation; |
83 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.DropTableOperation; |
|
84 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.ExecuteOperation; |
|
83 | 85 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.FetchFeatureTypeOperation; |
84 | 86 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.ListTablesOperation; |
85 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.DropTableOperation; |
|
86 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.ExecuteOperation; |
|
87 | 87 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.UpdateTableStatisticsOperation; |
88 | 88 |
import org.gvsig.json.Json; |
89 | 89 |
import org.gvsig.json.JsonObjectBuilder; |
... | ... | |
204 | 204 |
private final int mode; |
205 | 205 |
private final JDBCServerExplorerParameters serverParameters; |
206 | 206 |
private final boolean informationTables; |
207 |
private final JDBCHelper helper;
|
|
207 |
private JDBCHelper helper; |
|
208 | 208 |
|
209 | 209 |
public CachedTablesValue(JDBCHelper helper, int mode, JDBCServerExplorerParameters serverParameters, boolean informationTables) { |
210 | 210 |
this.mode = mode; |
... | ... | |
224 | 224 |
@Override |
225 | 225 |
protected void reload() { |
226 | 226 |
List<JDBCStoreParameters> tables = null; |
227 |
if(helper == null){ |
|
228 |
this.setValue(tables); |
|
229 |
return; |
|
230 |
} |
|
227 | 231 |
OperationsFactory operations = helper.getOperations(); |
228 | 232 |
if (operations == null) { |
229 | 233 |
this.setValue(null); |
... | ... | |
240 | 244 |
} |
241 | 245 |
this.setValue(tables); |
242 | 246 |
} |
247 |
|
|
248 |
public JDBCHelper getHelper(){ |
|
249 |
return this.helper; |
|
250 |
} |
|
251 |
|
|
252 |
public void dispose() { |
|
253 |
this.helper = null; |
|
254 |
} |
|
243 | 255 |
} |
244 | 256 |
|
245 | 257 |
public JDBCServerExplorerBase( |
... | ... | |
431 | 443 |
|
432 | 444 |
@Override |
433 | 445 |
protected void doDispose() throws BaseException { |
434 |
helper.dispose(); |
|
435 |
helper = null; |
|
446 |
synchronized (CACHED_TABLES) { |
|
447 |
List<String> toRemove = new ArrayList<>(); |
|
448 |
for (Map.Entry<String, CachedValue<List<JDBCStoreParameters>>> entry : CACHED_TABLES.entrySet()) { |
|
449 |
CachedTablesValue value = (CachedTablesValue) entry.getValue(); |
|
450 |
if (value.getHelper() == this.helper) { |
|
451 |
toRemove.add(entry.getKey()); |
|
452 |
value.dispose(); |
|
453 |
} |
|
454 |
} |
|
455 |
for (String key : toRemove) { |
|
456 |
CACHED_TABLES.remove(key); |
|
457 |
} |
|
458 |
helper.dispose(); |
|
459 |
helper = null; |
|
460 |
} |
|
436 | 461 |
} |
437 | 462 |
|
438 | 463 |
@Override |
... | ... | |
550 | 575 |
boolean informationTables = BooleanUtils.isTrue( |
551 | 576 |
this.getParameters().getShowInformationDBTables() |
552 | 577 |
); |
553 |
CACHED_TABLES.remove(buildKeyForCachedTables(MODE_ALL, this.getParameters(), informationTables)); |
|
554 |
CACHED_TABLES.remove(buildKeyForCachedTables(MODE_FEATURE, this.getParameters(), informationTables)); |
|
555 |
CACHED_TABLES.remove(buildKeyForCachedTables(MODE_GEOMETRY, this.getParameters(), informationTables)); |
|
578 |
synchronized(CACHED_TABLES){ |
|
579 |
CACHED_TABLES.remove(buildKeyForCachedTables(MODE_ALL, this.getParameters(), informationTables)); |
|
580 |
CACHED_TABLES.remove(buildKeyForCachedTables(MODE_FEATURE, this.getParameters(), informationTables)); |
|
581 |
CACHED_TABLES.remove(buildKeyForCachedTables(MODE_GEOMETRY, this.getParameters(), informationTables)); |
|
582 |
} |
|
556 | 583 |
} |
557 | 584 |
|
558 | 585 |
@Override |
Also available in: Unified diff