Author Archive
July 8th, 2009 by Simon Zambrovski

Abstract
Using Eclipse-based rich-clients as stand-alone applications is discussed in many
books and
articles. In the context of enterprise systems, the software development adopted several paradigms to improve the quality of the overall architecture. This short article describes some issues in packaging the application for using it in the context of enterprise systems.
Architectural Assumptions
Designing enterprise architectures is a standard discipline for IT-consulting companies or freelancers involved in software development. Maybe one of the main characteristics of enterprise architectures is the framework-driven approach of software creation. Thus, the software has to comply certain rules and standards adopted inside the enterprise. In order to simplify such constrained development process, it is common to use an in-house software framework, which enforces the compliance of the enterprise-internal standards and acts as glue between different technologies adopted as parts of the enterprise architecture.
Using such frameworks has major implications for the software development in general, and especially for the rich client development. The design issues are summarized in the next section.
Usaging an Enterprise Framework
The major goal of the enterprise in-house framework is to simplify the process of software systems development and to enforce standardization among the software systems. This usually includes the following aspects:
- Domain-specific component framework
- Methods for master data management
- Infrastructure services: authentication, authorization, communication, security, printing, reporting
- Application skeletons and launchers
The more unification and standardization is included inside the framework, the easier it is for a software developer to concentrate on the particular business task and the easier is the maintenance of the software system.
From the previous list, the most interesting part related to RCP packaging and deployment is the existence of the application skeletons and launchers. So, when launching an application, the framework libraries are loaded and executed first and pass the control to the application-specific modules. The advantage of this approach is that infrastructure services can be loaded first, which can be developed and shared among different applications.
(more…)
Posted in eclipse, enterprise systems, java, rcp | 7 Comments »
May 27th, 2009 by Simon Zambrovski
As announced in a
previous post the Eclipse Demo Camp Hamburg – Galileo Edition took place in the East Hotel in Hamburg. Organized by
Peter and
Martin, the event was again an interesting meeting with Eclipse-interested people in a wonderful location. Five presenters introduced Eclipse and OSGi-related topics.
Moritz Eysholdt reported about the
(Meta)Model Evolutions, he was focusing on during his masters thesis. The interesting part of his solution are two Xtext DSLs for description of the Metamodel changes (EPatch) and model migration algorithms (MetaPatch).
Heiko Behrens gave a funny and really good introduction of Xtext and DSLs for not Xtext developers. I really like his examples: these are simple and understanding for everyone. Great job!
Marco Mosconi showed some
ObjectTeams (black) magic. A
very intersting technology using aspect-oriented programming for type-safe framework modifications. Seem to be pretty advanced technology with interesting tooling.
Markus Alexander Kuppe had a talk on ECF and
RFC 119 and gave some sneak preview of the upcomming features. Finally, I had a short talk on Common Navigator Framework, basically explaining the
article posted here and something I documented for Galileo. Here are some visual impressions:
my FlickR set and
Peter’s.
Posted in eclipse, java, technology | 1 Comment »
April 28th, 2009 by Simon Zambrovski

Abstract
This article describes some efforts to use the Common Navigator Framework (CNF). In doing so it incorporates the information already covered in different articles, but also focuses on the specific use case of providing a view of something completely unrelated to the platform resources. So the aim is not to add some content to the “Project Explorer” which is an example of resource-oriented CNF usage, but to provide a view on a completely own data model.
Introduction

A very common UI element to represent data is a tree view. In SWT this UI element is implemented using the Tree widget. Following the MVC design pattern in the TreeViewer, JFace simplifies the usage of the Tree widget by delegating the task of content adoption to the ContentProvider and the label production to the LabelProvider (and using Sorters and Filters for sorting and filtering). Still for a single representation one has to construct a viewer and configure it with a corresponding Label- and ContentProvider. Further code reduction can be achieved by the use of WorkbenchContentProvider and WorkbenchLabelProvider if the elements can be made adaptable (implement IAdaptable interface and making them first-class workbench citizens). This approach is helpful, if the elements has to be displayed in several different viewers (e.G. Table). Finally, the Common Navigator Framework (CNF) is a facility provided by the Eclipse Platform which allows the usage of multiple Label- and ContentProvider on the same view. The providers are activated and used dynamically and can be configured declarative or programmatically. The advantage of CNF approach is the ability to combine elements in one view which have different origins(e.G. contributed by different plugins). CNF is used in Eclipse IDE: e.G. “ProjectExplorer” and “CVS Synchrnoize” are both instances of the CNF.
The usage of the CNF in your own application for purposes of representation of resource-based (and usually file-based) content is discussed in
articles of Micael Elder in detail. The main idea is to instantiate the view, declare the default content and UI interface and make some additions where needed. This post has a different aim: we start from scratch and represent completely resource unrelated content. Before diving in the implementation details, some overview is provided.
UI Overview
There are many things which can be configured by the usage of CNF and it is beyond the scope of this post to cover all of them. Still there are several things to understand before the actual code can be written. The user interacts with a View which shows the data elements. Which elements are shown is configured using the navigation content extensions. Shown elements can be filtered with Filters and sorted using Sorters on behalf of the user. There are some predefined actions and their positions in the UI and corresponding extension points to contribute to.
. The actions for Working sets, Customize View, Link with editor belong to this category. The user can also right-click on particular element in the tree and sees a popup-menu. This menu is configured based on the content element and can be (is) contributed by several plugins. The action contribution is also covered in the article series from
Michael Elder.
(more…)
Posted in eclipse, java, rcp | 13 Comments »
April 27th, 2009 by Simon Zambrovski
The Galileo Edition of Eclipse is already in the pipeline and the community is happy to celebrate this with a series of events. In Hamburg we do it in two ways – there are Eclipse DemoCamps and Eclipse Stammtisch. This time
Peter and
Martin managed to put both events together. To make it short:
If you want to attend, make sure you find a minute to
write you name down in EclipseWiki. I suppose these kind of events is well-known. If you never heard of that – I can only recomend to take part. You will have the opportunity to listen to the talks, to speak with interesting people and get some news from Eclipse Commiters and Users. In the end you usually get some food and bevereges, to make the atmosphere a little more relaxed. The location is a very descend place with wonderfull flair. If you never be there it is worth to visit…
Posted in announce | 4 Comments »
April 24th, 2009 by Simon Zambrovski
Eclipse Platform provides a help system that can be used during creation of the help content for your application. It is very convenient while used inside of the IDE, but needs a special approach if used in the RCP. This article tries to gather the information which may be useful.
Adding Help Support
Basic preparations
As discussed in Eclipse RCP Book and RCP Articles, the help system is not a part of the RCP-Runtime and should be added separately. The question arises where to add at to? If you follow the best practices for packaging of RCP applications, you should have at least one product and the top level feature defined (See Rule 1 of Chapter 23 of Eclipse Rich Client Platform). The top level feature includes the branding plug-in (containing the product definition) and refer to other features (like org.eclipse.rcp, and your functional features). In order to add the help system, you need to add the org.eclipse.help feature in this list.
Platform help buttons
There are several predefined buttons (actions) you can use for calling the help system. These are:
- Help Contents
- Help Search
- Dynamic Help
In order to activate them from your ApplicationActionBarAdvisor just call:
private IWorkbenchAction helpContentsAction;
private IWorkbenchAction helpSearchAction;
private IWorkbenchAction dynamicHelpAction;
protected void makeActions(IWorkbenchWindow window)
{
helpContentsAction = ActionFactory.HELP_CONTENTS.create(window);
dynamicHelpAction = ActionFactory.DYNAMIC_HELP.create(window);
helpSearchAction = ActionFactory.HELP_SEARCH.create(window);
register(helpContentsAction);
register(helpSearchAction);
register(dynamicHelpAction);
}
If you want to do the same declarative, you have to create commands that use the following actionDefinitionIds:
- org.eclipse.ui.help.helpContents
- org.eclipse.ui.help.helpSearch
- org.eclipse.ui.help.dynamicHelp
The same ids are required for registration of key bindings (e.G. Ctrl + F1, Shift + F1, F1 on Win32). Apparently, since these actions adjust their status depending on the state of the system and the plug-ins installed, I could not figure out how to force them to be enabled, when installed in a declarative way. Since they are still provided as ActionFactory (which is legacy due to the changes introduced by new Command Framework), they should be further activated from the ApplicationActionBarAdvisor.
Context-Sensitive Help UI Integration
The Eclipse platform provides not only the help system, but also support the so-called Context-Sensitive Help (a very confusing name, because the context is only the widget, and not the data). In the following, it is shown, how the connection between the widgets and the help system can be established.
The big picture
The content already defined in the help system can be pointed at from various places in the your application using the so-called help contexts, which on one hand point to the places in the documentation and on the other hand can be assigned to widgets in the application UI.
Establishing contexts
In order to assign the help context to a widget the invocation of the method PlatformUI.getWorkbench().getHelpSystem().setHelp(Control control, String contextId); is used. The contextId is a full-qualified string constructed from the pluginId and the local context name. The context name should be unique for this plug-in (usage of non-unique ids leads to a merge of different subjects, which is a nice feature, but may be not desired). I prefer to create the convenience method for this invocation:
public class HelpUtil
{
public static void setHelp(Control control, String localContextId)
{
if (localContext == null || control == null) return;
PlatformUI.getWorkbench().getHelpSystem().setHelp(control,
Activator.PLUGIN_ID + "." + localContextId);
}
}
There are also methods for registration of other SWT widgets (Control, IAction, Menu, or MenuItem) in the help system, which can be handled by the overloaded version of the method. The invocation of the convenenience method usually looks like: HelpUtil.setHelp(composite, "newWizardPage") and should be invoked from the createControls() of the correponding element. Please note, that the “newWizardPage” is a local name, and the pluginId is added to it inside of the conveninece method. Widgets that do not get focus should not be assigned context ids, since they will never trigger a context-sensitive help
The declarative part
As usual in Eclipse, there is a declarative part, that connects the context ids, set up in the code with the help pages. The connection is established by a special XML file. In order for the platform to know, where to find the file, there is an extension point (org.eclipse.help.contexts), that you need to contribute to:
<extension point="org.eclipse.help.contexts">
<contexts file="contexts.xml" plugin="de.techjava.rcp.ui" />
</extension>
The file attribute specifies the full path to the XML file containing the context definition. The plugin attribute is optional and declares for which plugin the context definition applies. Please note, that if the plugin attribute is ommited, the context names used in the context definition file will be seen as local to the plugin they are declared in. For example, if you want to support the context-sensitive help in plug-in de.techjava.rcp.xyz then your in-code definition of the context should define full qualified context names like de.techjava.rcp.xyz.context1. Either you use the extension point (org.eclipse.help.contexts) in the plugin.xml of the de.techjava.rcp.xyz plugin.xml, or if you put the usage of the extension point into some other plugin (e.G. central for all help), you must provide the plugin attribute with value “de.techjava.rcp.xyz”. This issue is badly discussed in the help guide and is a little confusing. In the context definition file the contexts are defined as follows:
<contexts>
<context id="context1" title="My first context">
<description>This is a test context</description>
<topic href="path/context1.htm" label="Context1"/>
</context>
...
</contexts>
Wizards and Dialogs
Wizards are used with or without dialog.
The call of the Wizard#setHelpAvailable(true) shows the Help button.
The call of the WizardDialog.setHelpAvailable(true); shows the small sexy round Question button.
References
Posted in eclipse, enterprise systems, java, rcp | 6 Comments »
January 14th, 2009 by Simon Zambrovski

