Jul  25, 2005

        onlpara, Fedora Core 3 上で JXTA のデモ・プログラムを実行
          		---  JXTA のデモ・プログラム実行 #2
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
               (http://www-online.kek.jp/~inoue/para-CAMAC/
                                   Work/onlpara-JXTA2.html)



                        高エネルギー加速器研究機構
                            素粒子原子核研究所
                         物理、オンライングループ
                                井上 栄二

        目的

	    onlpara で稼動している Fedora Core 3 上で JXTA のデモ・プログラム、
	    Hello World を実行する。


        項目

        (1). JXTA のチュートリアル・プログラムを入手
        (2). 入手したパッケージを展開
        (3). Hello Worldデモ・プログラムを実行


  --------------------------------------------------------------------

 (1). JXTA のデモ・プログラムを入手

	JXTAプロジェクトのJXTA のチュートリアル・サイトから、デモ・プログラムを
	ダウンロードする。


 (2). 入手したパッケージを展開

[inoue@onlpara JXTA]$ cd jxta_devguide
[inoue@onlpara jxta_devguide]$ pwd
/home/inoue/JXTA/jxta_devguide
[inoue@onlpara jxta_devguide]$ ls
HelloWorld   JxtaBiDiPipe   PeerGroupDiscovery  SecurePeerGroup
JXTAService  JxtaSocket     PipeService         lib
JoinDemo     PeerDiscovery  PublishDemo
[inoue@onlpara jxta_devguide]$ cd H*
[inoue@onlpara HelloWorld]$ ls
SimpleJxtaApp.class  SimpleJxtaApp.java  runIt.bat  runit.sh
[inoue@onlpara HelloWorld]$ ls -l
合計 32
-rw-r--r--  1 inoue inoue 1666  4月  8 06:41 SimpleJxtaApp.class
-rw-rw-rw-  1 inoue inoue 4082  3月 10  2004 SimpleJxtaApp.java
-rw-r--r--  1 inoue inoue   91  1月 19  2005 runIt.bat
-rwxr-xr-x  1 inoue inoue  118  1月 19  2005 runit.sh
[inoue@onlpara HelloWorld]$


 (3). Hello Worldデモ・プログラムを実行

[inoue@onlpara HelloWorld]$ pwd
/home/inoue/JXTA/jxta_devguide/HelloWorld
[inoue@onlpara HelloWorld]$
[inoue@onlpara HelloWorld]$ java -version
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)
[inoue@onlpara HelloWorld]$
[inoue@onlpara HelloWorld]$ export DISPLAY=onlnote2.kek.jp:0
[inoue@onlpara HelloWorld]$
[inoue@onlpara HelloWorld]$ ls -l
合計 32
-rw-r--r--  1 inoue inoue 1666  4月  8 06:41 SimpleJxtaApp.class
-rw-rw-rw-  1 inoue inoue 4082  3月 10  2004 SimpleJxtaApp.java
-rw-r--r--  1 inoue inoue   91  1月 19  2005 runIt.bat
-rwxr-xr-x  1 inoue inoue  118  1月 19  2005 runit.sh
[inoue@onlpara HelloWorld]$

	JXTA Hello World デモ・プログラムを実行する。

[inoue@onlpara HelloWorld]$ ./runit.sh
Starting JXTA ....
:146> JXTA_HOME = /home/inoue/JXTA/jxta_devguide/HelloWorld/client
 PlatformConfig does not exist
 jxta.properties reset /home/inoue/JXTA/jxta_devguide/HelloWorld/client/jxta.properties
 Platform Config not found : /home/inoue/JXTA/jxta_devguide/HelloWorld/client/PlatformConfig
 Log4Jlogging preference not set, using defaults
 Reconfig requested - New PlatformConfig Advertisement
 Reconfig requested - Missing peer name
 Reconfig requested - http advertisement missing, making a new one.
 Reconfig requested - tcp advertisement missing, making a new one.
 Reconfig requested - PSE wanted config
 Reconfig requested - relay advertisement missing, making a new one.
 Reconfig requested - rendezvous advertisement missing, making a new one.
 Log4J[user default] requested, not adjusting logging priority
 Log4J[user default] requested, not adjusting logging priority
