Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mpisws.p2p.transport.wire
Class WireTransportLayerImpl

    java.lang.Object
      org.mpisws.p2p.transport.wire.WireTransportLayerImpl

All Implemented Interfaces:
  TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>, SocketOpeningTransportLayer<java.net.InetSocketAddress>, WireTransportLayer, Destructable

    public class WireTransportLayerImpl

extends java.lang.Object
implements WireTransportLayer, SocketOpeningTransportLayer<java.net.InetSocketAddress>

Field Summary
`protected java.net.InetSocketAddress` | `bindAddress`
`protected Environment` | `environment`
`protected ErrorHandler<java.net.InetSocketAddress>` | `errorHandler`
`protected Logger` | `logger`
`protected TCPLayer` | `tcp`
`protected UDPLayer` | `udp`

Fields inherited from interface org.mpisws.p2p.transport.wire.WireTransportLayer
`OPTION_TRANSPORT_TYPE, TRANSPORT_TYPE_DATAGRAM, TRANSPORT_TYPE_GUARANTEED`

Constructor Summary
`WireTransportLayerImpl(java.net.InetSocketAddress bindAddress, Environment env, ErrorHandler<java.net.InetSocketAddress> errorHandler)`
`WireTransportLayerImpl(java.net.InetSocketAddress bindAddress, Environment env, ErrorHandler<java.net.InetSocketAddress> errorHandler, boolean disableServer)`

Method Summary
`void` | `acceptMessages(boolean b)` Toggle accepting incoming messages.
`void` | `acceptSockets(boolean b)` Toggle accepting new sockets.
`void` | `addSocketCountListener(SocketCountListener<java.net.InetSocketAddress> listener)`
`void` | `addTransportLayerListener(TransportLayerListener<java.net.InetSocketAddress> listener)`
`void` | `broadcastChannelClosed(java.net.InetSocketAddress addr, java.util.Map<java.lang.String,java.lang.Object> options)`
`void` | `broadcastChannelOpened(java.net.InetSocketAddress addr, java.util.Map<java.lang.String,java.lang.Object> options, boolean outgoing)`
`void` | `destroy()`
`java.net.InetSocketAddress` | `getLocalIdentifier()` Notification methods
`protected java.lang.Iterable<SocketCountListener<java.net.InetSocketAddress>>` | `getSlisteners()`
`protected java.lang.Iterable<TransportLayerListener<java.net.InetSocketAddress>>` | `getTLlisteners()`
`protected void` | `incomingSocket(P2PSocket<java.net.InetSocketAddress> sm)`
`boolean` | `isDestroyed()`
`protected void` | `messageReceived(java.net.InetSocketAddress address, java.nio.ByteBuffer buffer, java.util.Map<java.lang.String,java.lang.Object> options)`
`SocketRequestHandle<java.net.InetSocketAddress>` | `openSocket(java.net.InetSocketAddress destination, SocketCallback<java.net.InetSocketAddress> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)` Open a socket to the Identifier
`void` | `removeSocketCountListener(SocketCountListener<java.net.InetSocketAddress> listener)`
`void` | `removeTransportLayerListener(TransportLayerListener<java.net.InetSocketAddress> listener)`
`MessageRequestHandle<java.net.InetSocketAddress,java.nio.ByteBuffer>` | `sendMessage(java.net.InetSocketAddress destination, java.nio.ByteBuffer m, MessageCallback<java.net.InetSocketAddress,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)` Send the message to the identifier
`void` | `setCallback(TransportLayerCallback<java.net.InetSocketAddress,java.nio.ByteBuffer> callback)` Set the callback for incoming sockets/messages
`void` | `setErrorHandler(ErrorHandler<java.net.InetSocketAddress> handler)` To be notified of problems not related to an outgoing messaage/socket.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### bindAddress

    protected java.net.InetSocketAddress bindAddress

### udp

    protected UDPLayer udp

### tcp

    protected TCPLayer tcp

### logger

    protected Logger logger

### environment

    protected Environment environment

### errorHandler

    protected ErrorHandler<java.net.InetSocketAddress> errorHandler

Constructor Detail

### WireTransportLayerImpl

    public WireTransportLayerImpl(java.net.InetSocketAddress bindAddress,
                                  Environment env,
                                  ErrorHandler<java.net.InetSocketAddress> errorHandler)
                           throws java.io.IOException

Parameters:
  `bindAddress` - the address to bind to, if it fails, it will throw an exception
  `env` - will acquire the SelectorManager from the env
Throws:
  `java.io.IOException`

### WireTransportLayerImpl

    public WireTransportLayerImpl(java.net.InetSocketAddress bindAddress,
                                  Environment env,
                                  ErrorHandler<java.net.InetSocketAddress> errorHandler,
                                  boolean disableServer)
                           throws java.io.IOException

Throws:
  `java.io.IOException`

Method Detail

### setCallback

    public void setCallback(TransportLayerCallback<java.net.InetSocketAddress,java.nio.ByteBuffer> callback)

  Description copied from interface: `TransportLayer`
  Set the callback for incoming sockets/messages

  Specified by:
    `setCallback` in interface `TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>`
  Parameters:
    `callback` - the callback for incoming sockets/messages

