JICSCore
Class StatusItemHelper

java.lang.Object
  extended by JICSCore.StatusItemHelper

public class StatusItemHelper
extends java.lang.Object

This class contains methods which can be used to manipulate the IDL data type StatusItem. They are really convenience methods to facilitate the extraction of data which is held within the status items.

Version:
$Id: StatusItemHelper.java,v 1.8 2009/04/08 08:45:41 cb Exp $
Author:
Craige Bevil

Constructor Summary
StatusItemHelper()
           
 
Method Summary
static void checkStatusItemInError(ing.status.StatusItemValue statusItem)
          Checks to see if the status item which is provided is in error and if it is then it raises an exception to that effect.
static java.lang.String convertAnyValueToString(org.omg.CORBA.Any ValueToConvert)
          Can be used to convert the value which is contained in an Any to it's string representation.
static ing.status.StatusItemValue[] createErrorStatusItem(java.lang.String[] NoticeboardItems, OCSCORBAHelper OCSCorba, java.lang.String[] StatusVariableNames, int ErrorCode, java.lang.String ErrorMessage)
          Used to create an array of status items which are in error.
static ing.status.StatusItemValue createErrorStatusItem(java.lang.String NoticeboardItem, OCSCORBAHelper OCSCorba, java.lang.String StatusVariableName, int ErrorCode, java.lang.String ErrorMessage)
          Used to create a status item which is in error.
static ing.status.StatusItemValue[] createNormalStatusItem(java.lang.String[] NoticeboardItem, OCSCORBAHelper OCSCorba, java.lang.String[] StatusVariableNames, org.omg.CORBA.Any[] StatusValues)
          Used to create an array of StatusItemValue and optionally write it into the parameter noticeboard.
static ing.status.StatusItemValue createNormalStatusItem(java.lang.String NoticeboardItem, OCSCORBAHelper OCSCorba, java.lang.String StatusVariableName, org.omg.CORBA.Any StatusValue)
          Used to create a status item and optionally write it into the parameter noticeboard
static boolean extractStatusValueBoolean(ing.status.StatusItemValue statusItem)
          This will be used to extract the value from the status item which is supplied.
static double extractStatusValueDouble(ing.status.StatusItemValue statusItem)
          This will be used to extract the value from the status item which is supplied.
static float extractStatusValueFloat(ing.status.StatusItemValue statusItem)
          This will be used to extract the value from the status item which is supplied.
static int extractStatusValueInt(ing.status.StatusItemValue statusItem)
          This will be used to extract the value from the status item which is supplied.
static int extractStatusValueLong(ing.status.StatusItemValue statusItem)
          This will be used to extract the value from the status item which is supplied.
static short extractStatusValueShort(ing.status.StatusItemValue statusItem)
          This will be used to extract the value from the status item which is supplied.
static java.lang.String extractStatusValueString(ing.status.StatusItemValue statusItem)
          This will be used to extract the value from the status item which is supplied.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatusItemHelper

public StatusItemHelper()
Method Detail

checkStatusItemInError

public static void checkStatusItemInError(ing.status.StatusItemValue statusItem)
                                   throws BadStatusValueException
Checks to see if the status item which is provided is in error and if it is then it raises an exception to that effect.

Parameters:
statusItem - This is the status item to check.
Throws:
BadStatusValueException - In the case that the status item is actually bad.

extractStatusValueString

public static java.lang.String extractStatusValueString(ing.status.StatusItemValue statusItem)
                                                 throws BadStatusValueException
This will be used to extract the value from the status item which is supplied. It expects that the status item which is tucked away in the CORBA Any is a string. If there was an error associated with the status item, an exception will be thrown.

Parameters:
statusItem - This is the status item which is to have it's status item extracted.
Throws:
BadStatusValueException

extractStatusValueInt

public static int extractStatusValueInt(ing.status.StatusItemValue statusItem)
                                 throws BadStatusValueException
This will be used to extract the value from the status item which is supplied. It expects that the status item which is tucked away in the CORBA Any is a CORBA long. If there was an error associated with the status item, an exception will be thrown.

Parameters:
statusItem - This is the status item which is to be extracted.
Throws:
BadStatusValueException

extractStatusValueFloat

public static float extractStatusValueFloat(ing.status.StatusItemValue statusItem)
                                     throws BadStatusValueException
This will be used to extract the value from the status item which is supplied. It expects that the status item which is tucked away in the CORBA Any is a CORBA float. If there was an error associated with the status item, an exception will be thrown.

Parameters:
statusItem - This is the status item which is to be extracted.
Throws:
BadStatusValueException

extractStatusValueBoolean

public static boolean extractStatusValueBoolean(ing.status.StatusItemValue statusItem)
                                         throws BadStatusValueException
This will be used to extract the value from the status item which is supplied. It expects that the status item which is tucked away in the CORBA Any is a CORBA boolean. If there was an error associated with the status item, an exception will be thrown.

Parameters:
statusItem - This is the status item which is to be extracted.
Throws:
BadStatusValueException