Hello from JXTA group NetPeerGroup
  Group ID = urn:jxta:jxta-NetGroup
  Peer name = KEKpeer2
  Peer ID = urn:jxta:uuid-59616261646162614A787461503250336F258954F73C4EF3BDCDADF6138A9C6503
Good Bye ....
[inoue@onlpara HelloWorld]$

	参考:
	  プログラムの実行途中で、JXTAコンフィグレーションのウィンドウが開くの
	  で適切に入力する。

	ok.  Hello World プログラムは正常に実行できた。

	注:
	  JXTAコンフィグレーションのウィンドウは一回目の実行時にのみ表示され、
	  二回目からは表示されない。


[inoue@onlpara HelloWorld]$ ls -l
合計 40
-rw-r--r--  1 inoue inoue 1666  4月  8 06:41 SimpleJxtaApp.class
-rw-rw-rw-  1 inoue inoue 4082  3月 10  2004 SimpleJxtaApp.java
drwxrwxr-x  3 inoue inoue 4096  7月 25 13:41 client
-rw-r--r--  1 inoue inoue   91  1月 19  2005 runIt.bat
-rwxr-xr-x  1 inoue inoue  118  1月 19  2005 runit.sh
[inoue@onlpara HelloWorld]$ cat runit.sh
#!/bin/sh
java -DJXTA_HOME=client -classpath ../lib/jxta.jar:../lib/log4j.jar:../lib/bcpro
v-jdk14.jar:. SimpleJxtaApp
[inoue@onlpara HelloWorld]$
[inoue@onlpara HelloWorld]$ cat SimpleJxtaApp.java
/*
 * Copyright (c) 2001 Sun Microsystems, Inc.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by the
 *       Sun Microsystems, Inc. for Project JXTA."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Sun", "Sun Microsystems, Inc.", "JXTA" and "Project JXTA" must
 *    not be used to endorse or promote products derived from this
 *    software without prior written permission. For written
 *    permission, please contact Project JXTA at http://www.jxta.org.
 *
 * 5. Products derived from this software may not be called "JXTA",
 *    nor may "JXTA" appear in their name, without prior written
 *    permission of Sun.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of Project JXTA.  For more
 * information on Project JXTA, please see
 * .
 *
 * This license is based on the BSD license adopted by the Apache Foundation.
 *
 */

import net.jxta.peergroup.PeerGroup;
import net.jxta.peergroup.PeerGroupFactory;
import net.jxta.exception.PeerGroupException;

/**
 *  This is a simple example of how an application would start jxta
 */

public class SimpleJxtaApp {

    static PeerGroup netPeerGroup = null;

    public static void main(String args[]) {

        System.out.println("Starting JXTA ....");
        SimpleJxtaApp myapp = new SimpleJxtaApp();
        myapp.startJxta();

        System.out.println("Hello from JXTA group " +
                           netPeerGroup.getPeerGroupName() );
        System.out.println("  Group ID = " +
                           netPeerGroup.getPeerGroupID().toString());
        System.out.println("  Peer name = " +
                           netPeerGroup.getPeerName());
        System.out.println("  Peer ID = " +
                           netPeerGroup.getPeerID().toString());
        System.out.println( "Good Bye ....");
        myapp.netPeerGroup.stopApp();
        System.exit(0);
    }

    private void startJxta() {
        try {
            // create and start the default JXTA NetPeerGroup
            netPeerGroup = PeerGroupFactory.newNetPeerGroup();
        } catch (PeerGroupException e) {
            // could not instantiate the group, print the stack and exit
            System.out.println("fatal error : group creation failure");
            e.printStackTrace();
            System.exit(1);
        }
    }
}
[inoue@onlpara HelloWorld]$ ls -l
合計 40
-rw-r--r--  1 inoue inoue 1666  4月  8 06:41 SimpleJxtaApp.class
-rw-rw-rw-  1 inoue inoue 4082  3月 10  2004 SimpleJxtaApp.java
drwxrwxr-x  3 inoue inoue 4096  7月 25 13:41 client
-rw-r--r--  1 inoue inoue   91  1月 19  2005 runIt.bat
-rwxr-xr-x  1 inoue inoue  118  1月 19  2005 runit.sh
[inoue@onlpara HelloWorld]$
[inoue@onlpara HelloWorld]$ ls -lR client
client:
合計 24
-rw-rw-r--  1 inoue inoue 3961  7月 25 13:41 PlatformConfig
drwxrwxr-x  4 inoue inoue 4096  7月 25 13:41 cm
-rw-rw-r--  1 inoue inoue  445  7月 25 13:37 jxta.properties

