Revision 46338 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 | ||
---|---|---|
81 | 81 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper; |
82 | 82 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
83 | 83 |
import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory; |
84 |
import static org.gvsig.fmap.dal.store.jdbc2.spi.JDBCResourcesStorage.TABLENAME_SERVER_EXPLORER_MARK; |
|
84 | 85 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.CanCreateTablesOperation; |
85 | 86 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.CreateTableOperation; |
86 | 87 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.DropTableOperation; |
... | ... | |
227 | 228 |
@Override |
228 | 229 |
protected void reload() { |
229 | 230 |
String jsonConfig = getConfigValue(this.openParameters, CONFIG_NAME_CUSTOM_RESOURCES); |
231 |
LOGGER.info("reload CustomResourcesConfig "+jsonConfig); |
|
230 | 232 |
CustomResourcesConfig config = new CustomResourcesConfig(jsonConfig); |
231 | 233 |
this.setExpireTime(config.getCacheExpireTimeInMillis()); |
232 | 234 |
this.setValue(config); |
... | ... | |
261 | 263 |
|
262 | 264 |
@Override |
263 | 265 |
protected void reload() { |
266 |
LOGGER.info("reload list of tables"); |
|
264 | 267 |
List<JDBCStoreParameters> tables = null; |
265 | 268 |
if(helper == null){ |
266 | 269 |
this.setValue(tables); |
... | ... | |
662 | 665 |
|
663 | 666 |
@Override |
664 | 667 |
public JDBCStoreParameters get(String name) throws DataException { |
665 |
JDBCStoreParameters params = this.getOpenParameters(); |
|
666 |
params.setTable(name); |
|
668 |
JDBCStoreParameters params = this.getOpenParameters(name); |
|
667 | 669 |
return params; |
668 | 670 |
} |
669 | 671 |
|
... | ... | |
678 | 680 |
String key = buildKeyForCachedTables(MODE_ALL, serverParams, false, SHOW_TABLES_AND_VIEWS); //??? |
679 | 681 |
CachedValue<CustomResourcesConfig> cachedConfig = CACHED_CUSTOM_RESOURCES_CONFIG.get(key); |
680 | 682 |
if (cachedConfig != null) { |
683 |
LOG.info("Get CustomResourcesConfig from CACHE_1: "+!cachedConfig.isExpired()); |
|
681 | 684 |
CustomResourcesConfig config = cachedConfig.get(); |
682 |
// LOG.info("Return custom resource from CACHE."); |
|
683 | 685 |
return config; |
684 | 686 |
} |
685 | 687 |
JDBCStoreParameters params = this.helper.createOpenStoreParameters(this.getParameters()); |
686 | 688 |
cachedConfig = new CachedCustomResourcesConfig(params); |
687 | 689 |
CACHED_CUSTOM_RESOURCES_CONFIG.put(key, cachedConfig); |
690 |
LOG.info("Get CustomResourcesConfig from CACHE_2: "+!cachedConfig.isExpired()); |
|
688 | 691 |
return cachedConfig.get(); |
689 | 692 |
} |
690 | 693 |
|
... | ... | |
693 | 696 |
String key = buildKeyForCachedTables(MODE_ALL, serverParams, false, SHOW_TABLES_AND_VIEWS); //??? |
694 | 697 |
CachedValue<CustomResourcesConfig> cachedConfig = CACHED_CUSTOM_RESOURCES_CONFIG.get(key); |
695 | 698 |
if (cachedConfig != null) { |
699 |
LOG.info("Force expire CustomResourcesConfig cache"); |
|
696 | 700 |
cachedConfig.expired(); |
697 | 701 |
} |
698 | 702 |
} |
... | ... | |
736 | 740 |
} else { |
737 | 741 |
resourcesTablename = config.getResourcesTablename(storeName); |
738 | 742 |
if( StringUtils.isNotBlank(resourcesTablename) ) { |
739 |
JDBCStoreParameters params = this.getOpenParameters(); |
|
740 |
params.setTable(resourcesTablename); |
|
743 |
JDBCStoreParameters params = this.getOpenParameters(resourcesTablename); |
|
741 | 744 |
customResourcesStorage = new JDBCResourcesStorage( |
742 | 745 |
this.helper, |
743 | 746 |
alternateResourcesStorage, |
... | ... | |
760 | 763 |
public ResourcesStorage getResourcesStorage() { |
761 | 764 |
JDBCStoreParameters params; |
762 | 765 |
try { |
763 |
params = this.getOpenParameters(); |
|
764 |
params.setTable(DatabaseWorkspaceManager.TABLE_RESOURCES_NAME); |
|
766 |
params = this.getOpenParameters(DatabaseWorkspaceManager.TABLE_RESOURCES_NAME);
|
|
767 |
// params.setTable(DatabaseWorkspaceManager.TABLE_RESOURCES_NAME);
|
|
765 | 768 |
JDBCResourcesStorage theResourcesStorage = new JDBCResourcesStorage( |
766 | 769 |
this.helper, |
767 | 770 |
null, |
768 | 771 |
params, |
769 |
"$ServerExplorer"
|
|
772 |
TABLENAME_SERVER_EXPLORER_MARK
|
|
770 | 773 |
); |
771 | 774 |
return theResourcesStorage; |
772 | 775 |
} catch (DataException ex) { |
... | ... | |
842 | 845 |
|
843 | 846 |
if (StringUtils.isNotBlank(resourcesTableName)) { |
844 | 847 |
try { |
845 |
params = this.getOpenParameters(); |
|
846 |
params.setTable(resourcesTableName); |
|
848 |
params = this.getOpenParameters(resourcesTableName); |
|
847 | 849 |
JDBCResourcesStorage resourcesStorage = new JDBCResourcesStorage( |
848 | 850 |
this.helper, |
849 | 851 |
null, |
... | ... | |
981 | 983 |
return this.helper.getTransaction(); |
982 | 984 |
} |
983 | 985 |
|
986 |
private JDBCStoreParameters getOpenParameters(String tableName) throws DataException { |
|
987 |
//No esta claro si se debe hacer este bucle o no. NO BORRAR ALEGREMENTE |
|
988 |
|
|
989 |
// List<JDBCStoreParameters> tables = this.list(); |
|
990 |
// for (JDBCStoreParameters params : tables) { |
|
991 |
// String theTableName = params.getTable(); |
|
992 |
// if (StringUtils.equals(theTableName, tableName)) { |
|
993 |
// return params; |
|
994 |
// } |
|
995 |
// } |
|
996 |
JDBCStoreParameters p = this.getOpenParameters(); |
|
997 |
p.setTable(tableName); |
|
998 |
return p; |
|
999 |
} |
|
984 | 1000 |
} |
Also available in: Unified diff