Class ContextAwareHelperTest
- java.lang.Object
-
- ptolemy.actor.lib.jjs.modules.contextAwareTest.ContextAwareHelperTest
-
public class ContextAwareHelperTest extends java.lang.ObjectSet 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)
-
-
Field Summary
Fields Modifier and Type Field Description protected ContextAwareGUI_GUIThe GUI.protected java.lang.String_selectedServiceParamThe service that was selected.protected java.lang.String_sensorServiceThe sensor that was selected.java.lang.String[]defaultParamListThe default parameters.java.lang.String[]firebaseOutputPortThe output choices of the FireBase service.java.lang.String[]gsnOutputPortThe output choices of the GSN service.java.lang.String[]iotServiceListThe choices of the IoT service.java.lang.String[]paraimpuOutputPortThe output choices of the Paraimpu service.javax.swing.JButtonsearchButtonThe search button.
-
Constructor Summary
Constructors Constructor Description ContextAwareHelperTest()
-
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.voidchooseSensor(java.lang.String[] sensors)Dialog Box to select a service the accessor mimics.java.util.ArrayListconvertXMLtoJSON(java.lang.String response)Convert an XML data format to JSON data format using the XML class from org.json.xml.java.lang.StringdiscoverServices()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.StringgetSelectedService()Return the name of the selected service.java.lang.StringgetSelectedServiceParameter(java.lang.String selectedService)Return the parameters associated with the selected service.java.lang.StringgetService()Get the name of a particular sensor in a service.voidsetParameters(java.lang.String[] parameters)Create a list of parameters specific to the middleware chosen.voidsetSelectedService(java.lang.String[] list)Initializes the list of available iot REST services and creates a GUI for a user to make the selection.
-
-
-
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.
-
_GUI
protected ContextAwareGUI _GUI
The GUI.
-
_selectedServiceParam
protected java.lang.String _selectedServiceParam
The service that was selected.
-
_sensorService
protected java.lang.String _sensorService
The sensor that was selected.
-
-
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.
-
-