Class TransportManager
- java.lang.Object
-
- org.eclipse.persistence.sessions.coordination.TransportManager
-
- Direct Known Subclasses:
BroadcastTransportManager
,CORBATransportManager
,RMITransportManager
public abstract class TransportManager extends java.lang.Object
Purpose: Provide an abstract class that offers a common API to handling remote command connections.
Description: This class manages the remote connections to other RCM service instances and posts the local connection to this service instance in a name service so that other RCM service instances can connect to it.
- Author:
- Steven Vo
- Since:
- OracleAS TopLink 10g (9.0.4)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Hashtable
connectionsToExternalServices
Connections to other servicesstatic java.lang.String
DEFAULT_CONTEXT_FACTORY
Default JNDI properties for remote accessstatic java.lang.String
DEFAULT_DEDICATED_CONNECTION_KEY
static java.lang.String
DEFAULT_DEDICATED_CONNECTION_VALUE
static java.lang.String
DEFAULT_IIOP_URL_PORT
static java.lang.String
DEFAULT_IIOP_URL_PROTOCOL
static int
DEFAULT_NAMING_SERVICE
static boolean
DEFAULT_REMOVE_CONNECTION_ON_ERROR_MODE
static java.lang.String
DEFAULT_URL_PORT
static java.lang.String
DEFAULT_URL_PROTOCOL
Defaults for RMI applicationsstatic java.lang.String
DEFAULT_USER_NAME
static int
JNDI_NAMING_SERVICE
Valid values for naming service typeprotected org.eclipse.persistence.internal.sessions.coordination.RemoteConnection
localConnection
The remote command connection to this transportprotected java.util.Hashtable
localContextProperties
Properties to obtain the context used for local JNDI accessprotected int
namingServiceType
The type of naming service used to look up other connectionsprotected RemoteCommandManager
rcm
The RCM that manages this transportstatic int
REGISTRY_NAMING_SERVICE
protected java.util.Hashtable
remoteContextProperties
Properties to obtain the context used for remote JNDI accessprotected org.eclipse.persistence.internal.security.SecurableObjectHolder
securableObjectHolder
Security util that is used to decrypt and encrypt passwordprotected boolean
shouldRemoveConnectionOnError
Determines whether a connection should be discarded if an error occurs on it
-
Constructor Summary
Constructors Constructor Description TransportManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addConnectionToExternalService(org.eclipse.persistence.internal.sessions.coordination.RemoteConnection connection)
INTERNAL: Add a remote Connection to a remote service.void
connectBackToRemote(org.eclipse.persistence.internal.sessions.coordination.RemoteConnection connection)
INTERNAL: This method is called by the remote command manager when this service should connect back ('handshake') to the service from which this remote connection came.abstract org.eclipse.persistence.internal.sessions.coordination.RemoteConnection
createConnection(ServiceId serviceId)
INTERNAL: Return a remote connection to the specified servicevoid
createConnections()
INTERNAL: Does nothing by default.DiscoveryManager
createDiscoveryManager()
ADVANCED: Factory of new DiscoveryManager for different transports.abstract void
createLocalConnection()
INTERNAL: Put the remote connection to local host in naming service and return the of the created remote connectionprotected java.lang.String
decrypt(java.lang.String encryptedPwd)
INTERNAL: Security method called by the children classesvoid
discardConnections()
INTERNAL: Remove all remote connections for its list and the local connection from JNDI or JMS Subsriberprotected java.lang.String
encrypt(java.lang.String pwd)
INTERNAL: Security method.java.util.Map<java.lang.String,org.eclipse.persistence.internal.sessions.coordination.RemoteConnection>
getConnectionsToExternalServices()
INTERNAL:java.util.Map<java.lang.String,org.eclipse.persistence.internal.sessions.coordination.RemoteConnection>
getConnectionsToExternalServicesForCommandPropagation()
INTERNAL: Returns clone of the original map.org.eclipse.persistence.internal.sessions.coordination.RemoteConnection
getConnectionToLocalHost()
INTERNAL: Return a remote connection to this servicejavax.naming.Context
getContext(java.util.Hashtable contextProperties)
INTERNAL: Helper method to get a naming context.java.lang.String
getEncryptedPassword()
PUBLIC: Return the encrypted (assumed) password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.java.lang.String
getInitialContextFactoryName()
PUBLIC: Return the context factory name used as the value to the INITIAL_CONTEXT_FACTORY key in the cached context properties.java.util.Hashtable
getLocalContextProperties()
ADVANCED: Return the properties that will be used to create the initial context for local JNDI access.int
getNamingServiceType()
PUBLIC: Return the type of naming service used to look up remote connections to other service instances.java.lang.String
getPassword()
PUBLIC: Return the password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.RemoteCommandManager
getRemoteCommandManager()
INTERNAL:java.util.Hashtable
getRemoteContextProperties()
ADVANCED: Return the cached properties that will be used to create the initial context when doing remote JNDI lookups.javax.naming.Context
getRemoteHostContext(java.lang.String remoteHostURL)
INTERNAL: Return the context used for looking up in the JNDI space of the specified remote URL.java.lang.String
getUserName()
PUBLIC: Return the user name used as the value to the SECURITY_PRINCIPAL key in the cached context properties.protected boolean
hasPassword()
INTERNAL:void
initialize()
INTERNAL: Initialize default properties.void
removeAllConnectionsToExternalServices()
INTERNAL: Remove all remote connections from the list.void
removeConnectionToExternalService(org.eclipse.persistence.internal.sessions.coordination.RemoteConnection connection)
INTERNAL: Remove a remote connection from the list of connections to receive remote commands.abstract void
removeLocalConnection()
ADVANCED: Remove the local connection from remote accesses.void
setConfig(java.lang.String config)
Generic API to allow config to be set.void
setEncryptedPassword(java.lang.String encryptedPassword)
ADVANCED: Set the encrypted password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.void
setEncryptionClassName(java.lang.String encryptionClassName)
INTERNAL SECURITY: Set encryption class that will be loaded by the SecurableObjectHoldervoid
setInitialContextFactoryName(java.lang.String contextFactoryName)
ADVANCED: Set the context factory name used as the value to the INITIAL_CONTEXT_FACTORY key in the cached context properties.void
setLocalContextProperties(java.util.Hashtable properties)
ADVANCED: Set the properties that will be used to create the initial context for local JNDI access.void
setNamingServiceType(int serviceType)
ADVANCED: Set the type of naming service used to look up remote connections to other service instances.void
setPassword(java.lang.String password)
ADVANCED: Set the password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.void
setRemoteCommandManager(RemoteCommandManager rcm)
INTERNAL:void
setRemoteContextProperties(java.util.Hashtable properties)
ADVANCED: Set the cached properties that will be used to create the initial context when doing remote JNDI lookups.void
setShouldRemoveConnectionOnError(boolean shouldRemoveConnectionOnError)
PUBLIC: Set whether connections to remote services should be disconnected when an error occurs.void
setUserName(java.lang.String userName)
ADVANCED: Set the user name used as the value to the SECURITY_PRINCIPAL key in the cached context properties.boolean
shouldRemoveConnectionOnError()
PUBLIC: Return whether connections to remote services should be disconnected when an error occurs.
-
-
-
Field Detail
-
localConnection
protected org.eclipse.persistence.internal.sessions.coordination.RemoteConnection localConnection
The remote command connection to this transport
-
rcm
protected RemoteCommandManager rcm
The RCM that manages this transport
-
namingServiceType
protected int namingServiceType
The type of naming service used to look up other connections
-
localContextProperties
protected java.util.Hashtable localContextProperties
Properties to obtain the context used for local JNDI access
-
remoteContextProperties
protected java.util.Hashtable remoteContextProperties
Properties to obtain the context used for remote JNDI access
-
shouldRemoveConnectionOnError
protected boolean shouldRemoveConnectionOnError
Determines whether a connection should be discarded if an error occurs on it
-
connectionsToExternalServices
protected java.util.Hashtable connectionsToExternalServices
Connections to other services
-
securableObjectHolder
protected org.eclipse.persistence.internal.security.SecurableObjectHolder securableObjectHolder
Security util that is used to decrypt and encrypt password
-
DEFAULT_REMOVE_CONNECTION_ON_ERROR_MODE
public static final boolean DEFAULT_REMOVE_CONNECTION_ON_ERROR_MODE
- See Also:
- Constant Field Values
-
JNDI_NAMING_SERVICE
public static final int JNDI_NAMING_SERVICE
Valid values for naming service type- See Also:
- Constant Field Values
-
REGISTRY_NAMING_SERVICE
public static final int REGISTRY_NAMING_SERVICE
- See Also:
- Constant Field Values
-
DEFAULT_URL_PROTOCOL
public static final java.lang.String DEFAULT_URL_PROTOCOL
Defaults for RMI applications- See Also:
- Constant Field Values
-
DEFAULT_IIOP_URL_PROTOCOL
public static final java.lang.String DEFAULT_IIOP_URL_PROTOCOL
- See Also:
- Constant Field Values
-
DEFAULT_URL_PORT
public static final java.lang.String DEFAULT_URL_PORT
- See Also:
- Constant Field Values
-
DEFAULT_IIOP_URL_PORT
public static final java.lang.String DEFAULT_IIOP_URL_PORT
- See Also:
- Constant Field Values
-
DEFAULT_NAMING_SERVICE
public static final int DEFAULT_NAMING_SERVICE
- See Also:
- Constant Field Values
-
DEFAULT_CONTEXT_FACTORY
public static final java.lang.String DEFAULT_CONTEXT_FACTORY
Default JNDI properties for remote access- See Also:
- Constant Field Values
-
DEFAULT_DEDICATED_CONNECTION_KEY
public static final java.lang.String DEFAULT_DEDICATED_CONNECTION_KEY
- See Also:
- Constant Field Values
-
DEFAULT_DEDICATED_CONNECTION_VALUE
public static final java.lang.String DEFAULT_DEDICATED_CONNECTION_VALUE
- See Also:
- Constant Field Values
-
DEFAULT_USER_NAME
public static final java.lang.String DEFAULT_USER_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
createConnection
public abstract org.eclipse.persistence.internal.sessions.coordination.RemoteConnection createConnection(ServiceId serviceId)
INTERNAL: Return a remote connection to the specified service
-
createConnections
public void createConnections()
INTERNAL: Does nothing by default. In case TransportManager doesn't use DiscoveryManager (createDiscoveryManager method retuns null) this method called during RCM initialization to create all the necessary connections. TransportManager ancestors that override createDiscoveryManager method to return null must override this method, too.
-
connectBackToRemote
public void connectBackToRemote(org.eclipse.persistence.internal.sessions.coordination.RemoteConnection connection) throws java.lang.Exception
INTERNAL: This method is called by the remote command manager when this service should connect back ('handshake') to the service from which this remote connection came.- Throws:
java.lang.Exception
-
getConnectionToLocalHost
public org.eclipse.persistence.internal.sessions.coordination.RemoteConnection getConnectionToLocalHost()
INTERNAL: Return a remote connection to this service
-
createLocalConnection
public abstract void createLocalConnection()
INTERNAL: Put the remote connection to local host in naming service and return the of the created remote connection
-
getNamingServiceType
public int getNamingServiceType()
PUBLIC: Return the type of naming service used to look up remote connections to other service instances.- Returns:
- The type of naming service used.
-
setNamingServiceType
public void setNamingServiceType(int serviceType)
ADVANCED: Set the type of naming service used to look up remote connections to other service instances. The service type must be one of JNDI_NAMING_SERVICE or REGISTRY_NAMING_SERVICE.
-
getUserName
public java.lang.String getUserName()
PUBLIC: Return the user name used as the value to the SECURITY_PRINCIPAL key in the cached context properties.
-
setUserName
public void setUserName(java.lang.String userName)
ADVANCED: Set the user name used as the value to the SECURITY_PRINCIPAL key in the cached context properties.
-
getPassword
public java.lang.String getPassword()
PUBLIC: Return the password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.
-
getEncryptedPassword
public java.lang.String getEncryptedPassword()
PUBLIC: Return the encrypted (assumed) password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.
-
setPassword
public void setPassword(java.lang.String password)
ADVANCED: Set the password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.
-
setEncryptedPassword
public void setEncryptedPassword(java.lang.String encryptedPassword)
ADVANCED: Set the encrypted password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.
-
getInitialContextFactoryName
public java.lang.String getInitialContextFactoryName()
PUBLIC: Return the context factory name used as the value to the INITIAL_CONTEXT_FACTORY key in the cached context properties.
-
setInitialContextFactoryName
public void setInitialContextFactoryName(java.lang.String contextFactoryName)
ADVANCED: Set the context factory name used as the value to the INITIAL_CONTEXT_FACTORY key in the cached context properties.
-
getContext
public javax.naming.Context getContext(java.util.Hashtable contextProperties)
INTERNAL: Helper method to get a naming context.
-
getRemoteContextProperties
public java.util.Hashtable getRemoteContextProperties()
ADVANCED: Return the cached properties that will be used to create the initial context when doing remote JNDI lookups.
-
setRemoteContextProperties
public void setRemoteContextProperties(java.util.Hashtable properties)
ADVANCED: Set the cached properties that will be used to create the initial context when doing remote JNDI lookups.
-
getLocalContextProperties
public java.util.Hashtable getLocalContextProperties()
ADVANCED: Return the properties that will be used to create the initial context for local JNDI access.
-
setLocalContextProperties
public void setLocalContextProperties(java.util.Hashtable properties)
ADVANCED: Set the properties that will be used to create the initial context for local JNDI access.
-
getRemoteCommandManager
public RemoteCommandManager getRemoteCommandManager()
INTERNAL:
-
setRemoteCommandManager
public void setRemoteCommandManager(RemoteCommandManager rcm)
INTERNAL:
-
addConnectionToExternalService
public void addConnectionToExternalService(org.eclipse.persistence.internal.sessions.coordination.RemoteConnection connection)
INTERNAL: Add a remote Connection to a remote service.
-
removeConnectionToExternalService
public void removeConnectionToExternalService(org.eclipse.persistence.internal.sessions.coordination.RemoteConnection connection)
INTERNAL: Remove a remote connection from the list of connections to receive remote commands.
-
removeAllConnectionsToExternalServices
public void removeAllConnectionsToExternalServices()
INTERNAL: Remove all remote connections from the list.
-
getConnectionsToExternalServices
public java.util.Map<java.lang.String,org.eclipse.persistence.internal.sessions.coordination.RemoteConnection> getConnectionsToExternalServices()
INTERNAL:
-
getConnectionsToExternalServicesForCommandPropagation
public java.util.Map<java.lang.String,org.eclipse.persistence.internal.sessions.coordination.RemoteConnection> getConnectionsToExternalServicesForCommandPropagation()
INTERNAL: Returns clone of the original map.
-
setShouldRemoveConnectionOnError
public void setShouldRemoveConnectionOnError(boolean shouldRemoveConnectionOnError)
PUBLIC: Set whether connections to remote services should be disconnected when an error occurs.
-
shouldRemoveConnectionOnError
public boolean shouldRemoveConnectionOnError()
PUBLIC: Return whether connections to remote services should be disconnected when an error occurs.
-
setEncryptionClassName
public void setEncryptionClassName(java.lang.String encryptionClassName)
INTERNAL SECURITY: Set encryption class that will be loaded by the SecurableObjectHolder
-
hasPassword
protected boolean hasPassword()
INTERNAL:- Returns:
- true if a non null password has been set.
-
initialize
public void initialize()
INTERNAL: Initialize default properties.
-
encrypt
protected java.lang.String encrypt(java.lang.String pwd)
INTERNAL: Security method.
-
decrypt
protected java.lang.String decrypt(java.lang.String encryptedPwd)
INTERNAL: Security method called by the children classes
-
getRemoteHostContext
public javax.naming.Context getRemoteHostContext(java.lang.String remoteHostURL)
INTERNAL: Return the context used for looking up in the JNDI space of the specified remote URL.
-
createDiscoveryManager
public DiscoveryManager createDiscoveryManager()
ADVANCED: Factory of new DiscoveryManager for different transports. The RemoteCommandManger uses this method to create its DicscoveryManager. Sub-class of TransportManager should return special discovery if required. The default is discovery type is DiscoveryManager; If this method returns null then during initialization RemoteCommandManager calls createConnections method.
-
discardConnections
public void discardConnections()
INTERNAL: Remove all remote connections for its list and the local connection from JNDI or JMS Subsriber
-
removeLocalConnection
public abstract void removeLocalConnection()
ADVANCED: Remove the local connection from remote accesses. The implementation should set remove the local connection from JNDI or JMS and set it to null. This method is invoked internally by TopLink when the RCM is shutdown and should not be invoked by user's application.
-
setConfig
public void setConfig(java.lang.String config)
Generic API to allow config to be set.
-
-