You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@river.apache.org by Gregg Wonderly <gr...@wonderly.org> on 2012/02/03 22:50:28 UTC

Starting the core Jini services

The batch file below, is what I use on windows machines, during development, to 
startup all the
core river services.  There are some things in here that are private to my 
"fork" of River where I
have some specific requirements.  I've tried to comment out, or remove the 
things that I think would
be fatal to using this for yourself.  But, ultimately, this is just using 
com.sun.jini.start to run everything.
Whatever is in the indicated configuration file is what will be run.   I've 
included my config file as well,
which has references to the use of some of my private jars, but should not cause 
problems because of that.

In some of the adjusting of the .bat below, I might have broke something, with a 
typo.  This should run, and if configured appropriately for your environment, it 
should just work.  I have a variation of this that I also use on UNIX machines, 
but that should be not much different from what is in the river dist.

Gregg Wonderly
======================================================================================
title Edge Broker Jini

set PROGFILES=C:\Program Files

REM all of this below just looks for the newest JDK version of those listed 
here, that you have
REM installed, and that is the one that it runs with.

REM try all the JDK5 first, prefer JDK7
if exist "%PROGFILES%\java\jdk1.5.0_03" set JAVA_HOME=%PROGFILES%\Java\jdk1.5.0_03
if exist "%PROGFILES%\java\jdk1.5.0_04" set JAVA_HOME=%PROGFILES%\Java\jdk1.5.0_04
if exist "%PROGFILES%\java\jdk1.5.0_05" set JAVA_HOME=%PROGFILES%\Java\jdk1.5.0_05
if exist "%PROGFILES%\java\jdk1.5.0_06" set JAVA_HOME=%PROGFILES%\Java\jdk1.5.0_06
if exist "%PROGFILES%\java\jdk1.5.0_07" set JAVA_HOME=%PROGFILES%\Java\jdk1.5.0_07
if exist "%PROGFILES%\java\jdk1.5.0_08" set JAVA_HOME=%PROGFILES%\Java\jdk1.5.0_08
if exist "%PROGFILES%\java\jdk1.5.0_09" set JAVA_HOME=%PROGFILES%\Java\jdk1.5.0_09
if exist "%PROGFILES%\java\jdk1.5.0_10" set JAVA_HOME=%PROGFILES%\Java\jdk1.5.0_10
if exist "%PROGFILES%\java\jdk1.5.0_11" set JAVA_HOME=%PROGFILES%\Java\jdk1.5.0_11

REM find the latest JDK6, prefer JDK7
if exist "%PROGFILES%\java\jdk1.6.0" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0
if exist "%PROGFILES%\java\jdk1.6.0_01" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_01
if exist "%PROGFILES%\java\jdk1.6.0_02" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_02
if exist "%PROGFILES%\java\jdk1.6.0_03" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_03
if exist "%PROGFILES%\java\jdk1.6.0_04" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_04
if exist "%PROGFILES%\java\jdk1.6.0_05" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_05
if exist "%PROGFILES%\java\jdk1.6.0_06" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_06
if exist "%PROGFILES%\java\jdk1.6.0_18" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_18
if exist "%PROGFILES%\java\jdk1.6.0_19" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_19
if exist "%PROGFILES%\java\jdk1.6.0_20" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_20
if exist "%PROGFILES%\java\jdk1.6.0_21" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_21
if exist "%PROGFILES%\java\jdk1.6.0_22" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_22
if exist "%PROGFILES%\java\jdk1.6.0_23" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_23
if exist "%PROGFILES%\java\jdk1.6.0_24" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_24
if exist "%PROGFILES%\java\jdk1.6.0_25" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_25
if exist "%PROGFILES%\java\jdk1.6.0_26" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_26
if exist "%PROGFILES%\java\jdk1.6.0_27" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_27
if exist "%PROGFILES%\java\jdk1.6.0_28" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_28
if exist "%PROGFILES%\java\jdk1.6.0_29" set JAVA_HOME=%PROGFILES%\Java\jdk1.6.0_29