client/cm:
合計 16
drwxrwxr-x  3 inoue inoue 4096  7月 25 13:41 jxta-NetGroup
drwxrwxr-x  2 inoue inoue 4096  7月 25 13:41 jxta-WorldGroup

client/cm/jxta-NetGroup:
合計 116
-rw-rw-r--  1 inoue inoue 12288  7月 25 13:41 advertisements-AdvDstPID.idx
-rw-rw-r--  1 inoue inoue 12288  7月 25 13:41 advertisements-AdvMSID.idx
-rw-rw-r--  1 inoue inoue 12288  7月 25 13:41 advertisements-PeersName.idx
-rw-rw-r--  1 inoue inoue 12288  7月 25 13:41 advertisements-PeersPID.idx
-rw-rw-r--  1 inoue inoue  9216  7月 25 13:41 advertisements-offsets.tbl
-rw-rw-r--  1 inoue inoue 24576  7月 25 13:41 advertisements.tbl
drwxrwxr-x  2 inoue inoue  4096  7月 25 13:41 srdi

client/cm/jxta-NetGroup/srdi:
合計 48
-rw-rw-r--  1 inoue inoue 5120  7月 25 13:41 pipeResolverSrdi-offsets.tbl
-rw-rw-r--  1 inoue inoue 5120  7月 25 13:41 pipeResolverSrdi.tbl
-rw-rw-r--  1 inoue inoue 5120  7月 25 13:41 routerSrdi-offsets.tbl
-rw-rw-r--  1 inoue inoue 5120  7月 25 13:41 routerSrdi.tbl

client/cm/jxta-WorldGroup:
合計 144
-rw-rw-r--  1 inoue inoue 12288  7月 25 13:41 advertisements-AdvMSID.idx
-rw-rw-r--  1 inoue inoue 12288  7月 25 13:41 advertisements-GroupsDesc.idx
-rw-rw-r--  1 inoue inoue 12288  7月 25 13:41 advertisements-GroupsGID.idx
-rw-rw-r--  1 inoue inoue 12288  7月 25 13:41 advertisements-GroupsName.idx
-rw-rw-r--  1 inoue inoue 12288  7月 25 13:41 advertisements-PeersName.idx
-rw-rw-r--  1 inoue inoue 12288  7月 25 13:41 advertisements-PeersPID.idx
-rw-rw-r--  1 inoue inoue  9216  7月 25 13:41 advertisements-offsets.tbl
-rw-rw-r--  1 inoue inoue 32256  7月 25 13:41 advertisements.tbl
[inoue@onlpara HelloWorld]$
[inoue@onlpara HelloWorld]$
[inoue@onlpara HelloWorld]$ cat client/PlatformConfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jxta:CP>
<jxta:CP type="jxta:PlatformConfig" xmlns:jxta="http://jxta.org">
        <PID>
                urn:jxta:uuid-59616261646162614A787461503250336F258954F73C4EF3BDCDADF6138A9C6503
        </PID>
        <Name>
                KEKpeer2
        </Name>
        <Desc>
                Platform Config Advertisement created by : net.jxta.impl.peergroup.DefaultConfigurator
        </Desc>
        <Svc>
                <MCID>
                        urn:jxta:uuid-DEADBEEFDEAFBABAFEEDBABE0000000505
                </MCID>
                <Parm type="jxta:PSEConfig" xmlns:jxta="http://jxta.org>
                        <RootCert>
                                <Certificate>
                                        MIICDDCCAXWgAwIBAgIBATANBgkqhkiG9w0BAQUF
