Class TransportManager
java.lang.Object
org.eclipse.persistence.sessions.coordination.TransportManager
- Direct Known Subclasses:
BroadcastTransportManager
,CORBATransportManager
,RMITransportManager
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
-
Field Summary
Modifier and TypeFieldDescriptionConnections to other servicesstatic final String
Default JNDI properties for remote accessstatic final String
static final String
static final String
static final String
static final int
static final boolean
static final String
static final String
Defaults for RMI applicationsstatic final String
static final int
Valid values for naming service typeprotected org.eclipse.persistence.internal.sessions.coordination.RemoteConnection
The remote command connection to this transportprotected Hashtable
Properties to obtain the context used for local JNDI accessprotected int
The type of naming service used to look up other connectionsprotected RemoteCommandManager
The RCM that manages this transportstatic final int
protected Hashtable
Properties to obtain the context used for remote JNDI accessprotected org.eclipse.persistence.internal.security.SecurableObjectHolder
Security util that is used to decrypt and encrypt passwordprotected boolean
Determines whether a connection should be discarded if an error occurs on it -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
INTERNAL: Does nothing by default.ADVANCED: Factory of new DiscoveryManager for different transports.abstract void
INTERNAL: Put the remote connection to local host in naming service and return the of the created remote connectionprotected String
INTERNAL: Security method called by the children classesvoid
INTERNAL: Remove all remote connections for its list and the local connection from JNDI or JMS Subsriberprotected String
INTERNAL: Security method.INTERNAL:INTERNAL: Returns clone of the original map.org.eclipse.persistence.internal.sessions.coordination.RemoteConnection
INTERNAL: Return a remote connection to this servicegetContext
(Hashtable contextProperties) INTERNAL: Helper method to get a naming context.PUBLIC: Return the encrypted (assumed) password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.PUBLIC: Return the context factory name used as the value to the INITIAL_CONTEXT_FACTORY key in the cached context properties.ADVANCED: Return the properties that will be used to create the initial context for local JNDI access.int
PUBLIC: Return the type of naming service used to look up remote connections to other service instances.PUBLIC: Return the password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.INTERNAL:ADVANCED: Return the cached properties that will be used to create the initial context when doing remote JNDI lookups.getRemoteHostContext
(String remoteHostURL) INTERNAL: Return the context used for looking up in the JNDI space of the specified remote URL.PUBLIC: Return the user name used as the value to the SECURITY_PRINCIPAL key in the cached context properties.protected boolean
INTERNAL:void
INTERNAL: Initialize default properties.static TransportManager
INTERNAL: Creates a new instance oforg.eclipse.persistence.sessions.coordination.rmi.RMITransportManager
class.void
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
ADVANCED: Remove the local connection from remote accesses.void
Generic API to allow config to be set.void
setEncryptedPassword
(String encryptedPassword) ADVANCED: Set the encrypted password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.void
setEncryptionClassName
(String encryptionClassName) INTERNAL SECURITY: Set encryption class that will be loaded by the SecurableObjectHoldervoid
setInitialContextFactoryName
(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
(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
(String password) ADVANCED: Set the password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.void
INTERNAL:void
setRemoteContextProperties
(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
(String userName) ADVANCED: Set the user name used as the value to the SECURITY_PRINCIPAL key in the cached context properties.boolean
PUBLIC: Return whether connections to remote services should be disconnected when an error occurs.
-
Field Details
-
localConnection
protected org.eclipse.persistence.internal.sessions.coordination.RemoteConnection localConnectionThe remote command connection to this transport -
rcm
The RCM that manages this transport -
namingServiceType
protected int namingServiceTypeThe type of naming service used to look up other connections -
localContextProperties
Properties to obtain the context used for local JNDI access -
remoteContextProperties
Properties to obtain the context used for remote JNDI access -
shouldRemoveConnectionOnError
protected boolean shouldRemoveConnectionOnErrorDetermines whether a connection should be discarded if an error occurs on it -
connectionsToExternalServices
protected Hashtable<String,org.eclipse.persistence.internal.sessions.coordination.RemoteConnection> connectionsToExternalServicesConnections to other services -
securableObjectHolder
protected org.eclipse.persistence.internal.security.SecurableObjectHolder securableObjectHolderSecurity 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:
-
JNDI_NAMING_SERVICE
public static final int JNDI_NAMING_SERVICEValid values for naming service type- See Also:
-
REGISTRY_NAMING_SERVICE
public static final int REGISTRY_NAMING_SERVICE- See Also:
-
DEFAULT_URL_PROTOCOL
Defaults for RMI applications- See Also:
-
DEFAULT_IIOP_URL_PROTOCOL
- See Also:
-
DEFAULT_URL_PORT
- See Also:
-
DEFAULT_IIOP_URL_PORT
- See Also:
-
DEFAULT_NAMING_SERVICE
public static final int DEFAULT_NAMING_SERVICE- See Also:
-
DEFAULT_CONTEXT_FACTORY
Default JNDI properties for remote access- See Also:
-
DEFAULT_DEDICATED_CONNECTION_KEY
- See Also:
-
DEFAULT_DEDICATED_CONNECTION_VALUE
- See Also:
-
DEFAULT_USER_NAME
- See Also:
-
-
Constructor Details
-
TransportManager
public TransportManager()
-
-
Method Details
-
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 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:
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: Return the user name used as the value to the SECURITY_PRINCIPAL key in the cached context properties. -
setUserName
ADVANCED: Set the user name used as the value to the SECURITY_PRINCIPAL key in the cached context properties. -
getPassword
PUBLIC: Return the password used as the value to the SECURITY_CREDENTIALS key in the cached context properties. -
getEncryptedPassword
PUBLIC: Return the encrypted (assumed) password used as the value to the SECURITY_CREDENTIALS key in the cached context properties. -
setPassword
ADVANCED: Set the password used as the value to the SECURITY_CREDENTIALS key in the cached context properties. -
setEncryptedPassword
ADVANCED: Set the encrypted password used as the value to the SECURITY_CREDENTIALS key in the cached context properties. -
getInitialContextFactoryName
PUBLIC: Return the context factory name used as the value to the INITIAL_CONTEXT_FACTORY key in the cached context properties. -
setInitialContextFactoryName
ADVANCED: Set the context factory name used as the value to the INITIAL_CONTEXT_FACTORY key in the cached context properties. -
getContext
INTERNAL: Helper method to get a naming context. -
getRemoteContextProperties
ADVANCED: Return the cached properties that will be used to create the initial context when doing remote JNDI lookups. -
setRemoteContextProperties
ADVANCED: Set the cached properties that will be used to create the initial context when doing remote JNDI lookups. -
getLocalContextProperties
ADVANCED: Return the properties that will be used to create the initial context for local JNDI access. -
setLocalContextProperties
ADVANCED: Set the properties that will be used to create the initial context for local JNDI access. -
getRemoteCommandManager
INTERNAL: -
setRemoteCommandManager
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 Map<String,org.eclipse.persistence.internal.sessions.coordination.RemoteConnection> getConnectionsToExternalServices()INTERNAL: -
getConnectionsToExternalServicesForCommandPropagation
public Map<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
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
INTERNAL: Security method. -
decrypt
INTERNAL: Security method called by the children classes -
getRemoteHostContext
INTERNAL: Return the context used for looking up in the JNDI space of the specified remote URL. -
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
Generic API to allow config to be set. -
newSunCORBATransportManager
INTERNAL: Creates a new instance oforg.eclipse.persistence.sessions.coordination.rmi.RMITransportManager
class.- Parameters:
rcm
- cache coordination manager- Returns:
- new instance of RMI transport manager implementation
-