svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.db / org.gvsig.fmap.dal.db.h2 / src / main / java / org / gvsig / fmap / dal / store / h2 / H2SpatialExplorer.java @ 45063
History | View | Annotate | Download (1.82 KB)
1 |
package org.gvsig.fmap.dal.store.h2; |
---|---|
2 |
|
3 |
import org.apache.commons.io.FilenameUtils; |
4 |
import org.apache.commons.lang3.StringUtils; |
5 |
import org.gvsig.fmap.dal.DataStore; |
6 |
import org.gvsig.fmap.dal.exception.InitializeException; |
7 |
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices; |
8 |
import org.gvsig.fmap.dal.spi.ZipResourcesStorage; |
9 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
10 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper; |
11 |
import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCServerExplorerBase; |
12 |
import org.gvsig.tools.resourcesstorage.EmptyResourcesStorage; |
13 |
import org.gvsig.tools.resourcesstorage.ResourcesStorage; |
14 |
|
15 |
/**
|
16 |
*
|
17 |
* @author jjdelcerro
|
18 |
*/
|
19 |
@SuppressWarnings("UseSpecificCatch") |
20 |
public class H2SpatialExplorer extends JDBCServerExplorerBase { |
21 |
|
22 |
public H2SpatialExplorer(JDBCServerExplorerParameters parameters, DataServerExplorerProviderServices services, JDBCHelper helper) throws InitializeException { |
23 |
super(parameters, services, helper);
|
24 |
} |
25 |
|
26 |
@Override
|
27 |
public H2SpatialExplorerParameters getParameters() {
|
28 |
return (H2SpatialExplorerParameters) super.getParameters(); |
29 |
} |
30 |
|
31 |
@Override
|
32 |
public ResourcesStorage getResourcesStorage(DataStore dataStore) {
|
33 |
ResourcesStorage ress = super.getResourcesStorage(dataStore);
|
34 |
if( ress instanceof EmptyResourcesStorage ) { |
35 |
String zipPath = this.getParameters().getFile().getAbsolutePath(); |
36 |
String zipPathName = FilenameUtils.removeExtension(zipPath);
|
37 |
ress = new ZipResourcesStorage(zipPathName, dataStore.getName());
|
38 |
} |
39 |
return ress;
|
40 |
} |
41 |
|
42 |
@Override
|
43 |
public void execute(String sql) { |
44 |
if( StringUtils.equalsIgnoreCase(sql, "!SHUTDOWN") ) { |
45 |
H2SpatialHelper.ConnectionProviderImpl.stopServer(); |
46 |
return;
|
47 |
} |
48 |
super.execute(sql);
|
49 |
} |
50 |
} |