root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / store / memory / MemoryStoreParameters.java @ 38533
History | View | Annotate | Download (3.4 KB)
1 | 30631 | jpiera | /* 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.memory; |
||
29 | |||
30 | import org.gvsig.fmap.dal.DataStoreParameters; |
||
31 | import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
||
32 | import org.gvsig.tools.ToolsLocator; |
||
33 | import org.gvsig.tools.dynobject.DelegatedDynObject; |
||
34 | 32880 | jjdelcerro | import org.gvsig.tools.dynobject.DynStruct; |
35 | import org.gvsig.tools.persistence.PersistenceManager; |
||
36 | 30631 | jpiera | |
37 | /**
|
||
38 | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
||
39 | */
|
||
40 | public class MemoryStoreParameters extends AbstractDataParameters implements |
||
41 | DataStoreParameters{ |
||
42 | |||
43 | 32880 | jjdelcerro | private static final String PARAMETERS_DEFINITION_NAME = "MemoryStoreParameters"; |
44 | 31022 | cordinyana | |
45 | 32880 | jjdelcerro | private static final String NAME_PARAMETER_NAME = "name"; |
46 | 32904 | cordinyana | private static final String NAME_PARAMETER_DESCRIPTION = "Memory data name"; |
47 | public static final String ORDER_PARAMETER_NAME = "autoOrderAttributeName"; |
||
48 | private static final String ORDER_PARAMETER_DESCRIPTION = "Atribute name to order by, by default"; |
||
49 | 31022 | cordinyana | |
50 | 32880 | jjdelcerro | private DelegatedDynObject parameters;
|
51 | |||
52 | 30631 | jpiera | public MemoryStoreParameters() {
|
53 | 31022 | cordinyana | this(MemoryStoreProvider.NAME);
|
54 | } |
||
55 | |||
56 | public MemoryStoreParameters(String name) { |
||
57 | 30631 | jpiera | super();
|
58 | 31022 | cordinyana | initialize(name); |
59 | 30631 | jpiera | } |
60 | |||
61 | 31022 | cordinyana | protected void initialize(String name) { |
62 | 32880 | jjdelcerro | this.parameters = (DelegatedDynObject) ToolsLocator.getDynObjectManager()
|
63 | .createDynObject( |
||
64 | ToolsLocator.getPersistenceManager().getDefinition(PARAMETERS_DEFINITION_NAME) |
||
65 | ); |
||
66 | setDynValue(NAME_PARAMETER_NAME, name); |
||
67 | 30631 | jpiera | } |
68 | |||
69 | 31022 | cordinyana | protected DelegatedDynObject getDelegatedDynObject() {
|
70 | 32880 | jjdelcerro | return parameters;
|
71 | 31022 | cordinyana | } |
72 | 32904 | cordinyana | |
73 | 32880 | jjdelcerro | protected static void registerParametersDefinition() { |
74 | PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
||
75 | if( manager.getDefinition(PARAMETERS_DEFINITION_NAME) == null ) { |
||
76 | 32904 | cordinyana | DynStruct parametersDefinition = manager.addDefinition( |
77 | 32880 | jjdelcerro | MemoryStoreParameters.class, |
78 | PARAMETERS_DEFINITION_NAME, |
||
79 | (String)null, |
||
80 | null,
|
||
81 | null
|
||
82 | ); |
||
83 | 32904 | cordinyana | parametersDefinition.addDynFieldString(NAME_PARAMETER_NAME) |
84 | .setDescription(NAME_PARAMETER_DESCRIPTION) |
||
85 | 32880 | jjdelcerro | .setMandatory(true);
|
86 | 32904 | cordinyana | parametersDefinition.addDynFieldString(ORDER_PARAMETER_NAME) |
87 | .setDescription(ORDER_PARAMETER_DESCRIPTION); |
||
88 | 32880 | jjdelcerro | |
89 | } |
||
90 | } |
||
91 | 32904 | cordinyana | |
92 | 30631 | jpiera | public String getDataStoreName() { |
93 | return MemoryStoreProvider.NAME;
|
||
94 | } |
||
95 | |||
96 | public String getDescription() { |
||
97 | return MemoryStoreProvider.DESCRIPTION;
|
||
98 | } |
||
99 | |||
100 | public boolean isValid() { |
||
101 | 32880 | jjdelcerro | return true; |
102 | 30631 | jpiera | } |
103 | |||
104 | 31022 | cordinyana | public String getName() { |
105 | 32880 | jjdelcerro | return (String) parameters.getDynValue(NAME_PARAMETER_NAME); |
106 | 31022 | cordinyana | } |
107 | 30631 | jpiera | |
108 | 32904 | cordinyana | public String getOrderByAttributeName() { |
109 | return (String) parameters.getDynValue(ORDER_PARAMETER_NAME); |
||
110 | } |
||
111 | 31022 | cordinyana | } |