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.jdbc / src / main / java / org / gvsig / fmap / dal / store / jdbc / JDBCNewStoreParameters.java @ 44058
History | View | Annotate | Download (5.98 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
6 | 41509 | jjdelcerro | * 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 | 40435 | jjdelcerro | *
|
11 | 41509 | jjdelcerro | * 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 | 40435 | jjdelcerro | *
|
16 | 41509 | jjdelcerro | * 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 | 40435 | jjdelcerro | *
|
20 | 41509 | jjdelcerro | * For any additional information, do not hesitate to contact us at info AT
|
21 | * gvsig.com, or visit our website www.gvsig.com.
|
||
22 | 40435 | jjdelcerro | */
|
23 | package org.gvsig.fmap.dal.store.jdbc; |
||
24 | |||
25 | 41638 | jjdelcerro | import org.apache.commons.lang3.StringUtils; |
26 | 41490 | jjdelcerro | import org.gvsig.fmap.dal.store.db.DBNewStoreParameters; |
27 | 40435 | jjdelcerro | |
28 | 41497 | jjdelcerro | import static org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters.CATALOG_PARAMTER_NAME; |
29 | import static org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters.JDBC_DRIVER_CLASS_PARAMTER_NAME; |
||
30 | import static org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters.SCHEMA_PARAMTER_NAME; |
||
31 | 40435 | jjdelcerro | |
32 | 41509 | jjdelcerro | public class JDBCNewStoreParameters extends DBNewStoreParameters implements |
33 | 41497 | jjdelcerro | JDBCConnectionParameters { |
34 | |||
35 | 40435 | jjdelcerro | public static final String PARAMETERS_DEFINITION_NAME = "JDBCNewStoreParameters"; |
36 | |||
37 | 41497 | jjdelcerro | public JDBCNewStoreParameters() {
|
38 | super(PARAMETERS_DEFINITION_NAME, JDBCStoreProvider.NAME);
|
||
39 | } |
||
40 | 40435 | jjdelcerro | |
41 | 41497 | jjdelcerro | protected JDBCNewStoreParameters(String parametersDefinitionName, String providerName) { |
42 | super(parametersDefinitionName, providerName);
|
||
43 | } |
||
44 | 40435 | jjdelcerro | |
45 | 41497 | jjdelcerro | /**
|
46 | * Set <code>JDBC Driver class name</code> parameter
|
||
47 | *
|
||
48 | * @param className
|
||
49 | */
|
||
50 | public void setJDBCDriverClassName(String className) { |
||
51 | this.setDynValue(JDBC_DRIVER_CLASS_PARAMTER_NAME, className);
|
||
52 | } |
||
53 | |||
54 | public String getJDBCDriverClassName() { |
||
55 | return (String) this.getDynValue(JDBC_DRIVER_CLASS_PARAMTER_NAME); |
||
56 | } |
||
57 | |||
58 | public String getCatalog() { |
||
59 | return (String) this.getDynValue(CATALOG_PARAMTER_NAME); |
||
60 | } |
||
61 | |||
62 | /**
|
||
63 | * Set <code>catalog</code> parameter
|
||
64 | *
|
||
65 | * @param className
|
||
66 | */
|
||
67 | public void setCatalog(String catalog) { |
||
68 | this.setDynValue(CATALOG_PARAMTER_NAME, catalog);
|
||
69 | } |
||
70 | |||
71 | public String getSchema() { |
||
72 | return (String) this.getDynValue(SCHEMA_PARAMTER_NAME); |
||
73 | } |
||
74 | |||
75 | /**
|
||
76 | * Set <code>schema</code> parameter
|
||
77 | *
|
||
78 | * @param className
|
||
79 | */
|
||
80 | public void setSchema(String schema) { |
||
81 | this.setDynValue(SCHEMA_PARAMTER_NAME, schema);
|
||
82 | } |
||
83 | |||
84 | public String getUrl() { |
||
85 | return (String) this.getDynValue(URL_PARAMTER_NAME); |
||
86 | } |
||
87 | |||
88 | /**
|
||
89 | * Set <code>JDBC connection url</code> parameter
|
||
90 | *
|
||
91 | * @param url
|
||
92 | */
|
||
93 | public void setUrl(String url) { |
||
94 | this.setDynValue(URL_PARAMTER_NAME, url);
|
||
95 | } |
||
96 | |||
97 | 41509 | jjdelcerro | /**
|
98 | * Return table <code>name</code> or <code>schema.tableName</code> if
|
||
99 | * <code>schema</code> parameter is set.
|
||
100 | *
|
||
101 | * @return
|
||
102 | */
|
||
103 | public String tableID() { |
||
104 | if (this.getSchema() == null || this.getSchema() == "") { |
||
105 | return escapeName(this.getTable()); |
||
106 | } |
||
107 | return escapeName(this.getSchema()) + "." + escapeName(this.getTable()); |
||
108 | } |
||
109 | |||
110 | protected String escapeName(String name) { |
||
111 | return "\"".concat(name).concat("\""); |
||
112 | } |
||
113 | |||
114 | 41638 | jjdelcerro | public String getSelectRole() { |
115 | String value = (String) this.getDynValue("SelectRole"); |
||
116 | return StringUtils.defaultIfBlank(value, null); |
||
117 | } |
||
118 | |||
119 | public String getInsertRole() { |
||
120 | String value = (String) this.getDynValue("InsertRole"); |
||
121 | return StringUtils.defaultIfBlank(value, null); |
||
122 | } |
||
123 | |||
124 | |||
125 | public String getUpdateRole() { |
||
126 | String value = (String) this.getDynValue("UpdateRole"); |
||
127 | return StringUtils.defaultIfBlank(value, null); |
||
128 | } |
||
129 | |||
130 | |||
131 | public String getDeleteRole() { |
||
132 | String value = (String) this.getDynValue("DeleteRole"); |
||
133 | return StringUtils.defaultIfBlank(value, null); |
||
134 | } |
||
135 | |||
136 | |||
137 | public String getTruncateRole() { |
||
138 | String value = (String) this.getDynValue("TruncateRole"); |
||
139 | return StringUtils.defaultIfBlank(value, null); |
||
140 | } |
||
141 | |||
142 | |||
143 | public String getReferenceRole() { |
||
144 | String value = (String) this.getDynValue("ReferenceRole"); |
||
145 | return StringUtils.defaultIfBlank(value, null); |
||
146 | } |
||
147 | |||
148 | |||
149 | public String getTriggerRole() { |
||
150 | String value = (String) this.getDynValue("TriggerRole"); |
||
151 | return StringUtils.defaultIfBlank(value, null); |
||
152 | } |
||
153 | |||
154 | |||
155 | public String getAllRole() { |
||
156 | String value = (String) this.getDynValue("AllRole"); |
||
157 | return StringUtils.defaultIfBlank(value, null); |
||
158 | } |
||
159 | |||
160 | |||
161 | public String getPostCreatingStatement() { |
||
162 | String value = (String) this.getDynValue("PostCreatingStatement"); |
||
163 | return StringUtils.defaultIfBlank(value, null); |
||
164 | } |
||
165 | 41655 | jjdelcerro | |
166 | 41638 | jjdelcerro | |
167 | 41655 | jjdelcerro | public void setSelectRole(String role) { |
168 | this.setDynValue("SelectRole", role); |
||
169 | } |
||
170 | |||
171 | public void setInsertRole(String role) { |
||
172 | this.setDynValue("InsertRole", role); |
||
173 | } |
||
174 | |||
175 | public void setUpdateRole(String role) { |
||
176 | this.setDynValue("UpdateRole", role); |
||
177 | } |
||
178 | |||
179 | public void setDeleteRole(String role) { |
||
180 | this.setDynValue("DeleteRole", role); |
||
181 | } |
||
182 | |||
183 | public void setTruncateRole(String role) { |
||
184 | this.setDynValue("TruncateRole", role); |
||
185 | } |
||
186 | |||
187 | public void setReferenceRole(String role) { |
||
188 | this.setDynValue("ReferenceRole", role); |
||
189 | } |
||
190 | |||
191 | public void setTriggerRole(String role) { |
||
192 | this.setDynValue("TriggerRole", role); |
||
193 | } |
||
194 | |||
195 | public void setAllRole(String role) { |
||
196 | this.setDynValue("AllRole", role); |
||
197 | } |
||
198 | |||
199 | public void setPostCreatingStatement(String statement) { |
||
200 | this.setDynValue("PostCreatingStatement", statement); |
||
201 | } |
||
202 | 40596 | jjdelcerro | } |