|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.TimerTask
ConfigSnapshot.ConfigSnapshot
class ConfigSnapshot
This class will be used to take snap shots of the state of the current instrument configuration which is included in the observing system which is indicated by the environment variable INSTRUMENT which is initialised as part of the setup of the observing system.
Snapshots will be taken of the instrumentation every 15 mins between the hours of 0000 and 0900 and also when the application is closed down through the use of the stopobssys scripts between these hours as well.
On start up of the application, a comparison of the existing instrument configuration and the previous snapshot will be made and if the configuration changes then it will be reported by means of an alarm in the syslog.
The application is CORBA enabled and registers itself in the name service as ConfigSnapshot/ConfigSnapshot. The details of the interface are outlined in iConfigSnapshot interface.
A client of the application is the 4MSControl panel which contains a drop down menu which is used to instruct the application to perform a instrument configuration snap shot comparison of the current instrumentation configuration and the last snapshot taken. The details of any instrument configuration mismatches will be reported accordingly. If the application is unable to perform the comparison (for example if the instrument configuration has changed for instance), the user will be notified accordingly.
The application will not take snapshots unless running on the machine which is hosting the whtics database. This is to prevent the application running on a different host computer with a different instrument configuration and polluting the snapshot information in the database on the ICS computer.
Field Summary | |
---|---|
(package private) org.omg.IOP.Codec |
codec
A codec which will be used for converting any values to strings |
private org.omg.CosNaming.NamingContextExt |
ControllerNameServiceContext
This is the context in the COS naming service into which we should store the details of mechanisms and the subactions which are associated with them |
private 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 |
(package private) java.util.Map<java.lang.String,java.lang.String> |
env
These are our environment variables |
(package private) boolean |
FirstSnapShot
True if this is the first snap shot to be taken. |
(package private) java.lang.String |
ICSHostComputer
This is the name of the machine which is hosting the database, if we are not running on the ICS host computer then we do not perform snapshots. |
(package private) java.util.ArrayList<java.lang.String> |
InstrumentsInConfiguration
These are the instruments which are associated with the camera stations which are included in the INSTRUMENT environment variable |
private java.util.Calendar |
LastSnapShotTime
This is the time that the last snap shot was taken of the system |
(package private) java.lang.String |
LocalhostName
This is the name of the host which we are running upon |
OCSCORBAHelper |
OCSCorba
This will be used to perform a lot of the donkey work associated with setting up a CORBA application. |
private org.omg.CORBA.ORB |
Orb
The CORBA request broker or ORB which will be used for handling CORBA requests |
private iParameterNoticeBoard.ParameterNoticeBoardSupplier |
ParameterNoticeBoard
This is reference to the remote proxy CORBA object which will be used to access the parameter noticeboard |
private org.omg.PortableServer.POA |
Poa
The portable object adapter which will be used by this class |
private org.omg.CosNaming.NamingContextExt |
RootNamingServiceContext
This is a reference to the COS naming service |
(package private) java.util.HashMap<java.lang.String,SnapshotVariable> |
SnapshotItems
This is a collection which contains the details of all of the variables which are to be snapshotted. |
private java.util.Timer |
SnapShotTimer
This is a timer object which will be used for scheduling of the snapshots |
private MessageHandler |
SyslogMessageHandler
This is a syslog object which will be used to report errors etc |
Constructor Summary | |
---|---|
ConfigSnapshot(java.lang.String[] args,
MessageHandler SyslogMessageHandler,
java.lang.String dbHost)
|
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.When the application is requested to close down, it will take a snapshot of the instrument configuration before it actually shuts down |
private java.util.ArrayList<java.lang.String> |
getInstrumentsFromInstrumentStations()
Break down the environment variable INSTRUMENT and then retrieves from the INSTRUMENTCAMERASTATIONS table in the whtics database, the names of the instruments which are associated with those camera stations. |
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. |
static void |
main(java.lang.String[] args)
|
void |
performConfigurationSnapshot()
Takes a snapshot of the current configuration for the instrumentation which is configured on the current machine. |
ComparisonResult |
performSnapShotComparison()
Forms a part of the IDL ConfigSnapshot interface and will result in the application verifying if the current instrument configuration differs from the previous instrument configuration which is held in the database. |
java.lang.String |
performSnapShotComparisonWithHTMLResponse()
Forms a part of the IDL ConfigSnapshot interface and will result in the application verifying if the current instrument configuration differs from the previous instrument configuration which is held in the database. |
private void |
readSnapshotConfigurationInformation()
Will read from the database the details of the parameters in the parameter noticeboard which need to be stored as part of this snapshot. |
private void |
removeOldSnapShotDataFromDatabase()
Cleans up the database by removing snapshot data from the database which is older than 2 weeks old. |
void |
run()
This is the obligation of the TimerTask interface and is called intermittingly. |
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. |
void |
verifyInstrumentConfigurationChangesOnStartup()
Verify instrument configuration has not changed. |
Methods inherited from class java.util.TimerTask |
---|
cancel, scheduledExecutionTime |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
java.lang.String ICSHostComputer
java.lang.String LocalhostName
java.util.ArrayList<java.lang.String> InstrumentsInConfiguration
java.util.HashMap<java.lang.String,SnapshotVariable> SnapshotItems
java.util.Map<java.lang.String,java.lang.String> env
private java.util.Calendar LastSnapShotTime
private final java.util.Timer SnapShotTimer
public OCSCORBAHelper OCSCorba
private org.omg.CORBA.ORB Orb
private org.omg.PortableServer.POA Poa
boolean FirstSnapShot
private org.omg.CosNaming.NamingContextExt ControllerNameServiceContext
private org.omg.CosNaming.NamingContextExt RootNamingServiceContext
private java.sql.Connection DBConnection
private iParameterNoticeBoard.ParameterNoticeBoardSupplier ParameterNoticeBoard
org.omg.IOP.Codec codec
private MessageHandler SyslogMessageHandler
Constructor Detail |
---|
@TODO(value="Remove the call to the performSnapShotComparison at the end of the method - Change so that we will not create snapshots on any machine other than whtics - We have commented out the removal of the old snapshots") ConfigSnapshot(java.lang.String[] args, MessageHandler SyslogMessageHandler, java.lang.String dbHost)
Method Detail |
---|
private java.util.ArrayList<java.lang.String> getInstrumentsFromInstrumentStations()
public void verifyInstrumentConfigurationChangesOnStartup()
public java.lang.String performSnapShotComparisonWithHTMLResponse() throws UnableToPerformComparison, InstrumentConfigurationChangedException
The result is a HTML formatted string which contains the details of the comparison
performSnapShotComparisonWithHTMLResponse
in interface ConfigSnapshotOperations
UnableToPerformComparison
- When it unable to perform a
comparison of the data in the snapshot database. If we are not
running on the ICS computer this expception will be thrown.
InstrumentConfigurationChangedException
- Thrown when the
last snapshot instrument configuration does not correspond to
the instrument configuration which we are currently using.public ComparisonResult performSnapShotComparison() throws UnableToPerformComparison, InstrumentConfigurationChangedException
performSnapShotComparison
in interface ConfigSnapshotOperations
UnableToPerformComparison
- When it unable to perform a comparison of the data in the snapshot database.
InstrumentConfigurationChangedException
- Thrown when the
last snapshot instrument configuration does not correspond to
the instrument configuration which we are currently using.private void removeOldSnapShotDataFromDatabase()
private void readSnapshotConfigurationInformation() throws UnableToGetSnapshotInformationFromDatabase
UnableToGetSnapshotInformationFromDatabase
- Should there be any problem getting the snapshot configuration data from the ICS database on whtics.@TODO(value="Uncomment the code which restricts the time that that the snapshots are taken") public void run()
run
in interface java.lang.Runnable
run
in class java.util.TimerTask
public void performConfigurationSnapshot() throws UnableToTakeSnapShot
performConfigurationSnapshot
in interface ConfigSnapshotOperations
UnableToTakeSnapShot
public void setDebugState(boolean DebugState)
setDebugState
in interface iInstrumentController.InstrumentControllerOperations
DebugState
- Whether or not debug should be enabled or disabled.public void setTraceLevel(double TraceLevel)
setTraceLevel
in interface iInstrumentController.InstrumentControllerOperations
TraceLevel
- The expected trace level of the application when debug is enabled.public void closeDown(java.lang.String CloseDownMessage)
closeDown
in interface iInstrumentController.InstrumentControllerOperations
CloseDownMessage
- The text of a message which is to be put
into the syslog when the application closes downpublic boolean handshake()
handshake
in interface iInstrumentController.InstrumentControllerOperations
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |