Setup
Environment
- Effectively, you can only develop MPSGui inside Eclipse on lcls-builder.
- Check out the CVS module physics/mps/mpsgui into your workspace
- From now on, the root of project is referred to as $MPSGUI_ROOT
- You can use eco to checkout the package. The name of the module is mpsgui.
- Run ant to build the mpsgui and mpscud jar files.
- The mpsgui and mpscud scripts should use the jar files built in the jar folder.
Dependencies
For library paths, see the scripts $MPSGUI_ROOT/mpsgui or $MPSGUI_ROOT/mpscudthe build.xml file. Note that the dependent jar files are copied into the lib folder and are part of CVS. To update the jar files, run ant update_dependencies. This should copy the files from $PHYSICS_TOP on dev onto the lib folder. You can then commit these updated dependent jar files into CVS.
- ezJCA (version R0-0-10)
- javainterfaces (current version)
- MPS Config(current version)
- Oracle JDBC driver
- Sqlite JDBC driver
- SwingUtil (current version)
- jgoodies.jar can be added at runtime for the Matlab look & feel
- xal4lcls
- ext.jar (current version)
- xal.jar (current version)
Test
...
- Select $MPSGUI_ROOT/src/edu.stanford.slac.mpsgui/MpsGuiLauncher
- Right-click => select Run As... => Java Application
- If you run the app for the first time, it should fail
- Go to Run in the Window menu
- Select "Open Run Dialog..."
- Select "MpsGuiLauncher" in the window on the left
- Select the "Arguments" tab
- Enter the following arguments:
in the "Program arguments" area.Code Block jdbc:sqlite:/usr/local/lcls/epics/iocTop/MachineProtection/mpsConfiguration/database/ jdbc:sqlite:/usr/local/lcls/epics/iocTop/MachineProtection/mpsConfiguration/algorithm/ jdbc:oracle:thin:MPS_HISTORY/*current_password*@mccqa.slac.stanford.edu:1521:MCCQA
- Replace current_password with the current password (can be found in the $MPSGUI_ROOT/mpsgui script)
- Press "Run"
Development
- Test using the mpsgui and mpscud scripts from the command line. This sets the Oracle Wallet environment variable and other EPICS variables.
Development
Major Recurring Tasks
- Previously, one had to check the live history in the MPS GUI HistoryViewer (and if empty, restart the MPS History Server). However, now there is a CRON job that monitors this and will trigger alarms for the operators
...
Tips
- Find the Java field that contains the UI component that prompted your development (change the back-/foreground color, if not sure); then use Eclipse References (right-click menu) to find where the field is being used
Overview
Launch
...
Scripts
mpsgui
- Located under $MPSGUI_ROOT, must be executable (chmod +x)
- Sets up the CLASSPATH ORACLE Wallet and the log file
- Launches MPSGui using Plastic3DLookAndFeel from jgoodies
- byenti is a legacy system property that tells MPSGui to interpret bypass end times as absolute (or, if false, relative) times
...
- Located under $MPSGUI_ROOT, must be executable (chmod +x)
- Sets up the CLASSPATH Oracle Wallet and the log file
- Launches MPSGui in CUD mode using Plastic3DLookAndFeel from jgoodies
- Operators have and Mike Z know details about the CUD mode
- byenti is a legacy system property that tells MPSGui to interpret bypass end times as absolute (or, if false, relative) times
Classes and Functions
Entry Points
edu.stanford.slac.mpsgui.MpsCudController
...
edu.stanford.slac.mpsgui.MpsGuiController
- Creates the full UI
- If successful, initializes "viewers" (controllers) for each tab
edu.stanford.slac.mpsgui.MpsGuiLauncher
- The main class expects the following arguments (in the order):
- Config DB URL prefix
- Logic DB URL prefix
- History JDBC URL (including username and password)
- See $MPSGUI_ROOT/mpsgui for an example
- Loads Config and Logic DB via MPS Config
- Depending on the system property slac.launchAsCud, initializes either MpsCudController or MpsGuiController
edu.stanford.slac.mpsgui.MpsGuiProperties
- Contains constants/properties used by MPSGui, such as:
- Application name, version number, NULL string, date formats, background color for alternate table rows, etc.
User Interface
- The main user interface consists of 5 tabs: Summary, Faults, Logic, Ignore Logic, and History
- Each tab has a corresponding package under edu.stanford.slac.mpsgui.ui
- Classes in those packages are complex Swing components (mostly, JPanels and JTables)
- Each XYZPanel class under edu.stanford.slac.mpsgui.ui is a subclass of edu.stanford.slac.mpsgui.ui.AbstractPanel
- (Almost) every widget of the panel is stored in a field in the corresponding XYZPanel class, where XYZ is a descriptive string that explains what the panel shows
- The fields are public to allow registration of the listeners (however, it doesn't make sense to set them)
...
- Controller for the "Ignore Logic" tab
- Monitors the state of ignoring macros (using MPS Config)
- Caches previous states
- Shows detailed information about ignoring and ignored macros
To test, ignore/unignore macros by writing 0 or 1 to YAGS:IN20:211:IN_LMTSW_BYPV
Code Block caput YAGS:IN20:211:IN_LMTSW_BYPV 1 to ignore caput YAGS:IN20:211:IN_LMTSW_BYPV 0 to unignore
...
- Controller for the "Summary" tab
- Initializes the logic "viewer" for the integrated logic panel
- If applicable, styles the summary UI as a CUD (larger font etc.)
- Monitors beam rate PVs (both MPS and actual)
- Monitors bypassed faults and end times; warns (using proper colors) when bypasses are about to expire
- Allows user to re-bypass to a bypassed macro state
...
Others
edu.stanford.slac.mpsgui.MpsCudController
- Creates the summary UI, tries to setup as a CUD
- Initializes the summary "viewer" (controller)
edu.stanford.slac.mpsgui.MpsGuiController
- Creates the full UI
- If successful, initializes "viewers" (controllers) for each tab
edu.stanford.slac.mpsgui.MpsGuiLauncher
- The main class expects the following arguments (in the order):
- Config DB URL prefix
- Logic DB URL prefix
- History JDBC URL (including username and password)
- See $MPSGUI_ROOT/mpsgui for an example
- Loads Config and Logic DB via MPS Config
- Depending on the system property slac.launchAsCud, initializes either MpsCudController or MpsGuiController
edu.stanford.slac.mpsgui.MpsGuiProperties
- Contains constants/properties used by MPSGui, such as:
- Application name, version number, NULL string, date formats, background color for alternate table rows, etc.
edu.stanford.slac.mpsgui.jdbc.hist.HistoryDB
- Client for the MPS History data (currently in Oracle, used to be in sqlite)
- SQL queries are located in the file oracle.properties in the package edu.stanford.slac.mpsgui.jdbc.hist
- Has an auxilliary API to insert/delete test messages
Release
...
to production
- Update the application version in $MPSGUI_ROOT/src/edu.stanford.slac.mpsgui.MpsGuiProperties
- Add a note in $MPSGUI_ROOT/RELEASE_NOTES
- Increment the tag version accordingly
- Commit to CVS
- Tag with mpsgui-R#-#-#
- Check out the tagged version into production on development using eco, and build with ant:
Code Block |
---|
$ cd ~/workspace
$ eco
Enter name of module/package to checkout: mpsgui
Enter name of tag or [RETURN] to use HEAD>mpsgui-R0-1-23
Using mpsgui-R0-1-23. The name of the directory will be mpsgui-R0-1-23.
cvs checkout -P -r mpsgui-R0-1-23 -d mpsgui-R0-1-23 mpsgui
cvs checkout: Updating mpsgui-R0-1-23
...
$ cd mpsgui/mpsgui-R0-1-23/
$ ant
....
jar:
[jar] Building jar: /afs/slac.stanford.edu/u/cd/mshankar/temp/test/docTest/mpsgui/mpsgui-R0-1-23/jar/mpsgui.jar
BUILD SUCCESSFUL
$ $ ls jar/mpsgui.jar
jar/mpsgui.jar
$ ./mpsgui
|
Use cram push and cram upgrade to push and upgrade to this release
Code Block $ cram ls Current version on facility: LCLS => mpsgui-R0-1-22 Current version on facility: FACET => None Current version on facility: TestFac => None Current version on facility: Dev => mpsgui-R0-1-22 $ cram push .... $ cram upgrade -f Dev mpsgui-R0-1-23 ....
- Select File => New Java project => Create project from existing source
- Select $PHYSICS_TOP/release/mpsgui-R#-#-#
- Name the project mpsgui-R#-#-#
- Press "Finish"
- Right-click on the new project mpsgui-R#-#-# => Export...
- Select Java => JAR file
- Check mpsgui-R#-#-# in "Resources to export"
- Check "Export generated class files and resources"
- As the export destination, type (and/or select)
Code Block $PHYSICS_TOP/release/mpsgui-R#-#-#/jar/mpsgui.jar
- Press "Finish"
- Move the symbolic link
Code Block cd $PHYSICS_TOP/ rm -rf mpsgui; ln -s release/mpsgui-R#-#-# mpsgui
- Launch from lclshome
- MPS Global => MPS GUI...
- MPS Global => MPS CUD...
- Note that the mpsgui script redirects all logs to files elsewhere. During development and testing, it is often fruitful to have the logs on the console.
cd $PHYSICS_TOP/release
cvs co -r mpsgui-R#-#-# -d mpsgui-R#-#-# physics/mps/mpsgui