Bean Shell Compiler

Bean Shell makes your Java programs scriptable. Recently I started working on it. BeanShell provides its own JavaScript-like syntax to access your Java Objects. You can even change the syntax to anything you like using JavaCC. I started playing with it. BeanShell uses a Parser and Abstract Syntax Tree (AST) to tokenize the code. Here’s a small class for compiling the BSH script, before sending it to the interpreter.

Google Reader – RSS Reader for Web 2.0

Google unviels Google Reader – an online RSS reader. It currently integrated with the Google Account. Interface is very sleek just like you would expect from Google, simple, accessible and with keyboard short-cuts, with all the magic of AJAX. Check it out.

In other news Sergey Brin, google co-founder, says “No Office suite for now“.

“Most of our success has nothing to do with what an executive said was a good idea,” he said. With all the smart people at Google spending time on innovating, there won’t be many areas that Google will leave untouched.”

So, I still have a chance to create my webOffice!

JMX Tutorial

I just started writing new JMX tutorial. Just completed writing the HelloWorld program. Take a look at it here. I’m right now busy settling down at Gurgaon, today or tomorrow will finalize about the accommodation, once I settle down, I’m planning to add more content and my thoughts to the website. Keep browsing visiting again.

JMX HelloWorld

Introduction

JMX or Java Management eXtensions gives you the ability to manage programs remotely. I’ve been working on JMX in one of the SOA application. I would like to share how my first program in JMX has been written and deployed onto JBoss. The MBeans are also know as Platform MBeans (MBeans – Management Beans). You can use JMX to remotely invoke the function on an object. In layman terms, JMX MBeans can be used as "Remote Control" for the "Object that implements the MBean". Using the MBean the object’s operations can be invoked remotely. The JBoss application server has been constructed over a microkernel that uses JMX specification. Every service JBoss provides is an MBean or collection of MBeans. Different kinds of MBeans and notifications are not covered in this article. This article just explains two examples: The plain MBean (HelloWorld), and creating and deploying MBean in the JBoss as an SAR (Service Archive).

The HelloWorld MBean

As already told, MBeans are a way to control the Object remotely. A JMX Agent will expose the MBeans to the platform. Here are the setps to create the first Manageable Object using MBeans.
Step 1: Create the HelloWorldMbean class with sayHello method (Note: MBean interface to be named as ***Mbean):

Step 2: Create the Implementation for the MBean:

Step 3: Create an Agent that exposes the MBean to the platform, so that we can manage it remotely:

Once the three classes are created, compile all of them, and then run the Agent class using the command java -Dcom.sun.management.jmxremote com.vijaykiran.jmx.HelloWorldAgent If you are using Eclipse then, you need to set the VM arguements in the "Run…" dialog. If you want you can download the Zip file Eclipse Project at the end of the article. Now your Agent is running and exposed to the platform. If you want to invoke the function, goto command line and use the jconsole command to strart the JMX console. The command is in your Javabin directory.

Click on Connect, then goto MBeans Tab. You’ll find com.vijaykiran.jmx package on the left, and expand it to get the HelloWorld Mbean. And then select it and on the right pane, click on the Operations tab. You’ll find the sayHelloButton(). Click on it, and your method is ivoked via the exposed MBean.