root / trunk / extensions / extSDE / src / com / iver / cit / gvsig / sde / gui / sdewizard / ConnectionSettings.java @ 11193
History | View | Annotate | Download (3.27 KB)
1 |
package com.iver.cit.gvsig.sde.gui.sdewizard; |
---|---|
2 |
|
3 |
import com.hardcode.driverManager.DriverLoadException; |
4 |
import com.iver.cit.gvsig.fmap.drivers.VectorialJDBCDriver; |
5 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
6 |
|
7 |
|
8 |
/**
|
9 |
* @author Fernando Gonz?lez Cort?s
|
10 |
*/
|
11 |
public class ConnectionSettings { |
12 |
/**
|
13 |
* @uml.property name="host"
|
14 |
*/
|
15 |
private String host; |
16 |
/**
|
17 |
* @uml.property name="port"
|
18 |
*/
|
19 |
private String port; |
20 |
/**
|
21 |
* @uml.property name="db"
|
22 |
*/
|
23 |
private String db; |
24 |
/**
|
25 |
* @uml.property name="driver"
|
26 |
*/
|
27 |
private String driver; |
28 |
/**
|
29 |
* @uml.property name="user"
|
30 |
*/
|
31 |
private String user; |
32 |
/**
|
33 |
* @uml.property name="name"
|
34 |
*/
|
35 |
private String name; |
36 |
/**
|
37 |
* @uml.property name="passw"
|
38 |
*/
|
39 |
private String passw; |
40 |
|
41 |
/**
|
42 |
* @return
|
43 |
* @uml.property name="db"
|
44 |
*/
|
45 |
public String getDb() { |
46 |
return db;
|
47 |
} |
48 |
/**
|
49 |
* @param db
|
50 |
* @uml.property name="db"
|
51 |
*/
|
52 |
public void setDb(String db) { |
53 |
this.db = db;
|
54 |
} |
55 |
/**
|
56 |
* @return
|
57 |
* @uml.property name="driver"
|
58 |
*/
|
59 |
public String getDriver() { |
60 |
return driver;
|
61 |
} |
62 |
/**
|
63 |
* @param driver
|
64 |
* @uml.property name="driver"
|
65 |
*/
|
66 |
public void setDriver(String driver) { |
67 |
this.driver = driver;
|
68 |
} |
69 |
/**
|
70 |
* @return
|
71 |
* @uml.property name="host"
|
72 |
*/
|
73 |
public String getHost() { |
74 |
return host;
|
75 |
} |
76 |
/**
|
77 |
* @param host
|
78 |
* @uml.property name="host"
|
79 |
*/
|
80 |
public void setHost(String host) { |
81 |
this.host = host;
|
82 |
} |
83 |
/**
|
84 |
* @return
|
85 |
* @uml.property name="port"
|
86 |
*/
|
87 |
public String getPort() { |
88 |
return port;
|
89 |
} |
90 |
/**
|
91 |
* @param port
|
92 |
* @uml.property name="port"
|
93 |
*/
|
94 |
public void setPort(String port) { |
95 |
this.port = port;
|
96 |
} |
97 |
/**
|
98 |
* @return
|
99 |
* @uml.property name="user"
|
100 |
*/
|
101 |
public String getUser() { |
102 |
return user;
|
103 |
} |
104 |
/**
|
105 |
* @param user
|
106 |
* @uml.property name="user"
|
107 |
*/
|
108 |
public void setUser(String user) { |
109 |
this.user = user;
|
110 |
} |
111 |
/**
|
112 |
* @param name
|
113 |
* @uml.property name="name"
|
114 |
*/
|
115 |
public void setName(String name) { |
116 |
this.name = name;
|
117 |
} |
118 |
/**
|
119 |
* @return
|
120 |
* @uml.property name="name"
|
121 |
*/
|
122 |
public String getName() { |
123 |
return name;
|
124 |
} |
125 |
|
126 |
public String toString(){ |
127 |
return host+","+port+","+db+","+driver+","+user+","+name; |
128 |
} |
129 |
|
130 |
public void setFromString(String str) { |
131 |
String[] values = str.split(","); |
132 |
host = values[0];
|
133 |
port = values[1];
|
134 |
db = values[2];
|
135 |
driver = values[3];
|
136 |
user = values[4];
|
137 |
name = values[5];
|
138 |
if (values.length == 7) |
139 |
passw = values[6];
|
140 |
} |
141 |
/**
|
142 |
* @return
|
143 |
* @uml.property name="passw"
|
144 |
*/
|
145 |
public String getPassw() { |
146 |
return passw;
|
147 |
} |
148 |
/**
|
149 |
* @param passw
|
150 |
* @uml.property name="passw"
|
151 |
*/
|
152 |
public void setPassw(String passw) { |
153 |
this.passw = passw;
|
154 |
} |
155 |
public String getConnectionString() throws DriverLoadException |
156 |
{ |
157 |
VectorialJDBCDriver vecDriver = (VectorialJDBCDriver) LayerFactory.getDM().getDriver(getDriver()); |
158 |
String connectionString = vecDriver.getConnectionStringBeginning() + "//" + getHost(); |
159 |
|
160 |
connectionString += (":" + getPort());
|
161 |
|
162 |
connectionString += ("/" + getDb());
|
163 |
|
164 |
return connectionString;
|
165 |
} |
166 |
} |