Class GeneralHandler

java.lang.Object
  extended by GeneralHandler

public class GeneralHandler
extends java.lang.Object

WellnessRules (Any) PA: This class handles general method calls for PA's such as retrieving the time and date, and determining a PA's responsible profiles and user's requested profile. AGFA Project - WellnessRules Initiative NRC-IIT Fredericton 46 Dineen Drive Fredericton, New Brunswick, E3B 9W4 Canada


Constructor Summary
GeneralHandler()
           
 
Method Summary
static java.lang.String getProfileSpecified(java.lang.String message)
          Based on the provided message, it will return the name of the profile specified by the user.
static java.lang.String[] getResponsibleProfiles(java.lang.String configXML, java.lang.String activity)
          Based on an XML File and a provided activity of a PA, it will return what profiles the PA will be responsible for, as well as the format each of the profiles is in.
static java.lang.String getTimeAndDate(java.lang.String contents)
          Retrieves the current time and date from the GregorianCalendar and appends it to the provided message.
static void sendFinalMessage(MessageParser m, java.lang.String messageEndpoint, java.lang.String address, java.lang.String port)
          Sends the final message to the OA.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneralHandler

public GeneralHandler()
Method Detail

sendFinalMessage

public static void sendFinalMessage(MessageParser m,
                                    java.lang.String messageEndpoint,
                                    java.lang.String address,
                                    java.lang.String port)
Sends the final message to the OA. This message will tell the OA that all answers have been receieved and to stop listening. If this message is not sent, the OA will wait for a timeout (lasting ~5 seconds).

Parameters:
m - Message parser containing OA information.
messageEndpoint - The mule endpoint to send the message down.
address - The IP where the mule ESB is held.
port - The port the mule ESB (for this OA) is on.

getTimeAndDate

public static java.lang.String getTimeAndDate(java.lang.String contents)
Retrieves the current time and date from the GregorianCalendar and appends it to the provided message.

Parameters:
contents - The current message which will have date-time appended.
Returns:
The message with date-time appended.

getResponsibleProfiles

public static java.lang.String[] getResponsibleProfiles(java.lang.String configXML,
                                                        java.lang.String activity)
Based on an XML File and a provided activity of a PA, it will return what profiles the PA will be responsible for, as well as the format each of the profiles is in. (Check XML file to see supported activities)

Parameters:
configXML - XML file containing the PA responsibility information.
activity - The responsible activity of the PA
Returns:
A string containing the file name with the format as an extension. (i.e. p0001.n3)

getProfileSpecified

public static java.lang.String getProfileSpecified(java.lang.String message)
Based on the provided message, it will return the name of the profile specified by the user. If none is found, all profiles are assumed. WORKAROUND: Assumes variable name will be "ProfileID". Assumes constant name starts with 'p'. TODO: Rewrite to accept and name, but assumed that it is the 1st variable or constant following the reltation name.

Parameters:
message - The message sent by the user.
Returns:
The responsible profile, or "All".