svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.impl / src / main / java / org / gvsig / fmap / dal / store / memory / MemoryStoreParameters.java @ 43020
History | View | Annotate | Download (3.43 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
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
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 3
|
||
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 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | */
|
||
24 | 40435 | jjdelcerro | |
25 | package org.gvsig.fmap.dal.store.memory; |
||
26 | |||
27 | 43020 | jjdelcerro | import org.gvsig.fmap.dal.feature.OpenFeatureStoreParameters; |
28 | 40435 | jjdelcerro | import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
29 | import org.gvsig.tools.ToolsLocator; |
||
30 | import org.gvsig.tools.dynobject.DelegatedDynObject; |
||
31 | import org.gvsig.tools.dynobject.DynStruct; |
||
32 | import org.gvsig.tools.persistence.PersistenceManager; |
||
33 | |||
34 | /**
|
||
35 | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
||
36 | */
|
||
37 | public class MemoryStoreParameters extends AbstractDataParameters implements |
||
38 | 43020 | jjdelcerro | OpenFeatureStoreParameters{ |
39 | 40435 | jjdelcerro | |
40 | private static final String PARAMETERS_DEFINITION_NAME = "MemoryStoreParameters"; |
||
41 | |||
42 | private static final String NAME_PARAMETER_NAME = "name"; |
||
43 | private static final String NAME_PARAMETER_DESCRIPTION = "Memory data name"; |
||
44 | public static final String ORDER_PARAMETER_NAME = "autoOrderAttributeName"; |
||
45 | private static final String ORDER_PARAMETER_DESCRIPTION = "Atribute name to order by, by default"; |
||
46 | |||
47 | private DelegatedDynObject parameters;
|
||
48 | |||
49 | public MemoryStoreParameters() {
|
||
50 | this(MemoryStoreProvider.NAME);
|
||
51 | } |
||
52 | |||
53 | public MemoryStoreParameters(String name) { |
||
54 | super();
|
||
55 | initialize(name); |
||
56 | } |
||
57 | |||
58 | protected void initialize(String name) { |
||
59 | this.parameters = (DelegatedDynObject) ToolsLocator.getDynObjectManager()
|
||
60 | .createDynObject( |
||
61 | ToolsLocator.getPersistenceManager().getDefinition(PARAMETERS_DEFINITION_NAME) |
||
62 | ); |
||
63 | setDynValue(NAME_PARAMETER_NAME, name); |
||
64 | } |
||
65 | |||
66 | protected DelegatedDynObject getDelegatedDynObject() {
|
||
67 | return parameters;
|
||
68 | } |
||
69 | |||
70 | protected static void registerParametersDefinition() { |
||
71 | PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
||
72 | if( manager.getDefinition(PARAMETERS_DEFINITION_NAME) == null ) { |
||
73 | DynStruct parametersDefinition = manager.addDefinition( |
||
74 | MemoryStoreParameters.class, |
||
75 | PARAMETERS_DEFINITION_NAME, |
||
76 | (String)null, |
||
77 | null,
|
||
78 | null
|
||
79 | ); |
||
80 | parametersDefinition.addDynFieldString(NAME_PARAMETER_NAME) |
||
81 | .setDescription(NAME_PARAMETER_DESCRIPTION) |
||
82 | .setMandatory(true);
|
||
83 | parametersDefinition.addDynFieldString(ORDER_PARAMETER_NAME) |
||
84 | .setDescription(ORDER_PARAMETER_DESCRIPTION); |
||
85 | |||
86 | } |
||
87 | } |
||
88 | |||
89 | public String getDataStoreName() { |
||
90 | return MemoryStoreProvider.NAME;
|
||
91 | } |
||
92 | |||
93 | public String getDescription() { |
||
94 | return MemoryStoreProvider.DESCRIPTION;
|
||
95 | } |
||
96 | |||
97 | public boolean isValid() { |
||
98 | return true; |
||
99 | } |
||
100 | |||
101 | public String getName() { |
||
102 | return (String) parameters.getDynValue(NAME_PARAMETER_NAME); |
||
103 | } |
||
104 | |||
105 | public String getOrderByAttributeName() { |
||
106 | return (String) parameters.getDynValue(ORDER_PARAMETER_NAME); |
||
107 | } |
||
108 | 40767 | jjdelcerro | } |