radioAe6rt

Dumping the JXTA Cache

leave a comment »

hamada kindly pointed out that there is utility code in platform/binding/java/contrib/cm/Dump.java that allows one to dump the JXTA cache articles without running JXTA and doing the same via the DiscoveryService.

Copy Dump.java to a working directory and compile:


#!/bin/sh
rel=Pavlova
jxtah=$HOME/JXTA/Release/${rel}/
javac -cp $jxtah/platform/binding/java/jnlp/lib/jxta.jar Dump.java

then run


#!/bin/sh

source $HOME/lib/JXTAfuncs.sh

function db() {
    # process db files
    flist=`find $apph/cm -name \*.tbl`
    for i in ${flist}; do
       echo Processing db ${i}
       java -cp ${cp} Dump -dir / -type db -file ${i}
    done
 }

function idx() {
    # process idx files
    flist=`find $apph/cm -name \*.idx`
    for i in ${flist}; do
       echo Processing index ${i}
       java -cp ${cp} Dump -dir / -type index -file ${i}
    done
 }

function offsets() {
    # process offset files
    flist=`find $apph/cm -type f|grep offsets`
    for i in ${flist}; do
       echo Processing offset ${i}
       java -cp ${cp} Dump -dir / -type offsets -file ${i}
    done
 }

function main() {
    unset cp
    rel=Pavlova
    jxtah=$HOME/JXTA/Release/${rel}/
    apph=${HOME}/Beacon
    cp=.
    jxtaclasspath $jxtah cp

    db
    idx
    offsets
 }

main

 

where $HOME/lib/JXTAfuncs.sh is


 function jxtaclasspath {
    local usage="Usage:  jxtaclasspath relHome outputvar"
    local classp
    jhome=${1:?need a JXTA_REL_HOME.  $usage}
    if [ ! -d $jhome ] ; then
       echo $jhome does not exist
       return -1
    fi
    tmp=${2:?need a output variable.  $usage}
    eval classp=\$$2
    for i in ${jhome}/platform/binding/java/jnlp/lib/*.jar ; do
       classp=${i}:${classp}
    done
    eval "$2=$classp"
    return 0
 }

 

The shell function jxtaclasspath takes two arguments, the base directory pointing at the platform build, and the shell classpath variable cp. cp is modified on output to contain a usable classpath to the platform jars. You will probably need to tweak the platform basedir jxtah, as well as apph, which points to the application JXTA_HOME.

[tags]jxta,p2p[/tags]

Written by radioae6rt

December 4, 2006 at 8:02 am

Posted in Internet

Leave a Reply