solar.service.transport
Class PastryTransport

java.lang.Object
  |
  +--rice.pastry.client.PastryAppl
        |
        +--rice.pastry.client.CommonAPIAppl
              |
              +--solar.service.transport.PastryTransport
All Implemented Interfaces:
rice.pastry.messaging.MessageReceiver, Transport
Direct Known Subclasses:
PastryObjectTransport

public class PastryTransport
extends rice.pastry.client.CommonAPIAppl
implements Transport

A Pastry transport application interfacing with Pastry routing substrate.

Version:
$Id: PastryTransport.java,v 1.12 2003/10/05 18:51:03 glchen Exp $
Author:
Guanling Chen

Nested Class Summary
private static class PastryTransport.MultiplexAddress
           
 
Field Summary
protected  AduFactory _aduFactory
           
protected static rice.pastry.security.Credentials _cred
          Credentials of this Pastry application / our transport layer.
protected  Address _laddr
          The local transport address for Pastry node.
protected  java.util.List _listeners
          The list of transport listeners.
protected static org.apache.log4j.Logger _log
          Logging facility.
protected static rice.pastry.messaging.Address _maddr
          Local address, multiplexing over same Pastry node.
protected  rice.pastry.PastryNode _pnode
          The pastry node associated with this application.
 
Fields inherited from class rice.pastry.client.PastryAppl
address, instance, thePastryNode
 
Constructor Summary
PastryTransport(rice.pastry.PastryNode pn)
           
 
Method Summary
 void addTransportListener(TransportListener listener)
          Add a transport listener.
 void deliver(rice.pastry.Id key, rice.pastry.messaging.Message msg)
           
 rice.pastry.messaging.Address getAddress()
           
 Address getAddressByKey(java.lang.String key)
          Return a peer address by specified key.
 rice.pastry.security.Credentials getCredentials()
           
 Address getLocalAddress()
          Return the local address of this transport layer.
 rice.pastry.PastryNode getPastryNode()
           
protected  void notifyDataReceived(Adu adu, Header header)
          Notify transport listeners about received data.
 void removeTransportListener(TransportListener listener)
          Remove a transport listener.
 void send(Adu adu, Address dest)
          Send the adu over transport to destination.
 void send(Adu adu, Address dest, Id multiplex)
          Send the adu over transport to destination, with a multipex ID.
 void send(byte[] data, Address dest)
          Send an data unit to destination address.
 void send(byte[] data, Address dest, Id multiplex)
          Send an data unit to destination address with a multiplexer.
 void setAduFactory(AduFactory aduFactory)
          Set the factory that parse the received bytes into data unit.
 void stop()
          Stop the transport layer.
 
Methods inherited from class rice.pastry.client.CommonAPIAppl
forward, leafSetChange, localLookup, messageForAppl, neighborSet, notifyReady, range, range, receiveMessage, replicaSet, route, update
 
Methods inherited from class rice.pastry.client.PastryAppl
enrouteMessage, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, registerReceiver, routeMsg, routeMsgDirect, routeSetChange, sendMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected static org.apache.log4j.Logger _log
Logging facility.


_maddr

protected static rice.pastry.messaging.Address _maddr
Local address, multiplexing over same Pastry node.


_cred

protected static rice.pastry.security.Credentials _cred
Credentials of this Pastry application / our transport layer.


_pnode

protected rice.pastry.PastryNode _pnode
The pastry node associated with this application.


_listeners

protected java.util.List _listeners
The list of transport listeners.


_laddr

protected Address _laddr
The local transport address for Pastry node.


_aduFactory

protected AduFactory _aduFactory
Constructor Detail

PastryTransport

public PastryTransport(rice.pastry.PastryNode pn)
Method Detail

getPastryNode

public rice.pastry.PastryNode getPastryNode()

setAduFactory

public void setAduFactory(AduFactory aduFactory)
Description copied from interface: Transport
Set the factory that parse the received bytes into data unit.

Specified by:
setAduFactory in interface Transport

getLocalAddress

public Address getLocalAddress()
Description copied from interface: Transport
Return the local address of this transport layer.

Specified by:
getLocalAddress in interface Transport

getAddressByKey

public Address getAddressByKey(java.lang.String key)
                        throws TransportException
Description copied from interface: Transport
Return a peer address by specified key.

Specified by:
getAddressByKey in interface Transport
TransportException

send

public void send(byte[] data,
                 Address dest)
          throws TransportException
Description copied from interface: Transport
Send an data unit to destination address.

Specified by:
send in interface Transport
TransportException

send

public void send(byte[] data,
                 Address dest,
                 Id multiplex)
          throws TransportException
Description copied from interface: Transport
Send an data unit to destination address with a multiplexer.

Specified by:
send in interface Transport
TransportException

send

public void send(Adu adu,
                 Address dest)
          throws TransportException
Description copied from interface: Transport
Send the adu over transport to destination.

Specified by:
send in interface Transport
TransportException

send

public void send(Adu adu,
                 Address dest,
                 Id multiplex)
          throws TransportException
Description copied from interface: Transport
Send the adu over transport to destination, with a multipex ID.

Specified by:
send in interface Transport
TransportException

addTransportListener

public void addTransportListener(TransportListener listener)
Description copied from interface: Transport
Add a transport listener.

Specified by:
addTransportListener in interface Transport

removeTransportListener

public void removeTransportListener(TransportListener listener)
Description copied from interface: Transport
Remove a transport listener.

Specified by:
removeTransportListener in interface Transport

stop

public void stop()
Description copied from interface: Transport
Stop the transport layer.

Specified by:
stop in interface Transport

notifyDataReceived

protected void notifyDataReceived(Adu adu,
                                  Header header)
Notify transport listeners about received data.


getAddress

public rice.pastry.messaging.Address getAddress()
Overrides:
getAddress in class rice.pastry.client.PastryAppl

getCredentials

public rice.pastry.security.Credentials getCredentials()
Specified by:
getCredentials in class rice.pastry.client.CommonAPIAppl

deliver

public void deliver(rice.pastry.Id key,
                    rice.pastry.messaging.Message msg)
Specified by:
deliver in class rice.pastry.client.CommonAPIAppl