-
Domain names - what were they thinking?
Powergen Italia owns the domain http://www.powergenitalia.com/. Who Represents owns http://www.whorepresents.com/. Goes to show you have to put some thought into your domain name :D.
-
Integrating JADE into JBoss with BlueJADE
The following are installation instructions for integrating JADE (Java Agent DEvelopment Framework) as a managed container in JBoss using BlueJADE. It addresses several issues with group installation, which doesn't seem to work as indicated in the official installation instructions. I've posted them more for reference than as a weblog entry per se.
What is BlueJADE?
BlueJADE makes the JADE agent system a manageable service under a J2EE application server. BlueJADE allows JADE to become a service that can be managed through JMX (Java Management Extension).
Installation in WinXP
Setting up the environment
- Install JADE, BlueJADE and JBoss. It is recommended that a version of JBoss with Tomcat already integrated be used. Refer to their respective documentation on the installation process. This often involves simply unarchiving the binaries, or compilation if you're building from sources.
- Set the JADE_HOME, BLUEJADE_HOME and JBOSS_HOME environment variables to point to the respective directories.Group Installation
- Pick a group under $BLUEJADE_HOME/groups to install. It's simplest to choose the 'simpleagent' group.
- To install the group, run the install script (install.bat) in $BLUEJADE_HOME/groups/simpleagent. 1 argument, the group to install, should be specified. A 2nd argument would copy over an existing JBoss environment if specified.
Eg.
$ install simpleagent default
- At this point, you could run into problems. Apparently, the environment variables are not picked up properly by the installation script/program so you have to edit $BLUEJADE_HOME/bin/win/install.properties to add in the "missing" environment variables.
The variables include:
LOCALHOSTNAME, GROUP, TEMP, JBOSS_HOME, JADE_HOME, BLUEJADE_HOME
Set these to point to the exact path/name.
- If installation goes well (no error messages), open the file $JBOSS_HOME/server/simpleagent/deploy/jade-service.xml. The elementwith name="ConfigDocName" should be pointing to an incorrect path - change it to point to $JBOSS_HOME/server/simpleagent/conf/jade-service-config.xml. Depending on the group you're installing, there could be more bogus paths - just keep an eye out for them and correct accordingly.
- Open that jade-service-config.xml file and make similar corrections for the 2 (or more, depending on your group) paths there:
xsi:noNamespaceSchemaLocation=$JBOSS_HOME/server/simpleagent/conf/JADE-1_0.xsd
jadeArgs=$JBOSS_HOME/server/simpleagent/conf/jadeboot.propertiesRunning JBoss with JADE container
- Run JBoss with the simpleagent environment by executing the following command at $JBOSS_HOME/bin
run -c simpleagent
- If all goes well, you should see no errors in the startup process and a JADE Remote Agent Management GUI appears (only for simpleagent and demoagent groups).
- JADE is now manageable as a service under JMX - go to http://localhost:8080/jmx-console/ -
Java Tip #1: Defensive copies
Something that could easily be missed when programming in Java is inadvertently exposing the internals of a supposedly encapsulated field to clients of your class. Consider the following naive implementation of a rectangle class that disallows negative dimensions:
public final class MyRectangle {
private final Dimension dim;public MyRectangle(Dimension dim) {
if( dim.height < 0 || dim.width < 0 ) {
throw new IllegalArgumentException("Dimensions cannot be negative");
}this.dim = dim;
}public int getArea() {
return dim.height * dim.weight;
}
}
A cursory glance may seem indicate that the class should be immutable and no negative dimensions, and thus no negative areas, are possible. Not true. Consider this bit of code that uses the MyRectangle class:
Dimension dim = new Dimension(2, 3);
MyRectangle rect = new MyRectangle(dim);
dim.setSize(-3, 4); // modifies rect's internal Dimension field!
This is possible because Dimension is a mutable class! Therefore, it is important to make a defensive copy of each parameter to the constructor that is mutable. We can fix the MyRectangle class by changing it's constructor like so:
public MyRectangle(Dimension dim) {
this.dim = new Dimension(dim); // make defensive copyif( dim.height < 0 || dim.width < 0 ) {
throw new IllegalArgumentException("Dimensions cannot be negative");
}
}
Notice how a copy of the Dimension parameter is made, so that the client has no reference (and thus no access) to the internal dim field of the MyRectangle object. The same has to be done in the case where accessors return mutable fields - make sure to return defensive copies. The rule is never to directly return the internal field to a client class - always create a defensive copy and return that instead, so that there is no handle into the object internals. -
Move and redesign
I've moved my blog from FreeRoller.net. That is an amazing thing for Anthony Eden to do, providing blog hosting for free to the Java community. Thanks Anthony (who'll get an email from me requesting a removal of my account)!
I've redesigned the look of the site to achieve a fresher feel - at least I do hope so. Let me know if you hate it! ;)
Oh, and MovableType is a wonderful piece of blog software. No wonder it won the Webby Award for Best Practices.
-
Winners of JavaWorld 2002 Editors' Choice Awards
JavaWorld has announced the winners of the JavaWorld 2002 Editors' Choice Awards. These are the results (with my predictions ;))
Best Java Data Access Tool: Winner: Oracle 9iAS TopLink Finalists: CocoBase Enterprise O/R 4.5, Hibernate 1.2.4 My prediction: N/A Best Java IDE: Winner: IntelliJ IDEA 3.0 Finalists: Borland JBuilder 8.0, Eclipse 2.1 My prediction: Borland JBuilder 8.0 (makes me want to evalute IntelliJ IDEA) Best Java Performance Monitoring/Testing Tool: Winner: JUnit 3.8.1 Finalists: JProbe 5.0, Optimizeit Suite 5 My prediction: JUnit 3.8.1 (no doubts about this one) Best Java Application Server: Winner: BEA WebLogic Server 8.1 Finalists: IBM WebSphere Application Server 5.0, JBoss 3.0 My prediction: BEA WebLogic Server 8.1 (no doubts about this either) Best Java Device Application Development Tool: Winner: Java 2 Platform, Micro Edition (J2ME) Wireless Toolkit 2.0 Finalists: IBM WebSphere Studio Device Developer 5.0, Sun ONE Studio 4 Update 1 ME My prediction: J2METWK (I've used this and it's perfect! Sun ONE Studio ME is a little too cumbersome to use.) Best Java-XML Tool: Winner: Xerces2 Java Parser 2.4 Finalists: JAXB (Java Architecture for XML Binding), Xalan-Java 2.5 My prediction: N/A Best Java Installation Tool: Winner: Java Web Start 1.2 Finalists: InstallAnywhere 5, InstallShield MultiPlatform 5 My prediction: N/A Best Java Book: Winner: Patterns of Enterprise Application Architecture (Martin Fowler et al.) Finalists: Java Development with Ant, Java Performance Tuning, Second Edition My prediction: Java Development with Ant (I'm reading it now. And it is GOOD.) Most Useful Java Community-Developed Technology: Winner: Apache Ant 1.5 Finalists: Eclipse 2.1, Tomcat 4.1 My prediction: Apache Ant 1.5 (Of course) Most Innovative Java Product or Technology: Winner: AspectJ 1.0.6 Finalists: Eclipse 2.1, JavaServer Faces My prediction: N/A (unfortunately I've not caught up with what AspectJ is)
subscribe via RSS