Skip navigation
2010

In my last article, I talked about how to extend the Annotation Properties view provided as part of WTP in Eclipse Helios. And that gets into the implementation details of adding your own annotations.

 

Here, I'd like to focus on how you'd use the view in conjunction with ESB support in JBoss Tools to actually create a new ESB action using the annotations added as part of ESB 4.9. Now instead of extending the AbstractActionPipelinedProcessor class you can create your own POJO and annotate to indicate various configuration options, as documented here.

 

Let's say you want to create a simple PrintMessageAction, similar to the example that extends AbstractActionPipelinedProcessor, but want to see the differences between the two implementations. (You can find the original example implementation in the ESB Programmer's Guide here.)

 

The original example code looks like this (Listing 1):

 

public class PrintMessage extends AbstractActionPipelineProcessor {

  private String information;
  private Integer repeatCount;

  public PrintMessage(ConfigTree config) {
    information = config.getAttribute("information");
    repeatCount = new Integer(config.getAttribute("repeatCount"));
  }

  public Message process(Message message) throws ActionProcessingException {
    for (int i=0; i < repeatCount; i++) {
      System.out.println(information);
    }
  }
}

 

As you can see, if you already had a PrintMessage class, you'd have to revamp it a bit to get it to work. Let's say you have this class (Listing 2):

 

import org.jboss.soa.esb.message.Message;

public class PrintMessage {
  
  private String information;
  private Integer repeatCount;
  
  public void printMessage(Message message) {
    for (int i=0; i < repeatCount; i++) {
      System.out.println(information);
    }
  }
}

 

If you use the new ESB annotations available in ESB 4.9, this becomes much more straightforward (Listing 3):

 

import org.jboss.soa.esb.message.Message;

public class PrintMessage {
  
  @ConfigProperty // this will come from the ESB configuration
  private String information;
  @ConfigProperty // this also will come from the ESB configuration
  private Integer repeatCount;
  
  @Process // and this is the actual action that will get invoked
  public void printMessage(Message message) {
    for (int i=0; i < repeatCount; i++) {
      System.out.println(information);
    }
  }
}

 

By now you're wondering - so how does the tooling come into this? Well, with the new Annotation Properties view and the ESB annotations we hooked up in the upcoming JBoss Tools 3.2 Beta1 release, you can let the tooling add the annotations for you.

 

In JBoss Tools, let's say that you have your original PrintMessage class (Listing 2) open in your ESB project and you want to turn it into an ESB action you can configure for the project.

 

To open and use the Annotation Properties view

  1. Go to Window->Show View->Other
  2. Type "Annotation" in the search box
  3. Select JAX-WS->Annotation Properties
    annotation_show_view.jpg
  4. Click OK.

 

By default, all available annotations are enabled in the view. This will most likely cause you to see a message such as "No suitable library can be found on the projects classpath." To get around this since we're just interested in ESB annotations at this point, we simply filter out the other types.

 

To change the filtered annotation types:

  1. In the View Menu for the Annotation Properties view, select "Filters..."
  2. When the Selection Needed dialog appears, make sure that all other annotation types are checked except for JBoss ESBannotation_props_view_filters.jpg
  3. Click OK

 

Now, with your PrintMessage class open and the Annotation Properties view open and filtered for ESB annotations, select the "information" class variable. In the Annotations list, you should see org.jboss.soa.esb.configure.ConfigProperty appear, as in the following image:

InformationVariableAnnotation.jpg

If you click the "Values" checkbox beside the ConfigProperty annotation, you'll see @ConfigProperty() appear above the variable. Do it again for the repeatCount variable as well.

repeatCountVariableAnnotation.jpg

The last step is to click on the method line for printMessage(Message message) and check the @Process annotation box.

printMessageAnnotation.jpg

And that's it for this example. You'll notice if you look closely at the @ConfigProperty annotation in the Annotation Properties view that you can expand it and set different properties on the annotation as well. So there is room for further configuration there.

 

Once you configure your action in an ESB configuration file and deploy it, you can test it. In this case, I'm using a simple JMS queue to send a message to the service to trigger it. The action gets the configuration from the properties we set in the jboss-esb.xml file, and we can see the output in the console:

esb_config_and_run.jpg

So starting with the JBoss Tools 3.2 Beta you'll have some new tools in the ESB toolbox for custom actions!

