svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.spi / src / main / java / org / gvsig / fmap / dal / resource / spi / MultiResourceParameters.java @ 40767
History | View | Annotate | Download (2.94 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
|
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 |
package org.gvsig.fmap.dal.resource.spi; |
25 |
|
26 |
import org.gvsig.fmap.dal.feature.spi.memory.MemoryResource; |
27 |
import org.gvsig.tools.ToolsLocator; |
28 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
29 |
import org.gvsig.tools.dynobject.DynClass; |
30 |
import org.gvsig.tools.dynobject.DynObjectManager; |
31 |
|
32 |
/**
|
33 |
* Parameters for the creation of a multi resource.
|
34 |
*
|
35 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team
|
36 |
*/
|
37 |
public class MultiResourceParameters extends AbstractResourceParameters { |
38 |
|
39 |
public static final String DYNCLASS_NAME = "MultiResourceParameters"; |
40 |
|
41 |
private static final String FIELD_NAME = "name"; |
42 |
|
43 |
private DelegatedDynObject delegatedDynObject;
|
44 |
|
45 |
/**
|
46 |
* Creates a new {@link MultiResourceParameters}.
|
47 |
*/
|
48 |
public MultiResourceParameters() {
|
49 |
this.delegatedDynObject =
|
50 |
(DelegatedDynObject) ToolsLocator.getDynObjectManager() |
51 |
.createDynObject(registerDynClass()); |
52 |
} |
53 |
|
54 |
/**
|
55 |
* Creates a new {@link MultiResourceParameters}.
|
56 |
*
|
57 |
* @param name
|
58 |
* for the parameters. Will be used as the name of the
|
59 |
* {@link MemoryResource} created with this parametres.
|
60 |
*/
|
61 |
public MultiResourceParameters(String name) { |
62 |
this();
|
63 |
setName(name); |
64 |
} |
65 |
|
66 |
protected DelegatedDynObject getDelegatedDynObject() {
|
67 |
return delegatedDynObject;
|
68 |
} |
69 |
|
70 |
public String getTypeName() { |
71 |
return MultiResource.TYPE_NAME;
|
72 |
} |
73 |
|
74 |
public String getName() { |
75 |
return (String) getDelegatedDynObject().getDynValue(FIELD_NAME); |
76 |
} |
77 |
|
78 |
public void setName(String name) { |
79 |
getDelegatedDynObject().setDynValue(FIELD_NAME, name); |
80 |
} |
81 |
|
82 |
/**
|
83 |
* Registers the {@link DynClass} of this parameters attributes.
|
84 |
*
|
85 |
* @return the dyn class of this parameters
|
86 |
*/
|
87 |
private static synchronized DynClass registerDynClass() { |
88 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
89 |
DynClass dynClass = dynman.get(DYNCLASS_NAME); |
90 |
if (dynClass == null) { |
91 |
dynClass = dynman.add(DYNCLASS_NAME); |
92 |
dynClass.addDynFieldString(FIELD_NAME).setDescription( |
93 |
"The name of the multi resource");
|
94 |
} |
95 |
return dynClass;
|
96 |
} |
97 |
} |