Tuesday, July 08, 2008

Experimental Snmp trapd as event source for RHQ (+ comments about Event polling)

I have just committed an experimental SNMP trapd plugin for RHQ. Currently it is only able to listen for V1 traps at a fixed address, but I am sure this will change :)
Incoming traps will be forwarded as Events into the events subsystem, so you can view them in the GUI and even define alarms on them (that trigger SNMP traps :-)

The plugin has its own page within the RHQ plugin community pages. This page also shows the location in SVN. The plugin is marked as experimental, meaning that it is not linked in the parent pom. To build it, you need to go into the plugin base directory and build from there.

Events processing



This plugin is also an example for processing of Events. In addition to the three components that you already know from my plugin development series, you need an EventPoller - that is a class with a method that gets called at regular intervals and which pulls the event data in. Lets have a look at the Component class, the plugin descriptor and the Poller. As the discovery component more or less follows what you have seen in part 3 of the series, I am not going to show this again.

Plugin Descriptor



The plugin descriptor is mostly as we know it. There is now one new element:


<event name="SnmpTrap" description="One single incoming trap"/>


The important part here is the name attribute, as we will need its content later again. The name is the key into the EventDefinition object.

Plugin Component



In the plugin component, we are using start() and stop() to start and stop polling for events:


public void start(ResourceContext context) throws
InvalidPluginConfigurationException, Exception {
 
eventContext = context.getEventContext();
snmpTrapEventPoller = new SnmpTrapEventPoller();
eventContext.registerEventPoller(snmpTrapEventPoller, 60);


So first we are getting an EventContext from the passed ResourceContext, Instantiate an EventPoller and register this Poller with the EventContext (60 is the number of seconds between polls).
The plugin container will start its timer when this registration is done.

In stop() we just unregister the poller again:

eventContext.unregisterEventPoller(TRAP_TYPE);

TRAP_TYPE is the ResourceType name as String - we will see this again in a second.

The remainder of this class is nothing special and if you have read the plugin development series, it should actually be no news at all.

Event Poller



This class is the only real new piece in the game.


public class SnmpTrapEventPoller implements EventPoller {


Implementing EventPoller means to implement two methods:


public String getEventType() {
return SnmpTrapdComponent.TRAP_TYPE;
}


Here we return the content of the name attribute from the <event> tag of the plugin descriptor. The plugin will not start if they don't match.

The other method to implement is poll():


public Set<Event> poll() {
Set<Event> eventSet = new HashSet<Event>();
...
return eventSet;
}


To create one Event object you just instantiate it. The needed type can just be obtained by a call to getEventType().


That's all




Well, that's all. Source is in the RHQ subversion repository - go and check out the sources yourself.

Feedback is always appreciated.




Technorati Tags:
, ,

Friday, July 04, 2008

RHQ 1.0.1 binaries are available from SourceForge

We were finally able to provide binaries of RHQ 1.0.1 next to the source which has been available since February.

You can find the download instructions in the RHQ wiki

Remember: you can reach us in #rhq on irc.freenode.net or via the forums.

JavaForumStuttgart 2008 (subjective review)

Yesterday I was at 11th Java Forum Stuttgart (JFS), a regional Java conference with 1100 attendees(!). The JFS featured 42 sessions in 6 parallel tracks in one day. This conference is very popular and attendees came from all over Germany. As last year, the conference took place in the Liederhalle, which offers much more space than the place the JFS has been in the years before.

I also had a talk about "Profiler, the better debugger?". The talk went well - I had around 250-300 attendees, that stayed in the room :-) I was going through some slides and then showing live examples about how to dig into unknown software with the help of the profiler.

Of course I took RHQ as example, even if it was not that unknown for me :-) After the session I got some feedback that people liked the talk and one ex-colleague told me that he is currently having the problem to dig into more or less unknown software, so that this exactly fits his needs.


There have been two talks about JBoss products / projects:

  • Advanced JBoss Cache (Carsten Mjartan): I was briefly in this session to take some pictures, but left early again, as I already know a lot about JBoss Cache, so this was no big news for me.


  • Geschäftsprozese und -regeln mit jBPM und Drools - ein unschlagbares Team (Bernd Rücker): I also know a little about this, but as I was the moderator, I had to stay :-) Seriously: Bernd gave a good talk in front of ~300 attendees about what is BPM and BRM and how you can combine jBPM and Drools.



One of the highlights shurely was the talk by Erich Gamma (about Jazz)- my talk was unfortunately at the same time, so I was not able to attend it :-(

Red Hat also had a booth at JFS:



Later in the evening there have been some BOF sessions - I have a BOF about RHQ - basically the same thing as in the SIG-JBoss meeting a week ago.

You will find the slides of my talk at the JFS pages. The slides of the BOF can be found

After the talks, there was food and free beer sponsored by IBM - and Gee Hye Lee was nicely playing piano for us.



The JFS featured good content and good food as usual, so mark the date in your calendar for next years conference:-)


Monday, June 30, 2008

RHQ 1.0.1 and JBossON 2.0.1 available



We just released RHQ Version 1.0.1 and JBossOn 2.0.1 in the wild.

Both are bugfix releases and don't add much of new functionality (read: "as in new subsystems") - if you want you can have a look at the closed JIRAs. You will also find a few new features in there :)

You can find the RHQ 1.0.1.GA tag in RHQ svn.

JBoss customers can of course download JBossON 2.0.1 from the customer support portal as usual.

As usual, it is cool to get a release out of the door :-)






Friday, June 27, 2008

Yesterday SIG-JBoss-Meeting about RHQ

Ok, I have to admit, that yesterday wasn't the best day to run a SIG-JBoss meeting
of the Stuttgart Java User Group, as the second semi final of the European Soccer Championship was also yesterday. But then we have seen all three goals on the big screen in a nearby Italian restaurant after the meeting anyway.

In the meeting I went a bit through what RHQ is, how it relates to JBossON, showed the components and then just did a live demo of the whole system.

After that we went through what it takes to develop plugins and showed some code (Yeah man, show me the code :-)

Conclusion was that RHQ, even if still lacking things is already very powerful and that the agent and server infrastructure does a lot for you for free.

My slides can be downloaded here (PDF, German).

If you are interested in RHQ, you can also pass by at the Red Hat booth at Java Forum Stuttgart, where I may be able to demonstrate that (or one of my colleagues).

Wednesday, June 25, 2008

RHQ - tip of the day: Which groups are containing a resource

RHQ has a powerful grouping feature: you can generate groups of resources (of compatible and mixed type).

When you go to the Browse Resources page, you can get a list of compatible and mixed groups and from the inventory of a group see all members of said group. Setting up a lot of groups is even easier with the cool DynaGroups feature.

But what if you want to know all groups that contain a certain resource? Of course, you can look into each group and check if it is there. But this can get boring with lots of groups.

There is an easier solution to that: go to the inventory page of the resource and scroll down. You will find a section "Groups Containing this Resource":



This section shows the names and types of groups where the resource is in, as well as member count and availability of the group.





Technorati Tags:
,


Tuesday, June 24, 2008

RHQ - tip of the day: postgres and login permission

When creating a database and database user for RHQ, Postgres knows two commands to create a user:

create user
and
create role

They both do the same thing and create a database user. The big difference (which may cause you some grey hair) is that create role does not automatically allow log in.

So to create a database user for RHQ, use the create user form. Example:

create user rhqadmin password 'rhqadmin'