We added usage tracking into our JBoss Tools 3.2 M2 release and since then it have been pouring in with pings from all over the world and we love every second of it. Nothing like it, seeing your hard work being used across the planet. Today we've passed 1.000 different cities and the number is ever increasing.

 

ga_worldmap.png

The above screenshot is a snapshot of the current cities we have received pings from over the last week. Darker color and size of the circle indicates the % of visits. For now Brazil and especially the Sao Paolo region has the biggest crowd.

 

Yesterday we had 2.500+ instances of JBoss Tools starting up within 24 hours and our total of unique Eclipse installs using M2 passed 18.000 this morning.

 

Very happy to see that much pickup of our M2 release within just a week, I'm very postively surprised so many approved and enabled the tracking and growing every day.

 

Many thanks for those who did and those who will in the future - it's much more fun than watching simple download counts and give some nice fun content for a Friday blog

Free download of JBoss Developer Studio 4 Early Access is now available from
jbds_banner_earlyaccess.png
http://devstudio.jboss.com/earlyaccess/

 

 

I'm happy to inform you that Red Hat are providing free early access builds of JBoss Developer Studio 4 on the early access site.

 

JBoss Developer Studio is the supported IDE for doing JBoss Middleware development. It is based on Eclipse and the supported parts of the JBoss Tools project. The IDE comes with everything preconfigured and works out-of-the-box; making it easy to get started doing real work.

 

The current build is JBoss Developer Studio 4 M2 is based on Eclipse 3.6 (Helios), parts of the recent JBoss Tools 3.2.0.M2 release and with various updates to the 3rd party bundled plugins.

 

The early access site also provides access to JBoss Developer Studio 4 M2 bundled with JBoss Enterprise Application Platform (EAP) 5.1. To access these installers, you must be an existing Red Hat customer and/or participating in the early access program. Read more about the Early Access program here.

 

The site will be updated with future betas and more detailed info about changes/improvements in the near future.

 

Have fun!

While looking into some options on how to make the use of annotations simpler for users, I ran across the Annotation Properties view, which is in Helios in the JAX-WS->Annotation Properties view category when you're trying to open a view (Window->Show View->Other).

 

If you haven't seen this view before (and I know I hadn't), it offers a way to register annotation classes in a common place to allow you to add/remove/edit annotations in a class. By default in the Helios JEE package, it comes with JAXB and JAX-WS annotations already set up. It's a little clunky in spots, but I think it offers some interesting options as far as functionality goes.

 

For example, to create a new JAX-WS annotated class, you can start with your favorite POJO and annotate it pretty quickly:

Annotation_Properties_View_For_Blog.jpg

The view also offers the ability to filter the available annotations so you're not simply overwhelmed. To get to the Filters dialog, use the View menu and select Filters...

annotation_properties_view_filters_dialog.jpg

This is a little clunky as far as an interface goes. You can only open one instance of the view at a time and can't easily switch between annotation types. But it's a start anyway.

 

So with this in mind, I asked in the WTP newsgroup about how to go about extending it. Shane Clarke was nice enough to provide some tips...

 

The two extension points associated with the Annotation Properties view are located in the org.eclipse.jst.ws.annotations.core plug-in. The main two are the the org.eclipse.jst.ws.annotations.core.annotationCategory and org.eclipse.jst.ws.annotations.core.annotationDefinition extension points. Basically you just define a category (which shows up in the Filters dialog) and then define one or more associated annotation classes.

 

The only trick is making sure that the annotations are on the plug-in classpath and then adding the line "Eclipse-RegisterBuddy: org.eclipse.jst.ws.annotations.core" to your MANIFEST.MF.

 

So as an example, we'll just create a new category:

 

   <extension
         point="org.eclipse.jst.ws.annotations.core.annotationCategory">
      <category
            id="org.my.annotation.category"
            name="My Category Name">
      </category>
   </extension>

 

And then we'll define a new annotation for it:

 

   <extension
         point="org.eclipse.jst.ws.annotations.core.annotationDefinition">
      <annotation
            category="org.my.annotation.category"
            class="some.annotation.class.MyAnnotation"
            name="MyAnnotation">
      </annotation>
   </extension>

 

For examples of how they implemented the JAX-WS and JAXB annotations, check out org.eclipse.jst.ws.jaxws.core and org.eclipse.jst.ws.jaxb.core.

 

Pretty easy. I was able to define annotations for some new functionality in our JBoss ESB product that allows you to annotate a class instead of extending a particular interface or extending an existing class.

 

annotation_properties_view_esb_blog.jpg

 

I obviously think that the Annotation Properties view could be used for more than just Web Service class annotations.

 

But it needs a bit of work... For example, it would be nice if you could create a saved setting like a working set and made more visible - perhaps in the toolbar area at the top of the view. And it would be great if you could create multiple instances and associate a particular view instance with an editor, similar to how the Project Explorer can be linked to the editors and show which file is being worked on.

 

And I'm not quite sure how to use all of the functionality - like those other two extension points - or some of the settings on the annotationDefinition extension.

 

That said, I think it's a great start and it would be awesome to have a consistent way to annotate Java classes. I'm not sure that this is really a WTP-specific view and think it would make more sense in the more general Java tools category, but that's just me.

 

Big thanks to Shane for the pointers and I'm looking forward to seeing how this functionality improves in future releases!

 

--Fitz

Time for Milestone 2 of JBoss Tools, the Eclipse plugin suite for JBoss and related technologies.

 

http://in.relation.to/service/File/10824

3.2.0.M2

[Download] [Update Site]  [What's New] [Movies] [Documentation (not updated yet)]  [Forums]  [JIRA] [Twitter]

 

New Features Overview

We have a lot of different fixes and improvements in this release and I only touch upon a little in the following; you can see the full change log and What's New and Noteworthy for screenshots.

 

Usage Tracking

By default we now bundle a Usage Plugin that gathers anonymous usage statistics. You will see a dialog box when you start your Eclipse instance which will ask if you wish to send statistics or not; it is voluntary to participate but we hope you will since it makes us happy to know how and where JBoss Tools are used worldwide.

 

You can see details on how this work here.

 

Remote Deployment

JBoss AS Servers now has direct support for doing remote deployment via Eclipse Remote System Explorer (RSE), making any host with a RSE filesystem (SCP, FTP, etc.) a possible target for deploying resources. This can be used to deploy to remote system on the local network or on systems available in the cloud to which you have SCP or FTP access.

 

Runtime Detection

You no longer have to manually configure individual runtimes within JBoss Tools. We have moved our runtime detection from JBoss Developer Studio into JBoss Tools it self, allowing you to point to a JBoss AS, EAP, SOA-P or EPP installation and have all the supported runtimes (Seam, Drools, etc.) configured inside Eclipse automatically.

Delta Cloud

We are including the first public version of our tooling for Delta Cloud. The Delta Cloud tooling allows you to browse a Delta Cloud installation, manage images, start/stop instances and make them easily available in Eclipse Remote System Explorer which you then can use as targets for the JBoss AS Remote deployment.

 

Teiid

The Teiid Designer is now bundled in JBoss Tools  allowing you to utilize Teiid's features for federating data and query  its virtualized data models. Going forward there will be even more  integration between Teiid and the rest of the plugin suite, i.e. easy  usage of Teiid datasources when using Hibernate Tools and Seam Entities  generation.

 

DocBook Editor

There is now a designated editor supporting DocBook documents. Should remove some of the problems users were reporting trying to use the HTML Visual Page Editor for editing DocBook.

 

Context Dependency Injection

The CDI/Seam team have been providing a lot of feedback to the CDI tooling and this release therefore have a lot of improvements in context of validation messages, Open On's and wizards for CDI.

 

The Maven integration now also automatically configures CDI and Hibernate if your pom.xml files references CDI or Hibernate artifacts.

Google Web Tool Kit (Experimental)

We have added a GWT Facet to this release allowing you to use Google's (free, but not open) GWT Eclipse tooling in Eclipse WTP projects without manually configuration. This allows you to easily enable GWT for Dynamic Web Projects and deploy it to any WTP enabled server such as JBoss, Tomcat, Glassfish etc.

 

It is marked Experimental since we hope to convince Google to adopting this into their tooling instead of only having their Google AppEngine limited wizards (cross your fingers ). If you want to try it see this wiki.

 

..and More - Now Go get it!

As always feedback is welcome and we look forward to hear your input and other contributions.

 

Have Fun!

Filter Blog

By date:
By tag: