public class SafeModeSupport
extends java.lang.Object
Utility that does not use any of the ADF classes to obtain a database connection to the sandbox administration database.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
jdbcUrl
The fallback JDBC URL, may be
null. |
| Modifier | Constructor and Description |
|---|---|
protected |
SafeModeSupport(java.lang.String url)
Constructs an instance with a fallback data source.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeAll(java.sql.Connection cnn,
java.sql.PreparedStatement ps,
java.sql.ResultSet rs)
Closes the resources in the order of the arguments if not null.
|
protected java.lang.String |
getUserName(java.sql.Connection cnn)
Returns the name of the user in the current execution context.
|
protected java.sql.Connection |
newConnection()
Creates a new connection to the default data source.
|
protected java.sql.Connection |
newConnection(java.lang.String dataSourceName)
Creates a new connection to a data source.
|
protected java.sql.Connection |
newFallbackConnection()
Creates a new connection as the fallback option.
|
protected java.lang.String |
truncate(java.lang.String s,
int numOfBytes)
Truncates a String so that its length does not exceed the specified number
of bytes.
|
protected SafeModeSupport(java.lang.String url)
url - the JDBC URL; may be nullprotected java.lang.String getUserName(java.sql.Connection cnn)
protected void closeAll(java.sql.Connection cnn,
java.sql.PreparedStatement ps,
java.sql.ResultSet rs)
cnn - the connection objectps - the prepared statementrs - the result setprotected java.sql.Connection newFallbackConnection()
throws java.sql.SQLException,
java.lang.ClassNotFoundException
java.sql.SQLException - if any SQL error occursjava.lang.ClassNotFoundExceptionnewConnection(String)protected final java.sql.Connection newConnection()
protected final java.sql.Connection newConnection(java.lang.String dataSourceName)
dataSourceName - the name of the data sourceprotected java.lang.String truncate(java.lang.String s,
int numOfBytes)
s - the String to be truncatednumOfBytes - the maximum number of bytesnull if the given String is null