root / branches / v2_0_0_prep / libraries / libFMap_dalRaster / src / org / gvsig / fmap / dal / store / raster / RasterStoreProvider.java @ 32880
History | View | Annotate | Download (4.79 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.DataStore; |
36 |
import org.gvsig.fmap.dal.exception.CloseException; |
37 |
import org.gvsig.fmap.dal.exception.DataException; |
38 |
import org.gvsig.fmap.dal.exception.OpenException; |
39 |
import org.gvsig.fmap.dal.exception.ReadException; |
40 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
41 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
42 |
import org.gvsig.fmap.dal.raster.spi.AbstractCoverageStoreProvider; |
43 |
import org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices; |
44 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
45 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
46 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
47 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
48 |
import org.gvsig.fmap.mapcontext.layers.FLyrDefault; |
49 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
50 |
import org.gvsig.metadata.MetadataLocator; |
51 |
import org.gvsig.metadata.MetadataManager; |
52 |
import org.gvsig.metadata.exceptions.MetadataException; |
53 |
import org.gvsig.tools.ToolsLocator; |
54 |
import org.gvsig.tools.dynobject.DynClass; |
55 |
import org.gvsig.tools.dynobject.DynField; |
56 |
import org.gvsig.tools.dynobject.DynObjectManager; |
57 |
import org.gvsig.tools.dynobject.DynStruct; |
58 |
import org.gvsig.tools.persistence.PersistenceManager; |
59 |
|
60 |
public class RasterStoreProvider extends AbstractCoverageStoreProvider { |
61 |
public static String NAME = "RasterStore"; |
62 |
public static String DESCRIPTION = "Raster file"; |
63 |
|
64 |
private static final String METADATA_DEFINITION_NAME = "RasterStore"; |
65 |
protected static DynClass DYNCLASS = null; |
66 |
|
67 |
public RasterStoreProvider(RasterStoreParameters params,
|
68 |
DataStoreProviderServices storeServices) { |
69 |
super(params, storeServices, ToolsLocator
|
70 |
.getDynObjectManager().createDynObject(DYNCLASS)); |
71 |
init(params); |
72 |
} |
73 |
|
74 |
public ResourceProvider getResource() {
|
75 |
// TODO Create Raster resource
|
76 |
return null; |
77 |
} |
78 |
|
79 |
private void init(RasterStoreParameters params) { |
80 |
this.getStoreServices().setDynValue("DefaultSRS", |
81 |
params.getSRS()); |
82 |
this.getStoreServices().setDynValue("Envelope", null); |
83 |
} |
84 |
|
85 |
protected static void registerMetadataDefinition() throws MetadataException { |
86 |
MetadataManager manager = MetadataLocator.getMetadataManager(); |
87 |
if( manager.getDefinition(METADATA_DEFINITION_NAME)==null ) { |
88 |
DynStruct defnition = manager.addDefinition( |
89 |
METADATA_DEFINITION_NAME, |
90 |
METADATA_DEFINITION_NAME |
91 |
); |
92 |
defnition.extend( |
93 |
MetadataManager.METADATA_NAMESPACE, |
94 |
DataStore.METADATA_DEFINITION_NAME |
95 |
); |
96 |
} |
97 |
} |
98 |
|
99 |
|
100 |
public void close() throws CloseException { |
101 |
// TODO Auto-generated method stub
|
102 |
|
103 |
} |
104 |
|
105 |
public Iterator getChilds() { |
106 |
// TODO Auto-generated method stub
|
107 |
return null; |
108 |
} |
109 |
|
110 |
public DataServerExplorer getExplorer() throws ReadException, |
111 |
ValidateDataParametersException { |
112 |
DataManager manager = DALLocator.getDataManager(); |
113 |
FilesystemServerExplorerParameters params; |
114 |
try {
|
115 |
params = (FilesystemServerExplorerParameters) manager |
116 |
.createServerExplorerParameters(FilesystemServerExplorer.NAME); |
117 |
params.setRoot(this.getRasterParameters().getFile().getParent());
|
118 |
return manager.createServerExplorer(params);
|
119 |
} catch (DataException e) {
|
120 |
throw new ReadException(this.getName(), e); |
121 |
} |
122 |
} |
123 |
|
124 |
public RasterStoreParameters getRasterParameters() {
|
125 |
return (RasterStoreParameters)getDataStoreParameters();
|
126 |
} |
127 |
|
128 |
|
129 |
|
130 |
public void open() throws OpenException { |
131 |
// TODO Auto-generated method stub
|
132 |
|
133 |
} |
134 |
|
135 |
public void refresh() throws OpenException { |
136 |
// TODO Auto-generated method stub
|
137 |
|
138 |
} |
139 |
|
140 |
public CoverageStoreProviderServices getStoreServices() {
|
141 |
return this.store; |
142 |
} |
143 |
|
144 |
public String getName() { |
145 |
return NAME;
|
146 |
} |
147 |
|
148 |
public Object getSourceId() { |
149 |
return this.getRasterParameters().getFile(); |
150 |
} |
151 |
|
152 |
|
153 |
} |