EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference

org.eclipse.persistence.platform.server
Class ServerPlatformBase

java.lang.Object
  extended by org.eclipse.persistence.platform.server.ServerPlatformBase
All Implemented Interfaces:
ServerPlatform
Direct Known Subclasses:
CustomServerPlatform, JBossPlatform, NoServerPlatform, Oc4jPlatform, SunAS9ServerPlatform, WebLogicPlatform, WebSpherePlatform

public abstract class ServerPlatformBase
extends java.lang.Object
implements ServerPlatform

PUBLIC: Implementation of org.eclipse.persistence.platform.server.ServerPlatform

This is the abstract superclass of all platforms for all servers. Each DatabaseSession contains an instance of the receiver, to help the DatabaseSession determine:

Subclasses already exist to provide configurations for Oc4J, WebLogic, JBoss, and WebSphere.

If the user wants a different external transaction controller class or to provide some different behavior than the provided ServerPlatform(s), we recommend subclassing org.eclipse.persistence.platform.server.ServerPlatformBase (or a subclass), and overriding:

for the desired behavior.

See Also:
ServerPlatform

Field Summary
static java.lang.String DEFAULT_SERVER_NAME_AND_VERSION
          INTERNAL: Answer "unknown" as a default for platforms that do not implement getModuleName()
protected  java.lang.Class externalTransactionControllerClass
          externalTransactionControllerClass: This is a user-specifiable class defining the class of external transaction controller to be set into the DatabaseSession
protected  java.lang.String serverNameAndVersion
          INTERNAL: Server name and version.
 
Constructor Summary
ServerPlatformBase(DatabaseSession newDatabaseSession)
          INTERNAL: Default Constructor: Initialize so that runtime services and JTA are enabled.
 
Method Summary
 void clearStatementCache(java.sql.Connection connection)
          INTERNAL: Clears statement cache of the wrapper connection.
 void configureProfiler(Session session)
          INTERNAL: configureProfiler(): set default performance profiler used in this server.
 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.
 void disableRuntimeServices()
          INTERNAL: disableRuntimeServices(): Configure the receiver such that no JMX/MBean will be registered to provide runtime services for my DatabaseSession at runtime.
protected  void ensureNotLoggedIn()
          INTERNAL: Make sure that the DatabaseSession has not logged in yet.
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.
 DatabaseSession getDatabaseSession()
          INTERNAL: getDatabaseSession(): Answer the instance of DatabaseSession the receiver is helping.
abstract  java.lang.Class getExternalTransactionControllerClass()
          INTERNAL: getExternalTransactionControllerClass(): Answer the class of external transaction controller to use For this server platform.
 java.lang.String getModuleName()
          INTERNAL: getModuleName(): Answer the name of the module (jar name) that my session is associated with.
 org.eclipse.persistence.internal.helper.JPAClassLoaderHolder getNewTempClassLoader(PersistenceUnitInfo puInfo)
          INTERNAL: JIRA EJBTHREE-572 requires that we use the real classLoader in place of the getNewTempClassLoader().
 SessionLog getServerLog()
          INTERNAL: getServerLog(): Return the ServerLog for this platform Return the default ServerLog in the base
 java.lang.String getServerNameAndVersion()
          PUBLIC: getServerNameAndVersion(): Talk to the relevant server class library, and get the server name and version
 void initializeExternalTransactionController()
          INTERNAL: initializeExternalTransactionController(): Populate the DatabaseSession's external transaction controller with an instance of my transaction controller class.
