JINI™ NETWORK TECHNOLOGY FOR SMALL PLACES

This distribution contains experimental classes for running Jini Network Technology in small places, meaning Java devices that lack the Java 2 Standard Edition (J2SE).

See:
          Description

Packages
edu.rit.io Package edu.rit.io contains I/O classes that add capabilities to the standard java.io I/O package.
edu.rit.jini.discovery Package edu.rit.jini.discovery provides classes that implement the Jini discovery protocols, for use by a Jini service that implements (or masquerades as) the Jini Lookup Service.
edu.rit.jini.labinst Package edu.rit.jini.labinst defines an API for Jini-capable laboratory instruments.
edu.rit.jini.labinst.pmrmi Package edu.rit.jini.labinst.pmrmi contains an implementation of the Jini Meter Service which uses Poor Man's Remote Method Invocation (PMRMI) to communicate between the service proxy object and the service.
edu.rit.jini.labinst.pmrmi.j2sestub Package edu.rit.jini.labinst.pmrmi.j2sestub contains the client-side service proxy object for the PMRMI implementation of the Jini Meter Service, which runs in a J2SE environment.
edu.rit.jini.labinst.pmrmi.tiniserver Package edu.rit.jini.labinst.pmrmi.tiniserver contains the server-side service object for the PMRMI implementation of the Jini Meter Service, which runs on a Dallas Semiconductor TINITM board in a JDK 1.1 environment.
edu.rit.jini.labinst.pmrmi.tiniserver.rs22805 Package edu.rit.jini.labinst.tini.rs22805 contains classes for implementing the Jini Meter Service with the Dallas Semiconductor TINITM board interfacing to a Radio Shack #22-805 digital multimeter.
edu.rit.jini.lease Package edu.rit.jini.lease contains classes and interfaces for implementing leased remote objects using Poor Man's Remote Method Invocation (PMRMI).
edu.rit.jini.lease.pretend Package edu.rit.jini.lease.pretend contains an implementation of a lease where there are allocated resources that have to be deallocated when the lease expires or is canceled.
edu.rit.jini.lookup.entry Package edu.rit.jini.lookup.entry contains classes for various Jini service attributes.
edu.rit.jini.lookup.pretend Package edu.rit.jini.lookup.pretend contains the Pretend Lookup Service, a technique that allows a network-aware but non-J2SE-capable device to provide Jini services to a Jini federation.
edu.rit.jini.pmrmi Package edu.rit.jini.pmrmi defines a "Poor Man's Remote Method Invocation" API for use with JiniTM Connection Technology.
edu.rit.jini.watchdog Package edu.rit.jini.watchdog defines a Jini service interface for a "watchdog," used to determine if a remote service or system is responding.
edu.rit.net.http Package edu.rit.net.http contains classes for working with the HyperText Transfer Protocol (HTTP), including a bare-bones HTTP server.
edu.rit.util Package edu.rit.util contains generally-useful utility classes.

 

This distribution contains experimental classes for running Jini Network Technology in small places, meaning Java devices that lack the Java 2 Standard Edition (J2SE). This includes Java 2 Micro Edition Connected Limited Device Configuration (J2ME CLDC) devices as well as devices running JDK 1.1.

There are three principal components in this distribution:

I wrote and tested this distribution on a Windows 98 PC using JDK version 1.2.2 and Jini version 1.1 beta. The instructions below assume you're using that configuration. If you aren't, you'll have to adapt the instructions yourself.


Installing the Distribution

To install the distribution, unpack the ZIP file (smallplaces.zip) in a directory of your choice. You should see the following subdirectories under that top directory:

DirectoryContents
Java\ The portion of the distribution that is compiled and run on the host PC.
Java\clientlib\ Java source file and classfiles for a test client program for the Jini Meter Service. Batch files for running the test program.
Java\doc\ Documentation in javadoc format (you're reading it now). Browse to Java\doc\index.html.
Java\lib\ Java source files and classfiles for the distribution.
Java\project\ Batch files for building the distribution for the PC's J2SE environment.
Tini\ The portion of the distribution that is cross-compiled on the host PC and run on the TINI board.
Tini\download\ Executable image files and other files that are downloaded to the TINI board.
Tini\lib\ Java source files and classfiles that are cross-compiled for the TINI board, a subset of the Java\lib source tree. Each source file under Tini\lib is identical to its counterpart under Java\lib.
Tini\project\ Batch files for building the distribution for the TINI board's Java environment.


Studying the Distribution

To get an overview of what's in the distribution, look at the presentation I gave at the Fifth Jini Community Meeting in Amsterdam, the Netherlands, on December 12, 2000 -- "Running Jini Network Technology in Small Places." You can view the presentation on the Anhinga Project web site by clicking on the "Presentations" link.

To learn the details of what's in the distribution, I recommend the following course of study:

  1. Study package edu.rit.jini.pmrmi to learn about object transport and remote method invocation using PMRMI.

  2. Study package edu.rit.jini.lease to learn about remote leasing using PMRMI.

  3. Study package edu.rit.jini.lookup.pretend to learn about the Pretend Lookup Service.

  4. Study package edu.rit.jini.labinst to learn about the Jini Meter Service interface.

  5. Study package edu.rit.jini.labinst.pmrmi to learn about an example implementation of the Jini Meter Service that uses PMRMI to communicate between the service proxy object and the service.

  6. Study package edu.rit.jini.labinst.pmrmi.j2sestub to learn how to implement a client-side service proxy object that uses PMRMI and that runs in a J2SE environment, using the Jini Meter Service implementation as an example.

  7. Study package edu.rit.jini.labinst.pmrmi.tiniserver to learn how to implement a remote service that uses PMRMI, using the Jini Meter Service implementation as an example.

The remaining packages and classes in the distribution support the above packages.


Duplicating My Setup

Here's how to create an exact duplicate of my hardware and software environment. If your environment is different, you'll have to adapt on your own.

Hardware

Software

This software all runs on the PC.

Hookup -- Initial TINI Board Configuration

Follow the instructions in the TINI SDK to configure the TINI board. During initial configuration, the PC connects to the TINI board through a serial cable as shown above.

You must to set up the IP configuration for the two shaded boxes in the above diagram -- the TINI board's Ethernet interface and the PC's Ethernet NIC that will be connected to the experimental Jini network (I'll call this the PC's "Jini NIC"). Since this is an isolated network, you can assign them two arbitrary IP addresses within the same subnet.

Hookup -- Normal Operation

During normal operation, the PC, TINI board, and digital voltmeter are connected together as shown above. The PC's Jini NIC and the TINI board's Ethernet interface connect to the isolated Jini network via the Ethernet hub. The digital voltmeter connects to the TINI board's serial port through the null modem adapter.

Building and Running

  1. Define some environment variables by adding the following lines to your C:\AUTOEXEC.BAT file:

    set PCHOST=hostname of your PC
    set HTTP_SERVER_HOST=%PCHOST%
    set HTTP_SERVER_PORT=8080
    set JININET_NIC_ADDRESS=IP address of your PC's Jini NIC
    set JININET_TINI_ADDRESS=IP address of your TINI board's Ethernet interface
    set JAVA_HOME=SmallPlaces root directory\Java
    set JDK_HOME=JDK root directory
    set JINI_HOME=Jini SDK root directory
    set TINI_HOME=SmallPlaces root directory\Tini
    set TINI_SDK_HOME=TINI SDK root directory
    set TINI_MAC_ADDRESS=Hexadecimal MAC address of your TINI board's Ethernet interface

    The SmallPlaces root directory is the full pathname of the top-level directory where you unpacked this distribution. The JDK root directory is the full pathname of the top-level directory where you installed the JDK. The Jini SDK root directory is the full pathname of the top-level directory where you installed the Jini SDK. The TINI SDK root directory is the full pathname of the top-level directory where you installed the TINI SDK.

  2. Reboot your PC to put the above changes into effect.

  3. Compile all the SmallPlaces Java source files for the PC environment by running the %JAVA_HOME%\project\compileedurit.bat script. (I encourage you to look at the commands in this and the other batch scripts and figure out what they do.)

    The compiler will spit out one warning about calling a deprecated method: "Note: edu\rit\jini\discovery\MulticastDiscoveryServer.java uses or overrides a deprecated API." That source file calls the deprecated method MulticastSocket.setTTL(). This class is actually used on the TINI board, not on the PC. In the TINI board's JDK 1.1-compliant Java environment, this method is not deprecated.

  4. Make a JAR file containing just the classes needed to compile the Meter Display client program by running the %JAVA_HOME%\project\makeEduRitClientJar.bat script.

  5. Compile the Meter Display client program by running the %JAVA_HOME%\project\compileclientlib.bat script.

  6. Regenerate the javadoc by running the %JAVA_HOME%\project\runjavadoc.bat script.

  7. Copy the Java source files that must be cross-compiled for the TINI environment from the Java\ source tree to the Tini\ source tree by running the %TINI_HOME%\project\copysource.bat script.

  8. Cross-compile all the SmallPlaces Java source files for the TINI environment by running the %TINI_HOME%\project\compileall.bat script. Note that the cross-compilation is done using the PC's JDK 1.2.2 Java compiler with the TINI SDK's JDK 1.1 Java boot class library.

  9. Make the TINI executable file for the Jini Meter Service by running the %TINI_HOME%\project\makemeterservice.bat script. This creates the file %TINI_HOME%\download\MeterService.tini.

  10. Make a JAR file containing the codebase for the Pretend Lookup Service's and the Jini Meter Service's service proxy objects by running the %TINI_HOME%\project\makemsjlusjar.bat script. This creates the file %TINI_HOME%\download\msjlus.jar.

  11. Make a binary file containing the Pretend Lookup Service's serialized discovery response message plus other information the Jini Meter Service needs by running the %TINI_HOME%\project\makemsjlusser.bat script. This creates the file %TINI_HOME%\download\msjlus.ser.

  12. Add an entry to the Windows IP routing table to send traffic for the TINI board's IP address out over the PC's Jini NIC. Execute this command in a DOS command shell:

    route add %JININET_TINI_ADDRESS% mask 255.255.255.255 %JININET_NIC_ADDRESS% metric 1

    If you reboot Windows, you will have to repeat this command. If you wish, you can have Windows execute this command automatically by putting it in a batch script file in the C:\Windows\Start Menu\Programs\StartUp\ directory.

  13. Telnet to your TINI board and create two directories in your TINI board's file system by typing these commands:

    mkdir /bin
    mkdir /webroot

  14. FTP to your TINI board and upload the following files from your PC to your TINI board:

    %TINI_HOME%\download\msjlus.jar to the TINI board's /webroot directory
    %TINI_HOME%\download\msjlus.ser to the TINI board's /bin directory
    %TINI_HOME%\download\MeterService.tini to the TINI board's /bin directory

  15. Back in telnet, tell your TINI board to stop the PPP server, so the Jini Meter Service can use the serial port to talk to the digital voltmeter. Type this command:

    stopserver -s

    Hit y when it prompts you.

  16. Run the Jini Meter Service on your TINI board. Type these commands in telnet:

    cd /bin
    java MeterService.tini msjlus.ser &

  17. On your PC, verify that the TINI board's Pretend Lookup Service is operating using the Lookup Browser from the Jini distribution. Run the %JAVA_HOME%\clientlib\runLookupBrowser.bat script. If all is well, the Lookup Browser should do multicast discovery over the Jini network and discover a Lookup Service on the TINI board. The Lookup Browser should show two services registered, one the Pretend Lookup Service itself, the other the Jini Meter Service.

  18. On your PC, run the Meter Display client program by running the %JAVA_HOME%\clientlib\runMeterDisplay.bat script. If all is well, the Meter Display program should do multicast discovery over the Jini network find the Jini Meter Service on the TINI board, and display the service's icon and name at the top of the window.

The Meter Display Program

When the Meter Display program has started but before it discovers a Jini Meter Service, it looks like this:

When the Meter Display program has discovered a Jini Meter Service, it displays the service's icon and name at the top:

The Meter Display program shows the red "SERVICE IS DOWN" message whenever a RemoteException is thrown. This will happen when the program calls a Jini Meter Service method if the digital voltmeter is turned off or if any connection between the PC and the digital voltmeter fails.

Make sure the digital voltmeter is turned on, then click the Meter Display's "Read" button. The program gets one reading from the Jini Meter Service and displays it:

Click the "Start" button to cause the Jini Meter Service to report a new reading once every second. Click the "Stop" button to stop periodic readings again. Click the "Exit" button to exit the Meter Display program.


License Information

The documentation and Java source files in the Jini For Small Places Distribution ("The Software") are copyright © 2000, 2001 by the Rochester Institute of Technology. All rights reserved. For further information, contact the author, Alan Kaminsky, at ark@it.rit.edu.

Use and distribution of the Software are subject to the Sun Community Source License, Version 3.0, Jini Technology Specific Attachment, Version 1.0 (the License) available at http://sun.com/software/communitysource. You may not use the Software except in compliance with the License. Software distributed under the License is distributed on an AS IS basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.


Contact Information

This distribution is available to SCSL licensees from the Anhinga Project web site at http://www.cs.rit.edu/~anhinga. Click on the "Downloads" link. Please send questions, comments, and bug reports to the Anhinga Project email distribution list at mailto:anhinga@jini.org. Archives of the email DL are located at http://developer.jini.org/cgi-bin/wilma/anhinga.

Jini For Small Places is part of the Anhinga Project, an ongoing research effort in the Information Technology Laboratory of the Rochester Institute of Technology.

Alan Kaminsky
Senior Research Engineer
Information Technology Laboratory
Rochester Institute of Technology
102 Lomb Memorial Drive
Rochester, NY 14623-5608
USA
Phone: 716-475-6789
Fax: 716-475-7100
Email: ark@it.rit.edu
Web: http://www.cs.rit.edu/~ark


Revision History

16-Oct-2001
Fixed a bug in class edu.rit.jini.pmrmi.Stub: The IP address for reopening the DatagramSocket should be obtained from the DatagramSocket itself, otherwise the reopened DatagramSocket may not bind to the correct IP address on a multihomed host. (Thomas Preusser)
Fixed the same bug in class edu.rit.jini.pmrmi.Server. (Alan Kaminsky)
Changed class edu.rit.jini.labinst.pmrmi.j2sestub.MeterServiceProxy and class edu.rit.jini.labinst.pmrmi.j2sestub.MeterServiceRegistrar to work with the above fixes. (Alan Kaminsky)

07-Sep-2001
Fixed a bug in class edu.rit.jini.pmrmi.Stub: The invoke() method was not synchronized. (Thomas Preusser)
Fixed a bug in class edu.rit.io.LineInputStream: End of line was not detected properly in all cases. (Alan Kaminsky)

08-May-2001
First public distribution.

Jini For Small Places Version 16-Oct-2001



Copyright © 2000, 2001 by the Rochester Institute of Technology. All rights reserved. Contact Alan Kaminsky for further information.
Jini™ is a trademark of Sun Microsystems.