REM find the latest JDK7
if exist "%PROGFILES%\java\jdk1.7.0" set JAVA_HOME=%PROGFILES%\Java\jdk1.7.0
if exist "%PROGFILES%\java\jdk1.7.0_01" set JAVA_HOME=%PROGFILES%\Java\jdk1.7.0_01
if exist "%PROGFILES%\java\jdk1.7.0_02" set JAVA_HOME=%PROGFILES%\Java\jdk1.7.0_02
if exist "%PROGFILES%\java\jdk1.7.0_03" set JAVA_HOME=%PROGFILES%\Java\jdk1.7.0_03
if exist "%PROGFILES%\java\jdk1.7.0_04" set JAVA_HOME=%PROGFILES%\Java\jdk1.7.0_04
if exist "%PROGFILES%\java\jdk1.7.0_05" set JAVA_HOME=%PROGFILES%\Java\jdk1.7.0_05
if exist "%PROGFILES%\java\jdk1.7.0_06" set JAVA_HOME=%PROGFILES%\Java\jdk1.7.0_06


echo JAVA_HOME=%JAVA_HOME%

REM we use these device names to allow each developer to have these trees rooted 
whereever
REM they want.  So, we use perforce, and I have these files all check into 
perforce, so during startup
REM a .bat file does:
REM
REM  subst t: c:\perforce\cyte
REM  subst t: c:\classes
REM
set MYROOT=t:
set MYCLS=j:

set jini=%MYROOT%/home/jini
cd %jini%
%MYROOT%

set jinip=%MYROOT%/home/jini/lib
set jiniw=%MYROOT%\home\jini\lib
set jini_dl=%MYROOT%/home/jini/lib-dl
set jiniw_dl=%MYROOT%\home\jini\lib-dl

set edge=%MYROOT%/home/edge

copy %MYCLS%\cytetech5.jar %jiniw%
copy %MYCLS%\logman.jar %jiniw%
copy %MYCLS%\swingutil1.5.jar %jiniw%
copy %MYCLS%\edge-ext.jar %jiniw%
set PRIVJARS=cytetech5.jar swingutil1.5.jar edge-ext.jar
set MOREJARS=logman.jar startnow.jar serviceui.jar

copy %MYCLS%\jini\cyte\lib\jsk-platform.jar %jiniw%
copy %MYCLS%\jini\cyte\lib\jsk-lib.jar %jiniw%
copy %MYCLS%\startnow.jar %jiniw%
copy %MYCLS%\serviceui.jar %jiniw%

del %jiniw%\startwrap.jar

set COMPNAME=%COMPUTERNAME%
set MYNAME=%COMPUTERNAME%

"%JAVA_HOME%\bin\java" ^
     -Djava.util.logging.config.file=%edge%\logging.properties ^
-classpath %jini%\lib\tools.jar com.sun.jini.tool.JarWrapper 
%jini%\lib\startwrap.jar %jini%/lib start.jar %PRIVJARS% jsk-platform.jar 
jsk-lib.jar start.jar %MOREJARS%

"%JAVA_HOME%\bin\java" ^
     -XX:CompileThreshold=10 ^
     -Djava.security.auth.login.config=%jini%/java.login.config ^
     -Dhost.name=%COMPNAME% ^
     -Djava.security.debug=trace,debug ^
     -Djini.home="%jini%" ^
     "-Djava.protocol.handler.pkgs=net.jini.url|com.cytetech.url" ^
     -Djini.libs=%jini%/lib ^
     -Djini_dl.libs=%jini%/lib-dl ^
     "-Djava.rmi.server.codebase=http://%COMPNAME%:8080/logman-dl.jar" ^
     -Dorg.wonderly.jini.logmanager.config.file="%jini%/logman.cfg" ^
     -Djava.util.logging.manager=org.wonderly.jini2.log.JiniLogManager ^
     -Dedge.libs=%edge%/classes ^
     -Dedge.home=%edge% ^
     "-Dlocal.host=%myname%" ^
     -Dcodebase.host=%compname% ^
     -Djava.util.logging.config.file=%edge%\logging.properties ^
     -Djava.security.policy=%jini%\config\jsk-all.policy ^
     -jar %jini%\lib\startwrap.jar ^
     %jini%\config\start-transient-jeri-services.config