If you have further login issues, see also my other posting about "local is not local"







Technorati Tags:


Monday, June 23, 2008

RHQ - tip of the day: is the resource down or the network?

RHQ and JBossON 2, that is built on top of RHQ are distributed systems. The agents managing resources can (and will) live on a different system than the server. So sometimes the question arises when a resource is marked as unavailable if the resource itself is down - or the connection between agent and server.

There is a heartbeat going on between the RHQ agents and the server: the agents are periodically reporting the availability of their managed resources to the server. Now if the server doesn't get those reports for some time, it will report the managed resource as being down. This might have three causes

  • The resource is really down
  • The agent is down
  • The network between agent and server is down
  • Combination of the above


So if a resource is down and you are not sure, go to its inventory tab and scroll to the bottom. There is a section "Agent Managing this Resource":



This shows the availability of the agent and when the last availability report for this resource was received.

If this one shows red, you really should have a look at the machine hosting the agent and the resource.







Technorati Tags:
,


Stuttgart-Lauf

Yesterday I was at the Stuttgart-Lauf again. The track was a little bit longer with 8.2 km than in previous years with 7.6 km.

My result:



Actually I am quite happy with that, as I did not exercise a lot before and the weather was again very hot (32 Degrees Celsius). In my category (age 30-39), there were 425 finishers. Total finisher according to the stats at Mika Timing were 3664 ppl.

The run was fun again, because of the people along the track and also the finish in the Gottlieb-Daimler-Stadion. I think this time was the last time that the finishing line is in the stadium, as there are plans to convert it into a soccer-only arena.

Friday, June 20, 2008

RHQ - tip of the day: Use the skeleton generator to generate plugin skeletons

I wrote in length about writing plugins for RHQ - of course there is still more to know about.

That is why we created the plugin community.

One cool new feature since writing the blog series is the new plugin skeleton generator, that Jason Dobies wrote. While the name of (the generator, not of Jay :-) is a little complicated ("RHQ Plugin Archetype") you don't need to be afraid :)
It is just a maven command that will create all you need.

To use the archetype you first need to download it as indicated on its wiki page.

Then you call it as follows (I am using multiple lines here, but on the shell you need to give that in one line).


$ cd $RHQ/modules/plugins
$ mvn archetype:create -DarchetypeGroupId=org.rhq \
-DarchetypeArtifactId=rhq-plugin-archetype \
-Drhq-plugin-name=test \
-DarchetypeVersion=1.0.0.GA \
-DartifactId=rhq-test-plugin \
-Dversion=1.0.1-SNAPSHOT \
-Dpackage=org.rhq.plugins.test \


This will emit a lot of stuff ending in:

[INFO] Archetype created in dir: /jon/jonHEAD/rhq/modules/plugins/rhq-test-plugin


Note that the version in the -Dversion attribute above must correspond to the version of RHQ that you are using to build the plugin. Otherwise compiling of the plugin will fail.
All options are described on the wiki page. Basically you need two things: artifactId, the name of your plugin, and package, the java package of it.

One caveat: currently (as of 6/20) it is only generating the base directory structure and plugin descriptor, but no Java files. But I am very sure, Jason will fix that soon. And hey, this is open source and the source code is available from svn.

Have fun -- and join us on irc://irc.freenode.net/ in channel #rhq.




Technorati Tags:
, ,


Thursday, June 19, 2008

Java is finally free and open

My colleague Rich Sharples just blogged about it. But as this is so important, it needs to be repeated :-)

So: IcedTea passed the Java TCK. You can get it today in Fedora 9.

See also:

http://digg.com/software/Java_finally_open_and_free

Lilian Angel on IcedTea

IcedTea at Wikipedia

RHQ - tip of the day: Try JBoss ON 2

You surely know by now: JBossON 2 is built on top of RHQ.

JBoss is now providing a free trial version of JBoss ON 2 at http://www.jboss.com/products/jbosson. Sign up at the link provided there and see JBoss ON 2 in action. This also includes plugins for monitoring JBossAS

Support for that trial is through the forums at http://www.jboss.com/index.html?module=bb&op=viewforum&f=285.





Technorati Tags:
,


Reminder: Stuttgart SIG-JBoss meeting about RHQ

This is a reminder about the upcoming Stuttgart SIG-JBoss meeting.



The Stuttgart SIG-JBoss will hold a meeting on June 26th in the premises of Red Hat Germany.

Topic for this meeting is a presentation of RHQ -- and if we have time about how to write plugins.
If you want, bring your laptops, so we can do some installations and fun stuff.

You can view the full (German) announcement at the Stuttgart Java User Group page

Please register as indicated in the announcement page -- registration is free!

Remember: parking space is limited in the vicinity of the office, but U1,U14 and bus 44 stop directly in front of the office.

Wednesday, June 18, 2008

Postgres: local is not local (or how to solve connection issues)

When setting up RHQ and doing some testing around an open bug report, I stumbled once more over the PostgreSQL access configuration. Usually I just configure it and it works, but this time it just did not do what I wanted it to do ... It is not that it is not documented, but as I have seen others fighting here too, I will comment a little.

PostgreSQL use two files that configure who can access the database. The first one, postgresql.conf defines the network interfaces, PostgreSQL is listening on:


#listen_addresses = 'localhost' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all


If this line is commented, as shown it will only listen on TCP sockets on localhost (127.0.0.1) for
IPv4 and IPv6(!) and additionally on a unix domain socket.
If you want to give access to people from another computer, you need to uncomment the listen_address entry and list the respective network interfaces to listen on. Then restart the PostgreSQL server.

The second file is pg_hba.conf. It contains the specific about which user may access which database with which way of connecting and authentication:

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
 
# "local" is for Unix domain socket connections only
#local all all trust
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
#host all all ::1/128 trust


When you connect to the database via psql, you are by default using a unix domain socket connection - so the line starting with "local" applies.
If you try to connect via a JDBC driver, as RHQ and JBossON do, the connection will be done via TCP, which means the lines starting with "host" are applicable.

So even if you are successfully able to connect to Postgres via psql, it does not mean, that you can do so via other means or from remote hosts.

So how can you verify the connection setup without first starting your java app? Well, psql allows you to supply a hostname -- if this is there, it will use a TCP connection. Note that if you specify
-h localhost, the connection could go over TCPv6. To force the use of TCPv4 use -h 127.0.0.1.

With the above pg_hba.conf this could look like this:

snert$ psql -h localhost -Urhqadmin -d rhq
psql: FATAL: no pg_hba.conf entry for host "::1", user "rhqadmin", database "rhq", SSL off

This is ok, as the line for ::1/128 was commented out

snert$ psql -h 127.0.0.1 -Urhqadmin -d rhq
Password for user rhq:
Welcome to psql 8.3.3, the PostgreSQL interactive terminal.
rqh=>

Now we succeeded.







Technorati Tags:


RHQ - tip of the day: manual resource discovery

RHQ and JBossON 2 have both the possibility to automatically discover managed resources (see e.g. this posting for some details).

This autodiscovery is running at regular intervals. But sometimes you want to directly add a new managed resource like a freshly installed JBossAS server to your inventory. There are basically two possibilities (besides just waiting for the next autodiscovery to happen):


  • Trigger a manual autodiscovery on the server

  • Give a prompt command on the agent



Lets have a short look at both...

Trigger a manual autodiscovery on the server



In the RHQ-GUI go to the Operations Tab of the platform (=The machine) on which you started the new JBossAS server and click on "Manual Autodiscovery":



On the next page, select "Yes" for detailed discovery and click on "Schedule" below. This will take a few seconds and the just submitted operation will be shown in the history view. When it has finished, go to the Dashboard.

Give a prompt command on the agent



If you have your agent running in foreground and still have the agent commandline available, you can just issue a discovery --full command.

sending> discovery --full
Full discovery run in 4659ms
sending>


When the sending> prompt is back, go to the Dashboard in the GUI.

And Import ..



After you have discovered your resources, you still need to import them into inventory. To do this, go to the Dashboard and the autodiscovery portlet, that will show the resources you just discovered. Click on "Import" as usual:


(Screenshot was taken in JBossON 2)


Technorati Tags:
,


Tuesday, June 17, 2008

RHQ - tip of the day: Metric display is steady

In RHQ and JBossON 2, that is built on top of RHQ,
you have the possibility to graph metrics for (more or less) arbitrary time ranges.

But sometimes the display is not moving and not showing any data that you'd expect to see.

If this is the case, have a look at the time range setting, which are below the graphs:



Here it is fixed to a 1 hour interval between 10:31am on jun 16th to 11:31am on the same day.
This means that RHQ will all over the place only show metric data for this 1 hour timerange.

To get things "dynamic" again, just select the "Last x hours" radio button and click on "redraw".





Technorati Tags:
,


Monday, June 16, 2008

RHQ - tip of the day: sync your clocks

RHQ and JBossON 2, that is built on top of RHQ are distributed systems. The agents can (and will) live on a different system than the server.

Metric data that is gathered on the agents will be sent to the server and stored in the database. Now if you want to e.g. compare metrics from two different sources (e.g. the load of two JBossAS servers in a cluster), you can only make sense out of it when the metrics have been taken at the same time (a few seconds usually don't hurt, but if it is more, you will see a peek on one server at one time and a peek on the other server at the other time. This will make you wonder why your load balancer was distributing the load in strange ways. In reality the peeks were at the same time and the system was working as it should.



In the above image you see on the left side two peaks that obviously are not occurring at the same time. On the right with synchronized clocks, you see that those peaks, even at different level, occurred simultaneously.


Another issue that we have seen in the past is that metrics were not showing at all on the GUI and users were thinking that something is broken or that the agent did not collect data (especially directly after install). The cause to that was that that the agent clock was so far in the past or in the future that its values just well outside of the displayed time range.



You won't see metric data of an agent after it started when its clock is 2h away from the master clock with this setting of a display range of 1 hour.




Technorati Tags:
,


Friday, June 06, 2008

Good SIG meeting about jBPM (updated)

[ update: it is not jBPM 3.3 as I have written previously, but rather 3.2.3.
Also I added a link to the slides and the specific pages on the camunda home page ]


Yesterday we held a SIG JBoss meeting within the Java User Group Stuttgart.
Bernd Rücker from camunda gave a presentation about Business process simulation with jBPM.



First he introduced into business process management itself and then into jBPM, which was good as most of the over 20 attendees did not yet know about it.



Afterwards he was talking about statistics and simulation basics, how he married DESMO-J with jBPM and showed a live demo.

And you know the best?
His work has been committed to the jBPM repository, so version 3.2.3 (if it gets ever released) will contain it.

I would also like to thank Red Hat Germany for providing the location for that meeting.

The slides are available at http://www.camunda.com/content/publikationen/ruecker-jbpm-simulation.pdf

Introduction into BPS with jBPM

jBPM home page

Friday, May 30, 2008

Writing a RHQ plugin Part 5

Welcome back

As promised in the last part, I will talk a little bit more about the Facets of a plugin. But before we come to this, I want to show you how to detect physical processes on a machine via process scans. And last but least, I'm gonna talk a little bit about the skeleton plugin -- basically a plugin template that you can use to write your own plugins.

Using Process scans for discovery



Often when you want to discover resources, they are not virtual like the remote http servers in our examples, but processes on the local machine. The RHQ agent offers through its SIGAR library to query the process table in order to detect those resources. As you may have guessed, this involves the plugin descriptor, so lets have a look at this first before going to the discovery component

Process-scans in the plugin descriptor



As you have seen in part 2, each of platform/server/service can have <proces-scan> elements. The element itself is empty, but has two required attributes: name and query. Name just names this specific scan method. Query is the intersting part. It is a string written in PIQL (Process Info Query Language), which is documented in the JavaDoc to its class. I don't want to go into detail here and just show two queries. Visit the page just mentioned to learn more.

Query 1: find a JBossAS



process|basename|match=^java.*,arg|org.jboss.Main|match=.*


We want to query for a process, whose name is starting with java and which has an argument of org.jboss.Main -- a JBoss Server. The matching entry from ps is:

hrupp 2035 0.0 -1.5 724712 30616 p7 S+ 9:49PM 0:01.61 java
-Dprogram.name=run.sh -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.platform.mbeanserver
-Djava.endorsed.dirs=/devel/jboss-4.0.5.GA/lib/endorsed
-classpath /devel/jboss-4.0.5.GA/bin/run.jar:/lib/tools.jar
org.jboss.Main -c minimal


Query 2: find a process by its pid



Here the program id is stored in a file in a well known place


process|pidfile|match=/etc/product/lock.pid


PIQL will take the pid from /etc/product/lock.pid and search for a process with that id


Discovery component revisited



Ok, now that we have seen what we can do with the <process-scan> in the plugin descriptor, lets see how we can process that info. And .. as you may have alreay expected this is again very simple:


List<ProcessScanResult> autoDiscoveryResults =
context.getAutoDiscoveredProcesses();
for (ProcessScanResult result : autoDiscoveryResults) {
ProcessInfo procInfo = result.getProcessInfo();
....
// as before
DiscoveredResourceDetails detail =
new DiscoveredResourceDetails(
resourceType, key, name, null,
description, childConfig, procInfo
);
result.add(detail);
}


So basically you jut need to obtain the list of resources discovered by process scan (autodiscovered as opposed to a manual add) and create the DiscoveredResourceDetails as before. You can use ProcessInfo to get more information about the process and to even decide not to include it in the list of autodiscovered resources (imagine, the PIQL query would have looked for processes where the name starts with post. This would apply to postgres and postmaster. Here you could still filter the ones you really want.


A few more Facets



We have seen the MeasurementFacet in the previous articles. In this section I will briefly mention the other kinds of facets, so that you can get an idea what plugins are capable to do.

ConfigurationFacet



This facet indicats that the plugin is able to read and write the configuration of a managed resource. It goes hand in hand with <resource-configuration> in the plugin descriptor.

OperationFacet



An operation allows you to invoke functionality on the managed resource. This could be a restart operation or whatever you want to invoke on a target. Operations are described in <operation> elements in the plugin descriptor. They can have argument and return values.

ContentFacet



This facet allows the uploading content like files or archives into the managed resource. That way it is possible to centrally manage software distribution into managed resources. There exists a <content> element as counterpart.

The skeleton plugin



The skeleton plugin is a stub to get you started writing a plugin. So instead of copying an existing project like we did in the first place, you can take the skeleton, rename a few things on it and start with writing the plugin. It comes with a plugin descriptor that is filled with comments and also skeletons for the class files.
It is not yet complete, but expect it to be downloadable within the next few days. And if you are all nice to my colleague Jason, he will write a little installer for it, so a few of he manual steps can just be skipped :)


Plugin community


The RHQ wiki now hosts a plugin community page that shows available plugins:
RHQ Plugin Community.
Check it out for any updates about plugin related information - including lists of new plugins.

The end


Ok, that's it. I hope you have enjoyed the posts in the series. I am looking to forward to see you using RHQ and writing great plugins for it.

Please provide feedback - here or at the RHQ forums.

And join us in #rhq on irc.freenode.net




Part 1
Part 2
Part 3
Part 4

Small steps and bicycling

While Marlene did her first steps already some weeks ago, she wasn't to enthusiastic about. But since last weekend she is really 'running' around, enjoying walking on two feet wherever she can. This is really great.

Orlando on the other hand is now since yesterday able to ride a bicycle freely without any help and without stabilizer wheels. He still needs to practice some more before we can leave him into the wild, but its a great achievement too.

Wednesday, May 28, 2008

Reminder: Stuttgart SIG-JBoss meeting about jBPM

This is a reminder about the upcoming Stuttgart SIG-JBoss meeting.




The meeting is about Business process simulation with JBoss jBPM. Bernd Rücker will introduce into jBPM and Business Process Simulation.

The meeting will take place on Jun 5 at 7pm in the premises of Red Hat Germany.

You can read the full (German) announcement on the web site of the Stuttgart
Java User Group (JUGS)

Sunday, May 18, 2008

Writing a RHQ plugin Part 4

Welcome back to the fourth part of the trilogy :)

In the last three parts we have been building our first RHQ plugin. This was working great, but hardcoding the target URL is not really elegant. In this posting I will show you how to make the target URLs configurable from the GUI.

To do this we need to reshuffle things a little:
We will have a generic Server 'HttpCheck' that servers as parent for the individual http-servers that we want to monitor. Those will live as Services under that Server. In the Server inventory we will add the possibility to manually add new http servers on the go.



As you may have already guessed, most of this is done in the plugin descriptor. We also need some small code changes, but those are mostly to separate the concerns of the various files. Lets start with the changed plugin descriptor

Changed plugin descriptor



The boilerplate code is the same as before and will thus not be shown again.


<server name="HttpCheck"
description="Httpserver pinging"
discovery="HttpDiscoveryComponent"
class="HttpComponent">


I have changed the name of the Server to HttpCheck, as this is nicer in the GUI. Now the interesting part starts:


<service name="HttpServer"
discovery="HttpServiceDiscoveryComponent"
class="HttpServiceComponent"
description="One remote Http Server"
supportsManualAdd="true"
>


Here we introduce a Service as child of the above Server. It has its own Plugin Component and Discovery classes (the name of the classes reflect that they belong to this Service). Technically they could have gone into the existing classes, but this way it is more obvious who does what. The attribute supportsManualAdd tells RHQ that those HttpServer Services can be added by the operator in the GUI - just what we want.


<plugin-configuration>
<c:simple-property name="url"
type="string"
required="true" />
</plugin-configuration>


The plugin-configuration tells RHQ that this service can be configured with one simple property, the URL of the remote, which is required. I'll talk a bit more about properties in a minute.

Last but not least, we have moved the two metrics into the service tag (so I don't show them in detail again:


<metric property="responseTime" ...
 
<metric property="status" ...
</service>
</server>


A word about configuration and properties



The configuration type presented here, can be used in two forms within a plugin descriptor: plugin-configuration and resource-configuration. Check the structure diagram in part 2 to see where they belong.

A configuration can consist of a number of sub-elements - notably properties that are children of the abstract configurationType. This is described below.


(Diagram created with http://x2svg.sf.net/)

In addition it is possible to group properties together in the group element. The GUI will show those in their own collapsable section. Allowed child elements of group are one description element and instances of the abstract configuration-property. Templates allow you to preset some configuration properties, so the user has only to fill in stuff that is needed or that they want to change. The template itself is of the configuration type and thus no shown again.

Properties



Properties allow you to specify individual apsects of a configuration. There are three types of properties:

  • simple-property: for one key value pair, as shown above

  • map-property: for a bunch of key value pairs, following the java.util.Map concept

  • list-property: for a list of properties.




(Diagram created with http://x2svg.sf.net/)


As you can see from the structural diagram, it is possible to nest configuration properties within list-property and map-property elements to compose more complex configurations.

If we would want to allow our Services to add multiple remote servers with properties of 'host', 'port', 'protocol' it could look like this:


<plugin-configuration>
<c:list-property name="Servers">
<c:map-property name="OneServer">
<c:simple-property name="host"/>
<c:simple-property name="port">
<c:integer-constraint
minimum="0"
maximum="65535"/>
</c:simple-property>
<c:simple-property name="protocol">
<c:property-options>
<c:option value="http" default="true"/>
<c:option value="https"/>
</c:property-options>
</c:simple-property>
</c:map-property>
</c:list-property>
</plugin-configuration>


This example also shows a few more possibilities we have here:
The port has a constraint so, the GUI can validate the input being between 0 and 2^16-1. For the protocol, we offer the user a drop down list / radio buttons to choose the protocol from. It defaults to 'http', as indicated on the option element.

Change in discovery components



These changes are - as already indicated - more or less just for clarity reasons and to clearly separate out the concerns of each component.

Server level: HttpDiscoveryComponent



The HttpDiscoveryComponent from part 3 of the series only got some minor changes to cater for the change in naming, so I am not showing it here - have a look at the provided sources archive for details.

Service level: HttpServiceDiscoveryComponent



The HttpServiceDiscoveryComponent is more interesting, as we no longer have the hard coded keys, but we get the URL passed in from the GUI when the user is adding a new one.

public class HttpServiceDiscoveryComponent
implements ResourceDiscoveryComponent<HttpServiceComponent>
{
public Set<DiscoveredResourceDetails> discoverResources
(ResourceDiscoveryContext<HttpServiceComponent> context)
throws InvalidPluginConfigurationException, Exception
{
Set<DiscoveredResourceDetails> result =
new HashSet<DiscoveredResourceDetails>();
ResourceType resourceType = context.getResourceType();


This basically the same code that we already know. The interesting part starts now:


List<Configuration> childConfigs =
context.getPluginConfigurations();
for (Configuration childConfig : childConfigs) {
String key = childConfig.getSimpleValue("url", null);
if (key == null)
throw new InvalidPluginConfigurationException(
"No URL provided");


We get a list of plugin configurations passed from the context through which we loop
to determine the passed parameters. As we have only one - the url - this is simple.
If there is no url provided provided we complain (actually that should never happen, as we
marked the property as required in the plugin descriptor above).


String name = key;
String description = "Http server at " + key;
DiscoveredResourceDetails detail =
new DiscoveredResourceDetails(
resourceType, key, name, null,
description, childConfig, null
);
result.add(detail);
}
return result;
}


The remainder is the same as we know it already from the previous part.


Change in plugin components



The change in plugin components in basically that the old HttpComponent got
renamed to HttpServiceComponent and that we have a new "pseudo" HttpComponent on server level.

Server level - HttpComponent



Ok, this one is - as just described - a dummy implementation, as it just provides
placeholder methods from the ResourceComponent interface.


public AvailabilityType getAvailability() {
return AvailabilityType.UP;
}


We set the Availability to being always UP so the component can successfully start. We leave the other two methods just as empty implementations.

Service level - HttpServiceComponent



As indicated this is more or less the old HttpComponent except for one change:


public void start(ResourceContext context)
throws InvalidPluginConfigurationException, Exception
{
url = new URL(context.getResourceKey());
// Provide an initial status, so
// getAvailability() returns up
status = "200";
}


We are now setting the URL when the component is starting be reading it from the passed ResourceContext.

Building the plugin



The updated plugin can be built as shown in the previous part by calling mvn -Pdev install in the root of plugin source tree.

There is currently as of RHQ 1.0 a drawback though: Changes like those above may not be recognized by the system (or worse even throw an Exception in the server at plugin update time) - in this case you have to clean out the database and start with an empty one. We are looking into fixing this.

Summary



You have just seen, how easy it is to pass plugin configuration parameters from the GUI to a plugin by expressing the parameters in the plugin descriptor. Our plugin is now able to have an arbitrary number of child services that each monitor a different remote http server. The changes needed are basically a few more lines of XML and a little bit more Java code.

The sources are again available as zip archive. Just install it like the previous one (overwrite the previous one).

In the next posting I will talk a little more about the OperationFacet and the ConfigurationFacet and will show an example around using process scans for discovery of servers and services.


 


Part 1
Part 2
Part 3
Part 5








Technorati Tags:
, ,

OS X Gui package added to x2svg

For all of us OS X guys, it is always somewhat lame when the favorite app doesn't live in /Applications and can't just be double clicked (Ok, I admit, I love OS X because of its command line and its Unix internals).

So I just created an application bundle of the gui version of x2svg and uploaded it to SourceForge.

Just open the disk image and double click on x2svg.app

Enjoy :-)

Forums enabled for x2svg

I have enabled the forums fuctionality for x2svg in the hope for feedback from the community.

While this is not (yet) the top downloaded project at SourceForge, there are users out there and are using the program - I want to hear from you!

And in case you have missed it - Version 1.2 has been released with a lot of new functionality and fixes over previous versions.
Check the changelog at http://x2svg.sourceforge.net/changes.html.

Wednesday, May 14, 2008

Writing a RHQ plugin Part 3

Welcome to the third article in the "Writing a RHQ plugin" series.

In the last post I was talking about the plugin descriptor, discovery component and the plugin component. Today we will see the project structure, some code and how to build and run our plugin.

Remember: for the start we just have a very simple version of the plugin. We will perhaps enhance it in a future posting.

First let's talk about the project structure in the file system.

The RHQ project structure



To make things easier, we will host this plugin just within the RHQ tree. So go and check out RHQ from
http://svn.rhq-project.org/repos/rhq . Build the project as described on the build page on the wiki. After that is done, we will start to add our plugin into modules/plugins/.

Directory layout



Create the following directory structure:




Add modules/plugins/httptest/src/main/java to the build path in your IDE.

The classes within org.rhq.plugins.httptest form the plugin discovery component and plugin comonent and will be described below.


Maven pom


RHQ is a mavenized project, thus we need to supply a pom file. Easiest is to just grab another pom, copy it over to the root of the plugin subtree and change at least the artifactId:


<groupId>org.rhq</groupId>
<artifactId>rhq-httptest-plugin</artifactId>
<packaging>jar</packaging>
 
<name>RHQ HttpTest Plugin</name>
<description>A plugin to monitor http servers</description>


Please note that this only defines the pom for this subtree - it will not add this to the global project. To do this, you need to add the httptest plugin to the parent pom at the modules/plugins/ level:

  <modules>
<module>platform</module>
...
<module>postgres</module>
<module>httptest</module>
</modules>



The artifacts



We will now look at the individual three artifacts that make up a plugin. The directory tree above shows where they are located.

Plugin discovery component



First we start with discovering our server. This is relatively simple and directly
follows the description in the previous part.


public class HttpDiscoveryComponent implements
ResourceDiscoveryComponent
{
public Set discoverResources(ResourceDiscoveryContext context)
throws InvalidPluginConfigurationException, Exception
{
Set<DiscoveredResourceDetails> result =
new HashSet<DiscoveredResourceDetails>();
 
String key = "http://localhost:7080/"; // Jon server
String name = key;
String description = "Http server at " + key;
Configuration configuration = null;
ResourceType resourceType = context.getResourceType();
DiscoveredResourceDetails detail =
new DiscoveredResourceDetails(resourceType,
key, name, null, description,
configuration, null
);
 
result.add(detail);
 
return result;
}
}


Again it is extremely important that the key is/stays the same for each discovery performed!

Plugin component



So the next part is the plugin component to do the work


public class HttpComponent implements ResourceComponent,
MeasurementFacet
{
URL url; // remote server url
long time; // response time from last collection
String status; // Status code from last collection

As we want to monitor stuff, we need to implement the MeasurementFacet with the getValues() method (see below).

But first we implement two of the methods from ResourceComponent. The first returns the availability of the remote server. We check if the status is null or 500 and return DOWN, otherwise UP.

public AvailabilityType getAvailability()
{
if (status == null || status.startsWith("5"))
return AvailabilityType.DOWN;
return AvailabilityType.UP;
}

One needs to be careful here, as the discovery will not happen as long as this method is returning DOWN. So we provide a valid start value in the start() method from the ResourceComponent:

public void start(ResourceContext context) throws
InvalidPluginConfigurationException, Exception
{
url = new URL("http://localhost:7080/");
// Provide an initial status,
// so getAvailability() returns UP
status = "200"; so getAvailability() returns up
}

Analogous to start() there is a stop() method, that can be used to clean up resources, which we leave empty and don't show it here.

This leads us to getValues() from the MeasurementFacet:


public void getValues(MeasurementReport report,
Set<MeasurementScheduleRequest> metrics)
throws Exception
{
getData();
// Loop over the incoming requests and
// fill in the requested data
for (MeasurementScheduleRequest request : metrics)
{
if (request.getName().equals("responseTime")) {
report.addData(new MeasurementDataNumeric(
request, new Double(time)));
} else if (request.getName().equals("status")) {
report.addData(new MeasurementDataTrait
(request, status));
}
}
}

We get data from the remote and then loop over the incoming request to see which metric is wanted and fill it in. Depending on the type we need to wrap it into the correct MeasurementData* class.
This leaves the implementation of getData():

private void getData()
{
HttpURLConnection con = null;
int code = 0;
try {
con = (HttpURLConnection) url.openConnection();
con.setConnectTimeout(1000);
long now = System.currentTimeMillis();
con.connect();
code = con.getResponseCode();
long t2 = System.currentTimeMillis();
time = t2 - now;
} catch (Exception e) {
e.printStackTrace();
}
if (con != null)
con.disconnect();
 
status = String.valueOf(code);
}


This is nothing fancy again. Just open a URL connection, take the time it takes to connect, get the status code and we are done. Of course, this could be optimized, but for this article I wanted to use a simple solution.

Plugin descriptor



The plugin descriptor is where everything is glued together. First we start off with some "boiler plate" code:

<?xml version="1.0" encoding="UTF-8" ?>
<plugin name="HttpTest"
displayName="HttpTest plugin"
package="org.rhq.plugins.httptest"
version="2.0"
description="Monitoring of http servers"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin"
xmlns:c="urn:xmlns:rhq-configuration">


The package attribute predefines the Java package for Java class names that appear later in the descriptor.

   <server name="HttpServer"
discovery="HttpDiscoveryComponent"
class="HttpComponent"
description="Http Server"
>


We define our plugin as a Server. From the intuition it could be a Service, but Services can't just live on their own so we choose a server here. The attribute class denotes the plugin component and discovery the discovery component. If you have specified the package above, you can just use the class name without prefix.

    <metric property="responseTime"
displayName="Response Time"
measurementType="dynamic"
units="milliseconds"
displayType="summary"/>

<metric property="status"
displayName="Status Code"
dataType="trait"
displayType="summary"/>
</server>
</plugin>


Now the two metrics. With all the knowledge you have now, they are nothing special anymore.
Again, responseTime is modeled as numerical data, while the status is modeled as trait. This could have been done differently, but is done here for educational purposes :-)


Ready, steady, go ...



To compile the plugin, go to the root of the plugin tree and do
mvn -Pdev install
The dev mode allows maven to automatically deploy the plugin to a server instance as described on the Advanced Built Notes page on the RHQ-Wiki.

When the server is running or starting up, you will see a line like this in the server log:


21:49:31,874 INFO [ProductPluginDeployer] Deploying ON plugin HttpTest (HttpTest plugin)


The next step is to make the plugin available to the agent. Remember that the agent is usually pulling plugins from the server when it is starting up. So if you have not yet started the agent, there is nothing to do for you. If the agent is already started, you can issue plugins update at the command prompt to update them to the latest versions of the server.

If you now log into the GUI, go to the resource browser and click on 'Servers', you can see the server discovered by our plugin:



Clicking on the server name or the little 'M'onitor icon leads you to the indicator charts, where you can see the response time values:



When you click on the Metric Data subtab, you can see the raw data for the server:



On the top you see the numerical ResponseTime data, and in the lower section the server status as trait as expected.

Summary



Congratulations, you just wrote your first RHQ plugin, that can also be used in JBoss ON 2.0. Writing a plugin consists of three parts: Discovery, Plugin Component and plugin descriptor. The agent with its plugin container is providing you with all the infrastructure to talk to the server, scheduling of metric gathering, scheduling of discovery etc. This means that you can fully concentrate on the business code of your plugin. RHQ just does the rest.

I have made the source code of those articles available as zip archive, that you can unpack in the modules/plugins/ directory.

I want to stop here for now. I will perhaps extend this on how to make the configuration flexible instead of hardcoding the server url. I also kept a third type of measurement data a secret, that I might be talking about some more.

Please provide feedback - either as comment to these articles or in the RHQ forums.

Here are again the references to the other articles in this series:


Part 1
Part 2
Part 4
Part 5








Technorati Tags:
, ,

Tuesday, May 13, 2008

If your JBossAS does not want to redeploy embedded war archives ...

JBossAS has since I remember a cool feature called Hot-Deploy. When you want to deploy an archive (EJB-Jar, Webarchive or else), you just throw it into the deploy/ directory of the server config. JBossAS will detected (by default within 5 secs) and deploy it. Same if you have updated an existing archive.
To just force a redploy, you can just touch the archive.

JBossAS has a second cool feature around this: exploded archives. Here you don't need to zip up the archive to deploy it, but you can just deploy a flat directory hierarchy (which of course needs to follow the required archive structure). To redeploy a changed archive, you don't touch the archive directory, but the descriptor file in it (e.g. web.xml for a .war archive).

Now lets imagine you want to update a few files (like struts config) in an exploded .war within a .ear. You'd expect to just touch the web.xml file of the war an be done. But sometimes this just does not work. If this is the case, but normal redeploys of e.g. the ear work, then go and check deploy/jboss-web.deployer/context.xml

This needs to read:


<Context cookies="true" crossContext="true" reloadable="true">


After changing this, restart the JBossAS and the redeploy of the embedded war will work.

x2svg new release x2svg-1.2

Project x2svg just released the final 1.2 version.



Changes in release 1.2 since the last beta are:

  • Pass debug flag to the parsers.

  • Add the possibility in the GUI to pass parser specific options to
    the parser (SF fr#1956587).

  • Allow parsing of attributes and element comments. It depends on the
    individual parser if this is supported (SF FR#1940442). As this is still
    somewhat experimental, it is turned off by default.

  • Pull ant.lib into lib/, so the IDE can use this one.

  • Allow parsing of types in the XSD parser (SF FR#1947079).

  • Lot of cleanup and smaller fixes.



Browse the full changelog to see all changes in earlier versions.

You can download it from Sourceforge

Please provide feeback:


Help is always welcome.





Friday, May 09, 2008

Writing a RHQ plugin Part 2

In the last post I showed the general architecture of RHQ and where plugins live. So we can now start writing one.

The scenario revisited



Our plugin should be able to connect to a http server, issue a HEAD request on the base url (e.g.
http://localhost/) and return the http return code as trait and the time it took as numeric data (see below).



To make things easier for the purpose of this series of postings, we will have the agent running on the machine the RHQ server lives on and we will just try to get data from the Servers http connector at port 7080 (the default port).

What do we need ?



In order to write our plugin we basically need three things

  • A plugin descriptor. This contains metadata about the plugin: which metrics should be collected, what operations does it support etc.

  • A discovery component. This part discovers the actual resource(s) and delivers them to the Inventory.

  • A plugin component. This component executes operations and gathers the measurement data etc.



So lets have a look into those three parts.

Plugin descriptor



The plugin descriptor is described by an XML Schema that you can find in svn. The basic structure is as follows:




(Click for pdf version), Graphic done with http://x2svg.sf.net/

The desciptor consists of a few sections. First you can express dependencies to other plugins. This is allows reuse of existing plugins and is useful when you e.g. want to write a plugin that itself needs the JMX plugin, so that it can do its work.

The next are a row of platform/server/service sections. Each of those can have the same (XML-)content as the platform that is shown as an example - they are all of the same (XML-) data type (as a platform/server/service) as each is a kind of resource type, as you already know from the first part.

Example:

<service name="CheckHttp">
<metric property="responseTime"
description="How long did it take to connect"
displayType="Summary"
displayName="Time to get the response"
units="ms"
/>
</service>


The name of a <service> and the other ResourceTypes (platform, server) must be unique for a plugin. So it is not allowed to have two services named "CheckHttp" within our example plugin, but you could write a Tomcat5 and a separate Tomcat6 plugin that both have a service with the name "connector".

For the start we are especially interested in one of the sub elements: metric for our example plugin, so I will describe this here in a little more detail. For all other tags refer to the XML Schema that has a lot of comments.

Metric



This is a simple element with a bunch of attributes and no child tags. You have already seen an example above.
Attributes of it are:

property: name of this metric. Can be obtained in the code via getName()
  • description: A human readable description of the metric

  • displayName: The name that gets displayed

  • dataType: Type of metric (numeric / trait /...)

  • units: The measurement units for numerical dataType

  • displayType: if set to "summary", the metric will show at the indicator charts and collected by default

  • defaultOn: Shall this metric collected by default

  • measurementType: what characteristics do the numerical values have (trends up, trends down, dynamic). The system will for trends* metrics, automatically create additional per minute metrics.



For the sample plugin we will use a metric with numerical dataType for the response time and a dataType of trait for the Status code. Traits are meant to be data values that only rarely change like OS version, IP Address of an ethernet interface or the hostname. RHQ is intelligent enough to only store changed traits to conserve space.

Discovery component



The discovery component will be called by the InventoryManager in the agent to discover resources. This can be done by a process table scan (e.g. for the Postgres plugin) or by any other means (if your plugin wants to look for JMX-based resources, then it can just query the MBeanServer. Well, actually there is a JMX-Plugin that can do that for you in clever ways).

The most important thing here is that the Discovery component must return the same unique key each time for the same resource.

The DiscoveryComponent needs to implement org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent and you need to implement discoverResources().
The usual code block that you will see in discoverResources() is:


Set<DiscoveredResourceDetails> result = new HashSet<DiscoveredResourceDetails>();
for ( ... ) {
...
DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
context.getResourceType(),
uniqueResourceKey,
resourceName,
resourceVersion,
description,
configuration, // can be null if no confi
processInfo);
result.add(detail);
}
return result;


Basically the context passed in gives you a lot of information, that you can use to discover the resource and create a DiscoveredResourceDetails object per discovered resource. The list of result objects is then returned to the caller. Simple - eh?

Plugin component



The plugin component is the part of the plugin that does the work after the discovery has finished.
For each of the "basic functions" in the plugin descriptor, it needs to implement an appropriate Facet:












Descriptor elementFacet
<metric> MeasurementFacet
<operation> OperationFacet
.....


Each Facet has its own methods to implement. In the case of the MeasurementFacet this is e.g. getValues(MeasurementReport report, Set metrics). The report passed in is where you add your results. The metrics is a list of metrics for which data should be gathered. This can be all ouf your definied <metric>s at once or only a few of them - this depends on the schedules the user configured in the GUI.




Ok, that's it for now. In the next post we will do some coding and get our plugin to work.




Part 1
Part 3
Part 4
Part 5







Technorati Tags:
, ,


Thursday, May 08, 2008

Sample app of my ejb3 book updated (German)

I have just updated the sample app + installation guide of the sample app from my ejb3 book to use JBoss 4.2.2.GA. This makes the installation much simpler. I also removed a few issues from various places.

You can the updated description on the books web page.

Remember, even as there is the free PDF version of the book, it still can be ordered in print.

Wednesday, May 07, 2008

Writing a RHQ plugin Part 1

Red Hat and Hyperic released Project RHQ in the open in February. Meanwhile we released the first GA version of RHQ together with JBossON 2.0 at JavaOne 2008.

This post and the next few will try to show how to write your own plugins for RHQ.
As an example scenario the plugin will try to reach a http server, see if the base URL is available and return the status code + the time it took to reach it.

General architecture of RHQ



Before we go into detailed plugin writing, I first want to show the general architecture of RHQ and its plugin system.

RHQ follows a hub and spoke approach: A central server (or cluster) processes data coming in from agents. The data is stored in a database connected to the server. Users / admin can look at the data and trigger operations through a web-based GUI on the server



Agents do not have a fixed functionality, but can be extended through plugins which we will see below. Usually there is one agent running per machine with resources to manage. The RHQ server itself is able to run an agent embedded in the server. This is mostly for demo and test scenarios, but it is well able to monitor the server machine.

Server services



The server hosts a number of services like

  • It has a view on the complete Inventory

  • It processes incoming measurement data

  • It triggers alerts to be sent

  • It triggers operations on managed resources

  • It hosts the graphical user interface

  • It hosts the user management

  • ...



Some of those services are reflected in the agent like inventory syncing, gathering of measurement data or running operations on a managed resource, while alert processing or hosting of the GUI is purely on the server.

Agent architecture



The agent is sort of a container that hosts some common functionality like the communication interface with the server, logging, starting and stopping of plugins or reading configuration files. In addition to this, it hosts plugin containers, who host the actual plugins. When you write a plugin, you talk to the plugin container.



The agent is in addition to the plugin containers also hosting common service like the communication with the RHQ server, logging or the handling of the command line and interactive command prompt.


Central functionality: Inventory



The central functionality of RHQ is the inventory. Each resource that you want to manage or monitor must be present in that inventory. RHQ has mechanisms to autodetect and also manually add resources. We'll come back to that later when we are talking about implementing plugins.

Each org.rhq.core.domain.resource.Resource has a certain org.rhq.core.domain.resource.ResourceCategory:


  • Platform: This is basically a host where things run on

  • Server: Things like database server, JBossAS instance or the RHQ agent

  • Service: (Fine grained) Services offered by a server



The ResourceCategory is sort of hierarchic as you can see on the next image:



A platform hosts servers, a server can host other servers and services and a service can host other services. In theory it is also possible that a platform is hosting other platforms.
As an example: you have a Red Hat Linux platform, which hosts the RHQ Agent and JBossAS as a server. This AS it self is hosting a Tomcat server. Both JBossAS and Tomcat themselves are hosting services like JMS or Connectors.
So at the end this will result in a tree of resources with the Linux platform as its root.

In addition to the category each Resource also is of a certain org.rhq.core.domain.resource.ResourceType. For a platform this might e.g. "Max OS X", "Red Hat Linux", "Debian Linux" etc. Or the JBossAS and Tomcat from above are both of category Server, but have different ResourceType.

The RHQ wiki has an overview of the inventory db schema.



Ok, that's it for now. As a homework, check out the documentation at the RHQ wiki and the source code from the RHQ svn

Greg Hinkle also put a high level overview of the plugin system online.

Joseph Marques has written an article about things to consider before writing a plugin and will soon write a second part of it (actually it is already online).





Part 2
Part 3
Part 4
Part 5







Technorati Tags:
, ,


Tuesday, May 06, 2008

JBossON 2.0 and RHQ 1.0 released

After a lot of work JBossON 2.0 was released today together with RHQ 1.0 at JavaOne conference.

You can read the press release at:

Yahoo

Red Hat

This is a great release and it feels great that over a year of hard work finally fell into place. There are no real release notes for RHQ, but you can browse the release notes created by JIRA at jira.rhq-project.org.

I wrote already about a few of the new features and I am planning on writing soon about developing own plugins for RHQ and JBossON.

If you want to meet the team, join us on #rhq at irc.freenode.net.

Greg from the JBossON team will also be around at JavaOne - you can probably meet him at the JBoss booth.

My colleague Jason Dobies also has an article about the release.


Friday, May 02, 2008

JPA 2 first draft is out

The counterpart to the EJB 3.1 spec, the Java Persistence API 2.0 spec has just published a first public draft at JSR 317.
There have been so many changes to the spec since JPA 1.0 (JSR 220) that I don't want to mention them here.
Mike Keith has recently written an article that describes some of them.

Like in JPA 1.0, JBoss has contributed a lot to the stuff. Both Gavin King and Emmanuel Bernard were very active in this update.

But check them out by yourself at the JSR 317 spec page.

Monday, April 28, 2008

NetBeans 6.1. is here !

Last time I was asking where NetBeans 6.1 is, as its release got delayed.

I got a comment on my blog entry that it will be released today (4/28). And here it is!

Nice!

Stuttgart SIG-JBoss: upcoming meetings



After a long time without any meetings, SIG-JBoss as part of the Java User Group Stuttgart (JUGS e.V.) is coming to live again with the following two user group meetings:



  • Thu 5.6.2008 Bernd Rücker: Presentation of the jBPM Business Process Simulation Component

  • Thu 26.6.2008 Myself: presentation of RHQ



We will meet both times in the rooms of the Stuttgart Red Hat office at 7pm.
Guests are welcome as always.

Please register yourself so that we have an idea about the number of people that will participate.

Sunday, April 27, 2008

x2svg new release 1.2beta3

Project x2svg just released a new version.



Changes in release 1.2beta3 are:

  • Updated the libraries on the scripts to match the libraries introduced in 1.2-beta2 (SF bug#1944294).

  • Added the possibility to the XSD parser to just show references to substitutonGroups, but not the whole
    substituted group (SF fr#1769065).

  • Added the possibility to limit the depth of the parsed tree of the XSD Parser

  • It is now possible to get the parser specific help on the command line and to list modes and suffixes (SG
    bug#1950350)

  • Fix errors with options without argument and NPE without input file (SF bug#1951088).



You can download it from Sourceforge

Please provide feeback:

Saturday, April 26, 2008

JBossON 2 not just sexy - huh?

Rich Sharpless posted about JBossON 2 not only being sexy after he has seen a presentation on it.

Of course it is not only sexy when you look at the covers, but also when you unfold it. A few items to notice:

  • The plugin development is much easier than in the past

  • Groups are much more powerful - including new DynaGroups

  • The internal data model is much cleaner and easier to extend and understand

  • The application is written in EJB 3.0 with heavy usage of JPA 1 for the persistence (there is some pure hibernate and even JDBC code in it, but >90% is JPA).

  • Due to the latter (and other reasons) it is much faster.


And last but not least: most of it is (already) open source in the form of RHQ.

When you want to know for your self how JBossON 2 looks like, just check out RHQ.

And of course we are not only looking for marketing people, but also always for developers with clue :-)

Friday, April 25, 2008

So where is Netbeans 6.1 ?

When I was recently testing NetBeans, I also saw that 6.1 GA was supposed to be released on Apr 23th. Now it is two days later and still no sign of it (or why it is delayed). So I will postpone further testing in that area until 6.1 is out.

Small step for mankind, big Step for Marlene

My little daughter finally did her first steps on her own - that is just great. And she really is enjoying it. Orlando is also very happy.

As am I :-)

Monday, April 21, 2008

Testing NetBeans (coming from Eclipse)

Inspired by Adam Bien's praise on NetBeans and its Maven support, I was looking at NetBeans again.
NetBeans basically was my first Java IDE, but somehow I never got infected by it and switched to Eclipse relatively soon thereafter.

I downloaded NetBeans 6.0.1 for Mac OS X from the website and started ..

First a little test



So I first tried to import a simple Eclipse project like x2svg with the "Open Project..." and "from existing build file" option, but this wasn't really as I wanted it. Ok, back to the dialog and searching for "from Eclipse project" - nothing. A quick search in help showed that I first have to download and install the respective plugin. That was quick and this time the import worked well.

The next thing that I changed was the key bindings. I am so used to the Eclipse ones, that I don't want to learn new ones. This was equally simple. Just go to preferences and the key bindings section, then choose Eclipse from the drop down. Done (Note to Mac users: Save is on Ctrl-S in that binding, but can be easily changed).

One drawbacks for me is that run/debug options have not been transferred (I am currently trying to improve the XSD parser and have a longish command line).

One irritating thing is that it seemed like the SVN settings also have not been imported. But it turned out that as soon as I specified the location of the svn executable (actually SVN_HOME is the directory where it resides in), svn integration worked as supposed. Interestingly, as I have three source trees in the project, NetBeans is connecting three times to the svn server, while Eclipse uses one connection only on a svn up.

Another thing that is irritating (but which I find a good think after I know what is going on) is the fact that NetBeans is storing its information in a separate folder in the filesystem and uses this folder as default root directory when running an executable, which will make some tests fail. But the I am very happy, that it doesn't just write stuff in my existing project that I would need to remove later.

When I tried to open my two GUI files, I received a (well known) NPE both times - actually I was hoping to get some sort of visual Swing editor instead. The website that took my error report told me that this is probably already resolved and that I should download the latest NB 6.1 milestone (RC2 in my case).

Updating to 6.1 RC 2



The update was painless, and installed a new version next to the 6.0 one in /Applications/NetBeans. Having seen this, I did not expect the plugins that I installed earlier to be present - and I was right.

The NPE was gone too, but I still have no GUI editor - perhaps because NB is just not able to parse GUI elements that were not created using NB?

But from that little test I have to say that I like it much more than when I was looking at it the last time. Now lets go on to something heavier.

Testing with a mavenized project



In RHQ we are using maven a lot. So the next test is to see if the maven support is really as good as Adam is saying.

Checkout from http://svn.rhq-project.org/repos/rhq was painless and NetBeans was asking what project I want to open. I've chosen the root and it now showed me a structure of maven poms, that I could open as project afterwards. This again is very different from how Eclipse is handling things (I mean, RHQ is one project with a bunch of modules). But ok, that import was painless as well.
And then: a build from within NetBeans fails because of some wrong maven version. But this is not fatal for me, as I am used to build from the command line anyway.

Speed



In total NB doesn't feel slow, but with RHQ, auto completion is slower than in Eclipse, the "member view" is slower than the Outline view and the fan of my MacBook is much more active. I can imagine that this comes from the usage of the mavenized project. I will try to import this as Eclipse project as well to see if that changes things to the better.

My friend, the problem view



Eclipse has a problem view that just works. Period. IntelliJ 6 had its issues with it. And now I am finding basically the same in NB 6.1. Perhaps I am missing something obvious - dunno. I have already enabled the "track java dependencies" setting:



(I am not even sure if this setting is supposed to do what I want it to do).

In x2svg I have three source trees src, gui-src and test-src. When I now e.g. rename a method in src (by hand, not via re-factoring), only the errors in the src tree show in the project explorer and in the task list. Even when I have a file from gui-src open and the editor shows the error for that file, it doesn't appear in the task list nor the projects explorer.



When I switch back to the other file, the error will eventually show.

When I then fix the issue in src/ , the error will still show up for the file(s) in gui-src/.

Profiler



Just to mention that as a big plus for NetBeans: it comes with a built in profiler. I don't know how much I'll look at it or even use it, as we are using jProfiler in RHQ, but nevertheless this is a big plus.



Conclusion



NetBeans has gained a lot since I was last looking at it and the Maven integration is really so much better than in Eclipse, which saves me from the pain to always update the .classpath file when we pull in a different library version.

I will keep an eye on NB in the upcoming weeks to see if it could be an alternative to what I now have with Eclispe. But the issue with the problem view / task list, that I mentioned, really is close to a show stopper for me. Perhaps it will just be fixed in NB 6.1 GA.


Sunday, April 20, 2008

Java Forum Stuttgart 2008 - Schedule posted

The tracks for this years Java Forum Stuttgart has been
posted.

It again features 42 sessions in six parallel tracks.
From the JBoss side there are two interesting tracks:

  • Advanced JBoss Cache (F2)

  • Geschäftsprozesse & Regeln mit jBPM & Drools - ein unschlagbares Team (C3)


My submission for a talk about RHQ and JBossON was rejected as well as an outlook into EJB 3.1, but my third proposal made it into the program:
"Profiler der bessere Debugger?" (C6).

Go and check out the whole program - registration starts Mon 21.4.2008.
Hope to see you there!

Wednesday, April 16, 2008

Free PDF version of my German EJB 3 book available

I am very pleased to announce that dpunkt.verlag, my publisher for my EJB-3 and JBoss books, has made a free PDF version of my German EJB-3 book available for download.



Cover of my EJB 3 book



You can download it from the book site. Please take a few seconds to fill in the survey.

[ There were access issues on the server - please retry the download ]

The book is of course still available in printed form - e.g. at Amazon.de.

Many thanks go to the nice folks at dpunkt.