Class TransportManager

  • Direct Known Subclasses:
    BroadcastTransportManager, RMITransportManager

    public abstract class TransportManager
    extends 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.

    Since:
    OracleAS TopLink 10g (9.0.4)
    Author:
    Steven Vo
    • Field Detail

      • localConnection

        protected RemoteConnection localConnection
        The remote command connection to this transport
      • namingServiceType

        protected int namingServiceType
        The type of naming service used to look up other connections
      • localContextProperties

        protected Hashtable localContextProperties
        Properties to obtain the context used for local JNDI access
      • remoteContextProperties

        protected 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
      • securableObjectHolder

        protected 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_CONTEXT_FACTORY

        public static final String DEFAULT_CONTEXT_FACTORY
        Default JNDI properties for remote access
        See Also:
        Constant Field Values
    • Constructor Detail

      • TransportManager

        public TransportManager()
    • Method Detail

      • createConnection

        public abstract 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​(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 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 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​(String userName)
        ADVANCED: Set the user name used as the value to the SECURITY_PRINCIPAL key in the cached context properties.
      • getPassword

        public String getPassword()
        PUBLIC: Return the password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.
      • getEncryptedPassword

        public 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​(String password)
        ADVANCED: Set the password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.
      • setEncryptedPassword

        public void setEncryptedPassword​(String encryptedPassword)
        ADVANCED: Set the encrypted password used as the value to the SECURITY_CREDENTIALS key in the cached context properties.
      • getInitialContextFactoryName

        public 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​(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 Context getContext​(Hashtable contextProperties)
        INTERNAL: Helper method to get a naming context.
      • getRemoteContextProperties

        public 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​(Hashtable properties)
        ADVANCED: Set the cached properties that will be used to create the initial context when doing remote JNDI lookups.
      • getLocalContextProperties

        public Hashtable getLocalContextProperties()
        ADVANCED: Return the properties that will be used to create the initial context for local JNDI access.
      • setLocalContextProperties

        public void setLocalContextProperties​(Hashtable properties)
        ADVANCED: Set the properties that will be used to create the initial context for local JNDI access.
      • setRemoteCommandManager

        public void setRemoteCommandManager​(RemoteCommandManager rcm)
        INTERNAL:
      • addConnectionToExternalService

        public void addConnectionToExternalService​(RemoteConnection connection)
        INTERNAL: Add a remote Connection to a remote service.
      • removeConnectionToExternalService

        public void removeConnectionToExternalService​(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.
      • getConnectionsToExternalServicesForCommandPropagation

        public Map<String,​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​(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 String encrypt​(String pwd)
        INTERNAL: Security method.
      • decrypt

        protected String decrypt​(String encryptedPwd)
        INTERNAL: Security method called by the children classes
      • getRemoteHostContext

        public Context getRemoteHostContext​(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​(String config)
        Generic API to allow config to be set.
      • newSunCORBATransportManager

        public static TransportManager newSunCORBATransportManager​(RemoteCommandManager rcm)
        INTERNAL: Creates a new instance of org.eclipse.persistence.sessions.coordination.rmi.RMITransportManager class.
        Parameters:
        rcm - cache coordination manager
        Returns:
        new instance of RMI transport manager implementation