Revision 45581 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

View differences:

JDBCServerExplorerBase.java
110 110

  
111 111
    private static class CustomResourcesConfig {
112 112

  
113
        private static final String CUSTOM_RESOURCES_CACHETIME = "CacheTime";
114
        private static final String CUSTOM_RESOURCES_MAPPING = "Mapping";
115

  
116

  
113 117
        private int cacheTime;
114 118
        private Map<String, String> mapping;
115 119

  
......
119 123
            if (StringUtils.isNotBlank(jsonConfig)) {
120 124
                try {
121 125
                    JsonObject config = Json.createObject(jsonConfig);
122
                    this.cacheTime = config.getInt("CacheTime", 30*60);
123
                    if (!config.containsKey("Mapping")) {
124
                        JsonObject m = config.getJsonObject("Mapping");
126
                    this.cacheTime = config.getInt(CUSTOM_RESOURCES_CACHETIME, this.cacheTime);
127
                    if (!config.containsKey(CUSTOM_RESOURCES_MAPPING)) {
128
                        JsonObject m = config.getJsonObject(CUSTOM_RESOURCES_MAPPING);
125 129
                        for (Map.Entry<String, JsonValue> entry : m.entrySet()) {
126 130
                            String key = entry.getKey();
127 131
                            JsonValue value = entry.getValue();
......
139 143

  
140 144
        public String toJsonString() {
141 145
            JsonObjectBuilder builder = Json.createObjectBuilder();
142
            builder.add("cacheTime", cacheTime);
146
            builder.add(CUSTOM_RESOURCES_CACHETIME, cacheTime);
143 147
            JsonObjectBuilder m = Json.createObjectBuilder();
144 148
            for (Map.Entry<String, String> entry : mapping.entrySet()) {
145 149
                String key = entry.getKey();
146 150
                String value = entry.getValue();
147 151
                m.add(key, value);
148 152
            }
149
            builder.add("mapping", m);
153
            builder.add(CUSTOM_RESOURCES_MAPPING, m);
150 154
            return builder.build().toString();
151 155
        }
152 156

  
......
738 742
        } catch (Exception ex) {
739 743
            LOG.trace("Can't read configuration value '"+name+"'", ex);
740 744
            // Do noting
741
        } finally {
742
            DisposeUtils.disposeQuietly(store);
745
//        } finally {
746
//            DisposeUtils.disposeQuietly(store);
743 747
        }
744 748
        if( store == null ) {
745 749
            return false;
......
766 770
            store.finishEditing();
767 771
            return true;
768 772
        } catch (Exception ex) {
769
            LOG.warn("Can't write configuration value for '"+name+"'", ex);
773
            LOG.debug("Can't write configuration value for '"+name+"'", ex);
770 774
            return false;
771 775
        } finally {
772 776
            DisposeUtils.disposeQuietly(store);
......
785 789
        } catch (Exception ex) {
786 790
            LOG.trace("Can't read configuration value '"+name+"'", ex);
787 791
            // Do noting
788
        } finally {
789
            DisposeUtils.disposeQuietly(store);
792
//        } finally {
793
//            DisposeUtils.disposeQuietly(store);
790 794
        }
791 795
        if( store == null ) {
792 796
            return null;
......
805 809
            return value;
806 810
            
807 811
        } catch (Exception ex) {
808
            LOG.warn("Can't read configuration value '"+name+"'", ex);
812
            LOG.debug("Can't read configuration value '"+name+"'", ex);
809 813
            return null;
810 814
        } finally {
811 815
            DisposeUtils.disposeQuietly(store);

Also available in: Unified diff