Eclipse RCP by default promotes the usage of a single application window with multiple views and editors inside. This default can be changed to multi-windowed application. The platform API offers several methods to operate with multiple application windows:
package org.eclipse.ui;
...
public interface IWorkbench ...
{
/**
* Retrieves the number of opened windows
*/
public int getWorkbenchWindowCount();
/**
* Retrieves the array of opened windows
*/
public IWorkbenchWindow[] getWorkbenchWindows();
/**
* Openes a new window with given perspective
*/
public IWorkbenchWindow openWorkbenchWindow(String perspectiveId,
IAdaptable input) throws WorkbenchException;
/**
* Performs a perspective switch in a given window
*/
public IWorkbenchPage showPerspective(String perspectiveId,
IWorkbenchWindow window, IAdaptable input)
throws WorkbenchException;
...
}
Using this API, opening of new windows seems simple. For example one could define a perspective, that is always opens in a new window.
Closing windows is generally performed by calling close method on the IWorkbenchWindow instance.
package org.eclipse.ui;
...
public interface IWorkbenchWindow ...
{
/**
* Closes the window
*/
public boolean close();
}
Unfortunaly, there is no elegant way to find out which window are you in. A workaround which uses Eclipse internal API works fine for WorkbenchWindow, which is a standard platform implementation of the IWorkbenchWindow interface.
/**
* Determines if the window is a root window
* @param window a window to be checked
* @return true, if the window is considered to be a root window
*/
public static int getWindowId(IWorkbenchWindow window)
{
// HACK: note this could change in future
if (window != null && window instanceof WorkbenchWindow))
{
return ((WorkbenchWindow)window).getNumber();
}
return -1;
}
The initial application window gets the id 1. The lookup in the implementation reveals that the internal method finds the smalles unused positive number and assigns it to the newly opened window. If you do not want to rely on this algorithm, just hash the newly created windows by they ids.
Posted in eclipse, java, technology | No Comments »
September 17th, 2008 by Simon Zambrovski


