svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.mapcontext / org.gvsig.fmap.mapcontext.api / src / test / java / org / gvsig / fmap / mapcontext / persistence / DummyDBFeatureStore.java @ 42928
History | View | Annotate | Download (2.32 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify it under
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
9 |
* version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
14 |
* details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License along with
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
21 |
* gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.fmap.mapcontext.persistence; |
24 |
|
25 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
26 |
import org.gvsig.fmap.dal.feature.DummyFetureStore; |
27 |
import org.gvsig.tools.ToolsLocator; |
28 |
import org.gvsig.tools.dynobject.DynStruct; |
29 |
import org.gvsig.tools.persistence.PersistenceManager; |
30 |
import org.gvsig.tools.persistence.PersistentState; |
31 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
32 |
|
33 |
public class DummyDBFeatureStore extends DummyFetureStore implements FeatureStore { |
34 |
|
35 |
private String name = "[empty]"; |
36 |
|
37 |
public DummyDBFeatureStore() {
|
38 |
|
39 |
} |
40 |
|
41 |
public DummyDBFeatureStore(String id) { |
42 |
name = "[DATABASE FEATURE STORE - " + id + "]"; |
43 |
} |
44 |
|
45 |
public String getName() { |
46 |
return name;
|
47 |
} |
48 |
|
49 |
public void loadFromState(PersistentState state) throws PersistenceException { |
50 |
name = state.getString("name");
|
51 |
} |
52 |
|
53 |
public void saveToState(PersistentState state) throws PersistenceException { |
54 |
state.set("name", name);
|
55 |
} |
56 |
|
57 |
public static void registerPersistent() { |
58 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
59 |
DynStruct definition = manager.addDefinition( |
60 |
DummyDBFeatureStore.class, |
61 |
"DummyDBFeatureStore",
|
62 |
"DummyDBFeatureStore Persistence definition",
|
63 |
null,
|
64 |
null
|
65 |
); |
66 |
definition.addDynFieldString("name");
|
67 |
} |
68 |
} |