root / branches / v2_0_0_prep / extensions / extGPE-gvSIG / src / org / gvsig / fmap / dal / store / gpe / GPEStoreParameters.java @ 32880
History | View | Annotate | Download (4.08 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.gpe; |
29 |
|
30 |
import java.io.File; |
31 |
|
32 |
import org.cresques.cts.IProjection; |
33 |
import org.gvsig.fmap.dal.DataStoreParameters; |
34 |
import org.gvsig.fmap.dal.DataTypes; |
35 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
36 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
37 |
import org.gvsig.tools.ToolsLocator; |
38 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
39 |
import org.gvsig.tools.dynobject.DynClass; |
40 |
import org.gvsig.tools.dynobject.DynStruct; |
41 |
import org.gvsig.tools.persistence.PersistenceManager; |
42 |
|
43 |
/**
|
44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
45 |
*/
|
46 |
public class GPEStoreParameters extends AbstractDataParameters implements |
47 |
DataStoreParameters, FilesystemStoreParameters { |
48 |
protected static final String FIELD_FILE = "file"; |
49 |
protected static final String FIELD_SRS = "srs"; |
50 |
|
51 |
public static final String DYNCLASS_NAME = "GPEStoreParameters"; |
52 |
protected static DynClass DYNCLASS = null; |
53 |
private DelegatedDynObject delegatedDynObject;
|
54 |
|
55 |
public GPEStoreParameters() {
|
56 |
super();
|
57 |
initialize(); |
58 |
} |
59 |
|
60 |
protected void initialize() { |
61 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
|
62 |
.getDynObjectManager().createDynObject( |
63 |
GPEStoreParameters.DYNCLASS); |
64 |
} |
65 |
|
66 |
protected DelegatedDynObject getDelegatedDynObject() {
|
67 |
return delegatedDynObject;
|
68 |
} |
69 |
|
70 |
/* (non-Javadoc)
|
71 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDataStoreName()
|
72 |
*/
|
73 |
public String getDataStoreName() { |
74 |
return GPEStoreProvider.NAME;
|
75 |
} |
76 |
|
77 |
/* (non-Javadoc)
|
78 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDescription()
|
79 |
*/
|
80 |
public String getDescription() { |
81 |
return GPEStoreProvider.DESCRIPTION;
|
82 |
} |
83 |
|
84 |
/* (non-Javadoc)
|
85 |
* @see org.gvsig.fmap.dal.DataStoreParameters#isValid()
|
86 |
*/
|
87 |
public boolean isValid() { |
88 |
return (this.getFile() != null); |
89 |
} |
90 |
|
91 |
/* (non-Javadoc)
|
92 |
* @see org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters#getFile()
|
93 |
*/
|
94 |
public File getFile() { |
95 |
return (File) this.getDynValue(FIELD_FILE); |
96 |
} |
97 |
|
98 |
/* (non-Javadoc)
|
99 |
* @see org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters#setFile(java.io.File)
|
100 |
*/
|
101 |
public void setFile(File file) { |
102 |
this.setDynValue(FIELD_FILE, file);
|
103 |
} |
104 |
|
105 |
public String getFileName() { |
106 |
return this.getFile().getAbsolutePath(); |
107 |
} |
108 |
|
109 |
public void setFileName(String fileName) { |
110 |
this.setDynValue(FIELD_FILE, fileName);
|
111 |
} |
112 |
|
113 |
public IProjection getSRS(){
|
114 |
return (IProjection) this.getDynValue(FIELD_SRS); |
115 |
} |
116 |
|
117 |
public void setSRS(IProjection srs){ |
118 |
this.setDynValue(FIELD_SRS, srs);
|
119 |
} |
120 |
|
121 |
public void setSRS(String srs){ |
122 |
this.setDynValue(FIELD_SRS, srs);
|
123 |
} |
124 |
|
125 |
protected static void registerDynClass() { |
126 |
if (DYNCLASS == null) { |
127 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
128 |
DynStruct definition = manager.addDefinition( |
129 |
GPEStoreParameters.class, |
130 |
DYNCLASS_NAME, |
131 |
DYNCLASS_NAME+" Persistence definition",
|
132 |
null,
|
133 |
null
|
134 |
); |
135 |
definition.addDynField(FIELD_FILE) |
136 |
.setType(DataTypes.FILE) |
137 |
.setDescription("GPE file")
|
138 |
.setMandatory(true);
|
139 |
|
140 |
definition.addDynField(FIELD_SRS) |
141 |
.setType(DataTypes.CRS) |
142 |
.setDescription("SRS")
|
143 |
.setMandatory(true);
|
144 |
|
145 |
DYNCLASS = (DynClass) definition; |
146 |
} |
147 |
|
148 |
} |
149 |
|
150 |
} |
151 |
|