Methods Summary |
---|
public void | disableJTA()INTERNAL: disableJTA(): Configure the receiver such that my external transaction controller class will
be ignored, and will NOT be used to populate DatabaseSession's external transaction controller class
at runtime.
TopLink will NOT be configured to register for callbacks for beforeCompletion and afterCompletion.
this.ensureNotLoggedIn();
this.isJTAEnabled = false;
|
public void | disableRuntimeServices()INTERNAL: disableRuntimeServices(): Configure the receiver such that no JMX/MBean will be registered
to provide runtime services for my DatabaseSession at runtime.
this.ensureNotLoggedIn();
this.isRuntimeServicesEnabled = false;
|
protected void | ensureNotLoggedIn()INTERNAL: Make sure that the DatabaseSession has not logged in yet.
Throw a ValidationException if we have.
//RCM: Allow for a null database session
if (getDatabaseSession() == null) {
return;
}
if (getDatabaseSession().isConnected()) {
throw ValidationException.serverPlatformIsReadOnlyAfterLogin(this.getClass().getName());
}
|
protected void | externalTransactionControllerNotNullWarning()INTERNAL: externalTransactionControllerNotNullWarning():
When the external transaction controller is being initialized, we warn the developer
if they have already defined the external transaction controller in some way other
than subclassing ServerPlatformBase.
getDatabaseSession().warning("External_transaction_controller_not_defined_by_server_platform", SessionLog.EJB);
|
public oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl | getDatabaseSession()INTERNAL: getDatabaseSession(): Answer the instance of DatabaseSession the receiver is helping.
return this.databaseSession;
|
public abstract java.lang.Class | getExternalTransactionControllerClass()INTERNAL: getExternalTransactionControllerClass(): Answer the class of external transaction controller to use
For this server platform. This is read-only.
If the user wants a different external transaction controller class than the provided ServerPlatform(s),
we recommend subclassing oracle.toplink.essentials.platform.server.ServerPlatformBase (or a subclass),
and overriding:
ServerPlatformBase.getExternalTransactionControllerClass()
for the desired behaviour.
|
public java.lang.String | getModuleName()INTERNAL: getModuleName(): Answer the name of the module (jar name) that my session
is associated with.
Answer "unknown" if there is no module name available.
Default behaviour is to return "unknown".
return "unknown";
|
public oracle.toplink.essentials.logging.SessionLog | getServerLog()INTERNAL: getServerLog(): Return the ServerLog for this platform
Return the default ServerLog in the base
return new ServerLog();
|
public java.lang.String | getServerNameAndVersion()PUBLIC: getServerNameAndVersion(): Talk to the relevant server class library, and get the server name
and version
Default is "unknown"
return ToStringLocalization.buildMessage("unknown");
|
public void | initializeExternalTransactionController()INTERNAL: initializeExternalTransactionController(): Populate the DatabaseSession's
external transaction controller with an instance of my transaction controller class.
To change the external transaction controller class, we recommend creating a subclass of
ServerPlatformBase, and overriding getExternalTransactionControllerClass().
this.ensureNotLoggedIn();
//BUG 3975114: Even if JTA is disabled, override if we're in CMP
//JTA must never be disable during CMP (WLS/Oc4j)
if (!isJTAEnabled() && !isCMP()) {
return;
}
//BUG 3975114: display a warning if JTA is disabled and we're in CMP
if (!isJTAEnabled() && isCMP()) {
AbstractSessionLog.getLog().warning("jta_cannot_be_disabled_in_cmp");
}
//check if the transaction controller class is overridden by a preLogin or equivalent,
//or if the transaction controller was already defined, in which case they should have written
//a subclass. Show a warning
try {
if (getDatabaseSession().getExternalTransactionController() != null) {
this.externalTransactionControllerNotNullWarning();
return;
}
ExternalTransactionController controller = null;
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
controller = (ExternalTransactionController)AccessController.doPrivileged(new PrivilegedNewInstanceFromClass(this.getExternalTransactionControllerClass()));
} catch (PrivilegedActionException exception) {
Exception throwableException = exception.getException();
if (throwableException instanceof InstantiationException) {
throw ValidationException.cannotCreateExternalTransactionController(getExternalTransactionControllerClass().getName());
} else {
throw ValidationException.cannotCreateExternalTransactionController(getExternalTransactionControllerClass().getName());
}
}
} else {
controller = (ExternalTransactionController)PrivilegedAccessHelper.newInstanceFromClass(this.getExternalTransactionControllerClass());
}
getDatabaseSession().setExternalTransactionController(controller);
} catch (InstantiationException instantiationException) {
throw ValidationException.cannotCreateExternalTransactionController(getExternalTransactionControllerClass().getName());
} catch (IllegalAccessException illegalAccessException) {
throw ValidationException.cannotCreateExternalTransactionController(getExternalTransactionControllerClass().getName());
}
|
public boolean | isCMP()INTERNAL: isCMP(): Answer true if we're in the context of CMP (i.e. the container created me)
return isCMP;
|
public boolean | isJTAEnabled()INTERNAL: isJTAEnabled(): Answer true if the DatabaseSession's external transaction controller class will
be populated with my transaction controller class at runtime. If the transaction controller class is
overridden in the DatabaseSession, my transaction controller class will be ignored.
Answer true if TopLink will be configured to register for callbacks for beforeCompletion and afterCompletion.
return this.isJTAEnabled;
|
public boolean | isRuntimeServicesEnabled()INTERNAL: isRuntimeServicesEnabled(): Answer true if the JMX/MBean providing runtime services for
the receiver's DatabaseSession will be deployed at runtime.
return this.isRuntimeServicesEnabled;
|
public void | launchContainerRunnable(java.lang.Runnable runnable)INTERNAL: launchContainerRunnable(Runnable runnable): Use the container library to
start the provided Runnable.
Default behaviour is to use Thread(runnable).start()
new Thread(runnable).start();
|
public void | registerMBean()INTERNAL: registerMBean(): Create and deploy the JMX MBean to provide runtime services for my
databaseSession.
Default is to do nothing.
if (!this.isRuntimeServicesEnabled()) {
return;
}
this.serverSpecificRegisterMBean();
|
public void | serverSpecificRegisterMBean()INTERNAL: serverSpecificRegisterMBean(): Server specific implementation of the
creation and deployment of the JMX MBean to provide runtime services for my
databaseSession.
Default is to do nothing. This should be subclassed if required.
|
public void | serverSpecificUnregisterMBean()INTERNAL: serverSpecificUnregisterMBean(): Server specific implementation of the
unregistration of the JMX MBean from its server.
Default is to do nothing. This should be subclassed if required.
|
public void | setExternalTransactionControllerClass(java.lang.Class newClass)INTERNAL: setExternalTransactionControllerClass(Class newClass): Set the class of external
transaction controller to use in the DatabaseSession.
This is defined by the user via the sessions.xml.
this.externalTransactionControllerClass = newClass;
|
public void | setIsCMP(boolean isThisCMP)INTERNAL: setIsCMP(boolean): Define whether or not we're in the context of CMP (i.e. the container created me)
isCMP = isThisCMP;
|
public void | unregisterMBean()INTERNAL: unregisterMBean(): Unregister the JMX MBean that was providing runtime services for my
databaseSession.
if (!this.isRuntimeServicesEnabled()) {
return;
}
this.serverSpecificUnregisterMBean();
|
public java.sql.Connection | unwrapOracleConnection(oracle.toplink.essentials.internal.databaseaccess.Platform platform, java.sql.Connection connection)INTERNAL: This method is used to unwrap the oracle connection wrapped by
the application server. TopLink needs this unwrapped connection for certain
Oracle Specific support. (ie TIMESTAMPTZ)
This is added as a workaround for bug 4460996
try {
return connection.getMetaData().getConnection();
} catch (java.sql.SQLException e){
((DatabaseSessionImpl)getDatabaseSession()).log(SessionLog.WARNING, SessionLog.CONNECTION, "cannot_unwrap_connection", e);
return connection;
}
|