org.exolab.jms.net.socket
Class SocketRequestInfo

java.lang.Object
  |
  +--org.exolab.jms.net.connector.URIRequestInfo
        |
        +--org.exolab.jms.net.socket.SocketRequestInfo
All Implemented Interfaces:
ConnectionRequestInfo
Direct Known Subclasses:
TCPSRequestInfo

public class SocketRequestInfo
extends URIRequestInfo

Implementation of the ConnectionRequestInfo interface that enables socket based connectors to pass data across the connection request flow.

Version:
$Revision: 1.8 $ $Date: 2005/12/01 13:44:38 $
Author:
Tim Anderson

Constructor Summary
SocketRequestInfo(URI uri)
          Construct a new SocketRequestInfo.
SocketRequestInfo(URI uri, Properties properties)
          Construct a new SocketRequestInfo.
 
Method Summary
 boolean equals(java.lang.Object other)
          Checks whether this instance is equal to another.
protected  boolean equals(java.lang.Object o1, java.lang.Object o2)
          Helper to compare two objects for equality.
 void export(Properties properties)
          Helper to export this to a Properties instance.
 java.lang.String getAlternativeHost()
          Returns the alternative host.
 URI getAlternativeURI()
          Helper to return the alternative URI.
 boolean getBindAll()
          Determines if socket connections should be accepted on all addresses, on a multi-homed host.
 int getConnectionRequestQueueSize()
          Returns the maximum queue size for incoming connection indications.
 void setAlternativeHost(java.lang.String host)
          Sets the alternative host.
 void setBindAll(boolean bindAll)
          Sets how socket connections should be accepted, on a multi-homed host.
 void setConnectionRequestQueueSize(int size)
          Sets the maximum queue size for incoming connection indications (a request to connect).
 
Methods inherited from class org.exolab.jms.net.connector.URIRequestInfo
getHost, getHostAddress, getPort, getPrincipal, getURI, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketRequestInfo

public SocketRequestInfo(URI uri)
                  throws ResourceException
Construct a new SocketRequestInfo.
Parameters:
uri - the URI
Throws:
ResourceException - if uri has an invalid query string

SocketRequestInfo

public SocketRequestInfo(URI uri,
                         Properties properties)
                  throws ResourceException
Construct a new SocketRequestInfo.
Parameters:
uri - the URI
properties - the properties to populate this from
Throws:
ResourceException - if any of the properties are invalid
Method Detail

setAlternativeHost

public void setAlternativeHost(java.lang.String host)
Sets the alternative host. This is used as an alternative address for clients to connect to, if connections to URIRequestInfo.getURI() fail.

This can be useful if the server is behind a NAT firewall, and clients need to connect from both outside and inside the firewall.

Parameters:
host - the alternative host. May be null

getAlternativeHost

public java.lang.String getAlternativeHost()
Returns the alternative host.
Returns:
the alternative host, or null if none has been set.

getAlternativeURI

public URI getAlternativeURI()
                      throws ResourceException
Helper to return the alternative URI. This is the URI returned by URIRequestInfo.getURI() with the host set to getAlternativeHost().
Returns:
the alternative URI, or null if the alternative host is not set.
Throws:
ResourceException - if the alternative URI is invalid

setConnectionRequestQueueSize

public void setConnectionRequestQueueSize(int size)
Sets the maximum queue size for incoming connection indications (a request to connect). If a connection indication arrives when the queue is full, the connection is refused.
Parameters:
size - the queue size

getConnectionRequestQueueSize

public int getConnectionRequestQueueSize()
Returns the maximum queue size for incoming connection indications.
Returns:
the maximum queue size for incoming connection indications.

setBindAll

public void setBindAll(boolean bindAll)
Sets how socket connections should be accepted, on a multi-homed host.
Parameters:
bindAll - if true, server sockets will accept connections on all local addresses. If false, only connections to a specified address will be accepted.

getBindAll

public boolean getBindAll()
Determines if socket connections should be accepted on all addresses, on a multi-homed host.
Returns:
true if server sockets should accept connections on all local addresses; otherwise false, indicating that only connections to a specified address will be accepted.

export

public void export(Properties properties)
Helper to export this to a Properties instance.
Overrides:
export in class URIRequestInfo
Parameters:
properties - the properties to export to.

equals

public boolean equals(java.lang.Object other)
Checks whether this instance is equal to another.
Overrides:
equals in class URIRequestInfo
Parameters:
other - the object to compare
Returns:
true if the two instances are equal; otherwise false

equals

protected boolean equals(java.lang.Object o1,
                         java.lang.Object o2)
Helper to compare two objects for equality.
Parameters:
o1 - the first object to compare
o2 - the second object to compare
Returns:
true if the objects are equal, otherwise false


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