What you always wanted to know about Developing for Eclipse/CSS but were afraid to ask Kay Kasemir June 2010.

Slides:



Advertisements
Similar presentations
Control System Studio (CSS)
Advertisements

Control System Studio (CSS) Data Access Layer (DAL) Kay Kasemir, Xihui Chen July 2009.
Developing in CAS. Why? As distributed you edit CAS 3 with Eclipse and build with Maven 2 – Best Practice for Release Engineering – Difficult edit-debug.
ORNL is managed by UT-Battelle for the US Department of Energy Control System Studio: First Steps Kay Kasemir ORNL/SNS June 2014.
Managed by UT-Battelle for the Department of Energy Kay Kasemir, Xihui Chen ORNL/SNS April, 2013 Getting Started with CSS.
Goals Give you a feeling of what Eclipse is.
Java Integrated Development Environments: ECLIPSE Part1 Installation.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of The Java Development Tools project.
Eclipse Introduction Dwight Deugo Nesa Matic
Views Dwight Deugo Nesa Matic
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Jan Control System Studio Training - Alarm System Use.
Eclipse IDE. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as teaching.
03 Using Eclipse. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS April 2013 Control System Studio Training - Alarm System Use.
Managed by UT-Battelle for the Department of Energy Kay Kasemir, Xihui Chen ORNL/SNS 2012, April at SLAC Eclipse Products, Features, Plugins,
Control System Studio (CSS)‏ Kunal Shroff EPICS Training Meeting 07/10/2010.
Scan System Kay Kasemir, Xihui Chen Jan Managed by UT-Battelle for the U.S. Department of Energy Automated Experiment Control “Scan” should be.
Servlets Environment Setup. Agenda:  Setting up Java Development Kit  Setting up Web Server: Tomcat  Setting up CLASSPATH.
Managed by UT-Battelle for the Department of Energy Kay Kasemir, Ph.D. ORNL/SNS July 2011 at Control System Studio - CSS - Overview.
Introduction to Android. Android as a system, is a java based operating system that runs on the Linux kernel. The system is very lightweight and full.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS 2012, April at SLAC Control System Studio - Introduction.
Managed by UT-Battelle for the Department of Energy Kay Kasemir, Ph.D. ORNL/SNS July 2011 at Control System Studio - CSS - Overview.
Deutsches Elektronen-Synchrotron DESY Helmholtz Association of German Research Centres Hamburg, Germany The European X-Ray Laser Project.
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
ORNL is managed by UT-Battelle for the US Department of Energy Control System Studio: BOY Kay Kasemir ORNL/SNS A lot of material from.
Introduction to Eclipse Plug-in Development. Who am I? Scott Kellicker Java, C++, JNI, Eclipse.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Oct EPICS Meeting, PAL, Korea Control System Studio Training.
Jan Hatje, DESY CSS ITER March 2009: Technology and Interfaces XFEL The European X-Ray Laser Project X-Ray Free-Electron Laser 1 CSS – Control.
Control System Studio (CSS) Overview Kay Kasemir, July 2009.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Feb Material copied from the IOC Application Developer's.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Oct EPICS Meeting, PAL, Korea Control System Studio Training.
Prachi Chitnis.  The CSS feel  SDS – Synoptic Display Studio  ADL Converter  PV table, Probe…
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Jan Control System Studio, CSS Overview.
Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.
9/2/ CS171 -Math & Computer Science Department at Emory University.
GumTree Development Environment Setup Windows Only Compatible with Eclipse 3.2 M3 (Last update: 16/11/05)
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS With slides from Xihui Chen May 2014 Control System Studio Training.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Jan Control System Studio Training - Development Setup.
CSS – Control System Studio
XFEL The European X-Ray Laser Project X-Ray Free-Electron Laser Matthias Clausen, DESY XFEL Refrigerator Controls – April CSS Introduction 2 nd.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS 2011, October at CEA Saclay, France Control System Studio.
Managed by UT-Battelle for the Department of Energy Kay Kasemir, Xihui Chen ORNL/SNS April Control System Studio Training - Development.
Managed by UT-Battelle for the Department of Energy CSS Update Matthias Clausen, Helge Rickens, Jan Hatje and DESY Delphy Armstrong, Xihui Chen,
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS 2012, January 9-12 at NSRRC, Taiwan Control System Studio Training.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS 2011, October at CEA Saclay, France Control System Studio.
Not Yet Another EPICS Display Manager!? Kay Kasemir, Xihui Chen Kobe EPICS Meeting October.
Scalatest. 2 Test-Driven Development (TDD) TDD is a technique in which you write the tests before you write the code you want to test This seems backward,
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS April 2013 Control System Studio, CSS Overview.
Surya Bahadur Kathayat Outline  Ramses  Installing Ramses  Ramses Perspective (Views and Editors)  Importing/Exporting Example.
Jan Hatje, DESY CSS GSI Feb. 2009: Technology and Interfaces XFEL The European X-Ray Laser Project X-Ray Free-Electron Laser 1 CSS – Control.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS 2012, January 9-12 at NSRRC, Taiwan Control System Studio Training.
Introduction 1 Lars Vogel 4/22/2009.  Who am I?  Eclipse as a platform  What is Eclipse RCP?  Extension Points / Extensions  Equinox  SWT & JFace.
Applications Kay Kasemir ORNL/SNS Using Information and pictures from Matthias Clausen, Jan Hatje, and Helge Rickens (DESY) October 2007.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS Jan Control System Studio Training - Extension Points:
Matthias Clausen, DESY EPICS Training – Client Tools/ CSS EPICS collaboration meeting EPICS Training Client Tools EPICS collaboration meeting 2008.
CSS Synoptic Display Comments Kay Kasemir, July 2009.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS May 2014 Control System Studio Training - Hierarchical Preferences.
Managed by UT-Battelle for the Department of Energy Kay Kasemir ORNL/SNS 2012, April at SLAC Control System Studio Training - Alarm System.
Implementation and Testing of RDB Channel Archiver with MySQL Richard Ma, DePauw University Supervisor: Richard Farnsworth, Argonne National Laboratory.
Editing and Debugging Mumps with VistA and the Eclipse IDE Joel L. Ivey, Ph.D. Dept. of Veteran Affairs OI&T, Veterans Health IT Infrastructure & Security.
Managed by UT-Battelle for the Department of Energy Quest for the Best Ever Alarm System Tool Kay Kasemir Oct
BOY, A Modern Graphical Operator Interface Editor and Runtime Xihui Chen, Kay Kasemir RAD Control Group.
Introduction to Control System Studio (CSS) Kay Kasemir, Kunal Shroff EPICS Fall Collaboration Meeting, October 2011 PSI.
ECLIPSE RICH CLIENT PLATFORM Part 1 Introduction.
Goals Give you a feeling of what Eclipse is.
OpenOffice.org API Plugin for NetBeans- a look under the hood
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Presentation transcript:

