Revision 353 org.gvsig.projection.jcrs/trunk/org.gvsig.projection.jcrs/org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/JCRSPluginLibrary.java
JCRSPluginLibrary.java | ||
---|---|---|
10 | 10 |
import org.apache.commons.io.filefilter.FileFilterUtils; |
11 | 11 |
import org.apache.commons.lang3.BooleanUtils; |
12 | 12 |
import org.cresques.ProjectionLibrary; |
13 |
|
|
13 | 14 |
import org.gvsig.andami.PluginServices; |
14 | 15 |
import org.gvsig.andami.PluginsLocator; |
15 | 16 |
import org.gvsig.crs.installer.EPSGDatabaseInstallerFactory; |
... | ... | |
19 | 20 |
import org.gvsig.tools.dynobject.DynObject; |
20 | 21 |
import org.gvsig.tools.library.AbstractLibrary; |
21 | 22 |
import org.gvsig.tools.library.LibraryException; |
23 |
|
|
22 | 24 |
import org.slf4j.Logger; |
23 | 25 |
import org.slf4j.LoggerFactory; |
24 | 26 |
|
25 | 27 |
public class JCRSPluginLibrary extends AbstractLibrary { |
26 | 28 |
|
27 |
private final static Logger logger = LoggerFactory.getLogger(JCrsExtension.class); |
|
29 |
private static final String EPSG_VERSION = "EPSG_v8_7"; |
|
30 |
private final static Logger logger = LoggerFactory.getLogger(JCrsExtension.class); |
|
28 | 31 |
|
29 | 32 |
public void doRegistration() { |
30 | 33 |
// Hack to assign database folder to the jCRS library. |
... | ... | |
79 | 82 |
} catch(Exception ex) { |
80 | 83 |
logger.warn("Can't locate a EPSG database in folder '"+dbfolder+"' use '"+fname+"'.", ex); |
81 | 84 |
} |
82 |
fname = "EPSG" + File.separator + "EPSG_v8_7" + File.separator + "EPSG.sql";
|
|
85 |
fname = "EPSG" + File.separator + EPSG_VERSION + File.separator + "EPSG.sql";
|
|
83 | 86 |
return new File(fname); |
84 | 87 |
} |
85 | 88 |
|
... | ... | |
123 | 126 |
throw new RuntimeException(e); |
124 | 127 |
} |
125 | 128 |
} |
129 |
targetEPSGFolder = new File(targetEPSGFolder,EPSG_VERSION); |
|
130 |
if( !targetEPSGFolder.exists() ) { |
|
131 |
sourceEPSGFolder = new File(sourceEPSGFolder, EPSG_VERSION); |
|
132 |
try { |
|
133 |
logger.info("Initializing EPSG database folder in "+targetEPSGFolder.getAbsolutePath()); |
|
134 |
FileUtils.forceMkdir(targetEPSGFolder); |
|
135 |
FileUtils.copyDirectory(sourceEPSGFolder, targetEPSGFolder); |
|
136 |
} catch (IOException e) { |
|
137 |
logger.error("Can't initilize EPSG database folder in the gvSIG home (src="+sourceEPSGFolder.getAbsolutePath()+",target="+targetEPSGFolder.getAbsolutePath()+").",e); |
|
138 |
throw new RuntimeException(e); |
|
139 |
} |
|
140 |
} |
|
126 | 141 |
} |
127 | 142 |
|
128 | 143 |
protected void doPostInitialize() throws LibraryException { |
Also available in: Unified diff