### openSocket

    public SocketRequestHandle<java.net.InetSocketAddress> openSocket(java.net.InetSocketAddress destination,
                                                                      SocketCallback<java.net.InetSocketAddress> deliverSocketToMe,
                                                                      java.util.Map<java.lang.String,java.lang.Object> options)

  Description copied from interface: `TransportLayer`
  Open a socket to the Identifier

  Specified by:
    `openSocket` in interface `TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>`
  Parameters:
    `destination` - who to open the socket to
    `deliverSocketToMe` - the callback when the socket is opened
    `options` - options on how to open the socket (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
  Returns:
    an object to cancel opening the socket if it takes to long, or is no longer relevant

### sendMessage

    public MessageRequestHandle<java.net.InetSocketAddress,java.nio.ByteBuffer> sendMessage(java.net.InetSocketAddress destination,
                                                                                            java.nio.ByteBuffer m,
                                                                                            MessageCallback<java.net.InetSocketAddress,java.nio.ByteBuffer> deliverAckToMe,
                                                                                            java.util.Map<java.lang.String,java.lang.Object> options)

  Description copied from interface: `TransportLayer`
  Send the message to the identifier

  Specified by:
    `sendMessage` in interface `TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>`
  Parameters:
    `destination` - the destination
    `m` - the message
    `deliverAckToMe` - layer dependent notification when the message is sent (can indicate placed on the wire, point-to-point acknowledgment, or end-to-end acknowledgement)
    `options` - delivery options (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
  Returns:
    ability to cancel the message if no longer relevant

### getLocalIdentifier

    public java.net.InetSocketAddress getLocalIdentifier()

  Notification methods

  Specified by:
    `getLocalIdentifier` in interface `TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>`
  Parameters:
    `destination` -
    `msg` -
    `i` -
    `data` -
    `transport_type` - WireTransportLayer.TRANSPORT_TYPE_DATAGRAM or WireTransportLayer.TRANSPORT_TYPE_GUARANTEED
  Returns:
    The local node.

### destroy

    public void destroy()

  Specified by:
    `destroy` in interface `Destructable`

### isDestroyed

    public boolean isDestroyed()

### setErrorHandler

    public void setErrorHandler(ErrorHandler<java.net.InetSocketAddress> handler)

  Description copied from interface: `TransportLayer`
  To be notified of problems not related to an outgoing messaage/socket. Or to be notified if a callback isn't provided.

  Specified by:
    `setErrorHandler` in interface `TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>`
  Parameters:
    `handler` - to be notified of problems not related to a specific messaage/socket.

### acceptMessages

    public void acceptMessages(boolean b)

  Description copied from interface: `TransportLayer`
  Toggle accepting incoming messages. Useful in flow control if overwhelmed by incoming sockets. Default: true

  Specified by:
    `acceptMessages` in interface `TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>`

### acceptSockets

    public void acceptSockets(boolean b)

  Description copied from interface: `TransportLayer`
  Toggle accepting new sockets. Useful in flow control if overwhelmed by incoming sockets. Default: true

  Specified by:
    `acceptSockets` in interface `TransportLayer<java.net.InetSocketAddress,java.nio.ByteBuffer>`

### messageReceived

    protected void messageReceived(java.net.InetSocketAddress address,
                                   java.nio.ByteBuffer buffer,
                                   java.util.Map<java.lang.String,java.lang.Object> options)
                            throws java.io.IOException

  Throws:
    `java.io.IOException`

### incomingSocket

    protected void incomingSocket(P2PSocket<java.net.InetSocketAddress> sm)
                           throws java.io.IOException

  Throws:
    `java.io.IOException`

### addTransportLayerListener

    public void addTransportLayerListener(TransportLayerListener<java.net.InetSocketAddress> listener)

### removeTransportLayerListener

    public void removeTransportLayerListener(TransportLayerListener<java.net.InetSocketAddress> listener)

### getTLlisteners

    protected java.lang.Iterable<TransportLayerListener<java.net.InetSocketAddress>> getTLlisteners()

### addSocketCountListener

    public void addSocketCountListener(SocketCountListener<java.net.InetSocketAddress> listener)

  Specified by:
    `addSocketCountListener` in interface `SocketOpeningTransportLayer<java.net.InetSocketAddress>`

### removeSocketCountListener

    public void removeSocketCountListener(SocketCountListener<java.net.InetSocketAddress> listener)

  Specified by:
    `removeSocketCountListener` in interface `SocketOpeningTransportLayer<java.net.InetSocketAddress>`

### getSlisteners

    protected java.lang.Iterable<SocketCountListener<java.net.InetSocketAddress>> getSlisteners()

### broadcastChannelOpened

    public void broadcastChannelOpened(java.net.InetSocketAddress addr,
                                       java.util.Map<java.lang.String,java.lang.Object> options,
                                       boolean outgoing)

### broadcastChannelClosed

    public void broadcastChannelClosed(java.net.InetSocketAddress addr,
                                       java.util.Map<java.lang.String,java.lang.Object> options)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.