Yesterday,
the second
Adam Bien event in
Lehmanns Bookstore took place. Again, the event was a full success. I arrived half-an-hour earlier and got a seat only in the tenth row.
Adam spoke about new features of EJB 3.1 and Glassfish. He showed examples running on a developer build of Glassfish V3, promising that the features will work without exceptions…
Here are some topics, I remember:
- Singleton Beans: usefull a s a central point of the application, e.G. central cache etc…
- Async Methods: allows asynchronous execution of time-consuming methods. Especially, it is possible to abort the execution
- Deploying Beans in WARs: could be helpful for small applications
- Global JNDI-Namespace
- No interface view: simplifies the access to beans, if needed
- EJBCOntainer.getEJBContainer().getContext(): allows external initialization of bean context, which is nice for testing
Later,
Adam discussed some
Core J2EE patters, that become absolete with EJB 3.1 and others which are still valid.
After the talk, I spoke with Adam about the
OSGi as a module architecture inside JEE application, which seems interesting to me.
The pictures are as usual available in my
FlickR Gallery.
Marco published a
video on Loroma.
Posted in enterprise systems, java | No Comments »
September 10th, 2008 by Simon Zambrovski
The holiday season is over and we can enjoy an event every week. After
Maven 2,
Eclipse Stammtisch and
reasoning on modularity an event on enterprise systems can be visited. It seems that after the
last visit on Java EE 5 Hacking Adam want to tell something on Java EE 6 Hacking…
This session will be interactive / openspace like. He will walk through the new EJB 3.1 APIs and explain some interesting stuff as well. It is the logical conduction of the first
JUG HH session in May 2008.
Location:
Lehmanns Fachbuchhandlung (Hamburg Hauptbahnhof), Kurze Mühren 6, 20095 Hamburg
Date and Time: 16.09.2008, 20:00
Topic: Productive Java EE 6 – Rethinking Best Practices And Bashing On Patterns, Cluster One
Abstract: Java EE 6 is great, but many questions like:
- Are DAOs dead?
- Do JSF really suck?
- Are anemic JPA-entities a best practice?
- Are XML deployment descriptors legacy?
- Are EJBs lightweight?
- How to test EJBs?
- Is layering an antipattern?
- Do we need factories?
- How to integrate with RESTFul services?
- Is it possible to deploy EJBs into a …WAR?
- Are “plain old web containers” dead?
- Services or Objects – what is the way to go?
still remain open. These and many other questions will be discussed interactively with …code.
Speaker:
Adam Bien
About the speaker: Java Champion
Adam Bien is a self-employed consultant, lecturer, software architect, developer, and author in the enterprise Java sector in Germany who implements Java technology on a large scale. He is also the author of several books and articles on Java and J2EE technology, as well as distributed Java programming. His books include J2EE Patterns, J2EE HotSpots, Java EE 5 Architectures, Enterprise Architectures, Enterprise Java Frameworks, SOA Expert Knowledge, and Struts, all published in German.
As BEA technical director, Bien is also a member of the NetBeans Dream Team; an Expert Group member of the Java Community Process for EJB 3.1, JPA 2.0, and Java EE 6; and involved in embedded Java, Grid, and P2P technology. He currently works as an architect and developer in several J2EE-Java EE Model-Driven Architecture (MDA) and EAI component architecture projects for the Java EE platform and .NET.
Posted in announce, enterprise systems, java, mdsd, tools | 3 Comments »
September 10th, 2008 by Simon Zambrovski



