Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.db / org.gvsig.fmap.dal.db.lib / src / main / java / org / gvsig / fmap / dal / resource / db / DBResourceParameters.java @ 40435

History | View | Annotate | Download (3.42 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.fmap.dal.resource.db;
29

    
30
import org.gvsig.fmap.dal.resource.spi.AbstractResourceParameters;
31
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
32
import org.gvsig.fmap.dal.store.db.DBHelper;
33
import org.gvsig.tools.dynobject.DelegatedDynObject;
34

    
35
/**
36
 * Base Abstract class to Data Base Resources Parameters
37
 *
38
 * @author jmvivo
39
 *
40
 */
41
public abstract class DBResourceParameters extends AbstractResourceParameters
42
                implements DBParameters {
43

    
44
    public static final String PARAMETERS_DEFINITION_NAME = "DBResourceParameters";
45
        private DelegatedDynObject parameters;
46

    
47
    public DBResourceParameters(String parametersDefinitionName, String typeName) {
48
            this.parameters = (DelegatedDynObject) DBHelper.newParameters(parametersDefinitionName);
49
            this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, typeName);
50
        }
51

    
52
        protected DelegatedDynObject getDelegatedDynObject() {
53
                return parameters;
54
        }
55

    
56
        public String getTypeName() {
57
            return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME);
58
    }
59
    
60
    public String getHost() {
61
                return (String) this.getDynValue(HOST_PARAMTER_NAME);
62
        }
63

    
64
        public Integer getPort() {
65
                return (Integer) this.getDynValue(PORT_PARAMTER_NAME);
66
        }
67

    
68
        public String getDBName() {
69
                return (String) this.getDynValue(DBNAME_PARAMTER_NAME);
70
        }
71

    
72
        public String getUser() {
73
                return (String) this.getDynValue(USER_PARAMTER_NAME);
74
        }
75

    
76
        public String getPassword() {
77
                return (String) this.getDynValue(PASSWORD_PARAMTER_NAME);
78
        }
79

    
80
        /**
81
         * Set <code>host</code> parameter value
82
         *
83
         * @param host
84
         */
85
        public void setHost(String host) {
86
                this.setDynValue(HOST_PARAMTER_NAME, host);
87
        }
88

    
89
        /**
90
         * Set <code>port</code> parameter value
91
         *
92
         * @param port
93
         */
94
        public void setPort(int port) {
95
                this.setDynValue(PORT_PARAMTER_NAME, new Integer(port));
96
        }
97

    
98
        /**
99
         * Set <code>port</code> parameter value
100
         *
101
         * @param port
102
         */
103
        public void setPort(Integer port) {
104
                this.setDynValue(PORT_PARAMTER_NAME, port);
105
        }
106

    
107
        /**
108
         * Set <code>data base name</code> parameter value
109
         *
110
         * @param data
111
         *            base name
112
         */
113
        public void setDBName(String dbName) {
114
                this.setDynValue(DBNAME_PARAMTER_NAME, dbName);
115
        }
116

    
117
        /**
118
         * Set <code>user</code> parameter value
119
         * 
120
         * @param user
121
         */
122
        public void setUser(String user) {
123
                this.setDynValue(USER_PARAMTER_NAME, user);
124
        }
125

    
126
        /**
127
         * Set <code>password</code> parameter value
128
         * 
129
         * @param password
130
         */
131
        public void setPassword(String password) {
132
                this.setDynValue(PASSWORD_PARAMTER_NAME, password);
133
        }
134

    
135
}