("tyrex.jdbc.xa.EnabledDataSource"))) {
try {
// Getting a new EnabledDataSource instance
EnabledDataSource ds = new EnabledDataSource();
// Retrieving parameters
RefAddr currentRefAddr = null;
currentRefAddr = ref.get(DESCRIPTION);
if (currentRefAddr != null)
ds.setDescription
(currentRefAddr.getContent().toString());
currentRefAddr = ref.get(LOGIN_TIMEOUT);
if (currentRefAddr != null) {
ds.setLoginTimeout
(Integer.parseInt
(currentRefAddr.getContent().toString()));
}
currentRefAddr = ref.get(USER);
if (currentRefAddr != null) {
ds.setUser(currentRefAddr.getContent().toString());
} else {
ds.setUser(DEFAULT_USER);
}
currentRefAddr = ref.get(PASSWORD);
if (currentRefAddr != null) {
ds.setPassword(currentRefAddr.getContent().toString());
} else {
ds.setPassword(DEFAULT_PASSWORD);
}
currentRefAddr = ref.get(DRIVER_NAME);
if (currentRefAddr != null) {
ds.setDriverName
(currentRefAddr.getContent().toString());
} else {
ds.setDriverName(DEFAULT_DRIVER_NAME);
}
currentRefAddr = ref.get(DRIVER_CLASS_NAME);
String driverClassName = null;
if (currentRefAddr != null) {
driverClassName =
currentRefAddr.getContent().toString();
} else {
driverClassName = DEFAULT_DRIVER_CLASS_NAME;
}
ds.setDriverClassName(driverClassName);
// Loading and registering JDBC driver
Class driverClass = Class.forName(driverClassName);
Driver databaseDriver = (Driver) driverClass.newInstance();
DriverManager.registerDriver(databaseDriver);