Class VNSQuery


  • public class VNSQuery
    extends java.lang.Object
    Connects to and querries a given VNS server for a list a services bound to a given name.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  VNSQuery.VinciVNSQuery
      Inner class used for accessing the VNS server.
    • Constructor Summary

      Constructors 
      Constructor Description
      VNSQuery​(java.lang.String aVnsHost, int aVnsPort)
      Connects to a VNS server identified by host and port
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static int findUnassigned​(java.util.ArrayList oldList, java.util.ArrayList newList)
      Diffs two lists of services and returns those that have not yet been assigned
      java.util.ArrayList getServices​(java.lang.String aName)
      Returns a list of services registered in the VNS and bound to a given name.
      java.util.ArrayList getUnassignedServices​(java.lang.String aName, java.util.ArrayList assignedServices)
      Returns a list of services that have not yet been assigned to any CPM proxy.
      static void main​(java.lang.String[] args)  
      private static boolean newService​(VinciServiceInfo aService, java.util.ArrayList oldList)
      Checks if a service identified by VinciServiceInfo instance is in use.
      • Methods inherited from class java.lang.Object

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

      • VNSQuery

        public VNSQuery​(java.lang.String aVnsHost,
                        int aVnsPort)
                 throws java.lang.Exception
        Connects to a VNS server identified by host and port
        Parameters:
        aVnsHost - - VNS host name
        aVnsPort - - VNS port number
        Throws:
        java.lang.Exception - - when unable to connect to VNS
    • Method Detail

      • getServices

        public java.util.ArrayList getServices​(java.lang.String aName)
                                        throws java.lang.Exception
        Returns a list of services registered in the VNS and bound to a given name.
        Parameters:
        aName - - name of the service
        Returns:
        - ArrayList of VinciServiceInfo instances
        Throws:
        java.lang.Exception - - unable to get a list
      • getUnassignedServices

        public java.util.ArrayList getUnassignedServices​(java.lang.String aName,
                                                         java.util.ArrayList assignedServices)
                                                  throws java.lang.Exception
        Returns a list of services that have not yet been assigned to any CPM proxy. It diffs the current list and a new list as returned from the VNS.
        Parameters:
        aName - - name of the service
        assignedServices - - a list of services currently in use
        Returns:
        - ArrayList of VinciServiceInfo instances
        Throws:
        java.lang.Exception - - unable to get a list
      • findUnassigned

        public static int findUnassigned​(java.util.ArrayList oldList,
                                         java.util.ArrayList newList)
        Diffs two lists of services and returns those that have not yet been assigned
        Parameters:
        oldList - - current (in-use) list of services
        newList - - new list of services
        Returns:
        - number of un-assigned services
      • newService

        private static boolean newService​(VinciServiceInfo aService,
                                          java.util.ArrayList oldList)
        Checks if a service identified by VinciServiceInfo instance is in use. If a service exists in the service list but is not assigned, that means that is available. If the service does not exist in the list it is also considered available.
        Parameters:
        aService - - VinciServiceInfo instance to locate in the list
        oldList - - list of current (in-use) services
        Returns:
        - true, if service is available. false, otherwise
      • main

        public static void main​(java.lang.String[] args)