protected  void initializeServerNameAndVersion()
          INTERNAL: initializeServerNameAndVersion(): Talk to the relevant server class library, and get the server name and version Default is "unknown"
 boolean isCMP()
          INTERNAL: isCMP(): Answer true if we're in the context of CMP (i.e. the container created me)
 boolean isJTAEnabled()
          INTERNAL: isJTAEnabled(): Answer true if the DatabaseSession's external transaction controller class will be populated with my transaction controller class at runtime.
 boolean isRuntimeServicesEnabled()
          INTERNAL: isRuntimeServicesEnabled(): Answer true if the JMX/MBean providing runtime services for the receiver's DatabaseSession will be deployed at runtime.
 void launchContainerRunnable(java.lang.Runnable runnable)
          INTERNAL: launchContainerRunnable(Runnable runnable): Use the container library to start the provided Runnable.
 void registerMBean()
          INTERNAL: registerMBean(): Create and deploy the JMX MBean to provide runtime services for my databaseSession.
 void serverSpecificRegisterMBean()
          INTERNAL: serverSpecificRegisterMBean(): Server specific implementation of the creation and deployment of the JMX MBean to provide runtime services for my databaseSession.
 void serverSpecificUnregisterMBean()
          INTERNAL: serverSpecificUnregisterMBean(): Server specific implementation of the unregistration of the JMX MBean from its server.
 void setExternalTransactionControllerClass(java.lang.Class newClass)
          INTERNAL: setExternalTransactionControllerClass(Class newClass): Set the class of external transaction controller to use in the DatabaseSession.
 void setIsCMP(boolean isThisCMP)
          INTERNAL: setIsCMP(boolean): Define whether or not we're in the context of CMP (i.e. the container created me)
 boolean shouldUseDriverManager()
          INTERNAL: shouldUseDriverManager(): Indicates whether DriverManager should be used while connecting DefaultConnector.
 void unregisterMBean()
          INTERNAL: unregisterMBean(): Unregister the JMX MBean that was providing runtime services for my databaseSession.
 java.sql.Connection unwrapConnection(java.sql.Connection connection)
          INTERNAL: This method is used to unwrap the connection wrapped by the application server.
 boolean wasFailureCommunicationBased(java.sql.SQLException exception, org.eclipse.persistence.internal.databaseaccess.Accessor connection, org.eclipse.persistence.internal.sessions.AbstractSession sessionForProfile)
          INTERNAL: A call to this method will perform a platform based check on the connection and exception error code to determine if the connection is still valid or if a communication error has occurred.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

externalTransactionControllerClass

protected java.lang.Class externalTransactionControllerClass
externalTransactionControllerClass: This is a user-specifiable class defining the class of external transaction controller to be set into the DatabaseSession


serverNameAndVersion

protected java.lang.String serverNameAndVersion
INTERNAL: Server name and version.


DEFAULT_SERVER_NAME_AND_VERSION

public static final java.lang.String DEFAULT_SERVER_NAME_AND_VERSION
INTERNAL: Answer "unknown" as a default for platforms that do not implement getModuleName()

Constructor Detail

ServerPlatformBase

public ServerPlatformBase(DatabaseSession newDatabaseSession)
INTERNAL: Default Constructor: Initialize so that runtime services and JTA are enabled. Set the DatabaseSession that I will be helping.

Method Detail

configureProfiler

public void configureProfiler(Session session)
INTERNAL: configureProfiler(): set default performance profiler used in this server.


getDatabaseSession

public DatabaseSession getDatabaseSession()
INTERNAL: getDatabaseSession(): Answer the instance of DatabaseSession the receiver is helping.

Specified by:
getDatabaseSession in interface ServerPlatform
Returns:
DatabaseSession databaseSession

getServerNameAndVersion

public java.lang.String getServerNameAndVersion()
PUBLIC: getServerNameAndVersion(): Talk to the relevant server class library, and get the server name and version

Specified by:
getServerNameAndVersion in interface ServerPlatform
Returns:
String serverNameAndVersion

initializeServerNameAndVersion

protected void initializeServerNameAndVersion()
INTERNAL: initializeServerNameAndVersion(): Talk to the relevant server class library, and get the server name and version Default is "unknown"


getModuleName

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 behavior is to return "unknown".

Specified by:
getModuleName in interface ServerPlatform
Returns:
String moduleName

getExternalTransactionControllerClass

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 org.eclipse.persistence.platform.server.ServerPlatformBase (or a subclass), and overriding: ServerPlatformBase.getExternalTransactionControllerClass() for the desired behavior.

Specified by:
getExternalTransactionControllerClass in interface ServerPlatform
Returns:
Class externalTransactionControllerClass
See Also:
JTATransactionController, isJTAEnabled(), disableJTA()

setExternalTransactionControllerClass

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.

Specified by:
setExternalTransactionControllerClass in interface ServerPlatform
See Also:
JTATransactionController, isJTAEnabled(), disableJTA(), initializeExternalTransactionController()

initializeExternalTransactionController

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().

Specified by:
initializeExternalTransactionController in interface ServerPlatform
See Also:
ServerPlatformBase

externalTransactionControllerNotNullWarning

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.

See Also:
getExternalTransactionControllerClass()

isJTAEnabled

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.

Specified by:
isJTAEnabled in interface ServerPlatform
Returns:
boolean isJTAEnabled
See Also:
getExternalTransactionControllerClass(), disableJTA()

disableJTA

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.

Specified by:
disableJTA in interface ServerPlatform
See Also:
getExternalTransactionControllerClass(), isJTAEnabled()

isRuntimeServicesEnabled

public boolean isRuntimeServicesEnabled()
INTERNAL: isRuntimeServicesEnabled(): Answer true if the JMX/MBean providing runtime services for the receiver's DatabaseSession will be deployed at runtime.

