Revision 23913 branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/explorer/filesystem/FilesystemExplorer.java
FilesystemExplorer.java | ||
---|---|---|
14 | 14 |
import org.gvsig.fmap.data.exceptions.DataException; |
15 | 15 |
import org.gvsig.fmap.data.exceptions.InitializeException; |
16 | 16 |
import org.gvsig.fmap.data.exceptions.ReadException; |
17 |
import org.gvsig.fmap.data.exceptions.WriteException; |
|
18 |
import org.gvsig.fmap.data.feature.FeatureExplorer; |
|
19 |
import org.gvsig.fmap.data.feature.FeatureType; |
|
17 |
import org.gvsig.fmap.data.spi.DataExplorerProvider; |
|
18 |
import org.gvsig.tools.exception.NotYetImplemented; |
|
20 | 19 |
import org.gvsig.tools.extensionPoint.ExtensionPoint; |
21 | 20 |
import org.gvsig.tools.extensionPoint.ExtensionPoints; |
22 | 21 |
import org.gvsig.tools.extensionPoint.ExtensionPointsSingleton; |
23 | 22 |
|
23 |
import com.iver.utiles.XMLEntity; |
|
24 | 24 |
|
25 |
public class FilesystemExplorer implements FeatureExplorer { |
|
25 |
|
|
26 |
public class FilesystemExplorer implements DataExplorerProvider { |
|
26 | 27 |
// FIXME: , IPersistence{ |
27 | 28 |
|
28 | 29 |
|
... | ... | |
30 | 31 |
final private static String FILE_FILTER_EPSDESCRIPTION = "Registro de filtros asociados al explorador del sistema de ficheros."; |
31 | 32 |
|
32 | 33 |
FilesystemExplorerParameters parameters; |
34 |
private File path; |
|
33 | 35 |
|
34 |
public class FilterWraper { |
|
36 |
public static class FilterWraper {
|
|
35 | 37 |
|
36 | 38 |
private FileFilter filter; |
37 | 39 |
|
... | ... | |
53 | 55 |
|
54 | 56 |
} |
55 | 57 |
|
56 |
public class FilterWraperIterator implements Iterator { |
|
58 |
public static class FilterWraperIterator implements Iterator {
|
|
57 | 59 |
private Iterator it; |
58 | 60 |
|
59 | 61 |
public FilterWraperIterator(Iterator it) { |
... | ... | |
93 | 95 |
return it; |
94 | 96 |
} |
95 | 97 |
|
96 |
public void initialice(DataExplorerParameters parameters)
|
|
98 |
public void init(DataExplorerParameters parameters) |
|
97 | 99 |
throws InitializeException { |
98 | 100 |
this.parameters = (FilesystemExplorerParameters) parameters; |
101 |
this.path = new File(this.parameters.getPath()); |
|
99 | 102 |
} |
100 | 103 |
|
104 |
public void init(XMLEntity xmlEntity) throws InitializeException { |
|
105 |
// TODO Auto-generated method stub |
|
106 |
throw new NotYetImplemented(); |
|
107 |
|
|
108 |
} |
|
109 |
|
|
110 |
|
|
101 | 111 |
public DataExplorerType getType() { |
102 | 112 |
return parameters.getType(); |
103 | 113 |
} |
... | ... | |
110 | 120 |
|
111 | 121 |
} |
112 | 122 |
|
113 |
public boolean add(DataStoreParameters params, FeatureType type) |
|
114 |
throws WriteException, InitializeException { |
|
115 |
// TODO Auto-generated method stub |
|
116 |
return false; |
|
117 |
} |
|
118 |
|
|
119 | 123 |
public List list() throws DataException { |
120 | 124 |
if (!this.path.exists()) { |
125 |
//TODO crear excepcion de Data?? |
|
121 | 126 |
new FileNotFoundException(this.getName() + ": Path not found '" |
122 |
+ this.path + "'", new Exception());
|
|
127 |
+ this.path + "'"); |
|
123 | 128 |
} |
124 | 129 |
// DataManager dsm=DataManager.getManager(); |
125 | 130 |
|
... | ... | |
131 | 136 |
|
132 | 137 |
for (i = 0; i < files.length; i++) { |
133 | 138 |
theFile = new File(this.path, files[i]); |
134 |
if (this.accept(filters, theFile)) {
|
|
139 |
if (this.accept(theFile)) { |
|
135 | 140 |
fileList.add(theFile); |
136 | 141 |
} |
137 | 142 |
|
138 | 143 |
} |
139 |
DataStoreParameters[] x = new DataStoreParameters[1]; |
|
140 |
x[0] = dsp; |
|
141 |
return (DataStoreParameters[]) fileList.toArray(x); |
|
144 |
return fileList; |
|
142 | 145 |
} |
143 | 146 |
|
144 | 147 |
private boolean accept(File file) { |
... | ... | |
169 | 172 |
|
170 | 173 |
} |
171 | 174 |
|
175 |
public boolean add(DataStoreParameters ndsp) throws DataException { |
|
176 |
// TODO Auto-generated method stub |
|
177 |
return false; |
|
178 |
} |
|
179 |
|
|
180 |
public boolean canCreate() { |
|
181 |
return this.path.canWrite(); |
|
182 |
} |
|
183 |
|
|
184 |
public String getName() { |
|
185 |
// TODO Auto-generated method stub |
|
186 |
return null; |
|
187 |
} |
|
188 |
|
|
172 | 189 |
// ========================================== |
173 | 190 |
|
174 | 191 |
|
Also available in: Unified diff