SuperX-Kernmodul
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

106 lines
2.1 KiB

package de.memtext.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import de.memtext.baseobjects.NamedObject;
import de.memtext.util.CryptUtils;
/**
* wonder what this is
*/
public class DataSource extends NamedObject {
private static final String CRYPT_PREFIX = "^^@@@";
private String url, username, cryptPassword, driver;
private transient String password;
private DB db;
public DataSource() {
}
public DataSource(String url, String username, String password) {
setUrl(url);
setUsername(username);
setPassword(password);
}
public void setInformixSampleValues() {
setUrl("jupiter:50000:informixserver=superx_host;database=superx");
setUsername("informix");
setPassword("");
this.db=DB.INFORMIX;
}
public void setAccessSampleValues() {
setUrl("jdbc:odbc:jdbcodbc:");
setUsername("informix");
setPassword("");
this.db=DB.ACCESS;
}
public String getDriver() {
return driver;
}
public String getPassword() {
return password;
}
public String getUrl() {
return url;
}
public String getUsername() {
return username;
}
public void setDriver(String string) {
driver = string;
}
public void setPassword(String string) {
password = string;
this.setCryptPassword(string);
}
public void setUrl(String string) {
url = string;
}
public void setUsername(String string) {
username = string;
}
public DB getDb() {
return db;
}
public void setDb(DB db) {
this.db = db;
}
public void testConnection() throws SQLException, ClassNotFoundException {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection(url,username,password);
con.close();
}
public String getCryptPassword() {
return cryptPassword;
}
public void setCryptPassword(String aPwd) {
if (!isEncrypted(aPwd))
{
//cryptPassword =CRYPT_PREFIX + CryptUtils.encryptStringDES(aPwd);
}
}
public boolean isEncrypted(String aPwd)
{
return aPwd.startsWith(CRYPT_PREFIX);
}
}
//Created on 17.04.2004 at 16:28:15