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

History | View | Annotate | Download (4.35 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
/* gvSIG. Geographic Information System of the Valencian Government
25
*
26
* Copyright (C) 2007-2008 Infrastructures and Transports Department
27
* of the Valencian Government (CIT)
28
*
29
* This program is free software; you can redistribute it and/or
30
* modify it under the terms of the GNU General Public License
31
* as published by the Free Software Foundation; either version 2
32
* of the License, or (at your option) any later version.
33
*
34
* This program is distributed in the hope that it will be useful,
35
* but WITHOUT ANY WARRANTY; without even the implied warranty of
36
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37
* GNU General Public License for more details.
38
*
39
* You should have received a copy of the GNU General Public License
40
* along with this program; if not, write to the Free Software
41
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
42
* MA  02110-1301, USA.
43
*
44
*/
45

    
46
/*
47
* AUTHORS (In addition to CIT):
48
* 2009 IVER T.I   {{Task}}
49
*/
50

    
51
package org.gvsig.fmap.dal.resource.db;
52

    
53
import org.gvsig.fmap.dal.resource.spi.AbstractResourceParameters;
54
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
55
import org.gvsig.fmap.dal.store.db.DBHelper;
56
import org.gvsig.tools.dynobject.DelegatedDynObject;
57

    
58
/**
59
 * Base Abstract class to Data Base Resources Parameters
60
 *
61
 * @author jmvivo
62
 *
63
 */
64
public abstract class DBResourceParameters extends AbstractResourceParameters
65
                implements DBParameters {
66

    
67
    public static final String PARAMETERS_DEFINITION_NAME = "DBResourceParameters";
68
        private DelegatedDynObject parameters;
69

    
70
    public DBResourceParameters(String parametersDefinitionName, String typeName) {
71
            this.parameters = (DelegatedDynObject) DBHelper.newParameters(parametersDefinitionName);
72
            this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, typeName);
73
        }
74

    
75
        protected DelegatedDynObject getDelegatedDynObject() {
76
                return parameters;
77
        }
78

    
79
        public String getTypeName() {
80
            return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME);
81
    }
82
    
83
    public String getHost() {
84
                return (String) this.getDynValue(HOST_PARAMTER_NAME);
85
        }
86

    
87
        public Integer getPort() {
88
                return (Integer) this.getDynValue(PORT_PARAMTER_NAME);
89
        }
90

    
91
        public String getDBName() {
92
                return (String) this.getDynValue(DBNAME_PARAMTER_NAME);
93
        }
94

    
95
        public String getUser() {
96
                return (String) this.getDynValue(USER_PARAMTER_NAME);
97
        }
98

    
99
        public String getPassword() {
100
                return (String) this.getDynValue(PASSWORD_PARAMTER_NAME);
101
        }
102

    
103
        /**
104
         * Set <code>host</code> parameter value
105
         *
106
         * @param host
107
         */
108
        public void setHost(String host) {
109
                this.setDynValue(HOST_PARAMTER_NAME, host);
110
        }
111

    
112
        /**
113
         * Set <code>port</code> parameter value
114
         *
115
         * @param port
116
         */
117
        public void setPort(int port) {
118
                this.setDynValue(PORT_PARAMTER_NAME, new Integer(port));
119
        }
120

    
121
        /**
122
         * Set <code>port</code> parameter value
123
         *
124
         * @param port
125
         */
126
        public void setPort(Integer port) {
127
                this.setDynValue(PORT_PARAMTER_NAME, port);
128
        }
129

    
130
        /**
131
         * Set <code>data base name</code> parameter value
132
         *
133
         * @param data
134
         *            base name
135
         */
136
        public void setDBName(String dbName) {
137
                this.setDynValue(DBNAME_PARAMTER_NAME, dbName);
138
        }
139

    
140
        /**
141
         * Set <code>user</code> parameter value
142
         * 
143
         * @param user
144
         */
145
        public void setUser(String user) {
146
                this.setDynValue(USER_PARAMTER_NAME, user);
147
        }
148

    
149
        /**
150
         * Set <code>password</code> parameter value
151
         * 
152
         * @param password
153
         */
154
        public void setPassword(String password) {
155
                this.setDynValue(PASSWORD_PARAMTER_NAME, password);
156
        }
157

    
158
}