ADBMMRUwEwYDVQQKEwx3d3cuanh0YS5vcmcx
FDASBgNVBAMTC0tFS3BlZXIyLUNBMR0wGwYDVQQLExRBNjJGMTZENzFGNzhEQUI1QjYwNDAeFw0w
NTA3MjUwNDQxMzFaFw0xNTA3MjUwNDQxMzFaMEwxFTATBgNVBAoTDHd3dy5qeHRhLm9yZzEUMBIG
A1UEAxMLS0VLcGVlcjItQ0ExHTAbBgNVBAsTFEE2MkYxNkQ3MUY3OERBQjVCNjA0MIGfMA0GCSqG
SIb3DQEBAQUAA4GNADCBiQKBgQC8LsN6qIt//tn2eZvK5QnujEbAY2hG38zHgbfr6Vov+utBnpO2
X1BfIag/oJgFI8r6mxyW61Bk7bfvMs2Aoce2lkIJbdrxHKJiHTe64Llp/9WRnIOcxdxvgL9NSGvl
liIRXsFr1COY5UtoY5CqGpPh1YUc4gnc4omeK6HpgtOmqwIDAQABMA0GCSqGSIb3DQEBBQUAA4GB
AEipjerr5X5rB9d+pzOLZimlBJSzaxmzVNd32c0lv/E8/zmfasF1eb2oxe459BnQCatMeL4rEuos
9MSDo9DD5T1i+/vGX2VgMBhfxfZuJhQlKV8ohs1sfNIvcaEV/2RXreo0yATGfss0ijCaIBLB/vWw
9bBgKN3977X8stSe6Sm+
                                </Certificate>
                                <EncryptedPrivateKey algorithm="RSA">
                                        MIICoTAbBgkqhkiG9w0BBQMwDgQIK5D9a/Ffht4C
AgH0BIICgNRXOdKSSSEjYBx+fvjKwQP5pmC7
h6SgpgdBWM8GIs6XHICmWKs7/8VU+7ADWOvWWCQ7dYPpUukhxjjGjro1HX3Xu1t1OwkkcnoTvv+r
0WTh3FDvfS/oOxGY2y6c1pXMkWlGhVN/dh5zlIG5ld6mgL7YdMB33tg3KiTi259ZVi9icnNHD+Ye
4lUTrB4fuRe1hZE+P/+ZZ+Smqa90Wy3M/+b2MRZlBjEMo+B+iQRZlD8RqZkGMBzGwbPXDSf6L/lz
9iiSf5aeLg/RRhqPxxkTqxVyctQhcPQE9XkL/owUWGJICQWx7/h2smjL9xBVelKVLumpG5Kikh2U
B7CIeOb1LLWRBj3lnpXBbLpLLJO/qgH2Wv/Gzh4msEQ6o3WTdu4neLsnF5eOr/zq768ke/nmVlP/
orx9vawq5Rwe9s8n043WutGP3R6fHck3EILb1+QEqffihHixdBeUr0l5t+9RjqWI1gIsRA45HNNe
QcdfjCoqE/yBJQ00n1FVLoSx7jVA0lxPpc4apxVngR147Z40ovccwh9xYaMNsiN3DCifFcsr9C9x
CE/C00G33YKMJhLFQ5fInD2LHxwtJnX2Bi98WEeM2hd4V33kH1IKnKyD/sH2AN3hwGL1b3PJj/dl
pyvnkVEmymczlHWHN9IfGq8GGC2inQgUphGacQObi5jLsxMSLSUWAOiXhxYHI276HoyUpkrurr4e
+CmpttYpQwDRB0h+BTifkTtu0gke7q3Qog3MT1wleN+JJbXs/q7horxSwQzMvpelV6mlOy7IT35G
hu1e3EtOWP6yDP4Qv+gLcf6YcfEgaO6E7iqhMNLfIYGh9JYxanDSUpb9PLhmuPVbqt0=
                                </EncryptedPrivateKey>
                        </RootCert>
                </Parm>
        </Svc>
        <Svc>
                <MCID>
                        urn:jxta:uuid-DEADBEEFDEAFBABAFEEDBABE0000000A05
                </MCID>
                <Parm>
                        <jxta:TransportAdvertisement xmlns:jxta="http://jxta.org" type="jxta:HTTPTransportAdvertisement">
                                <Protocol>
                                        http
                                </Protocol>
                                <InterfaceAddress/>
                                <ConfigMode>
                                        auto
                                </ConfigMode>
                                <Port>
                                        9700
                                </Port>
                                <ProxyOff/>
                                <ServerOff/>
                        </jxta:TransportAdvertisement>
                </Parm>
        </Svc>
        <Svc>
                <MCID>
                        urn:jxta:uuid-DEADBEEFDEAFBABAFEEDBABE0000000E05
                </MCID>
                <Parm>
                        <isOff/>
                </Parm>
        </Svc>
        <Svc>
                <MCID>
                        urn:jxta:uuid-DEADBEEFDEAFBABAFEEDBABE0000000605
                </MCID>
                <Parm type="jxta:RdvConfig" config="client" xmlns:jxta="http://jxta.org">
                        <seeds>
                                <addr seeding="true">
                                        http://rdv.jxtahosts.net/cgi-bin/rendezvous.cgi?2
                                </addr>
                        </seeds>
                </Parm>
        </Svc>
        <Svc>
                <MCID>
                        urn:jxta:uuid-DEADBEEFDEAFBABAFEEDBABE0000000F05
                </MCID>
                <Parm type="jxta:RelayConfig" xmlns:jxta="http://jxta.org">
                        <client>
                                <seeds>
                                        <addr seeding="true">
                                                http://rdv.jxtahosts.net/cgi-bin/relays.cgi?2
                                        </addr>
                                </seeds>
                        </client>
                        <server/>
                        <isOff/>
                </Parm>
        </Svc>
        <Svc>
                <MCID>
                        urn:jxta:uuid-DEADBEEFDEAFBABAFEEDBABE0000000905
                </MCID>
                <Parm>
                        <jxta:TransportAdvertisement xmlns:jxta="http://jxta.org" type="jxta:TCPTransportAdvertisement">
                                <Protocol>
                                        tcp
                                </Protocol>
                                <ConfigMode>
                                        auto
                                </ConfigMode>
                                <Port>
                                        9701
                                </Port>
                                <MulticastAddr>
                                        224.0.1.85
                                </MulticastAddr>
                                <MulticastPort>
                                        1234
                                </MulticastPort>
                                <MulticastSize>
                                        16384
                                </MulticastSize>
                        </jxta:TransportAdvertisement>
                </Parm>
        </Svc>