What you always wanted to know about Developing for Eclipse/CSS but were afraid to ask Kay Kasemir June 2010

2Managed by UT-Battelle for the U.S. Department of Energy Outline Note: Diagram shows Eclipse and SNS CSS 2.0.1! DESY CSS allows optional Tine support here: Also: Your accelerator is different Wireless = Security Risk Oracle

3Managed by UT-Battelle for the U.S. Department of Energy Audience Familiar with Java? Can list differences between Java 5 and 6? Have used Eclipse as an IDE? … for test-driven development? … to refactor code? Have written Eclipse plug-ins, RCP apps? … including CSS? Worry about bug ?

4Managed by UT-Battelle for the U.S. Department of Energy This Talk Eclipse as an IDE Develop “Formula”, test-driven, with refactoring Plug-ins Package Formula as plug-in Extension Points Build simplistic “NIOC” CSS Plug-ins and Extension Points Build “Probe” Avoid bug

5Managed by UT-Battelle for the U.S. Department of Energy Basic Eclipse Setup Use Sun Java SDK (not JRE, not GCJ) Download “Eclipse for RCP/Plug-In Developers” Suggested Eclipse Preferences Java, Installed JREs: Set default to your SDK Java, Compiler: Compiler compliance level: “1.5” will create code that works for Java 1.5 and 1.6. Java, Compiler, Errors/Warnings: Enable as many as possible. Warnings help avoid errors

