Class ContextAwareHelperTest


  • public class ContextAwareHelperTest
    extends java.lang.Object
    Set up the parameters with the details of the specific REST service.

    This is a test version of ContextAwareHelper that is used for experimentation.

    Since:
    Ptolemy II 11.0
    Version:
    $Id$
    Author:
    Anne Ngu, Contributor: Christopher Brooks
    Pt.AcceptedRating:
    Green (bilung)
    Pt.ProposedRating:
    Green (eal)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String[] availableServices()
      Return an array of iot REST service names that are available to the user.
      void chooseSensor​(java.lang.String[] sensors)
      Dialog Box to select a service the accessor mimics.
      java.util.ArrayList convertXMLtoJSON​(java.lang.String response)
      Convert an XML data format to JSON data format using the XML class from org.json.xml.
      java.lang.String discoverServices()
      Return the selected service.
      java.lang.String[] getFirebaseOutput()
      Return the list of output choices of Firebase service.
      java.lang.String[] getGsnOutput()
      Return the list of output choices of GSN service.
      java.lang.String[] getParaimpuOutput()
      Return the list of output choices of Paraimpu service.
      java.lang.String getSelectedService()
      Return the name of the selected service.
      java.lang.String getSelectedServiceParameter​(java.lang.String selectedService)
      Return the parameters associated with the selected service.
      java.lang.String getService()
      Get the name of a particular sensor in a service.
      void setParameters​(java.lang.String[] parameters)
      Create a list of parameters specific to the middleware chosen.
      void setSelectedService​(java.lang.String[] list)
      Initializes the list of available iot REST services and creates a GUI for a user to make the selection.
      • Methods inherited from class java.lang.Object

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

      • searchButton

        public javax.swing.JButton searchButton
        The search button.
      • defaultParamList

        public java.lang.String[] defaultParamList
        The default parameters.
      • firebaseOutputPort

        public java.lang.String[] firebaseOutputPort
        The output choices of the FireBase service.
      • gsnOutputPort

        public java.lang.String[] gsnOutputPort
        The output choices of the GSN service.
      • iotServiceList

        public java.lang.String[] iotServiceList
        The choices of the IoT service.
      • paraimpuOutputPort

        public java.lang.String[] paraimpuOutputPort
        The output choices of the Paraimpu service.
      • _selectedServiceParam

        protected java.lang.String _selectedServiceParam
        The service that was selected.
      • _sensorService

        protected java.lang.String _sensorService
        The sensor that was selected.
    • Constructor Detail

      • ContextAwareHelperTest

        public ContextAwareHelperTest()
    • Method Detail

      • availableServices

        public java.lang.String[] availableServices()
        Return an array of iot REST service names that are available to the user.
        Returns:
        an array of iot REST service names that are available.
      • chooseSensor

        public void chooseSensor​(java.lang.String[] sensors)
        Dialog Box to select a service the accessor mimics.
        Parameters:
        sensors - The names of the sensors.
      • convertXMLtoJSON

        public java.util.ArrayList convertXMLtoJSON​(java.lang.String response)
        Convert an XML data format to JSON data format using the XML class from org.json.xml.
        Parameters:
        response - is the input in xml format
        Returns:
        the json formatted data in an array
      • discoverServices

        public java.lang.String discoverServices()
        Return the selected service.
        Returns:
        The selected service.
      • getGsnOutput

        public java.lang.String[] getGsnOutput()
        Return the list of output choices of GSN service. Currently, the list of choices is hard coded. Eventually, this list should come from a discovery process
        Returns:
        The list of data type to be extracted from the service
      • getFirebaseOutput

        public java.lang.String[] getFirebaseOutput()
        Return the list of output choices of Firebase service. Currently, the list of choices is hard coded. Eventually, this list should come from a discovery process
        Returns:
        The list of data type to be extracted from Firebase.
      • getParaimpuOutput

        public java.lang.String[] getParaimpuOutput()
        Return the list of output choices of Paraimpu service. Currently, the list of choices is hard coded. Eventually, this list should come from a discovery process
        Returns:
        The list of data type to be extracted from Paraimpu.
      • getSelectedService

        public java.lang.String getSelectedService()
        Return the name of the selected service. Currently, this method returns the string "GSN". Eventually, this method will return data from the GUI.
        Returns:
        The name of the service chosen by the user.
        See Also:
        setSelectedService(String[])
      • getSelectedServiceParameter

        public java.lang.String getSelectedServiceParameter​(java.lang.String selectedService)
        Return the parameters associated with the selected service. Currently just return a hard wired url for testing.
        Parameters:
        selectedService - The name of the service that was selected.
        Returns:
        An array of service parameters. Not used now
      • getService

        public java.lang.String getService()
        Get the name of a particular sensor in a service.
        Returns:
        The name of the service.
      • setSelectedService

        public void setSelectedService​(java.lang.String[] list)
        Initializes the list of available iot REST services and creates a GUI for a user to make the selection. Not used currently Currently, this method does nothing.
        Parameters:
        list - known list of services
        See Also:
        getSelectedService()
      • setParameters

        public void setParameters​(java.lang.String[] parameters)
        Create a list of parameters specific to the middleware chosen.
        Parameters:
        parameters - The names of the parameters.