</jxta:CP>
[inoue@onlpara HelloWorld]$ ls -l client
合計 24
-rw-rw-r--  1 inoue inoue 3961  7月 25 13:41 PlatformConfig
drwxrwxr-x  4 inoue inoue 4096  7月 25 13:41 cm
-rw-rw-r--  1 inoue inoue  445  7月 25 13:37 jxta.properties
[inoue@onlpara HelloWorld]$
[inoue@onlpara HelloWorld]$
[inoue@onlpara HelloWorld]$
[inoue@onlpara HelloWorld]$
[inoue@onlpara HelloWorld]$ cat client/jxta.properties
# JXTA Properties

# The minimum and maximum size of the thread pools for the http server
HttpServer.MinThreads = 10
HttpServer.MaxThreads = 200

# how long (in millis) an http request has to finish transferring before the
# http server discards the request (in millis)
HttpServer.MaxRequestReadTime = 60000

# how long (in millis) a thread in the thread pool is allowed to be idle before
# it is reclaimed
HttpServer.MaxThreadIdleTime = 120000
[inoue@onlpara HelloWorld]$ ls -l client
合計 24
-rw-rw-r--  1 inoue inoue 3961  7月 25 13:41 PlatformConfig
drwxrwxr-x  4 inoue inoue 4096  7月 25 13:41 cm
-rw-rw-r--  1 inoue inoue  445  7月 25 13:37 jxta.properties
[inoue@onlpara HelloWorld]$ ls -l client/cm
合計 16
drwxrwxr-x  3 inoue inoue 4096  7月 25 13:41 jxta-NetGroup
drwxrwxr-x  2 inoue inoue 4096  7月 25 13:41 jxta-WorldGroup
[inoue@onlpara HelloWorld]$

	ok.  onlpara のマシン上での JXTA Hello World デモ・プログラムは正常に
	実行できた。





---xxxx