Statistics
| Revision:

gvsig-raster / org.gvsig.raster.postgis / trunk / org.gvsig.raster.postgis / org.gvsig.raster.postgis.io / src / main / java / org / gvsig / raster / postgis / io / PostGISRasterServerExplorerParameters.java @ 956

History | View | Annotate | Download (3.34 KB)

1
/* 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
package org.gvsig.raster.postgis.io;
24

    
25
import org.gvsig.fmap.dal.DataServerExplorerParameters;
26
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
27
import org.gvsig.tools.ToolsLocator;
28
import org.gvsig.tools.dataTypes.DataTypes;
29
import org.gvsig.tools.dynobject.DelegatedDynObject;
30
import org.gvsig.tools.dynobject.DynClass;
31
import org.gvsig.tools.dynobject.DynField;
32
import org.gvsig.tools.dynobject.DynObjectManager;
33

    
34
/**
35
 * Parameters for the PostGIS Raster provider
36
 * @author Nacho Brodin (nachobrodin@gmail.com)
37
 */
38
public class PostGISRasterServerExplorerParameters extends AbstractDataParameters implements DataServerExplorerParameters {
39
        public static final String     DYNCLASS_NAME       = "PostGISRasterServerExplorerParameters";
40
        protected static final String  FIELD_HOST          = "host";
41
        protected static DynClass      DYNCLASS            = null;
42
        private DelegatedDynObject     delegatedDynObject  = null;
43
        
44
        public PostGISRasterServerExplorerParameters() {
45
                super();
46
                initialize();
47
        }
48

    
49
        protected void initialize() {
50
                this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
51
                                .getDynObjectManager().createDynObject(
52
                                                DYNCLASS);
53
        }
54
        
55
        @SuppressWarnings("deprecation")
56
        public static void registerDynClass() {
57
                DynObjectManager dynman = ToolsLocator.getDynObjectManager();
58
                DynClass dynClass;
59
                DynField field;
60
                
61
                if(dynman == null)
62
                        return;
63
                
64
                if (DYNCLASS == null) {
65
                        dynClass = dynman.add(DYNCLASS_NAME);
66

    
67
                        field = dynClass.addDynField(FIELD_HOST);
68
                        field.setTheTypeOfAvailableValues(DynField.ANY);
69
                        field.setDescription("Uniform Resource Identifier (File name or URL)");
70
                        field.setType(DataTypes.STRING);
71
                        field.setMandatory(true);
72
                        
73
                        DYNCLASS = dynClass;
74
                }
75

    
76
        }
77
        
78
        protected DelegatedDynObject getDelegatedDynObject() {
79
                return delegatedDynObject;
80
        }
81
        
82
        /**
83
         * Gets the assigned host
84
         * @return
85
         */
86
        public String getHost() {
87
                return (String) this.getDynValue(FIELD_HOST);
88
        }
89

    
90
        /**
91
         * Assign the host to this explorer
92
         * @param host
93
         */
94
        public void setHost(String host) {
95
                this.setDynValue(FIELD_HOST, host);
96
        }
97

    
98
        /*
99
         * (non-Javadoc)
100
         * @see org.gvsig.fmap.dal.DataStoreParameters#getDataStoreName()
101
         */
102
        public String getDataStoreName() {
103
                return PostGISRasterProvider.NAME;
104
        }
105
        
106
        /*
107
         * (non-Javadoc)
108
         * @see org.gvsig.fmap.dal.DataStoreParameters#getDescription()
109
         */
110
        public String getDescription() {
111
                return PostGISRasterProvider.DESCRIPTION;
112
        }
113

    
114
        public String getExplorerName() {
115
                return PostGISRasterProvider.NAME;
116
        }
117
}