Eclipse Modeling Framework and Netbeans Client - a forced marriage?
Pål Stenslet and Gunnar Reinseth
Lead Architect and Technical Lead (GUI), Exie AS
Understand some of the challenges faced when combining NetBeans Platform and Eclipse Modeling Framework
Useful hints to get started with metamodel-based development and stand-alone EMF usage
2009 CommunityOne Conference: North | no.sun.com/communityone
2
Agenda
About Exie Product architecture Using metamodels Platform choices – pros and cons Combining EMF and NetBeans Platform conflicts – and how to resolve them Practical use of EMF
2009 CommunityOne Conference: North | no.sun.com/communityone
3
Exie
Who we are – What we do The company
Norwegian software company located in Oslo 40+ people – 15+ developers In business for 10 years
The product
People-Driven Performance Management
Pervasive – Deployed to user at all levels Targeted applications – Disposed of when issue resolved
Exie 2.0
Application Builder (NetBeans client) End-user tool (Flex) Application Engine (JEE on Glassfish)
2009 CommunityOne Conference: North | no.sun.com/communityone 4
Our Product Vision
A new value-chain for application development
Applications custom-built by non-programmers
Built and deployed by business experts Understand requirements and application domain Agility - Disposable low-cost applications
Product developers unaware of application domain
The sad truth about many skilled developers Application metamodel Rule-based end-user GUI
2009 CommunityOne Conference: North | no.sun.com/communityone
5
Physical Architecture
A runtime view
2009 CommunityOne Conference: North | no.sun.com/communityone
6
Java Web-start
Flex (Adobe Flash)
NetBeans Platform End-user tool
Builder Plugin components System mgmt. tools Platform components
Glassfish JEE5
Application Engine Plugin components JMX
OpenDs
HTTP
XMLA/MDX
JDBC
Configuration Authorization & Authentication
Versioned Application Repositoy Cube
SVN XML for Analysis
Directory Service
2009 CommunityOne Conference: North | no.sun.com/communityone
7
Cherry Picking
FOSS used
2009 CommunityOne Conference: North | no.sun.com/communityone
8
Java Web-start
Flex (Adobe Flash)
NetBeans Platform End-user tool
Builder Plugin components System mgmt. tools Platform components
Flex
Glassfish
JMX Application Engine Plugin components
NetBeans
EMF
l2fprod JEE5 JRibbon
Glassfish
HTTP XMLA/MDX
OpenDs
OpenDS
Authorization & Authentication
JDBC
Configuration
Versioned Application Repositoy Cube
Subversion SVN kit
SVN
Directory Service XML for Analysis
2009 CommunityOne Conference: North | no.sun.com/communityone
Derby
9
Metamodel editing How it works at Exie
Edit Generate Build Run
2009 CommunityOne Conference: North | no.sun.com/communityone
10
Why use the Eclipse Modeling Framework?
We needed a robust and server-ready metamodel
EMF-Model
Editable as diagram Generated model API Persistency Cross-document models Upgrade of outdated models Cross-referencing
EMF-Transaction
Simplified action programming Triggers
EMF-Validation
Metamodel constraints Custom validations Give hints to user
EMF-Edit
Change notification Commands with undo-redo Syntax-oriented editing
EMF-Query
Filtering views Navigating and Traversing
2009 CommunityOne Conference: North | no.sun.com/communityone
11
Why use NetBeans Platform?
The application builder must appeal to business experts
Wanted to offer Office 2007 look-and-feel
Target users comfortable with Excel Third-party swing libraries necessary for Office 2007 look
Mature, proven and sustainable platform Useful built-in services
Persist tool state Persist user preferences Visual library Out-of-the-box build system
Good module system
2009 CommunityOne Conference: North | no.sun.com/communityone
12
Why not use Eclipse RCP?
The obvious choice when we use EMF
Look-and-feel hard to change due to SWT
Non-Java implementation Widgets implemented per OS platform
Team members familiar with Swing
Also applies to future team members
2009 CommunityOne Conference: North | no.sun.com/communityone
13
The forced marriage
Where were the conflicts?
GUI
EMF-Edit / JFace / SWT Nodes and Explorer APIs
Project structure
EMF project NetBeans module
Property Sheets Actions
EMF Commands NetBeans Actions API Drag-and-drop
Third-party IDE
IntelliJ IDEA
Platform dependencies
OSGi
2009 CommunityOne Conference: North | no.sun.com/communityone
14
Tree GUI in the Eclipse world
2009 CommunityOne Conference: North | no.sun.com/communityone
15
Tree GUI in the NetBeans world
2009 CommunityOne Conference: North | no.sun.com/communityone
16
The happy couple – Conflicts resolved
Bridging the handling of Tree GUI
2009 CommunityOne Conference: North | no.sun.com/communityone
17
The happy couple – Synergy
Using EMF query to filter trees
2009 CommunityOne Conference: North | no.sun.com/communityone
18
The happy couple – Conflicts resolved
Bridging the handling of Property Sheets Eclipse IItemPropertyDescriptor must be bridged to NetBeans Node.Property
NetBeans poor support for in-line editing of properties
Use third-party property sheet implementation (l2fprod)
2009 CommunityOne Conference: North | no.sun.com/communityone
19
The happy couple – Conflicts resolved
Bridging the handling of Property Sheets
2009 CommunityOne Conference: North | no.sun.com/communityone
20
Adding interfaces to generated code
Needed Icon Name rather than the built-in image
Modifying the Code Generation Template:
public class .... implements i = typs.iterator(); i.hasNext(); ) {%> ,
2009 CommunityOne Conference: North | no.sun.com/communityone
21
Practical use of EMF outside Eclipse
Some tips based on Exie’s experience
Consider splitting metamodel into several packages
Easier to maintain small diagrams
Inter-package relations are suppressed from diagrams
Hard to merge independent diagram changes
Keep Eclipse workspace template in VCS Keep generated code in VCS
Annotate with @generated NOT when necessary
Don’t integrate code generation with main build
Would require Eclipse installed on build server
Generate Eclipse application for reference Use newsgroup eclipse.tools.emf
2009 CommunityOne Conference: North | no.sun.com/communityone 22
Wishlist - NetBeans
OSGi Support for mixed JavaEE and RCP projects Better property sheets Flexible/Customizable docking system
2009 CommunityOne Conference: North | no.sun.com/communityone
23
Wishlist - EMF
Standard JavaBeans bridge Mechanism for persisting non-Eclipse attributes (e.g. java.awt.Color) Better support for upgrading between metamodel versions
2009 CommunityOne Conference: North | no.sun.com/communityone
24
Summary
It is viable to create a stable product combining the best from EMF and NetBeans Plan for some bridging effort when integrating mature frameworks from unrelated projects Plan for a changing metamodel Need a reasonably sized and stable team Experiment!
2009 CommunityOne Conference: North | no.sun.com/communityone
25
For More Information
Visit exie.com for white papers and product demonstration
video Office 2007 look-and-feel: officelaf.dev.java.net JRibbon: flamingo.dev.java.net Mikael Tollefsen on NetBeans:
http://javazone.no/incogito/session/Creating+attractive+clients+with+NetBeans +Rich+Client+Platform.html
2009 CommunityOne Conference: North | no.sun.com/communityone
26
Eclipse Modeling Framework and Netbeans Client - a forced marriage?
Pål Stenslet and Gunnar Reinseth
paal.stenslet@exie.com, gar@exie.com