Archive for the 'Java' Category

Face Time with JXTA and Shoal Engineers

The second day at the show was a little more of a grind than the first. Aching feet and all that. But the reaction was still overwhelmingly positive. I had more of a chance to have some chats with the JXTA team and also with one of the people responsible for the Shoal project.

It seems the JXTA team is pining for a new book on JXTA and at least one person suggested I write it! (Uh… yeah… in my plentiful spare time!) I must admit it’s tempting. Another temptation to consume time I don’t really have came from a Shoal engineer interested in a) integrating Shoal with Spring for declarative clustering of Spring apps, and b) using this method to cluster JXTA super-peers (that was actually my idea, since our super-peers are Spring apps.)

Finally someone from Sun’s ISV Engineeering team was very enthusiastic about the idea of us porting our app–or some variation on it–to SavaJe, and since we’ve been considering a mobile version, it’s definitely worth a look-see.

We’ve met a lot of our goals for this conference, so the last day should be pretty easy-going. As Leigh says, the last thing we’re hoping for is a visit from a Java Rock Star.

“Wow. Cool…”

We heard a fair bit of that yesterday here at the oponia “pod” in the Java Playground @ JavaOne 07. We’ve all become pretty slick at giving the demo and Leigh is mastering the art of snagging total strangers and forcing them to watch it. Most of them end up being glad they did. Another thing we’ve been hearing quite a bit is: “hey, this actually looks really useful.” Umm… yeah. We kinda planned it that way, but we’re glad you agree. ;-)

We had some pretty stiff competition for attention from the singing, dancing Robosapiens, the world’s fastest robot, and a Java-powered submarine. (It is a playground, after all.) Many thanks to Mike Duigou and Henry Jen for their fabulous demos of oponia’s ucaster in the JXTA pod.

I didn’t get to look around too much myself, but the coolest thing I’ve seen so far (besides the Robosapiens) was the Sunspot programmable sensor technology. Maybe today Mark and I will go find out what Nokia and Motorola are doing here. Well, we’re due back on the floor in a few minutes so… more later.

oponia at JavaOne

I’m thrilled to announce that we (oponia networks) will be premiering our “hyper-simple” sharing and collaboration platform at JavaOne this year. You’ll find us in the Java Playground in the Pavilion from May 8 to 10.

More info on the product will be available before the show (our team is working frantically on the material now), and I’ll post again when it’s ready to share.

I’d like to say a very special “Thank you!” to Bernard Traversat and Stephanie Kaul of Sun for providing us with this opportunity to showcase our JXTA-based product in such a great venue. Hope to see you there!

Gosling Appointed to Order of Canada

I guess it’s a big day for awards! My friend Eric points out that James Gosling, probably best known as the creator of Java, has been appointed to the Order of Canada by the Governor General. The CBC has more…

Configuring a JXTA Peer in Spring

Important update: This article is old and out of date. This method will no longer work with the current version of the JXTA platform. I am looking into what changes might be required to the platform and/or the example. I’ll post the results in a new entry and link to it here when it’s ready. I notice many people searching for JXTA+Spring configuration and landing here. Sorry for the inconvenience. VW, 23/07/2008

The new net.jxta.platform.NetworkConfigurator class provides a clean and straightforward way to configure an instance of the JXTA platform without a UI. It can be used programmatically (see the main() method for an example of stand-alone use) or—because it is a Java Bean—declaratively deployed inside containers like Spring.

Here is a simple example of a Spring context file, applicationContext-rdv.xml, which configures a Rendezvous Server:


    
        
.jxta
        
2752
        

             urn:jxta:uuid-XXXXXXXXXXXXXXXXXXXXXXXXXX...
        
        

            uuid-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        

           MyNetPG
        

            My Infrastructure Group
        
        

           com.mycompany RDV1
        

           Rendezvous Node
        
user
pwd
        
9700
9701
    

    

    

And here’s what MyJxtaBean.java might look like, in part:


public class MyJxtaBean {

    private NetworkConfigurator netConfig;

    private PeerGroup infrastructureGroup;

    public MyJxtaBean() {}

    public setNetConfig(NetworkConfigurator netConfig) {
        this.netConfig = netConfig;
    }

    public synchronized void start() {

        /*
        * Simplest case, we don't overwrite an existing configuration, nor
        * do we load and alter/ammend it. Only if there is no PlatformConfig
        * available, construct a new one using the bean's properties.
        */
        if (!netConfig.exists()) {
            try {
                netConfig.save();
            } catch (IOException io) {
                System.out.println("Error saving PlatformConfig");
            }
        }

        try {
            infrastructureGroup = PeerGroupFactory.newNetPeerGroup();
        } catch (PeerGroupException pge) {
            System.out.println("Couldn't create NetPeerGroup");
            System.exit(1);
        }
    }
}

Now all your applicaton has to do is get the MyJxtaBean from the context and call start() to start the JXTA platform.


    applicationContext =
        new ClassPathXmlApplicationContext("applicationContext-rdv.xml");
    myPlatform = (MyJxtaBean)applicationContext.getBean("myJxtaBean");
    myPlatform.start();

There’s more to writing a JXTA application, of course, but I hope this example demonstrates how NetworkConfigurator takes some of the mystery out of JXTA plaform configuration, while making it easy to combine JXTA and Spring.

Update: April 10, 2007 Christopher Marsh-Bourdon points out a flaw in this example when used with Spring 2.0.1. It’s related to the specification of the JXTA home directory. You can read Christopher’s analysis of Spring’s FileEditor Anomaly and solution to the probelm here. Thanks, Christopher.

All Feeds Lead to Rome

There’s probably no completely painless way to deal programmatically with the tangled mess of syndication formats, but the Rome project is looking promising. Unlike the Jakarta Commons FeedParser, Rome not only parses feeds but also provides:

  • RSS-specific, Atom-specific, and generalized object models–handy if you want to persist feeds after you’ve parsed them;
  • generators for all syndication formats;
  • conversion from any format to any other.

Apparently, there’s some co-operation brewing between the FeedParser and Rome folks, which will no doubt be good news for Java feed hackers everywhere.