root / tags / v1_0_2_Build_901 / extensions / extJDBC / src / com / iver / cit / gvsig / jdbc_spatial / gui / jdbcwizard / ConnectionSettings.java @ 10571
History | View | Annotate | Download (2.18 KB)
1 |
package com.iver.cit.gvsig.jdbc_spatial.gui.jdbcwizard; |
---|---|
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 |
private String host; |
13 |
private String port; |
14 |
private String db; |
15 |
private String driver; |
16 |
private String user; |
17 |
private String name; |
18 |
private String passw; |
19 |
|
20 |
public String getDb() { |
21 |
return db;
|
22 |
} |
23 |
public void setDb(String db) { |
24 |
this.db = db;
|
25 |
} |
26 |
public String getDriver() { |
27 |
return driver;
|
28 |
} |
29 |
public void setDriver(String driver) { |
30 |
this.driver = driver;
|
31 |
} |
32 |
public String getHost() { |
33 |
return host;
|
34 |
} |
35 |
public void setHost(String host) { |
36 |
this.host = host;
|
37 |
} |
38 |
public String getPort() { |
39 |
return port;
|
40 |
} |
41 |
public void setPort(String port) { |
42 |
this.port = port;
|
43 |
} |
44 |
public String getUser() { |
45 |
return user;
|
46 |
} |
47 |
public void setUser(String user) { |
48 |
this.user = user;
|
49 |
} |
50 |
public void setName(String name) { |
51 |
this.name = name;
|
52 |
} |
53 |
public String getName() { |
54 |
return name;
|
55 |
} |
56 |
|
57 |
public String toString(){ |
58 |
return host+","+port+","+db+","+driver+","+user+","+name; |
59 |
} |
60 |
|
61 |
public void setFromString(String str) { |
62 |
String[] values = str.split(","); |
63 |
host = values[0];
|
64 |
port = values[1];
|
65 |
db = values[2];
|
66 |
driver = values[3];
|
67 |
user = values[4];
|
68 |
name = values[5];
|
69 |
if (values.length == 7) |
70 |
passw = values[6];
|
71 |
} |
72 |
public String getPassw() { |
73 |
return passw;
|
74 |
} |
75 |
public void setPassw(String passw) { |
76 |
this.passw = passw;
|
77 |
} |
78 |
public String getConnectionString() throws DriverLoadException |
79 |
{ |
80 |
VectorialJDBCDriver vecDriver = (VectorialJDBCDriver) LayerFactory.getDM().getDriver(getDriver()); |
81 |
String connectionString = vecDriver.getConnectionStringBeginning() + "//" + getHost(); |
82 |
|
83 |
connectionString += (":" + getPort());
|
84 |
|
85 |
connectionString += ("/" + getDb());
|
86 |
|
87 |
return connectionString;
|
88 |
} |
89 |
} |