|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectFourMS.FourMSParameterConverter
public class FourMSParameterConverter
This class contains the methods necessary to perform conversion for the parameters associated with different mechanisms and message types between engineering and logical units. For example, a filter specified by a user for the MFW mechanism in the PFIP may be specified by the user as the filterName. However this filter name must be converted to a filter position in the filter wheel before being passed onto the 4MS module. The converse is true also, filter positions coming back from the 4MS must be converted back to their filter name before being stored. It is also responsible for pushing out changes that are coming in from the 4MS out to the notice board and the CORBA event channel. When we are talking about output parameters, we talk about parameters going out to the 4MS and conversely input parameters are parameters coming from the 4MS to the software system. Each of the conversions are stored in a hash which will be indexed by the using the Mechanism name, the message number and the parameter position in that message (i.e. MechanismName + MessageType + ParameterPosition). The class uses the java reflection interface to examine the conversion class to establish whether or not the registered conversion exists in the intrument specific conversion class and then that will be used to convert the input data into logical or engineering units as specified.
Field Summary | |
---|---|
private java.util.Hashtable<java.lang.String,java.lang.reflect.Method> |
ConversionMethodHash
This is an array of the methods which are included in the parameter conversion object |
private boolean |
Initialised
Flag to indicate whether or not we are initialised or not |
private java.util.Hashtable<java.lang.String,java.lang.String> |
ParameterConversionMappingHash
This is a hash table which will be used to store the details of the conversion routines which will be used when converting engineering units to logical units and vice-versa. |
MessageHandler |
SyslogMessageHandler
This is a syslog object which will be used to report errors etc |
private FourMSConversions |
TypeConverter
This object will be used to affect the type conversions which will be necessary, normally it will be specific to the instrument which is being controlled and the methods will be accessed through the reflection interface |
Constructor Summary | |
---|---|
FourMSParameterConverter(MessageHandler SyslogMessageHandler)
The constructor for the class |
Method Summary | |
---|---|
boolean |
initialiseConverter(FourMSConversions TypeConverter)
The purpose of this method is to initialise the convertor such that it is set up for this 4MS instrument. |
static void |
main(java.lang.String[] args)
This is a main routine which can be used to test the class should we need to |
java.lang.String |
performConversion(int ConversionType,
java.lang.String[] InputParameters,
java.lang.String MechanismName)
This method will be used to convert the input parameters into either engineering or logical units depending on what is required. |
java.lang.String |
performConversion(int ConversionType,
java.lang.String[] InputParameters,
java.lang.String MechanismName,
int MessageNumber,
int ParameterPosition)
This method will be used to convert the input parameters into either engineering or logical units depending on what is required. |
boolean |
registerParameterConversion(java.lang.String MechanismName,
int MessageNumber,
int ParameterPosition,
java.lang.String ConversionMethod)
This method will be used to register a parameter for conversion prior to being submitted to the 4MS or transfer back to the OCS. |
boolean |
registerParameterConversion(java.lang.String MechanismName,
java.lang.String ConversionMethod)
This method will be used to register a parameter for conversion prior to being submitted to the 4MS or transfer back to the OCS. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Hashtable<java.lang.String,java.lang.String> ParameterConversionMappingHash
private java.util.Hashtable<java.lang.String,java.lang.reflect.Method> ConversionMethodHash
private boolean Initialised
private FourMSConversions TypeConverter
public MessageHandler SyslogMessageHandler
Constructor Detail |
---|
public FourMSParameterConverter(MessageHandler SyslogMessageHandler)
SyslogMessageHandler
- Method Detail |
---|
public boolean initialiseConverter(FourMSConversions TypeConverter)
TypeConverter
- - This is an object that will be used to
perform the conversions expected of the input and output
parameters to the 4MS.
public java.lang.String performConversion(int ConversionType, java.lang.String[] InputParameters, java.lang.String MechanismName, int MessageNumber, int ParameterPosition) throws ConversionFailedException
ConversionType
- - This is the type of the conversion to
be performed, it should one of the following;
InputParameters
- - This is a list of the input parameters
to the conversion routine. For example, each message coming or
going from the 4MS might contain a number of parameters which
may or may not all need converting before they are suitable for
transmission to the 4MS or be returned to the OCS for futher
processing.MechanismName
- - This is the name of the mechanism such
as MFW, it used to index the correct conversion routine.MessageNumber
- - This is the message type (e.g. 800). It
used to index the correct conversion routine.ParameterPosition
- - This is the parameter number in the
dialogue.It will be used to index the correct conversion
routine.
ConversionFailedException
ConversionFailedException
public java.lang.String performConversion(int ConversionType, java.lang.String[] InputParameters, java.lang.String MechanismName) throws ConversionFailedException
ConversionType
- - This is the type of the conversion to
be performed, it should one of the following;
InputParameters
- - This is a list of the input parameters
to the conversion routine. For example, each message coming or
going from the 4MS might contain a number of parameters which
may or may not all need converting before they are suitable for
transmission to the 4MS or be returned to the OCS for futher
processing.MechanismName
- - This is the name of the mechanism such
as MFW, it used to index the correct conversion routine.
ConversionFailedException
ConversionFailedException
public boolean registerParameterConversion(java.lang.String MechanismName, int MessageNumber, int ParameterPosition, java.lang.String ConversionMethod) throws ConversionAlreadyRegisteredException
MechanismName
- - This is the name of the mechanism which
this conversion is to be associated with. For instance in the
case of the PFIP 4MS system this might be MFW.MessageNumber
- - This is the message type of the 4MS
message that this conversion is associated with. For instance
this could be message type 101. There may be several
conversions to be performed on parameters associated with a
specific message type.ParameterPosition
- - This is the position of the
parameter in the message that is to be sent or received from
the 4MS system. There may be only one conversion for a specific
parameter associated with a given message number on a specific
mechanism. If there is an attempt to register a multiple
conversions for the same parameter, an
ConversionAlreadyRegisteredException will be raised. The
position of the parameter in the message is an index into
looking up the conversion to be applied to the parameter. The
parameter position should be specified as a positive integer, 0
indicates the first parameter.ConversionMethod
- - This is the name of the conversion
method which will be used by the class when converting
backwards and forwards between engineering units and logical
units. Implementation note : as the name of the method that is
to perform the conversion is not available at compile time, we
need to use the Reflection facility of Java in order to call
random methods at runtime. This facility provides exactly that
functionality. The class will have a built in number of
conversion routines and also as part of it's initialisation it
will read a dynamic package which will have further conversion
routines specific to this 4MS. For instance in the case of the
PFIP system, the conversion routine to convert between the
filter positions and the filter names associated with the MFW
will need to access the filter database in order to establish
the filter name.
ConversionAlreadyRegisteredException
ConversionAlreadyRegisteredException
public boolean registerParameterConversion(java.lang.String MechanismName, java.lang.String ConversionMethod) throws ConversionAlreadyRegisteredException
MechanismName
- - This is the name of the mechanism which
this conversion is to be associated with. For instance in the
case of the PFIP 4MS system this might be MFW.ConversionMethod
- - This is the name of the conversion
method which will be used by the class when converting
backwards and forwards between engineering units and logical
units. Implementation note : as the name of the method that is
to perform the conversion is not available at compile time, we
need to use the Reflection facility of Java in order to call
random methods at runtime. This facility provides exactly that
functionality. The class will have a built in number of
conversion routines and also as part of it's initialisation it
will read a dynamic package which will have further conversion
routines specific to this 4MS. For instance in the case of the
PFIP system, the conversion routine to convert between the
filter positions and the filter names associated with the MFW
will need to access the filter database in order to establish
the filter name.
ConversionAlreadyRegisteredException
ConversionAlreadyRegisteredException
public static void main(java.lang.String[] args)
args
- The arguments to run the application
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |