Archive for April, 2007

Spring IDE 2.0 brings improved Project Explorer Integration

With this blog entry I would like to introduce one of Spring IDE 2.0’s new features - the improved integration with Eclipse’s Project Explorer.

But before delving into the details let’s take a look on the Project Explorer:

Project Explorer with web projectThis view was introduced with Eclipse 3.2. It leverages the Common Navigator Framework to present a domain-oriented view of the projects in the workspace. General projects are shown in the same way as the Navigator view, but other projects are presented in a hierarchy that makes sense for their particular domain. For example, Java projects appear as a hierarchy of source folders and packages rather than folders.

Project Explorer with web project Starting with version 1.3.3 Spring IDE contributed Spring-related content and corresponding filters to the Project Explorer.

With the upcoming version 2.0 of Spring IDE these contributions to the Project Explorer were further improved:

Continue reading ‘Spring IDE 2.0 brings improved Project Explorer Integration’

Most Useless Custom Namespace Ever

I was in London the other day to meet with Dave from Interface21 and two colleagues of mine (cheers to Scott and Lucas). One topic of the meeting was related to domain modeling. During the discussion we tried hard to come up with a decent name for a component in our domain model, but couldn’t figure out a descriptive name that would serve our needs well enough.

We were playing around with different names and - you know how that happens during meetings that take the whole day and you start loosing track for a couple of seconds - we started to look for names in other languages than English.

That moment I thought about a custom namespace that is properly the most useless one can think of: A translation of the Spring beans XSD into other languages. This idea sounds like non-sense in the first place, but on my way back at the Heathrow airport I couldn’t resist to think about it in more detail. Finally I ended up scratching a rapid prototype that allows to write bean definitions in my mother language:

<?xml version="1.0" encoding="UTF-8"?>
<bohnen xmlns="http://www.sfw.org/schema/beans-german"
    xsi:schemaLocation="http://www.sfw.org/schema/beans-german
    http://www.sfw.org/schema/beans/spring-beans-german-2.0.xsd"
>

    <bohne id="pet1" klasse="org.springframework.beans.Pet">
        <eigenschaft name="name" wert="kitty1" />
    </bohne>

    <bohne id="pet2" klasse="org.springframework.beans.Pet">
       <konstruktor-arg wert="kitty2" />
       <eigenschaft name="spouse" ref="pet1" />
    </bohne>

</bohnen>

Still, I don’t really see how a translation of the Spring beans XML configuration dialect into other languages can be useful for anyone, but there is already a request for translating Spring’s Exception message to other languages somewhere on the forums.

So what is the story of the post then?

There is one aspect of the preceding example, which I overlooked at the beginning, that could actually become quite useful. As you can see in the example there is not a single XML element from the original Spring dialect used to wire up two Beans. Certainly the syntax looks quite the same as plain Spring, but that is only an example. Even the root beans element is not used.

I wasn’t aware of the fact that with using Spring 2.0 namespaces you can introduce your own DSL to configure components without being tied to Spring’s XML syntax in any way. I haven’t seen a namespace example before that doesn’t use the beans element at least at the root level.

Consequently Spring allows mixing configuration files with different syntax in one ApplicationContext. So you can use a configuration file for your domain services or repositories that uses a Domain Specific Namespace and others for your technical infrastructure services, like transaction or security, that leverage the power of Spring’s XML syntax.

That could be very handy if you are working on a project that applies pattern following DDD. Furthermore that shows how flexible the Spring container is in terms of XML configuration since the introduction of custom namespaces with version 2.0.

The prototype source code of the German namespace handler is available here.

Web Flow 1.0.2 released

Spring Web Flow 1.0.2 has just been released. This version features full Spring IDE integration, not only in the samples but also in the NamespaceHandler implementation.

Beginning with Spring Web Flow 1.0.2, each of the sample applications has been Spring IDE 2.0 enabled, allowing you to easily assess these tools as they progress. To evaluate Spring IDE 2.0 simply import the sample projects into Eclipse and install the latest version of the Spring IDE 2.0 plugin from the nightly update site. #

Adding Support for Custom Namespaces

Since version 2.0 Spring supports an XSD-based configuration approach that allows integrating your own DSL for configuration into Spring. How to implement such namespace extension has been documented and the approach has been adopted by several Spring sub-projects and others, e.g. Spring Web Flow and DWR.

In response to an issue in our ticketing system and some comments I got recently, I’m going to introduce Spring IDE’s extension points for plugging in support for your own configuration namespace. These extension points allow you – as a custom namespace developer – to add support for navigation, content assist and validation to Spring IDE.

Continue reading ‘Adding Support for Custom Namespaces’

Adding Code Snippets in XML Editor

From my observation there are a couple features in Spring IDE that are being used very rarely, although I personally think that every one of them can become quite handy. I think that is because we haven’t promoted them and therefore most people don’t even know that they exist. This post is to introduce one very hidden feature.

springide_xml_templates_editor_thumb2.png Spring IDE installs a custom template category to the Spring Beans XML Editor. Out of the box Spring IDE adds a couple of common code snippet templates for inserting <bean />, <property /> and <constructor-args /> elements into Bean definition files. This snippets are available from the content assist proposals in the Beans XML Editor.

If you look around in Eclipse’ Preferences (Web and XML -> XML Files) you can find the Spring Beans XML Templates preference page. On that page you can modify and delete existing XML templates as well as create your own.

As you can see on the following screen shot, Spring IDE’s Web Flow support already installs templates for inserting <flow:executor /> and <flow:registry /> elements.

Anybody out there using this? Do you want us to include some more pre-definied templates? Which?

springide_xml_templates_editor2.png