6Managed by UT-Battelle for the U.S. Department of Energy “Formula” Project Menu File, New Project Plug-in Development, Plug-in Project Name: “Formula” Use defaults MANIFEST.MF, “Dependencies”: org.junit4 Unless a plugin has special requirements, I suggest to use the workspace settings (and they in turn target java 1.5 and higher) Right-click on new project in Package Explorer Properties, Java Compiler: Uncheck “Enable Project specific settings” Right-click on project’s “JRE System Library” in Package Explorer Properties: Select “Workspace default”

7Managed by UT-Battelle for the U.S. Department of Energy “Formula” Library What should it do? 2+3 x*atan(3/2) API? Expression.evaluate(“2+3”) Did you test it? Well, back when I wrote it. Does it still work after Fred “improved” it? Maybe… Do you have examples for using it? You mean a simple, standalone example?

8Managed by UT-Battelle for the U.S. Department of Energy Test Driven Development Write the test first! Clarify scope Brainstorm API Eclipse helps Skeleton implementation class Formula double eval() Refactoring Rename to “Expression” Extract Method assertEquals(…), Run As/JUnit Google Eclipse TDD, formula_tdd

9Managed by UT-Battelle for the U.S. Department of Energy Test Driven Development Red, Green, Refactor Once Test passes: Done! Plus Can re-run after “improvements” Extend test when new requirements arrive Variable names that start with “51…” Tests serve as developer examples For more about TDD, Agile Methods, why the waterfall model doesn’t work: Scott Ambler, Martin Fowler nioc.formula

10Managed by UT-Battelle for the U.S. Department of Energy Eclipse Plug-Ins: Packaging Jar(=ZIP) file or directory for grouping stuff Java Sources & Classes HTML files, Images, … Extra MANIFEST.MF entries for Access restrictions nioc.formula exports the Formula, but not the tests & internals Class path handling Define plug-in dependencies instead of editing CLASSPATH Versioned dependencies nioc, nioc.formula: MANIFEST.MF

11Managed by UT-Battelle for the U.S. Department of Energy Equinox Runtime Loads Plug-ins and their dependencies as needed (“lazy”) Adds exported packages to CLASSPATH Handles extra MANIFEST.MF entries for Live Cycle “Activator” start/stop nioc junit nioc.formula ?

12Managed by UT-Battelle for the U.S. Department of Energy “NIOC” Project nioc: example.xml

13Managed by UT-Battelle for the U.S. Department of Energy What do we need for an IOC? Network protocol – Omitted Scanning Engine – Very Simple Records – 2 Simple Examples Links – const, record, random, … Shell Emphasis: Extension Points to connect ‘Records’, ‘Links’ Console as shell. Network Engine Calc Record Input Record ‘const’ Link ‘record’ Link ‘…’ Link

14Managed by UT-Battelle for the U.S. Department of Energy Links, Records Link.java API for a read/write link ConstantLink.java Implementation for constant value Record.java API for a record InputRecord.java Implementation that reads “input” link nioc Link API nioc.Link const..more. Record API nioc.Record input..more.

15Managed by UT-Battelle for the U.S. Department of Energy Extension Points “Schema” allows plugins to provide implementations Registry allows lookup: “const” -> nioc.ConstantLink “calc” -> nioc.CalcRecord Addition of new Link and Record types without recompilation of code that uses them Creating an extension point can be copy/paste/trial/error. Google for help. Read Eclipse books. nioc, nioc.links Link API nioc.Link const..more.

16Managed by UT-Battelle for the U.S. Department of Energy Console Part of Equinox runtime Local access: -console Telnet access: -console 4812 Start/stop/ load/unload plug-ins Add your own commands nioc ConsoleCommands.java …

17Managed by UT-Battelle for the U.S. Department of Energy Running NIOC Example Menu Run Configurations, New OSGi Framework Select nioc.* plugins and required Bundles Console Commands help trace, dbl, records, links ss stop, start refresh - after for example small change in CalcRecord.process() close

18Managed by UT-Battelle for the U.S. Department of Energy Adding a new Link Add link type “one” that always returns the value 1.0 New or existing plug-in Dependency: “nioc” Extensions: Add “nioc.link” type: “one” class: “nioc.link.ExampleOneLink” Implement the class, as simple as getValue() { return new Double(1.0); }

