radioAe6rt

A JXTA Shell extension: mkids

leave a comment »

When you do JXTA development, sooner or later you will need new IDs for various purposes.

I wanted to learn how to write a Shell extension, so I implemented a new “mkids” command for the Shell.

Compile it, jar it, and add it to the Shell classpath when invoking the Shell:

#! /bin/sh
release=Eso
platform=$HOME/JXTA/Release
cp=$platform/$release/shell/binding/java/jnlp/lib/jxtashell.jar
cp=$cp:$HOME/projects/ShellExtensions/lib/shellextensions.jar
for i in $platform/$release/platform/binding/java/jnlp/lib/*.jar ; do
    cp=$cp:$i
done
set -x

# Set JXTA_HOME
home=$HOME/.jxta
# Clear the cache - a good habit!
rm -rf $home/cm

# invocation from http://download.jxta.org/build/release/latest/jxta-shell-2.3.7.zip
java -DJXTA_HOME=$home -classpath $cp net.jxta.impl.peergroup.Boot

To use it, run the Shell with the script above, and when the console comes up, type “mkids” to produce output that looks like this:

JXTA>mkids
Peer Group  ID  = urn:jxta:uuid-3C47FAB8ADCE46A6BEA79C8BE5337AB902
Peer ID         = urn:jxta:uuid-3C47FAB8ADCE46A6BEA79C8BE5337AB9D05AA5B90193498FBB55BA14DDD8FEBB03
Module Class ID = urn:jxta:uuid-BDDCD6F4FBE74A91B5E5A2A6C0876D7205
Module Spec  ID = urn:jxta:uuid-BDDCD6F4FBE74A91B5E5A2A6C0876D7257B26DC9438C45D4AEAA9C877F34F3F206
Pipe ID         = urn:jxta:uuid-3C47FAB8ADCE46A6BEA79C8BE5337AB9A25E8DF27E114C24AC9FBF5AE9B2C2AD04

[tags]JXTA,p2p[/tags]

Written by radioae6rt

November 14, 2006 at 8:05 am

Posted in Internet

Leave a Reply