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 @ 44454
History | View | Annotate | Download (3.62 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 | 44454 | jjdelcerro | public static final String ISTEMPORARY_NAME = "isTemporary"; |
46 | 40435 | jjdelcerro | private static final String ORDER_PARAMETER_DESCRIPTION = "Atribute name to order by, by default"; |
47 | |||
48 | private DelegatedDynObject parameters;
|
||
49 | |||
50 | public MemoryStoreParameters() {
|
||
51 | this(MemoryStoreProvider.NAME);
|
||
52 | } |
||
53 | |||
54 | public MemoryStoreParameters(String name) { |
||
55 | super();
|
||
56 | initialize(name); |
||
57 | } |
||
58 | |||
59 | protected void initialize(String name) { |
||
60 | this.parameters = (DelegatedDynObject) ToolsLocator.getDynObjectManager()
|
||
61 | .createDynObject( |
||
62 | ToolsLocator.getPersistenceManager().getDefinition(PARAMETERS_DEFINITION_NAME) |
||
63 | ); |
||
64 | setDynValue(NAME_PARAMETER_NAME, name); |
||
65 | } |
||
66 | |||
67 | protected DelegatedDynObject getDelegatedDynObject() {
|
||
68 | return parameters;
|
||
69 | } |
||
70 | |||
71 | protected static void registerParametersDefinition() { |
||
72 | PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
||
73 | if( manager.getDefinition(PARAMETERS_DEFINITION_NAME) == null ) { |
||
74 | DynStruct parametersDefinition = manager.addDefinition( |
||
75 | MemoryStoreParameters.class, |
||
76 | PARAMETERS_DEFINITION_NAME, |
||
77 | (String)null, |
||
78 | null,
|
||
79 | null
|
||
80 | ); |
||
81 | parametersDefinition.addDynFieldString(NAME_PARAMETER_NAME) |
||
82 | .setDescription(NAME_PARAMETER_DESCRIPTION) |
||
83 | .setMandatory(true);
|
||
84 | parametersDefinition.addDynFieldString(ORDER_PARAMETER_NAME) |
||
85 | .setDescription(ORDER_PARAMETER_DESCRIPTION); |
||
86 | 44454 | jjdelcerro | parametersDefinition.addDynFieldBoolean(ISTEMPORARY_NAME). |
87 | setDefaultFieldValue(false);
|
||
88 | 40435 | jjdelcerro | |
89 | } |
||
90 | } |
||
91 | |||
92 | public String getDataStoreName() { |
||
93 | return MemoryStoreProvider.NAME;
|
||
94 | } |
||
95 | |||
96 | public String getDescription() { |
||
97 | return MemoryStoreProvider.DESCRIPTION;
|
||
98 | } |
||
99 | |||
100 | public boolean isValid() { |
||
101 | return true; |
||
102 | } |
||
103 | |||
104 | public String getName() { |
||
105 | return (String) parameters.getDynValue(NAME_PARAMETER_NAME); |
||
106 | } |
||
107 | |||
108 | public String getOrderByAttributeName() { |
||
109 | return (String) parameters.getDynValue(ORDER_PARAMETER_NAME); |
||
110 | } |
||
111 | 40767 | jjdelcerro | } |