SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 281 | Next

Ola Bini

"Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java"

Provide any
parameters you??™d like and press the ???invoke??? button. You should get a window telling you the
result of the operation back. For example, type admin, admin, and list in the first boxes; this
should give you all sequence names available. Or, create a new sequence and increment it.
The interesting thing about this small management application is that it??™s incredibly easy
to create something powerful such as this, and you can add on it to provide everything you
need to handle your application in a programmatic manner. You can add attributes that
control everything about your application, and the MBean framework lets you update this
information and change it anytime you like, through a standard interface such as JConsole.
Or, if you have deployed your application in GlassFish or JBoss, you can use their standard
web interfaces for the same thing.
Simple JMX Access to Rails
Now that you??™ve seen how you can use JMX on the server side to control your operations, it??™s
time to see how to take control of a Rails application. The basics of doing this are simple, and
you already have most of the pieces needed. After that, the only thing stopping you is your
imagination. However, right now you??™ll just provide an MBean that allows you to connect to
a Rails process and execute anything you want, much like the script script/runner that??™s
available in all Rails applications. You??™ll let this code reside in the bbservice project too,
because the bbapp application needs to refer to this JAR file anyway (see Listing 10-3).


Pages:
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293