extractStatusValueDouble

public static double extractStatusValueDouble(ing.status.StatusItemValue statusItem)
                                       throws BadStatusValueException
This will be used to extract the value from the status item which is supplied. It expects that the status item which is tucked away in the CORBA Any is a CORBA double. If there was an error associated with the status item, an exception will be thrown.

Parameters:
statusItem - This is the status item which is to be extracted.
Throws:
BadStatusValueException

extractStatusValueLong

public static int extractStatusValueLong(ing.status.StatusItemValue statusItem)
                                  throws BadStatusValueException
This will be used to extract the value from the status item which is supplied. It expects that the status item which is tucked away in the CORBA Any is a CORBA long. If there was an error associated with the status item, an exception will be thrown.

Parameters:
statusItem - This is the status item which is to be extracted.
Throws:
BadStatusValueException

extractStatusValueShort

public static short extractStatusValueShort(ing.status.StatusItemValue statusItem)
                                     throws BadStatusValueException
This will be used to extract the value from the status item which is supplied. It expects that the status item which is tucked away in the CORBA Any is a CORBA short. If there was an error associated with the status item, an exception will be thrown.

Parameters:
statusItem - This is the status item which is to be extracted.
Throws:
BadStatusValueException

createErrorStatusItem

public static ing.status.StatusItemValue createErrorStatusItem(java.lang.String NoticeboardItem,
                                                               OCSCORBAHelper OCSCorba,
                                                               java.lang.String StatusVariableName,
                                                               int ErrorCode,
                                                               java.lang.String ErrorMessage)
                                                        throws java.lang.Exception
Used to create a status item which is in error.

Parameters:
NoticeboardItem - This is the noticeboard item which into which the value should be stored. If set to null then nothing will be written to the noticeboard.
OCSCorba - This will be used to help out with CORBA related activities.
StatusVariableName - This is the name of the status item
ErrorCode - This is the code which is associated with the error
ErrorMessage - This is the error message which is associated with the error
Returns:
StatusItemValue Returns a bad error status item
Throws:
java.lang.Exception

createErrorStatusItem

public static ing.status.StatusItemValue[] createErrorStatusItem(java.lang.String[] NoticeboardItems,
                                                                 OCSCORBAHelper OCSCorba,
                                                                 java.lang.String[] StatusVariableNames,
                                                                 int ErrorCode,
                                                                 java.lang.String ErrorMessage)
                                                          throws java.lang.Exception
Used to create an array of status items which are in error.

Parameters:
NoticeboardItems - An array of the noticeboard items which into which the values should be stored. If set to null then nothing will be written to the noticeboard.
OCSCorba - This will be used to help out with CORBA related activities.
StatusVariableNames - This is the name of the status items
ErrorCode - This is the code which is associated with the error
ErrorMessage - This is the error message which is associated with the error
Returns:
StatusItemValue Returns an arrau of error status items
Throws:
java.lang.Exception

createNormalStatusItem

public static ing.status.StatusItemValue[] createNormalStatusItem(java.lang.String[] NoticeboardItem,
                                                                  OCSCORBAHelper OCSCorba,
                                                                  java.lang.String[] StatusVariableNames,
                                                                  org.omg.CORBA.Any[] StatusValues)
                                                           throws java.lang.Exception
Used to create an array of StatusItemValue and optionally write it into the parameter noticeboard.

Parameters:
NoticeboardItem - This is an of the noticeboard items which need to be updated. If set to null then nothing will be written to the noticeboard.

OCSCorba - This will be used to help out with CORBA related activities.
StatusVariableNames - This is an array of the status item names
StatusValues - This is an array of the status values
Returns:
StatusItemValue Returns an array of the status item values which have been created.
Throws:
java.lang.Exception

createNormalStatusItem

public static ing.status.StatusItemValue createNormalStatusItem(java.lang.String NoticeboardItem,
                                                                OCSCORBAHelper OCSCorba,
                                                                java.lang.String StatusVariableName,
                                                                org.omg.CORBA.Any StatusValue)
                                                         throws java.lang.Exception
Used to create a status item and optionally write it into the parameter noticeboard

Parameters:
NoticeboardItem - This is the noticeboard item which into which the value should be stored. If set to null then nothing will be written to the noticeboard.
OCSCorba - This will be used to help out with CORBA related activities.
StatusVariableName - This is the name of the status item
Returns:
StatusItemValue Returns a bad error status item
Throws:
java.lang.Exception

convertAnyValueToString

public static java.lang.String convertAnyValueToString(org.omg.CORBA.Any ValueToConvert)
                                                throws UnableToConvertAnyValue,
                                                       StatusItemInErrorException
Can be used to convert the value which is contained in an Any to it's string representation.

Parameters:
ValueToConvert - An Any value which contains the value which is to be converted.
Returns:
String representation of the value which was in the Any
Throws:
UnableToConvertAnyValue - If the Any value cannot be converted to a string
StatusItemInErrorException - If the value which is contained with the Any value is a StatusItemValue which is in the error state