Revision 44276 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
H2SpatialExplorer.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.store.h2; |
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 |
import java.util.ArrayList; |
|
5 |
import java.util.List; |
|
4 | 6 |
import org.apache.commons.io.FilenameUtils; |
5 | 7 |
import org.gvsig.fmap.dal.DataStore; |
6 | 8 |
import org.gvsig.fmap.dal.exception.DataException; |
... | ... | |
10 | 12 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
11 | 13 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper; |
12 | 14 |
import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCServerExplorerBase; |
15 |
import org.gvsig.tools.util.ResourcesStorage.Resource; |
|
13 | 16 |
|
14 | 17 |
/** |
15 | 18 |
* |
... | ... | |
28 | 31 |
} |
29 | 32 |
|
30 | 33 |
@Override |
31 |
public DataResource getResource(DataStore dataStore, String resourceName) throws DataException {
|
|
34 |
public Resource getResource(DataStore dataStore, String resourceName) throws DataException { |
|
32 | 35 |
String zipPath = this.getParameters().getFile().getAbsolutePath(); |
33 | 36 |
zipPath = FilenameUtils.removeExtension(zipPath); |
34 | 37 |
FileMultiResource resource = new FileMultiResource(new File(zipPath), dataStore.getName(),resourceName); |
35 | 38 |
return resource; |
36 | 39 |
} |
37 | 40 |
|
41 |
@Override |
|
42 |
public List<Resource> getResources(DataStore dataStore, String resourceName) throws DataException { |
|
43 |
String zipPath = this.getParameters().getFile().getAbsolutePath(); |
|
44 |
zipPath = FilenameUtils.removeExtension(zipPath); |
|
45 |
List<Resource>ress = new ArrayList<>(); |
|
46 |
int n = 0; |
|
47 |
while(true) { |
|
48 |
String multiresourceName; |
|
49 |
if( n==0 ) { |
|
50 |
multiresourceName = resourceName; |
|
51 |
} else { |
|
52 |
multiresourceName = String.valueOf(n)+"."+resourceName; |
|
53 |
} |
|
54 |
FileMultiResource resource = new FileMultiResource(new File(zipPath), dataStore.getName(),multiresourceName); |
|
55 |
if( !resource.exists() ) { |
|
56 |
break; |
|
57 |
} |
|
58 |
ress.add(resource); |
|
59 |
n++; |
|
60 |
} |
|
61 |
if( ress.isEmpty() ) { |
|
62 |
return null; |
|
63 |
} |
|
64 |
return ress; |
|
65 |
} |
|
38 | 66 |
} |
Also available in: Unified diff