Jumpi v1.2.0

org.jumpi.impl.connector.tcp
Class TcpDestination

java.lang.Object
  |
  +--org.jumpi.impl.AbstractDestination
        |
        +--org.jumpi.impl.connector.tcp.TcpDestination
All Implemented Interfaces:
Destination, Destination

public class TcpDestination
extends AbstractDestination

A TcpDestination represents a TCP Internet Protocol Address. The TcpDestination consists of an InetAddress and a port number. The syntax is:

<protocolname>://[<ipaddress>|*]:[<port>|*]

Both InetAddress and port may be wildcard, used to filter received data.


Field Summary
 
Fields inherited from class org.jumpi.impl.AbstractDestination
connector_, controller_, props_, url_, wildcard_
 
Fields inherited from interface org.jumpi.Destination
PROTOCOL_SEPARATOR, SEPARATOR
 
Constructor Summary
TcpDestination(java.lang.String url, Controller controller, Connector connector)
          Creates TcpDestination which has a wildcard InetAddress and wilcard port.
TcpDestination(java.lang.String url, Controller controller, Connector connector, java.net.InetAddress address)
          Creates a TcpDestination which has a specific InetAddress but has a wildcard port.
TcpDestination(java.lang.String url, Controller controller, Connector connector, java.net.InetAddress address, int port)
          Creates a TcpDestination specifically for a given InetAddress and port.
TcpDestination(java.lang.String url, Controller controller, Connector connector, int port)
          Creates a TcpDestination which has a specific port but a wildcard InetAddress.
 
Method Summary
 java.net.InetAddress getInetAddress()
          Return the InetAddress.
 int getPort()
          Return the port.
 java.lang.String getUrl()
          Return the Url representation of the Destination.
 boolean matches(Destination dest)
           Determine if the dest TcpDestination matches this instance taking into account wildcard rules.
 
Methods inherited from class org.jumpi.impl.AbstractDestination
equals, getConnector, getController, getControllerName, getProperties, hashCode, isWildcard, setProperties
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcpDestination

public TcpDestination(java.lang.String url,
                      Controller controller,
                      Connector connector,
                      java.net.InetAddress address,
                      int port)
Creates a TcpDestination specifically for a given InetAddress and port.

Parameters:
url - the Url representing the TcpDestination.
controller - the Controller associated with the TcpDestination.
connector - the Connector associated with the TcpDestination.
address - the InetAddress part of the TcpDestination.
port - the port number of the TcpDestination.

TcpDestination

public TcpDestination(java.lang.String url,
                      Controller controller,
                      Connector connector)
Creates TcpDestination which has a wildcard InetAddress and wilcard port. This can be used allow all received data, from any host and port combination.

Parameters:
url - the Url representing the TcpDestination.
controller - the Controller associated with the TcpDestination.
connector - the Connector associated with the TcpDestination.

TcpDestination

public TcpDestination(java.lang.String url,
                      Controller controller,
                      Connector connector,
                      java.net.InetAddress address)
Creates a TcpDestination which has a specific InetAddress but has a wildcard port. This TcpDestination can be used to allow received data from any port on that host.

Parameters:
url - the Url representing the TcpDestination.
controller - the Controller associated with the TcpDestination.
connector - the Connector associated with the TcpDestination.
address - the InetAddress part of the TcpDestination.

TcpDestination

public TcpDestination(java.lang.String url,
                      Controller controller,
                      Connector connector,
                      int port)
Creates a TcpDestination which has a specific port but a wildcard InetAddress. This can be used to receive data from any host given that the port matches.

Parameters:
url - the Url representing the TcpDestination.
controller - the Controller associated with the TcpDestination.
connector - the Connector associated with the TcpDestination.
port - the port number of the TcpDestination.
Method Detail

getUrl

public java.lang.String getUrl()
Return the Url representation of the Destination.

Specified by:
getUrl in interface Destination
Specified by:
getUrl in class AbstractDestination
Returns:
the Url representation of the Destination.

getInetAddress

public java.net.InetAddress getInetAddress()
Return the InetAddress.

Returns:
the InetAddress.

getPort

public int getPort()
Return the port.

Returns:
the port.

matches

public boolean matches(Destination dest)

Determine if the dest TcpDestination matches this instance taking into account wildcard rules. A wildcard InetAddress matches any host, and a wildcard port matches any port number.

Specified by:
matches in interface Destination
Overrides:
matches in class AbstractDestination
Parameters:
dest - the other Destination to be checked for the match.
Returns:
true if the dest matches this Destination, taking into account wildcard matching.

Jumpi v1.2.0

Copyright 2003, Peter Jonathan Klauser.