OCSEPICS
Class EPICSController

java.lang.Object
  extended by OCSEPICS.EPICSController
All Implemented Interfaces:
iInstrumentController.InstrumentControllerOperations
Direct Known Subclasses:
ISISPController

public abstract class EPICSController
extends java.lang.Object
implements iInstrumentController.InstrumentControllerOperations


Field Summary
protected  java.lang.String DatabaseHost
          Host name of the machine hosting the database
protected  java.sql.Connection DBConnection
          This is used to hold a database connection to the WHT OCS postgres database where the configuration data for the mechanisms which are to be simulated is held
protected  gov.aps.jca.Context EPICSContext
          This is the EPICS context within which we perform all EPICS related channel access activities.
protected  java.lang.String InstrumentName
          This is the name of the instrument which we are controlling
protected  java.util.Hashtable<java.lang.String,ProcessVariable> InstrumentPVs
          This is a hashtable of all of the PVs which will be used in the control and monitoring of status of the instrument.
protected  gov.aps.jca.JCALibrary JCA
          This is an instance of the JCA library
protected  java.util.Hashtable<java.lang.String,EPICSMechanism> Mechanisms
          Mechanisms which are associated with the IOC which can be moved in some way
 OCSCORBAHelper OCSCorba
          This will be used to perform a lot of the donkey work associated with setting up a CORBA application.
protected  org.omg.CORBA.ORB Orb
          The CORBA object request broker (ORB) which will be used for handling incoming CORBA requests
protected  FourMS.FourMSParameterConverter ParameterConvertor
          This will be used to convert parameters backwards and forewards from engineering units and back again
protected  iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard
          This is reference to the remote proxy CORBA object which will be used to access the parameter noticeboard
protected  org.omg.PortableServer.POA Poa
          The CORBA portable object adapter which will be used by this class
protected  org.omg.CosNaming.NamingContextExt RootNamingServiceContext
          This is a reference to the COS naming service
protected  boolean SimulationMode
          Whether or not we are in simulation mode.
 MessageHandler SyslogMessageHandler
          This is a syslog object which will be used to report errors etc
 
Constructor Summary
EPICSController(java.lang.String[] args, MessageHandler SyslogMessageHandler, boolean SimulationMode, java.lang.String ORBPersistentPort, java.lang.String ORBServerID, java.lang.String InstrumentName, FourMS.FourMSParameterConverter ParameterConvertor, java.lang.String DatabaseHost)
          Constructor for the class.
 
Method Summary
 void closeDown(java.lang.String CloseDownMessage)
          This is an obligation to the CORBA instrument controller interface which permits the application to be closed down in a controlled manner.
private  boolean createInstrumentAssociatedCORBAActions()
          Now we need to go through the database and create all of the CORBA actions which are to be used to control the EPICS IOC.
private  boolean createInstrumentAssociatedProcessVariables()
          Determines the EPICS process variables which are associated with the instrument controller we are suppoesd to be controlling and sets up channel access to monitor them
 boolean handshake()
          This is an obligation to the CORBA instrument controller interface which permits a third party to ascertain if the instrument controller is responding.
 void setDebugState(boolean DebugState)
          This is an obligation to the CORBA instrument controller interface which permits the debug of the application to be enabled or disabled.
 void setTraceLevel(double TraceLevel)
          This is an obligation to the CORBA instrument controller interface which permits the trace level of the application to be set, in this application there is no different trace levels enabled.
protected  boolean SetupInstrumentControllerActions()
          This will be used to set up the controller for the instrument which we have been instructed to control.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DatabaseHost

protected java.lang.String DatabaseHost
Host name of the machine hosting the database


Mechanisms

protected java.util.Hashtable<java.lang.String,EPICSMechanism> Mechanisms
Mechanisms which are associated with the IOC which can be moved in some way


ParameterConvertor

protected FourMS.FourMSParameterConverter ParameterConvertor
This will be used to convert parameters backwards and forewards from engineering units and back again


EPICSContext

protected gov.aps.jca.Context EPICSContext
This is the EPICS context within which we perform all EPICS related channel access activities.


JCA

protected gov.aps.jca.JCALibrary JCA
This is an instance of the JCA library


InstrumentPVs

