Online Books:
java.net on MarkMail:
Search |
||
NetBeans RCP - beyond suite chainingPosted by fabriziogiudici on November 3, 2007 at 4:30 PM PDT
A few months ago I blogged about how to optimize a large NetBeans RCP project by splitting it in parts and taking advantage of a technique known as "suite chaining". Now I'm going forward as I have some more complex requirements to meet and suite chaining doesn't fit with them.
If you are not comfortable with the layout of NetBeans RCP projects and the related jargon I suggest you to read first my previous blog (at least the introductory part to understand the basic concepts such as "platform", "suite", "cluster", "NBM file"). And now let's recall what I wrote in the previous post. At that time, I basically split blueMarine in three parts (and defined some APIs so people could develop plugins to extend the application):
![]() As you can see a simple, linear chain of dependences emerges from the design and fits well with the "platform chain" concept of NetBeans RCP: basically each project builds upon the previous stage of the chain and delivers a new platform enhanced with new features. ![]() With the latest refactoring, two new components appeared:
![]() The basic concept is that OpenBlueSky must be reusable by other programmers outside the blueMarine ecosystem, as well as ForceTen that also originates a standalone application (and thus uses OpenBlueSky too). These new requirements lead to a more complex set of dependencies, where linear suite chaining can't be used any longer. Also consider that the previous diagram has been simplified: we should take into account that, for instance, there are multiple dependencies on JOGL (they are best shown in the next diagram).This lead me to have a sort of Copernican shift. In the previous approach, the final deliverable of any component was a public platform, exposed to further projects in the chain. Now I focus on delivering a set of NBM files (the pink component in each package in the diagram below), much like a standard Java application produces some JAR files, and each project defines its own "private" platform (named "***-base") which is "artificially" created by taking the required NBM files from multiple sources and unpacking them. Each set of NBM files creates a different cluster in the platform. Platforms are now "private" since they are only used by the project they belong to and not exposed to others. ![]() You see that there's an exception, since blueMarine Core and blueMarine are platforms, yet still publicly exposed. This is because they can be used by other people (for instance during the development of a Plugin) and the process of initially creating a platform requires some manual steps, which I want to avoid at the moment. But I think I'll work on it, so at a certain point I'll be able to deliver only a set of NBM files also in these cases (see the final remarks at the end of this post). Automating the process Now, a practical problem is to keep everything up-to-date. For instance, let's suppose I make some changes in OpenBlueSky. This means that one or more NBMs are updated and, following the dependency chain, you see that the "blueMarine Core base", "ForceTen base" and "blueMarine base" platforms need to be updated (as well as some further dependencies). We have some things to do:
"copyUpdatedStuff" (I might change its name as soon as I find something more appropriate). This task takes three arguments:
<property name="source.nbm.path" value="${openbluesky.dir}/build/updates:Basically we're looking at the build/updates directory of each ancestor project, where NetBeans placed the NBM files after compiling the sources. Then we define the target directories: <property name="nbm.dir" value="lib/nbm" />and specifically a set of cluster names to match the ancestor projects: <property name="platform.path" value="${platform.dir}/openbluesky:And now what we need is just to run ant prepare-platform whenever we want to bring into blueMarine the last updates from the ancestor projects:<target name="prepare-platform">The set of files produced by this task is the following: ./nbmIndeed blueMarine also depends on some modules from the NetBeans platform: ./lib/platform/ide8/config/Modulesbut at the moment I don't know how to automatically put them in the target directory - so I had to manually copy them the first time. The task also prints on the console some relevant information about what's happening: prepare-platform: What's next The relationship among my projects have turned out to be a bit cumbersome, but after all they reflect the dependencies in the new design. And the stuff seems to work. I also like the fact of focusing of the NBM files as a final deliverable for a component since it matches the same approach we have with JAR files. But one of the problems is a sort of redundancy (because of how NetBeans works): we need to keep both the NBM files and the platform folders, even though they share the same contents. Even worse, they both get checked in, thus wasting some space in Subversion. I thought a bit of it, and tried to use copyUpdatedStuff to add a target to build.xml that would recreate the platform starting from the NBM files in case it doesn't exist. In this way one could avoid putting the platform in the repository and the first time a project is checked out, the platform would be generated on the fly. Unfortunately, at the moment this is impossible: in fact, before being able to run ant on a NetBeans RCP project you must first set the referenced platform (by means of the Platform Manager tool of the IDE), but we're supposing it is not present at the very beginning, since ant should create it! I'll investigate how work around this.If you want to try it, copyUpdatedStuff sources can be checked out from https://bluemarine.dev.java.net/svn/bluemarine/trunk/src/UpdateManager. Beware, it's still alpha and has got some bugs.PS I'll blog about OpenBlueSky and ForceTen as soon as I have some basic documentation for them. But the good news is that you can check them out from https://openbluesky.dev.java.net and https://forceten.dev.java.net and try them since now all the dependencies on blueMarine has been removed. Technorati Tags: NetBeans, NetBeans RCP, suite chaining, blueMarine, ForceTen, OpenBlueSky »
Related Topics >>
Netbeans Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|