svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dalRaster / src / org / gvsig / fmap / dal / store / raster / RasterStoreProvider.java @ 30569
History | View | Annotate | Download (4.3 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2009 IVER T.I {{Task}}
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.fmap.dal.store.raster; |
29 |
|
30 |
import java.util.Iterator; |
31 |
|
32 |
import org.gvsig.fmap.dal.DALLocator; |
33 |
import org.gvsig.fmap.dal.DataManager; |
34 |
import org.gvsig.fmap.dal.DataServerExplorer; |
35 |
import org.gvsig.fmap.dal.exception.CloseException; |
36 |
import org.gvsig.fmap.dal.exception.DataException; |
37 |
import org.gvsig.fmap.dal.exception.OpenException; |
38 |
import org.gvsig.fmap.dal.exception.ReadException; |
39 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
40 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
41 |
import org.gvsig.fmap.dal.raster.spi.AbstractCoverageStoreProvider; |
42 |
import org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices; |
43 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
44 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
45 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
46 |
import org.gvsig.tools.ToolsLocator; |
47 |
import org.gvsig.tools.dynobject.DynClass; |
48 |
import org.gvsig.tools.dynobject.DynField; |
49 |
import org.gvsig.tools.dynobject.DynObjectManager; |
50 |
|
51 |
public class RasterStoreProvider extends AbstractCoverageStoreProvider { |
52 |
public static String NAME = "RasterStore"; |
53 |
public static String DESCRIPTION = "Raster file"; |
54 |
|
55 |
private static final String DYNCLASS_NAME = "RasterStore"; |
56 |
protected static DynClass DYNCLASS = null; |
57 |
|
58 |
private RasterStoreParameters rasterParams;
|
59 |
|
60 |
public RasterStoreProvider(RasterStoreParameters params,
|
61 |
DataStoreProviderServices storeServices) { |
62 |
super(params, storeServices, ToolsLocator
|
63 |
.getDynObjectManager().createDynObject(DYNCLASS)); |
64 |
init(params); |
65 |
} |
66 |
|
67 |
|
68 |
|
69 |
private void init(RasterStoreParameters params) { |
70 |
this.getStoreServices().setDynValue("DefaultSRS", |
71 |
this.getRasterParameters()
|
72 |
.getSRS()); |
73 |
this.getStoreServices().setDynValue("Envelope", null); |
74 |
|
75 |
} |
76 |
|
77 |
protected static void registerDynClass() { |
78 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
79 |
DynClass dynClass; |
80 |
DynField field; |
81 |
if (DYNCLASS == null) { |
82 |
dynClass = dynman.add(DYNCLASS_NAME); |
83 |
|
84 |
// The SHP store parameters extend the DBF store parameters
|
85 |
dynClass.extend(dynman.get(FeatureStore.DYNCLASS_NAME)); |
86 |
|
87 |
DYNCLASS = dynClass; |
88 |
} |
89 |
|
90 |
} |
91 |
|
92 |
|
93 |
public void close() throws CloseException { |
94 |
// TODO Auto-generated method stub
|
95 |
|
96 |
} |
97 |
|
98 |
public void dispose() throws CloseException { |
99 |
// TODO Auto-generated method stub
|
100 |
|
101 |
} |
102 |
|
103 |
public Iterator getChilds() { |
104 |
// TODO Auto-generated method stub
|
105 |
return null; |
106 |
} |
107 |
|
108 |
public DataServerExplorer getExplorer() throws ReadException, |
109 |
ValidateDataParametersException { |
110 |
DataManager manager = DALLocator.getDataManager(); |
111 |
FilesystemServerExplorerParameters params; |
112 |
try {
|
113 |
params = (FilesystemServerExplorerParameters) manager |
114 |
.createServerExplorerParameters(FilesystemServerExplorer.NAME); |
115 |
params.setRoot(this.getRasterParameters().getFile().getParent());
|
116 |
return manager.createServerExplorer(params);
|
117 |
} catch (DataException e) {
|
118 |
throw new ReadException(this.getName(), e); |
119 |
} |
120 |
} |
121 |
|
122 |
public RasterStoreParameters getRasterParameters() {
|
123 |
return this.rasterParams; |
124 |
} |
125 |
|
126 |
|
127 |
|
128 |
public void open() throws OpenException { |
129 |
// TODO Auto-generated method stub
|
130 |
|
131 |
} |
132 |
|
133 |
public void refresh() throws OpenException { |
134 |
// TODO Auto-generated method stub
|
135 |
|
136 |
} |
137 |
|
138 |
public CoverageStoreProviderServices getStoreServices() {
|
139 |
return this.store; |
140 |
} |
141 |
|
142 |
public String getName() { |
143 |
return NAME;
|
144 |
} |
145 |
|
146 |
public Object getSourceId() { |
147 |
return this.getRasterParameters().getFile(); |
148 |
} |
149 |
|
150 |
|
151 |
} |