Class CNSService


  • public final class CNSService
    extends java.lang.Object
    This is the service object used to register and resolve channel names with a Channel Name Server. This provides a client front end.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private NetChannelInput fromCNS
      The incoming channel to receive messages from the CNS from
      private NetChannelOutput toCNS
      The channel to send messages to the CNS upon
    • Constructor Summary

      Constructors 
      Constructor Description
      CNSService​(NodeID cnsNode)
      Creates a new CNSService
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean register​(java.lang.String name, NetChannelInput in)
      Registers an input end with the CNS
      NetChannelLocation resolve​(java.lang.String name)
      Resolves a name on the CNS, retrieving the NetChannelLocation for the channel
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • toCNS

        private final NetChannelOutput toCNS
        The channel to send messages to the CNS upon
      • fromCNS

        private final NetChannelInput fromCNS
        The incoming channel to receive messages from the CNS from
    • Constructor Detail

      • CNSService

        public CNSService​(NodeID cnsNode)
                   throws JCSPNetworkException
        Creates a new CNSService
        Parameters:
        cnsNode - The NodeID of the Node with the CNS on it
        Throws:
        JCSPNetworkException - Thrown if something goes wrong in the underlying architecture
    • Method Detail

      • register

        public boolean register​(java.lang.String name,
                                NetChannelInput in)
        Registers an input end with the CNS
        Parameters:
        name - The name to register the channel with
        in - The NetChannelInput to register with the CNS
        Returns:
        True if the channel was successfully registered, false otherwise
      • resolve

        public NetChannelLocation resolve​(java.lang.String name)
                                   throws JCSPNetworkException
        Resolves a name on the CNS, retrieving the NetChannelLocation for the channel
        Parameters:
        name - The name to resolve
        Returns:
        The NetChannelLocation of the channel declared name
        Throws:
        JCSPNetworkException - Thrown if something goes wrong in the underlying architecture