svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dalRaster / src / org / gvsig / fmap / dal / store / raster / RasterStoreProvider.java @ 27723
History | View | Annotate | Download (5.31 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.tools.ToolsLocator; |
46 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
47 |
import org.gvsig.tools.dynobject.DynClass; |
48 |
import org.gvsig.tools.dynobject.DynField; |
49 |
import org.gvsig.tools.dynobject.DynObject; |
50 |
import org.gvsig.tools.dynobject.DynObjectManager; |
51 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
52 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
53 |
|
54 |
public class RasterStoreProvider extends AbstractCoverageStoreProvider { |
55 |
public static String NAME = "RasterStore"; |
56 |
public static String DESCRIPTION = "Raster file"; |
57 |
|
58 |
private static final String DYNCLASS_NAME = "RasterStore"; |
59 |
protected static DynClass DYNCLASS = null; |
60 |
|
61 |
private RasterStoreParameters rasterParams;
|
62 |
|
63 |
public RasterStoreProvider(RasterStoreParameters params) {
|
64 |
super();
|
65 |
init(params); |
66 |
} |
67 |
|
68 |
private void init(RasterStoreParameters params) { |
69 |
this.rasterParams = params;
|
70 |
|
71 |
this.dynObject = (DelegatedDynObject) ToolsLocator
|
72 |
.getDynObjectManager().createDynObject(DYNCLASS); |
73 |
|
74 |
this.dynObject.setDynValue("DefaultSRS", this.getRasterParameters() |
75 |
.getSRS()); |
76 |
this.dynObject.setDynValue("Envelope", null); |
77 |
|
78 |
} |
79 |
|
80 |
protected static void registerDynClass() { |
81 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
82 |
DynClass dynClass; |
83 |
DynField field; |
84 |
if (DYNCLASS == null) { |
85 |
dynClass = dynman.add(DYNCLASS_NAME); |
86 |
|
87 |
// The SHP store parameters extend the DBF store parameters
|
88 |
dynClass.extend(dynman.get(FeatureStore.DYNCLASS_NAME)); |
89 |
|
90 |
DYNCLASS = dynClass; |
91 |
} |
92 |
|
93 |
} |
94 |
|
95 |
|
96 |
public void close() throws CloseException { |
97 |
// TODO Auto-generated method stub
|
98 |
|
99 |
} |
100 |
|
101 |
public void dispose() throws CloseException { |
102 |
// TODO Auto-generated method stub
|
103 |
|
104 |
} |
105 |
|
106 |
public Iterator getChilds() { |
107 |
// TODO Auto-generated method stub
|
108 |
return null; |
109 |
} |
110 |
|
111 |
public DataServerExplorer getExplorer() throws ReadException, |
112 |
ValidateDataParametersException { |
113 |
DataManager manager = DALLocator.getDataManager(); |
114 |
FilesystemServerExplorerParameters params; |
115 |
try {
|
116 |
params = (FilesystemServerExplorerParameters) manager |
117 |
.createServerExplorerParameters(FilesystemServerExplorer.NAME); |
118 |
params.setRoot(this.getRasterParameters().getFile().getParent());
|
119 |
return manager.createServerExplorer(params);
|
120 |
} catch (DataException e) {
|
121 |
throw new ReadException(this.getName(), e); |
122 |
} |
123 |
} |
124 |
|
125 |
public RasterStoreParameters getRasterParameters() {
|
126 |
return this.rasterParams; |
127 |
} |
128 |
|
129 |
|
130 |
|
131 |
public void open() throws OpenException { |
132 |
// TODO Auto-generated method stub
|
133 |
|
134 |
} |
135 |
|
136 |
public void refresh() throws OpenException { |
137 |
// TODO Auto-generated method stub
|
138 |
|
139 |
} |
140 |
|
141 |
public void delegate(DynObject arg0) { |
142 |
this.dynObject.delegate(arg0);
|
143 |
|
144 |
} |
145 |
|
146 |
public DynClass getDynClass() {
|
147 |
return this.dynObject.getDynClass(); |
148 |
} |
149 |
|
150 |
public Object getDynValue(String arg0) throws DynFieldNotFoundException { |
151 |
return this.dynObject.getDynValue(arg0); |
152 |
} |
153 |
|
154 |
public boolean hasDynValue(String arg0) { |
155 |
return this.dynObject.hasDynValue(arg0); |
156 |
} |
157 |
|
158 |
public void implement(DynClass arg0) { |
159 |
this.dynObject.implement(arg0);
|
160 |
|
161 |
} |
162 |
|
163 |
public Object invokeDynMethod(String arg0, DynObject arg1) |
164 |
throws DynMethodException {
|
165 |
return this.dynObject.invokeDynMethod(arg0, arg1); |
166 |
} |
167 |
|
168 |
public Object invokeDynMethod(int arg0, DynObject arg1) |
169 |
throws DynMethodException {
|
170 |
return this.dynObject.invokeDynMethod(arg0, arg1); |
171 |
} |
172 |
|
173 |
public void setDynValue(String arg0, Object arg1) |
174 |
throws DynFieldNotFoundException {
|
175 |
this.dynObject.setDynValue(arg0, arg1);
|
176 |
} |
177 |
|
178 |
public CoverageStoreProviderServices getStoreServices() {
|
179 |
return this.store; |
180 |
} |
181 |
|
182 |
public String getName() { |
183 |
return NAME;
|
184 |
} |
185 |
|
186 |
public Object getSourceId() { |
187 |
return this.getRasterParameters().getFile(); |
188 |
} |
189 |
} |