Revision 42792
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java | ||
---|---|---|
514 | 514 |
|
515 | 515 |
ftype = getFeatureType(defFTypeid); |
516 | 516 |
if (ftype == null) { |
517 |
throw new PersistenceCantFindDefaultFeatureTypeException( |
|
518 |
this.getName(), defFTypeid); |
|
517 |
/* |
|
518 |
* Un error en el m?todo de PostgresQL getName(), hace que |
|
519 |
* el nombre del featureType sea valor retornado por el getProviderName() |
|
520 |
* De momento se pone este parche para apa?arlo y poder mantener compatibilidad |
|
521 |
* con proyectos antiguos (2.1 y 2.2) |
|
522 |
*/ |
|
523 |
ftype = getFeatureType(provider.getName()); |
|
524 |
if(ftype == null){ |
|
525 |
throw new PersistenceCantFindDefaultFeatureTypeException( |
|
526 |
this.getName(), defFTypeid); |
|
527 |
} |
|
519 | 528 |
} |
520 | 529 |
this.defaultFeatureType = ftype; |
521 | 530 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/dynobjectutils/CreateComboModelFromTable.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.swing.impl.dynobjectutils; |
2 | 2 |
|
3 | 3 |
import java.util.Formatter; |
4 |
import javax.swing.ComboBoxModel; |
|
4 |
|
|
5 | 5 |
import javax.swing.DefaultComboBoxModel; |
6 |
|
|
6 | 7 |
import org.apache.commons.lang3.StringUtils; |
7 | 8 |
import org.gvsig.fmap.dal.DALLocator; |
8 | 9 |
import org.gvsig.fmap.dal.DataManager; |
... | ... | |
18 | 19 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
19 | 20 |
import org.gvsig.tools.dynobject.Tags; |
20 | 21 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
22 |
import org.slf4j.Logger; |
|
23 |
import org.slf4j.LoggerFactory; |
|
21 | 24 |
|
22 | 25 |
public class CreateComboModelFromTable extends AbstractDynMethod { |
26 |
|
|
27 |
public static final Logger logger = LoggerFactory.getLogger(CreateComboModelFromTable.class); |
|
23 | 28 |
|
24 | 29 |
private static final String DAL_foreingCode = "DAL.foreingCode"; |
25 | 30 |
private static final String DAL_foreingDescriptionMask = "DAL.foreingDescriptionMask"; |
... | ... | |
71 | 76 |
model.addElement(item); |
72 | 77 |
} |
73 | 78 |
} catch (Exception ex) { |
74 |
// TODO: log error
|
|
79 |
logger.debug("Error while creating ComboModelFromTable:", ex);
|
|
75 | 80 |
} |
76 | 81 |
return model; |
77 | 82 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/DefaultFeatureTypeDefinitionsManager.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 | 4 |
import java.io.FileInputStream; |
5 |
import java.io.FileOutputStream; |
|
5 | 6 |
import java.io.IOException; |
6 | 7 |
import java.io.InputStream; |
7 | 8 |
import java.nio.charset.Charset; |
... | ... | |
9 | 10 |
import java.util.Map; |
10 | 11 |
import java.util.Properties; |
11 | 12 |
import java.util.zip.CRC32; |
13 |
|
|
12 | 14 |
import org.apache.commons.io.FileUtils; |
13 | 15 |
import org.apache.commons.io.IOUtils; |
14 | 16 |
import org.gvsig.andami.PluginServices; |
... | ... | |
96 | 98 |
if (f.exists()) { |
97 | 99 |
return f; |
98 | 100 |
} |
101 |
f = new File(s); |
|
102 |
if (f.exists()) { |
|
103 |
return f; |
|
104 |
} |
|
99 | 105 |
return null; |
100 | 106 |
} |
101 | 107 |
|
... | ... | |
113 | 119 |
DynObjectManager dynObjectManager = ToolsLocator.getDynObjectManager(); |
114 | 120 |
try { |
115 | 121 |
String xml = FileUtils.readFileToString(definitionFile); |
122 |
xml = xml.replaceAll("@@@",definitionFile.getParentFile().getAbsolutePath()); |
|
123 |
|
|
116 | 124 |
InputStream is = IOUtils.toInputStream(xml, Charset.forName("UTF-8")); |
117 | 125 |
Map<String, DynClass> dynClasses = dynObjectManager.importDynClassDefinitions(is, this.getClass().getClassLoader()); |
118 | 126 |
for (DynClass aDynClass : dynClasses.values()) { |
... | ... | |
157 | 165 |
} |
158 | 166 |
|
159 | 167 |
public void addModel(File model) { |
160 |
// TODO: |
|
168 |
DynObjectManager dynObjectManager = ToolsLocator.getDynObjectManager(); |
|
169 |
try { |
|
170 |
String xml = FileUtils.readFileToString(model); |
|
171 |
InputStream is = IOUtils.toInputStream(xml, Charset.forName("UTF-8")); |
|
172 |
Map<String, DynClass> dynClasses = dynObjectManager.importDynClassDefinitions(is, this.getClass().getClassLoader()); |
|
173 |
|
|
174 |
File folder; |
|
175 |
try { |
|
176 |
folder = getDefinitionsFolder(); |
|
177 |
} catch (IOException ex) { |
|
178 |
return ; |
|
179 |
} |
|
180 |
Properties prop = new Properties(); |
|
181 |
FileInputStream fin = null; |
|
182 |
try { |
|
183 |
fin = new FileInputStream(new File(folder, "index.properties")); |
|
184 |
prop.load(fin); |
|
185 |
} catch (IOException ex) { |
|
186 |
} finally { |
|
187 |
IOUtils.closeQuietly(fin); |
|
188 |
} |
|
189 |
for (DynClass aDynClass : dynClasses.values()) { |
|
190 |
String className = aDynClass.getName(); |
|
191 |
prop.setProperty(className, model.getAbsolutePath()); |
|
192 |
} |
|
193 |
FileOutputStream fout = null; |
|
194 |
try { |
|
195 |
fout = new FileOutputStream(new File(folder, "index.properties")); |
|
196 |
prop.store(fout, ""); |
|
197 |
} catch (IOException ex) { |
|
198 |
} finally { |
|
199 |
IOUtils.closeQuietly(fout); |
|
200 |
} |
|
201 |
|
|
202 |
} catch (Exception ex) { |
|
203 |
logger.warn("Can't parse xml definition.", ex); |
|
204 |
} |
|
161 | 205 |
} |
162 | 206 |
|
163 | 207 |
} |
Also available in: Unified diff