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 @ 854

History | View | Annotate | Download (3.37 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
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 IVER T.I   {{Task}}
26
*/
27

    
28
package org.gvsig.raster.postgis.io;
29

    
30
import org.gvsig.fmap.dal.DataServerExplorerParameters;
31
import org.gvsig.fmap.dal.DataTypes;
32
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.dynobject.DelegatedDynObject;
35
import org.gvsig.tools.dynobject.DynClass;
36
import org.gvsig.tools.dynobject.DynField;
37
import org.gvsig.tools.dynobject.DynObjectManager;
38

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

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

    
72
                        field = dynClass.addDynField(FIELD_HOST);
73
                        field.setTheTypeOfAvailableValues(DynField.ANY);
74
                        field.setDescription("Uniform Resource Identifier (File name or URL)");
75
                        field.setType(DataTypes.STRING);
76
                        field.setMandatory(true);
77

    
78
                        DYNCLASS = dynClass;
79
                }
80

    
81
        }
82
        
83
        protected DelegatedDynObject getDelegatedDynObject() {
84
                return delegatedDynObject;
85
        }
86
        
87
        /**
88
         * Gets the assigned host
89
         * @return
90
         */
91
        public String getHost() {
92
                return (String) this.getDynValue(FIELD_HOST);
93
        }
94

    
95
        /**
96
         * Assign the host to this explorer
97
         * @param host
98
         */
99
        public void setHost(String host) {
100
                this.setDynValue(FIELD_HOST, host);
101
        }
102

    
103
        /*
104
         * (non-Javadoc)
105
         * @see org.gvsig.fmap.dal.DataStoreParameters#getDataStoreName()
106
         */
107
        public String getDataStoreName() {
108
                return PostGISRasterProvider.NAME;
109
        }
110
        
111
        /*
112
         * (non-Javadoc)
113
         * @see org.gvsig.fmap.dal.DataStoreParameters#getDescription()
114
         */
115
        public String getDescription() {
116
                return PostGISRasterProvider.DESCRIPTION;
117
        }
118

    
119
        public String getExplorerName() {
120
                return PostGISRasterProvider.NAME;
121
        }
122
}