Specified by:
isRuntimeServicesEnabled in interface ServerPlatform
Returns:
boolean isRuntimeServicesEnabled
See Also:
disableRuntimeServices()

disableRuntimeServices

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.

Specified by:
disableRuntimeServices in interface ServerPlatform
See Also:
isRuntimeServicesEnabled()

registerMBean

public void registerMBean()
INTERNAL: registerMBean(): Create and deploy the JMX MBean to provide runtime services for my databaseSession. Default is to do nothing.

Specified by:
registerMBean in interface ServerPlatform
See Also:
isRuntimeServicesEnabled(), disableRuntimeServices(), unregisterMBean()

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.

See Also:
isRuntimeServicesEnabled(), disableRuntimeServices(), registerMBean()

unregisterMBean

public void unregisterMBean()
INTERNAL: unregisterMBean(): Unregister the JMX MBean that was providing runtime services for my databaseSession.

Specified by:
unregisterMBean in interface ServerPlatform
See Also:
isRuntimeServicesEnabled(), disableRuntimeServices(), registerMBean()

unwrapConnection

public java.sql.Connection unwrapConnection(java.sql.Connection connection)
INTERNAL: This method is used to unwrap the connection wrapped by the application server. TopLink needs this unwrapped connection for certain database vendor specific support. (i.e. TIMESTAMPTZ,NCHAR,XMLTYPE) Be default we will use the connection's metadata to try to get the connection

Specified by:
unwrapConnection in interface ServerPlatform

serverSpecificUnregisterMBean

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.

See Also:
isRuntimeServicesEnabled(), disableRuntimeServices()

launchContainerRunnable

public void launchContainerRunnable(java.lang.Runnable runnable)
INTERNAL: launchContainerRunnable(Runnable runnable): Use the container library to start the provided Runnable. Default behavior is to use Thread(runnable).start()

Specified by:
launchContainerRunnable in interface ServerPlatform
Parameters:
Runnable - runnable: the instance of runnable to be "started"

ensureNotLoggedIn

protected void ensureNotLoggedIn()
INTERNAL: Make sure that the DatabaseSession has not logged in yet. Throw a ValidationException if we have.


getServerLog

public SessionLog getServerLog()
INTERNAL: getServerLog(): Return the ServerLog for this platform Return the default ServerLog in the base

Specified by:
getServerLog in interface ServerPlatform
Returns:
org.eclipse.persistence.logging.SessionLog

isCMP

public boolean isCMP()
INTERNAL: isCMP(): Answer true if we're in the context of CMP (i.e. the container created me)

Returns:
boolean

setIsCMP

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)


shouldUseDriverManager

public boolean shouldUseDriverManager()
INTERNAL: shouldUseDriverManager(): Indicates whether DriverManager should be used while connecting DefaultConnector.

Specified by:
shouldUseDriverManager in interface ServerPlatform
Returns:
boolean

wasFailureCommunicationBased

public boolean wasFailureCommunicationBased(java.sql.SQLException exception,
                                            org.eclipse.persistence.internal.databaseaccess.Accessor connection,
                                            org.eclipse.persistence.internal.sessions.AbstractSession sessionForProfile)
INTERNAL: A call to this method will perform a platform based check on the connection and exception error code to determine if the connection is still valid or if a communication error has occurred. If a communication error has occurred then the query may be retried. If this platform is unable to determine if the error was communication based it will return false forcing the error to be thrown to the user.

Specified by:
wasFailureCommunicationBased in interface ServerPlatform

getNewTempClassLoader

public org.eclipse.persistence.internal.helper.JPAClassLoaderHolder getNewTempClassLoader(PersistenceUnitInfo puInfo)
Description copied from interface: ServerPlatform
INTERNAL: JIRA EJBTHREE-572 requires that we use the real classLoader in place of the getNewTempClassLoader(). The override code should stay in place until the UCL3 loader does not throw a NPE on loadClass()

Specified by:
getNewTempClassLoader in interface ServerPlatform
Parameters:
puInfo - - the persistence unit info
Returns:
ClassLoaderHolder - a composite object containing the classLoader and the flag that is true if the classLoader returned is temporary
See Also:
org.eclipse.persistence.internal.helper.ClassLoaderHolder

clearStatementCache

public void clearStatementCache(java.sql.Connection connection)
INTERNAL: Clears statement cache of the wrapper connection. Required by Oracle proxy authentication: currently connection statement cache becomes invalid on switching to/from proxy session. This method is called by OracleJDBC_10_1_0_2ProxyConnectionCustomizer before opening proxy session and before closing it.

Specified by:
clearStatementCache in interface ServerPlatform

EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference