cgl.narada.transport.udp
Class UDPLinkFactory

java.lang.Object
  extended by cgl.narada.transport.udp.UDPLinkFactory
All Implemented Interfaces:
LinkFactory, TransportDebugFlags
Direct Known Subclasses:
UP2PLinkFactory

public class UDPLinkFactory
extends Object
implements LinkFactory, TransportDebugFlags

This is a UDP implementation of the LinkFactory Interface. Lets assume that the connection is being initiated by a node A to another node B. There are two independent factors that need to borne in mind while using LinkFactory. The first is of course setting the link factory properties. The second is specifying the properties to create a link to some other node B.

To initialize the UDPLinkFactory one needs to specify UDPListenerPort , this is the port on which the process running this factory would listen to for datagram packet communications.

To create a link to node B. The following properties needs to be specified.

  • hostname - The host on which node B's process is running
  • portnum - The portnum on which node B is listening to, for datagram packets.


    Field Summary
    protected  Hashtable links
               
    protected  TransportHandler transportHandler
               
    protected  DatagramSocket udpListenerSocket
               
    protected  UDPPingHandler udppinghandler
               
    protected  UDPReceiverThread udpReceiverThread
               
     
    Fields inherited from interface cgl.narada.transport.TransportDebugFlags
    IPSecLink_Debug, IPSecLinkFactory_Debug, IPSecReceiverThread_Debug, IPSecSenderThread_Debug, IPSecServerThread_Debug, MulticastLink_Debug, MulticastLinkFactory_Debug, MulticastReceiverThread_Debug, MulticastSenderThread_Debug, NIOTCPLink_Debug, NIOTCPLinkFactory_Debug, NIOTCPReceiverThread_Debug, NIOTCPSenderThread_Debug, NIOTCPServerThread_Debug, PoolTCPLink_Debug, PoolTCPLinkFactory_Debug, PoolTCPLinkReceiver_Debug, PoolTCPLinkSender_Debug, PoolTCPServerThread_Debug, PTCPLink_Debug, PTCPLinkFactory_Debug, PTCPReceiverThread_Debug, PTCPSenderThread_Debug, PTCPServerThread_Debug, ReceiveTask_Debug, RTPLink_Debug, RTPLinkFactory_Debug, RTPReceiverThread_Debug, RTPSenderThread_Debug, SendTask_Debug, TCPLink_Debug, TCPLinkFactory_Debug, TCPReceiverThread_Debug, TCPSenderThread_Debug, TCPServerThread_Debug, TransmissionManager_Debug, TransportHandlerImpl_Debug, UDPLink_Debug, UDPLinkFactory_Debug, UDPReceiverThread_Debug, UDPSenderThread_Debug
     
    Constructor Summary
    UDPLinkFactory()
               
     
    Method Summary
     boolean canManageLinkMigrationOfType(String linkType)
              Indicates if this factory can manage migration of links of a certain type
     Link createLink(Properties linkProperties)
              Create a communication link based on the properties that have been specified.
     void dispose()
              This method is used to garbage collect any resources associated with the link factory
     UDPLink getCurrentLink(InetAddress remoteAddress, int remotePort)
               
     String getManagedLinksType()
              Return the type of all the links created/managed by this factory
     TransportHandler getTransportHandler()
               
     void handleInboundUDPLinkRequest(InetAddress remoteAddress, int remotePort)
               
     boolean loadLinkFactoryServices()
              Starts communication services.
    static void main(String[] args)
               
     void manageLinkMigration(Link link)
              Used to migrate communications of a link to the one supported by links managed by this factory
     void reportLinkLoss(Link linkLost)
               
     void setLinkFactoryProperties(Properties factoryProperties)
               
     void setLinkStatusInterval(long interval)
              Set the interval for checking status of all links managed by this factory to the one specified in the argument
     void setTransportHandler(TransportHandler transportHandler)
              Sets the reference to the transport handler.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    udpReceiverThread

    protected UDPReceiverThread udpReceiverThread

    links

    protected Hashtable links

    transportHandler

    protected TransportHandler transportHandler

    udpListenerSocket

    protected DatagramSocket udpListenerSocket

    udppinghandler

    protected UDPPingHandler udppinghandler
    Constructor Detail

    UDPLinkFactory

    public UDPLinkFactory()
    Method Detail

    setLinkFactoryProperties

    public void setLinkFactoryProperties(Properties factoryProperties)
    Specified by:
    setLinkFactoryProperties in interface LinkFactory

    getManagedLinksType

    public String getManagedLinksType()
    Return the type of all the links created/managed by this factory

    Specified by:
    getManagedLinksType in interface LinkFactory

    createLink

    public Link createLink(Properties linkProperties)
                    throws TransportException
    Create a communication link based on the properties that have been specified.

    Specified by:
    createLink in interface LinkFactory
    Throws:
    TransportException

    setLinkStatusInterval

    public void setLinkStatusInterval(long interval)
    Set the interval for checking status of all links managed by this factory to the one specified in the argument

    Specified by:
    setLinkStatusInterval in interface LinkFactory

    loadLinkFactoryServices

    public boolean loadLinkFactoryServices()
                                    throws TransportException
    Starts communication services. In this case what we do is start the UDPListener thread, which listens to datagram packets arriving at the UDPListenerPort

    Specified by:
    loadLinkFactoryServices in interface LinkFactory
    Throws:
    TransportException

    canManageLinkMigrationOfType

    public boolean canManageLinkMigrationOfType(String linkType)
    Indicates if this factory can manage migration of links of a certain type

    Specified by:
    canManageLinkMigrationOfType in interface LinkFactory

    manageLinkMigration

    public void manageLinkMigration(Link link)
                             throws TransportException
    Used to migrate communications of a link to the one supported by links managed by this factory

    Specified by:
    manageLinkMigration in interface LinkFactory
    Throws:
    TransportException

    setTransportHandler

    public void setTransportHandler(TransportHandler transportHandler)
    Sets the reference to the transport handler. This is done during the loadLinkFactory() operation within the transport handler implementations.

    Specified by:
    setTransportHandler in interface LinkFactory

    dispose

    public void dispose()
    This method is used to garbage collect any resources associated with the link factory

    Specified by:
    dispose in interface LinkFactory

    getCurrentLink

    public UDPLink getCurrentLink(InetAddress remoteAddress,
                                  int remotePort)

    handleInboundUDPLinkRequest

    public void handleInboundUDPLinkRequest(InetAddress remoteAddress,
                                            int remotePort)

    reportLinkLoss

    public void reportLinkLoss(Link linkLost)

    getTransportHandler

    public TransportHandler getTransportHandler()

    main

    public static void main(String[] args)


    For comments and suggestions please send e-mail to The NaradaBrokering Project