org.exolab.jms.net.socket
Class SocketManagedConnection

java.lang.Object
  |
  +--org.exolab.jms.net.connector.AbstractManagedConnection
        |
        +--org.exolab.jms.net.multiplexer.MultiplexedManagedConnection
              |
              +--org.exolab.jms.net.socket.SocketManagedConnection
All Implemented Interfaces:
ManagedConnection, MultiplexerListener

public abstract class SocketManagedConnection
extends MultiplexedManagedConnection

SocketManagedConnection manages multiple Connection instances over a single socket.

Version:
$Revision: 1.5 $ $Date: 2006/12/16 12:37:17 $
Author:
Tim Anderson

Field Summary
protected static org.apache.commons.logging.Log _log
          The logger.
 
Constructor Summary
SocketManagedConnection(java.security.Principal principal, SocketRequestInfo info)
          Construct a new client SocketManagedConnection.
SocketManagedConnection(URI uri, java.net.Socket socket, Authenticator authenticator)
          Construct a new server SocketManagedConnection.
 
Method Summary
protected  Endpoint createEndpoint()
          Returns the endpoint to multiplex data over.
protected  java.net.Socket createSocket(SocketRequestInfo info)
          Creates a new socket.
protected  java.net.Socket createSocket(java.lang.String host, int port)
          Creates a new socket.
 URI getAlternativeURI()
          The alternative URI that the remote address is known as.
 URI getLocalURI()
          Returns the local address that this connection is bound to.
 URI getRemoteURI()
          Returns the remote address to which this is connected.
protected  void init(URI uri, java.net.Socket socket)
          Initialises this connection.
 
Methods inherited from class org.exolab.jms.net.multiplexer.MultiplexedManagedConnection
closed, createMultiplexer, createMultiplexer, destroy, error, getCaller, getConnection, getDisplayName, getPrincipal, getThreadGroup, hasPrincipal, invoke, isClient, ping, pinged, request, setInvocationHandler
 
Methods inherited from class org.exolab.jms.net.connector.AbstractManagedConnection
getConnectionEventListener, notifyClosed, notifyError, setConnectionEventListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected static final org.apache.commons.logging.Log _log
The logger.
Constructor Detail

SocketManagedConnection

public SocketManagedConnection(java.security.Principal principal,
                               SocketRequestInfo info)
                        throws ResourceException
Construct a new client SocketManagedConnection.
Parameters:
principal - the security principal
info - the connection request info
Throws:
ResourceException - if a socket cannot be created

SocketManagedConnection

public SocketManagedConnection(URI uri,
                               java.net.Socket socket,
                               Authenticator authenticator)
                        throws ResourceException
Construct a new server SocketManagedConnection.
Parameters:
uri - the URI the acceptor was listening on
socket - the socket
authenticator - the connection authenticator
Throws:
ResourceException - if an error occurs accessing the socket
Method Detail

getRemoteURI

public URI getRemoteURI()
Returns the remote address to which this is connected.
Returns:
the remote address to which this is connected

getLocalURI

public URI getLocalURI()
Returns the local address that this connection is bound to.
Returns:
the local address that this connection is bound to

getAlternativeURI

public URI getAlternativeURI()
The alternative URI that the remote address is known as.
Returns:
alternative URI that the remote address is known as. May be null.

createSocket

protected java.net.Socket createSocket(SocketRequestInfo info)
                                throws ResourceException
Creates a new socket.
Parameters:
info - the connection request info
Returns:
a new socket
Throws:
ResourceException - if a socket can't be created

createSocket

protected java.net.Socket createSocket(java.lang.String host,
                                       int port)
                                throws java.io.IOException
Creates a new socket.
Parameters:
host - the host to connect to
port - the port to connect to
Returns:
a new socket
Throws:
java.io.IOException - for any I/O error
java.lang.SecurityException - if permission is denied

createEndpoint

protected Endpoint createEndpoint()
                           throws java.io.IOException
Returns the endpoint to multiplex data over.
Overrides:
createEndpoint in class MultiplexedManagedConnection
Returns:
the endpoint to multiplex data over
Throws:
java.io.IOException - for any I/O error

init

protected void init(URI uri,
                    java.net.Socket socket)
             throws ResourceException
Initialises this connection.
Parameters:
uri - the URI representing this connection
socket - the socket
Throws:
ResourceException - for any error


Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.