protected java.util.Hashtable<java.lang.String,ProcessVariable> InstrumentPVs
This is a hashtable of all of the PVs which will be used in the control and monitoring of status of the instrument.


SimulationMode

protected boolean SimulationMode
Whether or not we are in simulation mode.


ParameterNoticeBoard

protected iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard
This is reference to the remote proxy CORBA object which will be used to access the parameter noticeboard


SyslogMessageHandler

public MessageHandler SyslogMessageHandler
This is a syslog object which will be used to report errors etc


DBConnection

protected java.sql.Connection DBConnection
This is used to hold a database connection to the WHT OCS postgres database where the configuration data for the mechanisms which are to be simulated is held


Orb

protected org.omg.CORBA.ORB Orb
The CORBA object request broker (ORB) which will be used for handling incoming CORBA requests


Poa

protected org.omg.PortableServer.POA Poa
The CORBA portable object adapter which will be used by this class


RootNamingServiceContext

protected org.omg.CosNaming.NamingContextExt RootNamingServiceContext
This is a reference to the COS naming service


InstrumentName

protected java.lang.String InstrumentName
This is the name of the instrument which we are controlling


OCSCorba

public OCSCORBAHelper OCSCorba
This will be used to perform a lot of the donkey work associated with setting up a CORBA application.

Constructor Detail

EPICSController

public EPICSController(java.lang.String[] args,
                       MessageHandler SyslogMessageHandler,
                       boolean SimulationMode,
                       java.lang.String ORBPersistentPort,
                       java.lang.String ORBServerID,
                       java.lang.String InstrumentName,
                       FourMS.FourMSParameterConverter ParameterConvertor,
                       java.lang.String DatabaseHost)
Constructor for the class.

Parameters:
args - Command line arguments which were passed into the application
SyslogMessageHandler - A syslog message handler
SimulationMode - Whether the system should be run in simulation mode or not.
ORBPersistentPort - This the port number upon which the ORB will listen.
ORBServerID - This is a string which indicates the ID associated with the ORB server and will be used for persistence.
InstrumentName - This is the name of the instrument which is being controlled.
Method Detail

setDebugState

public void setDebugState(boolean DebugState)
This is an obligation to the CORBA instrument controller interface which permits the debug of the application to be enabled or disabled.

Specified by:
setDebugState in interface iInstrumentController.InstrumentControllerOperations
Parameters:
DebugState - Whether or not debug should be enabled or disabled.

setTraceLevel

public void setTraceLevel(double TraceLevel)
This is an obligation to the CORBA instrument controller interface which permits the trace level of the application to be set, in this application there is no different trace levels enabled.

Specified by:
setTraceLevel in interface iInstrumentController.InstrumentControllerOperations
Parameters:
TraceLevel - The expected trace level of the application when debug is enabled.

closeDown

public void closeDown(java.lang.String CloseDownMessage)
This is an obligation to the CORBA instrument controller interface which permits the application to be closed down in a controlled manner.

Specified by:
closeDown in interface iInstrumentController.InstrumentControllerOperations
Parameters:
CloseDownMessage - The text of a message which is to be put into the syslog when the application closes down

handshake

public boolean handshake()
This is an obligation to the CORBA instrument controller interface which permits a third party to ascertain if the instrument controller is responding. The application should return true in the case that the application is working fine

Specified by:
handshake in interface iInstrumentController.InstrumentControllerOperations
Returns:
boolean true if the application is responding

SetupInstrumentControllerActions

protected boolean SetupInstrumentControllerActions()
This will be used to set up the controller for the instrument which we have been instructed to control. It first creates all of the PV controllers which will be needed by the application and then it will create all of the CORBA controlled actions which will be used by a CORBA clients to control the IOC.

Returns:
boolean True if everything was set up correctly

createInstrumentAssociatedCORBAActions

private boolean createInstrumentAssociatedCORBAActions()
Now we need to go through the database and create all of the CORBA actions which are to be used to control the EPICS IOC. Any errors here will result in the application being closed down as it is considered fatal.


createInstrumentAssociatedProcessVariables

private boolean createInstrumentAssociatedProcessVariables()
Determines the EPICS process variables which are associated with the instrument controller we are suppoesd to be controlling and sets up channel access to monitor them

Returns:
boolean True if we managed to initialise the PVs correctly.