Statistics
| Revision:

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 / feature / spi / memory / MemoryResourceParameters.java @ 42604

History | View | Annotate | Download (2.83 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.dal.feature.spi.memory;
24

    
25
import org.gvsig.fmap.dal.resource.spi.AbstractResourceParameters;
26
import org.gvsig.tools.ToolsLocator;
27
import org.gvsig.tools.dynobject.DelegatedDynObject;
28
import org.gvsig.tools.dynobject.DynClass;
29
import org.gvsig.tools.dynobject.DynObjectManager;
30

    
31
/**
32
 * Parameters to create a {@link MemoryResource}.
33
 *
34
 * @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team
35
 */
36
public class MemoryResourceParameters extends AbstractResourceParameters {
37

    
38
    public static final String DYNCLASS_NAME = "MemoryResourceParameters";
39

    
40
    private static String FIELD_NAME = "name";
41

    
42
    private DelegatedDynObject delegatedDynObject;
43

    
44
    /**
45
     * Creates a new memory resource parameters.
46
     */
47
    public MemoryResourceParameters() {
48
        delegatedDynObject
49
                = (DelegatedDynObject) ToolsLocator.getDynObjectManager()
50
                .createDynObject(registerDynClass());
51
    }
52

    
53
    /**
54
     * Creates a new memory resource parameters with the given memory resource
55
     * name.
56
     *
57
     * @param name of the resource
58
     */
59
    public MemoryResourceParameters(String name) {
60
        this();
61
        setDynValue(FIELD_NAME, name);
62
    }
63

    
64
    @Override
65
    protected DelegatedDynObject getDelegatedDynObject() {
66
        return delegatedDynObject;
67
    }
68

    
69
    @Override
70
    public String getTypeName() {
71
        return MemoryResource.NAME;
72
    }
73

    
74
    /**
75
     * Registers the DynClass related to this parameters.
76
     *
77
     */
78
    private static synchronized DynClass registerDynClass() {
79
        DynObjectManager dynman = ToolsLocator.getDynObjectManager();
80
        DynClass dynClass = dynman.get(DYNCLASS_NAME);
81
        if (dynClass == null) {
82
            dynClass = dynman.add(DYNCLASS_NAME);
83

    
84
            dynClass.addDynFieldString(FIELD_NAME).setDescription(
85
                    "The name of the memory resource");
86
        }
87
        return dynClass;
88
    }
89
}