pause

=======================================  start-transient-jeri-services.config 
=================================
import com.sun.jini.start.NonActivatableServiceDescriptor;
import com.sun.jini.start.ServiceDescriptor;
import net.jini.url.httpmd.HttpmdUtil;
import com.sun.jini.config.ConfigUtil;

com.sun.jini.start {
     //
     // Bootable Application Jar HTTPD Service
     //
     private static bhttpd_codebase = "";
     private static bhttpd_policy = "${jini.home}/config/jsk-all.policy";
     private static bhttpd_classpath = "${jini.libs}/tools.jar";
     private static bhttpd_impl = "com.sun.jini.tool.ClassServer";
     private static bhttpd_service =
         new NonActivatableServiceDescriptor(
             bhttpd_codebase, bhttpd_policy, bhttpd_classpath, bhttpd_impl,
             new String[]{"-port", "8080", "-dir", "${edge.libs}/", "-verbose"});

     //
     // Jini services HTTPD Service
     //
     private static httpd_codebase = "";
     private static httpd_policy = "${jini.home}/config/jsk-all.policy";
     private static httpd_classpath = "${jini.libs}/tools.jar";
     private static httpd_impl = "com.sun.jini.tool.ClassServer";
     private static httpd_service =
         new NonActivatableServiceDescriptor(
             httpd_codebase, httpd_policy, httpd_classpath, httpd_impl,
             new String[]{"-port", "8090", "-dir", "${jini_dl.libs}", "-verbose"});

     //
     // Fiddler (Lookup Discovery Service)
     //
     private static s_fiddler_codebase =
     ConfigUtil.concat( new String[] {
         HttpmdUtil.computeDigestCodebase(
         "${jini_dl.libs}",
         "httpmd://${codebase.host}:8090/fiddler-dl.jar;md5=0")," ",
         HttpmdUtil.computeDigestCodebase(
         "${jini_dl.libs}",
         "httpmd://${codebase.host}:8090/jsk-dl.jar;md5=0")
         } );
     private static fiddler_codebase =
     ConfigUtil.concat( new String[] {
         "http://${codebase.host}:8090/fiddler-dl.jar",
         " ",
         "http://${codebase.host}:8090/jsk-dl.jar"
     });
     private static fiddler_policy = "${jini.home}/config/jsk-all.policy";
     private static fiddler_classpath = 
"${edge.libs}/edge.jar${path.separator}${jini.libs}/fiddler.jar${path.separator}${edge.libs}/startnow.jar${path.separator}${edge.libs}/jsc-platform.jar${path.separator}${jini.libs}/jini-ext.jar${path.separator}${jini.libs}/jini-core.jar${path.separator}${edge.libs}/serviceui.jar";
     private static fiddler_config = "${jini.home}/config/transient-fiddler.config";
     private static fiddler_impl = "com.sun.jini.fiddler.TransientFiddlerImpl";
     private static fiddler_service =
         new NonActivatableServiceDescriptor(
             fiddler_codebase, fiddler_policy, fiddler_classpath,
         fiddler_impl, new String[] { fiddler_config });

     //
     // Mahalo (Transaction Service)
     //
     private static s_mahalo_codebase =
     ConfigUtil.concat( new String[] {
         HttpmdUtil.computeDigestCodebase(
             "${jini_dl.libs}",
             "httpmd://${codebase.host}:8090/mahalo-dl.jar;md5=0")," ",
         HttpmdUtil.computeDigestCodebase(
             "${jini_dl.libs}",
             "httpmd://${codebase.host}:8090/jsk-dl.jar;md5=0")
             } );
     private static mahalo_codebase =
     ConfigUtil.concat( new String[] {
             "http://${codebase.host}:8090/mahalo-dl.jar",
         " ",
             "http://${codebase.host}:8090/jsk-dl.jar",
         " ",
             "http://${codebase.host}:8080/serviceui.jar"
             });
     private static mahalo_policy = "${jini.home}/config/jsk-all.policy";
     private static mahalo_classpath = 
"${edge.libs}/edge.jar${path.separator}${edge.libs}/startnow.jar${path.separator}${edge.libs}/jsc-platform.jar${path.separator}${jini.libs}/mahalo.jar${path.separator}${edge.libs}/startnow.jar${path.separator}${jini.libs}/jini-ext.jar${path.separator}${edge.libs}/serviceui.jar${path.separator}${jini.libs}/jini-core.jar";
     private static mahalo_config = "${jini.home}/config/transient-mahalo.config";
     private static mahalo_impl = "com.sun.jini.mahalo.TransientMahaloImpl";
     private static mahalo_service =
         new NonActivatableServiceDescriptor(
             mahalo_codebase, mahalo_policy, mahalo_classpath,
         mahalo_impl, new String[] { mahalo_config });

     //
     // Mercury (Event Mailbox Service)
     //
     private static s_mercury_codebase =
     ConfigUtil.concat( new String[] {
         HttpmdUtil.computeDigestCodebase(
         "${jini_dl.libs}",
         "httpmd://${codebase.host}:8090/mercury-dl.jar;md5=0")," ",
         HttpmdUtil.computeDigestCodebase(
         "${jini_dl.libs}",
         "httpmd://${codebase.host}:8090/jsk-dl.jar;md5=0")
     } );
     private static mercury_codebase =
     ConfigUtil.concat( new String[] {
         "http://${codebase.host}:8090/mercury-dl.jar",
         " ",
         "http://${codebase.host}:8090/jsk-dl.jar"
         });
     private static mercury_policy = "${jini.home}/config/jsk-all.policy";
     private static mercury_classpath = 
"${edge.libs}/edge.jar${path.separator}${jini.libs}/mercury.jar${path.separator}${edge.libs}/startnow.jar${path.separator}${edge.libs}/jsc-platform.jar${path.separator}${jini.libs}/jini-ext.jar${path.separator}${edge.libs}/serviceui.jar${path.separator}${jini.libs}/jini-core.jar";
     private static mercury_config = "${jini.home}/config/transient-mercury.config";
     private static mercury_impl = "com.sun.jini.mercury.TransientMercuryImpl";
     private static mercury_service =
         new NonActivatableServiceDescriptor(
             mercury_codebase, mercury_policy, mercury_classpath,
         mercury_impl, new String[] { mercury_config });

     //
     // Norm (Lease Renewal Service)
     //
     private static s_norm_codebase =
     ConfigUtil.concat( new String[] {
         HttpmdUtil.computeDigestCodebase(
         "${jini_dl.libs}",
         "httpmd://${codebase.host}:8090/norm-dl.jar;md5=0")," ",
         HttpmdUtil.computeDigestCodebase(
         "${jini_dl.libs}",
         "httpmd://${codebase.host}:8090/jsk-dl.jar;md5=0")
         } );
     private static norm_codebase =
     ConfigUtil.concat( new String[] {
         "http://${codebase.host}:8090/norm-dl.jar",
         " ",
         "http://${codebase.host}:8090/jsk-dl.jar"
         });
     private static norm_policy = "${jini.home}/config/jsk-all.policy";
     private static norm_classpath = 
"${edge.libs}/edge.jar${path.separator}${jini.libs}/norm.jar${path.separator}${edge.libs}/startnow.jar${path.separator}${edge.libs}/jsc-platform.jar${path.separator}${jini.libs}/jini-ext.jar${path.separator}${edge.libs}/serviceui.jar${path.separator}${jini.libs}/jini-core.jar";
     private static norm_config = "${jini.home}/config/transient-norm.config";
     private static norm_impl = "com.sun.jini.norm.TransientNormServerImpl";
     private static norm_service =
         new NonActivatableServiceDescriptor(
             norm_codebase, norm_policy, norm_classpath,
         norm_impl, new String[] { norm_config });

     //
     // Outrigger (JavaSpaces Service)
     //
     private static s_outrigger_codebase =
     ConfigUtil.concat( new String[] {
         HttpmdUtil.computeDigestCodebase(
         "${jini_dl.libs}",
         "httpmd://${codebase.host}:8090/outrigger-dl.jar;md5=0")," ",
         HttpmdUtil.computeDigestCodebase(
         "${jini_dl.libs}",
         "httpmd://${codebase.host}:8090/jsk-dl.jar;md5=0")
         } );
     private static outrigger_codebase =
     ConfigUtil.concat( new String[] {
         "http://${codebase.host}:8090/outrigger-dl.jar",
         " ",
         "http://${codebase.host}:8090/jsk-dl.jar"
         });
     private static outrigger_policy = "${jini.home}/config/jsk-all.policy";
     private static outrigger_classpath = 
"${edge.libs}/edge.jar${path.separator}${jini.libs}/outrigger.jar${path.separator}${edge.libs}/startnow.jar${path.separator}${edge.libs}/jsc-platform.jar${path.separator}${jini.libs}/jini-ext.jar${path.separator}${edge.libs}/serviceui.jar${path.separator}${jini.libs}/jini-core.jar";
     private static outrigger_config = 
"${jini.home}/config/transient-outrigger.config";
     private static outrigger_impl = 
"com.sun.jini.outrigger.TransientOutriggerImpl";
     private static outrigger_service =
         new NonActivatableServiceDescriptor(
             outrigger_codebase, outrigger_policy, outrigger_classpath,
         outrigger_impl, new String[] { outrigger_config });

     //
     // Reggie (Lookup Service)
     //
     private static s_reggie_codebase =
     ConfigUtil.concat( new String[] {
         HttpmdUtil.computeDigestCodebase(
         "${jini_dl.libs}",
         "httpmd://${codebase.host}:8090/reggie-dl.jar;md5=0")," ",
         HttpmdUtil.computeDigestCodebase(
         "${jini_dl.libs}",
         "httpmd://${codebase.host}:8090/jsk-dl.jar;md5=0")
         } );
     private static reggie_codebase =
     ConfigUtil.concat( new String[] {
         "http://${codebase.host}:8090/jsk-dl.jar",
         " ",
         "http://${codebase.host}:8090/reggie-dl.jar"
         });
     private static reggie_policy = "${jini.home}/config/jsk-all.policy";
     private static reggie_classpath = 
"${edge.libs}/edge.jar${path.separator}${jini.libs}/reggie.jar${path.separator}${edge.libs}/startnow.jar${path.separator}${edge.libs}/jsc-platform.jar${path.separator}${jini.libs}/jini-ext.jar${path.separator}${edge.libs}/serviceui.jar${path.separator}${jini.libs}/jini-core.jar";
     private static reggie_config = "${jini.home}/config/transient-reggie.config";
     private static reggie_impl = "com.sun.jini.reggie.TransientRegistrarImpl";
     private static reggie_service =
         new NonActivatableServiceDescriptor(
             reggie_codebase, reggie_policy, reggie_classpath,
         reggie_impl, new String[] { reggie_config });

     static serviceDescriptors = new ServiceDescriptor[] {
         // jhttpd_service,
         httpd_service,
         bhttpd_service,
         reggie_service,
//        fiddler_service,
//        mahalo_service,
//        mercury_service,
//        norm_service,
//        outrigger_service
     };
}