Yesterday, the
OSGi session took place in
Hotel East in Hamburg.
Peter Kriens, the OSGi evangelist showed a wonderful
Zen Presentation on OSGi. I wrote a lot during his talk which happens to me very seldom. Here are the core statements I understood:
- The core difference between usual plugin architectures and OSGi is that OSGi concentrates on collaboration of the components.
- OSGi delivers a controlled environment, in which the question if a component runs or not can be answered in beforehand.
- OSGi bundles use metadata (about versions, dependencies, etc) to predict an error, not discover it in runtime.
- OSGi has a very narrow API containing the minimal common part.
- OSGi consists of module, life cycle and services layers. The initially developed services layer required smart class loading mechanisms (module layer).
- The module layer is desigend to control the class loading machanisms (e.G. structureal class loader hierarchies instead of a linear classpath)
- Life cycle layer adds a management API (e.G. inform the others about installation event)
- Separation of concerns is promoted by definition of services for different tasks.
- Services are used for decoupling of system parts (This is a standard application of service-orientation).
- OSGI makes dependencies explicit (private, import, export)
- OSGI tries to make the system managable, taking dynamics and lifecycle as fisrst-class citizens
- OSGI will be extended to support distribution: the team works on policies, SLAs, etc…
I liked the talk and the way how Peter Kriens addressed the problems of OO. I was confirmed in some ideas about coupling that will be layed out in my thesis. After the presentation we had a delicious meal and wraped up the evening with interesting discussion about pros and contras of OSGi.
Peter Friese showed me some
remote OSGi staff, he was playing with. The lack of documentation in this area makes it a little difficult, but I hope he will post some news on it. As usual, you can find other pictures in my
FlickR gallery.
Posted in java, technology | 3 Comments »
September 7th, 2008 by Simon Zambrovski
The
organizers of the
upcoming OSGI event selected a promiment Hamburg’s nightlife location. The location is a evidence of modern design. The entire hotel is equipped with non-standard items in various forms and colors and commemorates on Dali and Gaudi in the same time.
Topic: Why Modularity is Important
When: September 9th, 2008, 19:00 CET,
Registration required
Where:
East Hotel Hamburg,
Simon-von-Utrecht-Strasse 31, 20359 Hamburg / Germany
Abstract: Many developers are finding out that modularity has a significant influence on the development process. But unfortunately, Java has no concept of modularity, all JARs are placed on a linear classpath. Many projects have developed in-house plugin frameworks to achieve some modularity. The OSGi Service Platform is a standards based framework used by many projects. Some of the best known projects that use OSGi are Spring and Eclipse. There are many open source projects and commercial companies that have implemented the specifications: Apache Felix, Knopflerfish, Eclipse Foundation, ProSyst, IBM, Siemens, Hitachi, Samsung, etc. This presentation will analyze the problems with (the lack of) Java modularity and explain how OSGi provides many benefits for the development process as well as make the applications itself easier to maintain and extend.
Author: Peter Kriens
Posted in announce, eclipse | 2 Comments »