Methods Summary |
---|
public java.lang.Object | clone()INTERNAL:
Clone the connector.
try {
return super.clone();
} catch (Exception exception) {
throw new InternalError("Clone failed");
}
|
public java.sql.Connection | connect(java.util.Properties properties)INTERNAL:
Connect with the specified properties and return the Connection.
String user = properties.getProperty("user");
String password = properties.getProperty("password");
DataSource dataSource = getDataSource();
if (dataSource == null) {
try {
//bug#2761428 and 4405389 JBoss needs to look up datasources based on a string not a composite or compound name
if (lookupType == STRING_LOOKUP) {
dataSource = (DataSource)getContext().lookup(getName());
} else if (lookupType == COMPOSITE_NAME_LOOKUP) {
dataSource = (DataSource)getContext().lookup(new CompositeName(name));
} else {
dataSource = (DataSource)getContext().lookup(new CompoundName(name, new Properties()));
}
this.setDataSource(dataSource);
} catch (NamingException exception) {
throw ValidationException.cannotAcquireDataSource(getName(), exception);
}
}
try {
// WebLogic connection pools do not require a user name and password.
// JDBCLogin usually initializes these values with an empty string.
// WebLogic data source does not support the getConnection() call with arguments
// it only supports the zero argument call. DM 26/07/2000
if ((user == null) || (user.equalsIgnoreCase(""))) {
return dataSource.getConnection();
} else {
return dataSource.getConnection(user, password);
}
} catch (SQLException exception) {
throw DatabaseException.sqlException(exception);
}
|
public java.lang.String | getConnectionDetails()PUBLIC:
Provide the details of my connection information. This is primarily for JMX runtime services.
return getName();
|
public javax.naming.Context | getContext()PUBLIC:
Return the JNDI Context that can supplied the named DataSource.
if (context == null) {
try {
context = new InitialContext();
} catch (NamingException exception) {
}
}
return context;
|
public javax.sql.DataSource | getDataSource()PUBLIC:
Return the javax.sql.DataSource.
return dataSource;
|
public int | getLookupType()
return lookupType;
|
public java.lang.String | getName()PUBLIC:
Return the name of the DataSource within the
JNDI Context.
return name;
|
public void | setContext(javax.naming.Context context)PUBLIC:
Set the JNDI Context that can supply the named DataSource.
this.context = context;
|
public void | setDataSource(javax.sql.DataSource dataSource)PUBLIC:
Set the javax.sql.DataSource.
this.dataSource = dataSource;
|
public void | setLookupType(int lookupType)
this.lookupType = lookupType;
|
public void | setName(java.lang.String name)PUBLIC:
Set the name of the DataSource within the
JNDI Context.
this.name = name;
|
public java.lang.String | toString()PUBLIC:
Print data source info.
return Helper.getShortClassName(getClass()) + ToStringLocalization.buildMessage("datasource_name", (Object[])null) + "=>" + getName();
|
public void | toString(java.io.PrintWriter writer)INTERNAL:
Print something useful on the log.
writer.print(ToStringLocalization.buildMessage("connector", (Object[])null) + "=>" + Helper.getShortClassName(getClass()));
writer.print(" ");
writer.println(ToStringLocalization.buildMessage("datasource_name", (Object[])null) + "=>" + getName());
|