19Managed by UT-Battelle for the U.S. Department of Energy “Probe” Project GUI Tool for CSS Enter PV name, see values RCP/CSS Applications are all about Extension Points GUI: Eclipse Extension Points Channel Access: CSS Extension Points

20Managed by UT-Battelle for the U.S. Department of Energy Probe Project Setup Create new ‘project’ Use ‘plugin’ Call it ‘yetanotherprobe’ Add dependencies org.junit4 – For JUnit tests org.csstudio.utility.pv, …pv.simu – To access PVs Think about ‘Model’ Takes PV name, connects to control system PV Sends update when PV changes

21Managed by UT-Battelle for the U.S. Department of Energy Again: Test-Driven Development Start(!) with the ‘ModelTest’ API evolves as you’re actually trying to use it: // Create Model model = new Model(); model.setPVName(…); // Somehow register for updates … Eclipse helps to create code Refactor, navigate code, … When test compiles, implement Model until it actually ‘works’ yetanotherprobe0, 1

22Managed by UT-Battelle for the U.S. Department of Energy Using A CSS Plug-in Simulated PV: org.csstudio.utility.pv.simu SimulatedPVFactory creates simulated PVs Plug-in Dependencies handle the CLASSPATH yetanotherprobe2

23Managed by UT-Battelle for the U.S. Department of Energy CSS Extension Points Idea: Application uses generic API PV, Archive, Logbook, Authentication, … Pluggable implementations EPICS, RDB, SNS ELog, LDAP, … Extension Points, example PV PV plugin defines extension point: PVs for what prefix do you provide? EPICS PV: I understand “ca://…” PVs Simulated: I support “const://..”, “sine://…”, … Plugin Registry Lists all plugins PV Factory locates available implementations Loads them as needed, including dependencies yetanotherprobe3 Model PV PV Factory org.csstudio.utility.pv.pvfactory EPICS PV Channel Access Simulated Const, Sine, Ramp, …

24Managed by UT-Battelle for the U.S. Department of Energy Eclipse Rich Client Platform (RCP) RCP = Window framework Menu bar, Tool bar, Status bar Multiple document “editors”, “view” Background jobs, file system with change notification, … All based on extension points There is no way to learn about this in one presentation. Read the books, study online tutorials for a month.

25Managed by UT-Battelle for the U.S. Department of Energy Add GUI to Probe Add “View” to MANIFEST.MF, plugin.xml: Dependency: Add org.eclipse.ui Extensions: Add org.eclipse.ui.views id, name, class: Enter something Implement View for the Model Then run CSS with the new probe plugin included Where is the new Probe? Hollywood Principle, Window/Show View/… yetanotherprobe4

26Managed by UT-Battelle for the U.S. Department of Energy RCP GUI Notes SWT, not AWT Better, worse? Different. Layouts: Many. GridLayout: Fairly generic and easy to understand FormLayout: More coding, but allows for runtime changes to hide/show widgets Beware of GUI thread vs. other control system threads Use Display.asyncExec(Runnable …) yetanotherprobe4

27Managed by UT-Battelle for the U.S. Department of Energy Exporting a ‘Product’ Example: ‘Basic EPICS’ CSS.product Add yetanotherprobe plugin to Dependencies Export as “Eclipse Product”

28Managed by UT-Battelle for the U.S. Department of Energy What else is there in Eclipse? String Externalization Extension points for adding to main menu Entry that would ‘open’ our Probe view Editors: Similar to Views In center of workbench window Have input, typically file Examples: SDS, BOY, Data Browser, … Preference System, Online Help Object Contributions Allow ‘Probe’ to appear in context menus of other applications.. when a Process Variable is selected

29Managed by UT-Battelle for the U.S. Department of Energy What else is there in CSS? Suggested name and hierarchy for plugin names, menu, preferences, online help Types for Object Contributions, Drag & Drop IProcessVariable, IFrontEndControllerName, … Plugins for Logging Authentication/Authorization …

30Managed by UT-Battelle for the U.S. Department of Energy Summary Eclipse IDE Supports test-driven development Plug-ins Simplify handling of Dependencies Extension Points, Registry Decouple APIs from Implementations RCP, CSS A whole software ecosystem built on Extension Points Steep Learning Curve for Developers … but also many Books, online Tutorials Invest to learn it, and you’ll like it Results in good product for end users Image Source: ORNL General Employee Training Web