
NCSA Habanero - Version 3.0
&
- Version 1.0Users Guide
National Center for Supercomputing Applications
University of Illinois
605 East Springfield Ave
Champaign, IL 61820
Copyright and Licensing
Copyright 1995-2001, Board of Trustees of the University of Illinois, All Rights Reserved
NCSA Habanero software, binary, Java-bytecode, and source (hereafter, Software) is copyrighted by The Board of Trustees of the University of Illinois (UI), and ownership remains with the UI.
The UI grants you (hereafter, Licensee) a license to use the Software for academic, research and internal business purposes only, without a fee. Licensee may distribute the binary and source code (if released) to third parties provided that the copyright notice and this statement appears on all copies and that no charge is associated with such copies.
Licensee may make derivative works. However, if Licensee distributes any derivative work based on or derived from the Software, then Licensee will (1) notify NCSA regarding its distributing of the derivative work, and (2) clearly notify users that such derivative work is a modified version and not the original NCSA Habanero distributed by the UI.
Any Licensee wishing to make commercial use of the Software should contact the UI, c/o NCSA, to negotiate an appropriate license for such commercial use. Commercial use included (1) integration of all or part of the Software into a product for sale or license by or on behalf of Licensee to third parties, or (2) distribution of the Software to third parties that need it to utilize a commercial product sold or licensed by or on behalf of Licensee.
UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE USERS OF THIS SOFTWARE.
By using or copying this Software, Licensee agrees to abide by the copyright law and all other applicable laws of the U.S. including, but not limited to, export control laws, and the terms of this license. UI shall have the right to terminate this license immediately by written notice upon Licensee's breach of, or non-compliance with, any of its terms. Licensee may be held legally responsible for any copyright infringement that is caused or encouraged by Licensee's failure to abide by the terms of this license.
U.S. GOVERNMENT RESTRICTED RIGHTS
The Software and/or user documentation are provided with RESTRICTED AND LIMITED RIGHTS. Use, duplication or disclosure by or to the United States government shall be subject to restrictions as set forth in subparagraph (c)(1)(ii) of Defense Federal Acquisition Regulations Supplement (DFARS) Section 252.227-7013 for Department of Defense contracts and as set forth in Federal Acquisition Regulations (FAR) Section 52.227-19 for civilian agency contracts or any successor regulations. Contractor/Manufacturer is The Board of Trustees of the University of Illinois, Urbana, Illinois 61801.
Trademarks
NCSA Habanero is a registered trademark of the Board of Trustees of the University of Illinois. All brand and product names are trademarks or registered trademarks of their respective holders.
Commercial Licensing, Questions, Comments, Suggestions
For information, contact the Principal Investigator, Larry S. Jackson
Table of Contents
Introduction
NCSA - Scientific Collaboration Systems
Habanero and ISAAC Working in Concert
Installation and Configuration
Habanero
Windows (NT, 98/95)
UNIX
Windows (NT, 98/95)
UNIX
ISAAC Services
The Asynchronous Service in ISAAC
Behind the scenes of the Asynchronous Services
Adding Asynchronous Capability to a Hablet
The Habanero Server
The Habanero Client
File extensions
The Collaborative Tools
mpEdit
Life of a Habanero event
Appendix B
Adding Asynchronous Capability to a Hablet
Sample Asynchronous Handler Code
Appendix C
Creating a Hablet that can open File Extensions:
Introduction
Established in 1985 with a National Science Foundation grant, the National Center for Supercomputing Applications (NCSA) opened to the national research community in January 1986. NCSA is a high-performance computing and communications facility designed to server U.S. computational science and engineering communities. Located on the campus of the University Of Illinois at Urbana-Champaign (UIUC), NCSA is funded by the National Science Foundation, the State of Illinois, the University of Illinois, other Federal Agencies and industrial partners.
NCSA is the leading-edge site for the National Computational Science Alliance (Alliance). In this capacity, NCSA anchors all Alliance teams and oversees the administration of all Alliance programs. NCSA leads the Alliance in its mission to maintain American preeminence in science and technology.
The Scientific Collaboration Systems group (SCS) was dedicated to the development of tools that could improve communication and data visualization for the scientific community. SCS is primarily focused on developing Java applications that provide this cross-platform capability. A couple of these projects include NCSA Habanero and NCSA Java3D.
NCSA Habanero is the result of the Integration of Synchronous And Asynchronous Collaboration (ISAAC) research effort funded by the Intelligent Collaboration & Visualization (IC&V) program of the Information Technology Office (ITO) in the Defense Advanced Research Projects Agency (DARPA) under grant number N66001-96-C-8511.
NCSA Habanero provides a framework or API for developers and a collaborative environment and set of tools for users. Habanero facilitates synchronous and asynchronous collaboration. Using Habanero you can interact with other people through a variety of applications when your system is connected to the Internet. Habanero offers developers the libraries needed to create or convert Java applications and applets into collaborative applications.
The Habanero client and server provide the necessary environment to create collaborative virtual workspaces. The server hosts sessions and connects the clients that interact with the sessions using a variety of applications called Hablets. Sessions can be recorded, persistent, access restricted and even anonymous. The Habanero client provides the interface to define, list, create, join and interact with a session. The client provides session information, user identification, a notification mechanism, record and replay capabilities, security, a list of active users and tools, an address book and the capability to easily create session templates. The Habanero server is capable of hosting multiple sessions and the client is capable of joining multiple sessions with multiple unique instances of the tools.
The ISAAC Services provide a core set of Jini based services that work in concert to provide centralized notification services, a persistent object store and an interface to a logical database. Habanero 3.0 is the first client and serve to take advantage of these services. The notification services, (NOTIF), provide event notification to the client, server and other services. The persistent object store, (POS), provides a central repository for any file type. The logical database, (LDB), provides metadata about the objects stored in the POS. Habanero’s Asynchronous, (ASYNC), capability is built on these services and allows users to access to information from synchronous sessions.
Habanero and ISAAC Working in Concert
When the ISAAC services are available, the Habanero client and server register themselves with a Jini lookup server, which coordinates with the ISAAC services. The Habanero client provides additional panels that allow access a list of available sessions, the repository of files and recorded session data. Through the panels, a session participant can add, delete, save or load data from the POS; load or search recorded session data and view available session information. The ASYNC services also allow a participant to leave an active session and still maintain contact with the session’s events through a web page.
The asynchronous service can be decomposed into two parts. The first part is the notification listener that receives asynchronous notifications from the notification service and stores them into a database. The second part of the service is an HTTPD server and java servlets that read the database and construct the web pages for viewing.
When a participant chooses the "Make Asynchronous" option, a special notification is sent by the client to the server and the server redirects events for that client to the asynchronous service. The Habanero server now treats this participant as being asynchronous and forwards all of the predefined async events to the asynchronous handlers (i.e. whiteboard events to the whiteboard handler and chat events to the chat handler, etc.). The various handlers create notifications with the appropriate hablet specific information and send these to the notification service. The asynchronous service, which subscribes to receive all such notifications, is forwarded the notifications from each server as they occur. Thus, the asynchronous service can receive notifications from many ongoing sessions simultaneously and can produce the web pages for many different participants simultaneously as well.
The ISAAC services and Habanero server work together using the Jini services framework. They also share a common set of interfaces. It is important to note that because services are only ever interacted with through established interfaces, that the implementations of these services are interchangeable. So that if a different database or HTTPD application were desired for use in the asynchronous service -- as long as the new implementation implemented the existing interfaces, it could be exchanged readily. The Jini framework makes adding, removing, or replacing services simple.
A Summary of Habanero with ISAAC Services

|
Session Services Session Directory
Recorded Data
File Repository
MIME Services
E-mail Sessions
|
Session templates
Security
Address Book
|
Launch Client from a Web Browser
Record Data
Replay Data
|
A Summary of Habanero without ISAAC Services

When the ISAAC Services are not available to Habanero, it will not display the ISAAC graphical user interfaces to the asynchronous services, however Habanero remains a useful tool for synchronous collaboration.
|
Session Services MIME Services
E-mail Sessions
Address Book
|
Session templates
Security
|
Launch Client from a Web Browser
Record Data
Replay Data
|
Installation and Configuration
Habanero 3.0 and the ISAAC Services were written in Java. They will run under any operating system that support:
Habanero 3.0
JDK/JRE v1.2.2 http://java.sun.com/jdk/
JINI v1.0 http://java.sun.com/jini/
JavaBeans Activation Framework v1.0.1
ISAAC 1.0
JDK/JRE v1.2.2 http://java.sun.com/jdk/
JINI v1.0 http://java.sun.com/jini/
Jigsaw v2.1.0 http://www.w3.org/Jigsaw/
Java Servlet v 2.0 http://java.sun.com/products/servlet/index.html
Stored Objects v.090 (formerly available at http://www.jdbms.org/, but that site is gone now).
Instantdb v1.91 http://www.instantdb.co.uk/
The recommended operating systems include: Solaris (Sparc) & Microsoft Windows (95, 98, NT, W2K)
The following describes installation under Windows and Unix. Differences in the operating systems are addressed at each step and sample scripts for each OS are provided at the end.
c:\<windows directory>\profiles\<userid> directory. Drag and drop the habanero.rsc folder to this directory. For example: c:\winnt\profiles\smith NOTE: You can override default directory, using the "-Duser.home=" switch on the command line. For example, you can put the habanero.rsc folder in any directory and invoke the client or server in this manner:
UNIX
java -mx24m -Duser.home=/usr/local/etc/habanero3.0 HabaneroWindows
java -mx24m -Duser.home=c:\\habanero3.0 Habanero
NOTE 2: The switch –mx24m instructs the Java interpreter to provide Habanero 24 megabytes of virtual memory.
UNIX habanero.home=/usr/local/etc/habanero3.0
Windows habanero.home=c:\\habanero3.0
UNIX dir.record=/home/smith/capture
Windows dir.record=c:\\habanero3.0\\capture
UNIX & Windows jini.lookup=jini://morefun.ncsa.uiuc.edu
rmi.codebase=http://<your systems name or IP>:<port number>
UNIX & Windows rmi.codebase=http://vortex.ncsa.uiuc.edu:9090
UNIX & Windows classfileserver.port=9090
UNIX dir.resource=/home/smith/habanero.rsc/temp
Windows dir.resource=c:\\habanero3.0\\habanero.rsc\\temp
UNIX dir.scratch=/home/smith/habanero.rsc/temp
Windows dir.scratch=/home/smith/habanero.rsc/temp
The class used to invoke the Habanero client is
"Habanero". For example:
java -mx24m Habanero
The class used to invoke the Habanero server is,
"HabaneroServer".
java -mx24m HabaneroServer
NOTE: If you have changed the default location of the habanero.rsc directory use the command line example from the NOTE in step 6.
Habanero Script Examples - Windows (NT, 98/95)
General Notes about writing script files:
UNIX
chmod 755 HabaneroClient
chmod 755 HabaneroServer
Windows
A Sample Habanero Client Batch File (habanero.bat)
@ECHO OFF SET RISTRA=d:\h3 SET JAVA=d:\java\jre1.2.2 SET JINI=d:\java\jini1_0 SET PATH=%JAVA%\bin;%RISTRA%\rsc\lib\w95;%PATH% SET HABANERO=%RISTRA% SET HABANERO=%HABANERO%;%RISTRA%\rsc\jars\activation.jar SET HABANERO=%HABANERO%;%RISTRA%\rsc\jars\mail.jar SET HABANERO=%HABANERO%;%RISTRA%\rsc\jars\sound.jar SET HABANERO=%HABANERO%;%RISTRA%\rsc\jars\jgl3.1.0.jar SET HABANERO=%HABANERO%;%RISTRA%\rsc\jars\NewWhiteBoard.jar SET SERVICES=%JINI%\lib\jini-core.jar SET SERVICES=%SERVICES%;%JINI%\lib\jini-examples.jar SET SERVICES=%SERVICES%;%JINI%\lib\jini-ext.jar SET SERVICES=%SERVICES%;%JINI%\lib\mahalo.jar SET SERVICES=%SERVICES%;%JINI%\lib\reggie.jar SET SERVICES=%SERVICES%;%JINI%\lib\sun-util.jar SET SERVICES=%SERVICES%;%JINI%\lib\tools.jar SET CLASSPATH=.;%JAVA%\java\lib\classes.zip;%SERVICES%;%HABANERO% SET JAVA_COMPILER=NONE ECHO Starting the Habanero Client. ECHO Press Ctrl-C in this window to terminate the Client. java –Xmx24m -Duser.home=%RISTRA% Habanero
UNIX - A C-Shell style script for the Habanero Client
#!/usr/bin/csh
# JKD defines the location of JDK1.2.
# RISTRA defines the location of the Habanero classes.
# JINI defines the location of the JINI 1.0 lib directory.
# HABANERO defines the library dependencies of the Habanero client and server.
setenv JDK /java/sun/jdk1.2
setenv RISTRA /home/tmclaren/habanero/ristra
setenv JINI /java/sun/jini1_0/lib
setenv PATH $JKD/bin:$PATH
setenv LD_LIBRARY_PATH $RISTRA/rsc/lib/Solaris:$LD_LIBRARY_PATH
# Habanero 3.0 CLASSPATH dependencies
setenv HABANERO ${RISTRA}
setenv HABANERO ${HABANERO}:$RISTRA/rsc/jars/jgl3.1.0.jar
setenv HABANERO ${HABANERO}:$RISTRA/rsc/jars/mail.jar
setenv HABANERO ${HABANERO}:$RISTRA/rsc/jars/activation.jar
setenv HABANERO ${HABANERO}:$JINI/jini-core.jar
setenv HABANERO ${HABANERO}:$JINI/jini-examples.jar
setenv HABANERO ${HABANERO}:$JINI/jini-ext.jar
setenv HABANERO ${HABANERO}:$JINI/mahalo.jar
setenv HABANERO ${HABANERO}:$JINI/reggie.jar
setenv HABANERO ${HABANERO}:$JINI/sunutil.jar
setenv HABANERO ${HABANERO}:$JINI/tools.jar
# Define CLASSPATH based on the above declarations.
setenv CLASSPATH .
setenv CLASSPATH ${CLASSPATH}:$JDK/lib/classes
setenv CLASSPATH ${CLASSPATH}:$HABANERO
java -mx24m -Duser.home=%RISTRA% Habanero
A Korn-Shell Style Script for the Habanero Server
#!/bin/ksh
set JDK=/java/sun/jdk1.2
set RISTRA=/usr/local/etc/habanero3.0
set JINI=/java/sun/jini1_0/lib
set PATH=$PATH:./$JDK/bin:/usr/bin:/usr/ucb:/usr/sbin
set LD_LIBRARY_PATH=${RISTRA}/rsc/lib/Solaris:$LD_LIBRARY_PATH
# Habanero 3.0 CLASSPATH dependencies
set HABANERO=${RISTRA}
set HABANERO=${HABANERO}:$RISTRA/rsc/jars/jgl3.1.0.jar
set HABANERO=${HABANERO}:$RISTRA/rsc/jars/mail.jar
set HABANERO=${HABANERO}:$RISTRA/rsc/jars/activation.jar
set HABANERO=${HABANERO}:$JINI/jini-core.jar
set HABANERO=${HABANERO}:$JINI/jini-examples.jar
set HABANERO=${HABANERO}:$JINI/jini-ext.jar
set HABANERO=${HABANERO}:$JINI/mahalo.jar
set HABANERO=${HABANERO}:$JINI/reggie.jar
set HABANERO=${HABANERO}:$JINI/sunutil.jar
set HABANERO=${HABANERO}:$JINI/tools.jar
set CLASSPATH=.:$JDK/lib/classes.zip:$HABANERO
java -mx24m -Duser.home=$RISTRA HabaneroServer
The NCSA owned files for the ISAAC services are available in the /isaac directory of the Habanero package. Each service is self-contained in its own sub-directory. There are four services and sub-directories that include Asynchronous (async), Logical database (ldb), Notification (notification), and Persistent Object Store (pos). Each directory contains the necessary classes, property files and sample scripts for the service. There is also an /isaac/scripts directory that contains sh scripts for Unix. These scripts start and stop the services, redirect the stdout and stderr messages into log files found in /isaac/scripts/logs and track the process IDs in the /isaac/scripts/PIDs directory.
The ISAAC services are dependent on classes from Habanero’s /ncsa/isaac directory and other 3rd party software packages. We assume you will run ISAAC on a system where these classes and packages are available. The services run as stand-alone processes on any system that is correctly configured and connected to the Internet. The list of ISAAC dependencies include:
Habanero 3.0
JDK/JRE v1.2.2
http://java.sun.com/beans/glasgow/jaf.html
ISAAC 1.0
JDK/JRE v1.2.2 http://java.sun.com/jdk/
JINI v1.0 http://java.sun.com/jini/
Jigsaw v2.1.0
http://www.w3.org/Jigsaw/Java Servlet v 2.0 http://java.sun.com/products/servlet/index.html
Stored Objects v.090
http://www.jdbms.org/Installation of each service involves:
The following sections will describe the installation process for each ISAAC service.
The files for the asynchronous services are located in the /isaac/notif directory. The async service is dependent on the following 3rd party components:
JINI v1.0 [jini-ext.jar, sun-util.jar, jini-core.jar]
NOTE: Include the following jars in the CLASSPATH statement of the scripts: jini-ext.jar, sun-util.jar & jini-core.jar.
Windows (NT, 98/95) – Edit the batch files found in the /isaac/notification directory to reflect the correct paths on your system.
UNIX - Edit the scripts found in /isaac/scripts directory.
Persistent Object Store (POS)
The files for the asynchronous services are located in the /isaac/pos directory. The async service is dependent on the following 3rd party components:
JINI v1.0 [jini-ext.jar, sun-util.jar, jini-core.jar]
NOTE: Include the following jars in the CLASSPATH statement of the scripts: jini-ext.jar, sun-util.jar & jini-core.jar.
Windows (NT, 98/95) – Edit the batch files found in the /isaac/pos directory to reflect the correct paths on your system.
UNIX - Edit the scripts found in /isaac/scripts directory.
The files for the asynchronous services are located in the /isaac/ldb directory. The async service is dependent on the following 3rd party components:
JINI v1.0 [jini-ext.jar, sun-util.jar, jini-core.jar]
Instantdb v1.91 [instantdb.jar]
3. Configure the start-up scripts.
NOTE: Include the following jars in the CLASSPATH statement of the scripts: jini-ext.jar, sun-util.jar & jini-core.jar.
Windows (NT, 98/95) – Edit the batch files found in the /isaac/ldb directory to reflect the correct paths on your system.
UNIX - Edit the scripts found in /isaac/scripts directory.
The asynchronous services files are located in the /isaac/async directory. The async service is dependent on the following 3rd party components:
JavaBeans Activation Framework v1.0.1 [activation.jar]
JINI v1.0
[jini-ext.jar, sun-util.jar, jini-core.jar]
Java Servlet v 2.0
[jsdk.jar]
http://java.sun.com/products/servlet/index.html
Jigsaw v2.1.0
[jigsaw.jar, sax.jar, xp.jar]
Stored Objects v.090
[storedobj090.jar]
Java Mail v1.1.2
[mail.jar] http://java.sun.com/products/javamail/index.html
NOTE: Include the following jars in the CLASSPATH statement: activation.jar, jini-ext.jar, sun-util.jar, jini-core.jar, jsdk.jar, jigsaw.jar, sax.jar, xp.jar, storedobj090.jar, mail.jar.
Windows (NT, 98/95) – Edit the batch files found in the /isaac/async directory to reflect the correct paths on your system.
UNIX - Edit the scripts found in /isaac/scripts directory.
Starting the ISAAC Services
The start sequence is important because of interdependencies. The Jini services must start first and then the ISAAC services. The ISAAC Async service is also dependent on a db and jigsaw processe. Scripts have been written to help simplify this process. Each service contains scripts in their respective directories. And a central script directory contains the necessary scripts for Jini and ISAAC. If tThe initital start-up should be performed While each service has its own start-up script, it is recommended you use the scripts that were provided and edited by you during the installation process. The scripts are platform specific and include:
Windows (NT, 98/95) - use the start_ISAAC_svcs.bat
UNIX - use the startAll script in the /isaac/scripts directory.
Manual Start Sequence for ISAAC:
¨ Start the httpd server that is used by RMI (/scripts/jini/start_rmid_run.bat)
¨ Start RMI daemon (/scripts/jini/start_httpd_srv.bat)
¨ Start Jini lookup service (/scripts/jini/start_jini_lookup.bat)
¨ Start xaction service (/scripts/jini/start_xaction.bat)
¨ Start ISAAC notification service (/scripts/isaac/start_notification.bat)
¨ Start ISAAC pos service (/scripts/isaac/start_pos.bat)
¨ Start ISAAC ldb service (/scripts/isaac/start_LDB.bat)
* you should see one or all of the following messages:
Type 'q' <enter> to shutdown LDB Service
Type 'r' <enter> to rebuild the database
Type 'l' <enter> to see how many lookups have been joined VerifyTimer.run()
Type 'v' <enter> to correct and verify session status
* first time users should select r to build the tables in the db.
¨ Start ISAAC async service
* NOTE: The following scripts need to run before you start the Async service
1) initialize the db (/isaac/async/initializeDB.bat)
2) start Jigsaw (/isaac/async/jigsaw/scripts/jigsaw.bat)
3) start async (/scripts/isaac/start_Async.bat)
When terminating services you should type 'q' <enter> in the console window if possible. Doing this allows the service to unregister itself with Jini. If you use control-c instead, it will take Jini a few moments realize that the service is down and unregister it.
Using the Asynchronous Service in ISAAC
The asynchronous services of ISAAC are described, and illustrated with AVI movies, on the ISAAC project website. The asynchronous service of the ISAAC environment make it possible for a participant to leave an active session and still keep in-touch with the session events through a web browser. When a user leaves a session using the "Make Asynchronous" option from the Connect, Leave and... menu, the session's server sends the events for that client to the LDB marked with the user's ID and the session name. The user can then view these events from a web page on a predefined site.
To gain access to the data a user has to log into the web site by entering their participant name from the Habanero ID card and leaving the password blank. The password capability was not implemented for the 3.0 alpha release and only a valid user id is required to gain access to the data.

NOTE: The login is case sensitive
Once in the site, a servlet queries the LDB for available session data relevant to the user's ID and it generates a list of asynchronous sessions in an HTML format. A user can have multiple async sessions and the data is persistent, thus it can be referenced at anytime in the future.

After a session name is selected the servlet again queries the LDB for the specific events related to that session name and time stamp and returns the session details in an HTML format.
Not all hablets produce asynchronous events -- special handlers are needed in the tools code so the event information is translated into a useable web format. Furthermore, not all hablets lend themselves to textual or visual representation of their events, such as the Audio Chat tool. Currently, only the whiteboard, text chat, mpEdit, and voting tool hablets provide asynchronous output. There are also session management events that get displayed such as participants leaving or joining the session. The async pages are designed to provide a user a very quick and easy to understand synopsis of what has occurred (is occurring) in the session.
The information available from the web page includes the user's name, session name, a time stamp of the session, an email address link back to the session, two sort options and a refresh capability. By pressing the "Refresh" button the user can get live updates of events as they are received from the session.

A capability of sending email to a session exists if the server is running with the mail server option. The async web page provides a mailto link back to the active session and allows async users to send email and attachments to the session. However, as mentioned above, the Habanero server hosting the session must be running with its mailserver option. See the Habanero Server section for more details about running a server with its mail server option.
When the mailto link is clicked, the local email program is invoked and will allow the user to send a message. If a default email program is not available, you can still send email to a session using the following email address format:
<sessionName>PORT<number>@server.name.hosting.the.session
i.e. Sample_SessionPORT2000@morefun.ncsa.uiuc.edu
Note: Underscores, _, are inserted in the place of white space.
i.e. Sample Session = Sample_Session
Note: The ability of a Habanero server may be hindered by local security policies. Not all email servers are configured to allow mail to pass to other systems within their domain. You may need assistance from your local network administrators to all this condition to exist for the machine hosting the Habanero server.
The email sent to a session is available to both active (synchronous) and inactive (asynchronous) participants. The active clients can view the email and attachments through the Habanero client. The inactive clients see the email and attachments as another event that has occurred in the session. The email attachments follow the same mime type rules, as do the session items in the LDB explorer and can be redirected to the appropriate tool for display.
Lastly, if an asynchronous service is not available when a participant goes asynchronous, the system will revert back to its default mode of sending asynchronous events via email to the users email address that is listed in user ID.
The Habanero Server
The Habanero server runs as a background process and does not have a graphical user interface (GUI). The process is started from a command line console and will display messaging about the state of the server, stdout, and error messages, stderr. The server has a variety of command line switches that will you to customize the behavior of the server. Once the server process is started, Ctrl + C is only command that the console window will accept and is used to terminates the server process. Under UNIX the Habanero Server can be run as a background process or in the foreground with the console window minimized. Under Windows, the console window This window can be minimizedIt is typically started from a counsel window and any all messages are displayed in the counsel. The server is the link between the clients and acts as a reflector of events to the various Habanero clients during a Habanero session. The server also interacts with the active tools of a session by providing arbitration. All tools use the server’s default arbitrator to distinguish tool events. Some tools have additional arbitrator code, which provides rules checking, locks and gateway services to the various tools. All tool arbitration code runs at the server side.
The Habanero server supports multiple sessions and distinguishes each session by name. The session names are case sensitive. Thus, the session, "Sample Session", is considered a different session from "sample session". All sessions are initiated through the client.
The server is instantiated from a script or the command line. See the installation instructions for details.
The server supports additional configuration options through command line parameters or switch statements. You can us any number of the switches in any order. The switches include:
java Habaneroserver -listen 2112
java HabaneroServer -dbrecord
java HabaneroServer -debug
-mailserver
The Habanero framework provides the ability to email a running session. The email message can then be read and attachments can be viewed by using Habanero's file extension capabilities.
java HabaneroServer – mailserver
NOTE: You may have to register your computer as a system that is authorized to receive mail. Contact your system administrator before using this service.
Use the following email address syntax to send email including attachments to a Habanero session.
<Session Name>PORT<Port Number>@<Session Host>
For example:
Sample_SessionPORT2000@morefun.ncsa.uiuc.edu
NOTE: The blank spaces in the session name get replaced with underscores.
The Habanero Client

Primary controls
Many of the controls that can be accessed through the Menus can be accessed through the Toolbar as well. So I will cover the Menus themselves, and where appropriate, point out which Toolbar button does the corresponding action. It should be noted here also that most controls will have tooltips accessible by simply letting the mouse pointer linger over the desired control.
Connect Menu
Go to Session… This is the same as the first toolbar button, all the way on the left, with two computers connected by a cable. This control allows you to join a session if it exists, and if it doesn't, the client will seamlessly create a session with the specified name on the specified machine and port.
Join Session… This is the same as the second toolbar button from the left, with the merge sign as an icon. This control allows you to join a session at the specified name/machine/port combination. If no such session exists, the join process will fail with a dialog informing you.
Create Session… This control has no corresponding toolbar button. This control allows you to create a session with the specified name/machine/port combination. This will not allow you to join a session. If such a session already exists, the create process will fail with a dialog informing you.
Leave Session… This corresponding toolbar button is the third from the left, the exit sign. This control causes you to leave a session without any special cases. (i.e. a simple leaving action)
Leave Session and
Make Session Local No toolbar button. This causes you to leave the session but maintain state and move to a local mode. (i.e. in session without an active server)
Leave Session and
Stop the Session No toolbar button. This causes you to leave the session and, if you are the owner of the session, stop the session itself causing the session to drop all other participants and shut itself down.
Leave Session and
Make Asynchronous No toolbar button. This causes you to leave the session from a synchronous standpoint. You will remain part of the session as an asynchronous participant and can check session events and items through the asynch service.
Exit Habanero No toolbar button. Shuts down the client. Same effect as clicking on the "close-window" button on the frame. (i.e. the x in Windows) If you are part of a session, a dialog will ask you if you really want to exit.
Session Tools Menu
Launch MDBrowser Launches the early tool that was used to test and access the services before the new controls were integrated into the client environment.
Mime Type Browser Opens the control that allows you to view mime settings and create new ones. This is in a separate free floating frame.
Query Server for
Sesssions Opens the early control for searching a server for sessions and allowing the client to join the selected session.
Begin Recording Corresponding toolbar button is the 4th button from the left, with an image of a recording marker as an icon. This control brings up a dialog that allows you to set a directory to record to, and whether or not to log the recording with the LDB. Upon closing that dialog, the recording process will be initiated for that session.
Playback a Session
Local Batch Replay No toolbar button. Brings up a dialog box that allows you to browse to the local directory that captured files are on, and allows you to set the replay speed. Upon selecting 'OK', the replay process begins and it is a "hands-off" replay with no way to alter or stop the replay.
Playback a Session
Local GUI Controlled
Replay The toolbar button is the 5th from the left. The icon is a video camera and tapes. This allows you to select a directory for the recorded session files, and then loads up the session and the Replay Control GUI. From here, control of playing back the session is handled through the controls found on the Replay Control GUI.
Playback a Session
Distributed Replay No tollbar button. Brings up a dialog that allows you to select a session to replay, set a speed, and set a session name, server and port. Upon completing this dialog, another will be presented allowing clients to join your replay session. When ready, closing this second dialog will begin the replay of the session without controls.
User Menu
View Mail Toolbar button is 12th from the left, with a mail envelope and computer as icon. This brings up the mail browser for Habanero session mail.
Tile all Frames Toolbar button is 13th from the left, with two stacked frames as an icon. This control tiles all the internal frames on the desktop.
Cascade all Frames Toolbar button is 14th from the left, with 3 cascading frames as an icon. This control cascades all the internal frames on the desktop.
Information Menu
Session Information Toolbar button is 6th from the left, with a green background "i" as an icon. This control brings up the internal frame for Session Information. While in a session, this panel allows you to see the details of a session. While in Template Mode, this allows you to set session details as well as manipulate the Template Utilities. (i.e. create, delete, edit templates)
Tools in Use Toolbar button is 7th from the left, with a collection of tools as an icon. This control brings up an internal frame that shows which tools are currently active in the session. The icons for the tools can be moved around and are persistent for as long as the session is active. The icons have right-click functionality to bring forward or push backwards a given tool.
Security Information Toolbar button is 8th from the left, with a padlock and keys as an icon. This control, in template mode, allows a user to set up security for a session before actually creating the session. Otherwise when joining a session or when actuall in a session, this control only allows the viewing of the current security settings.
Participants Toolbar button is 9th from the left, with two people as an icon. This control allows one to view which participants are in a session. The icons reflect the users current image and information, and if someone changes anything while in sessions, that change will propogate to all clients. Icons can be moved around and grouped as seen fit. The icons also have right-click functionality to display a users full id, their full image, send mail to, or send a beep to the participant.
View Map Toolbar button is 10th from the left, with a globe as an icon. This control allows one to view the set locations for each participant in a given session. Right click functionality allows you to see all participants at one location and by selecting a single participant, to then view their ID, send them mail, or send them a beep.
Addressbook Toolbar button is 11th from the left, with a phone and addressbook as an icon. This control currently does not work.
Help Menu:
About Habanero No toolbar button. This control brings up the copyright frame.
Physical Layout
The environment is broken up into three main areas. The right-hand side is the desktop, where the various information panels and other session specific panels can be viewed and arranged. This is also where the LDB Explorer resides.
The left-hand side consists of two portions. The upper section are session controls and LDB panels, the lower portion is the Tools Palette.
Session control and LDB view panels
Main Tab This tab is the default tab, and it contains a list of existing Templates (i.e. pre-defined session configurations). From this panel you can select a Template, or simply enter in a new session name, server address, and server port number. By hitting enter in any of these three text fields, you do the same action as selecting "Go to Session " or clicking on the first toolbar button.
Sessions Tab This tab presents two folders that contain lists of active sessions and completed sessions. Each session appears as a node under the appropriate folder and contains basic information such as the session host, port, date, and description. If the session is active there will also be two sub-nodes for active tools and active participants. These nodes will contain the icon and name of the tools and participants that are active in the session and will be dynamically updated as tools or people enter or leave a session. There are three buttons at the bottom of the control. The first allows the current client to join a session if one has selected any part of a given session. (i.e. has clicked on the session itself or any of the nodes or leaves under it) The second button allows a user to delete records of a completed session. There is currently no access control on this, so be aware that the delete takes effect for everyone. The last button simply does a manual refresh on the list of sessions.
Recorded Sessions
Tab This tab consists of a Table that lists the available recorded sessions within the LDB. The name will reflect whether the record has been marked and thus can be utilized in conjunction with the Events Search control. Once a recorded session has been selected, the type of replay can be selected by using the ComboBox. The choices are Local Replay with GUI, Local Batch Replay, and Distributed Replay. These are the same choices as available from the Session Tools->Playback a Session menu. The slider allows you to set a multiplier for the speed of the replay. The Replay button allows you to start the selected replay with the current settings. The Mark button allows you to mark the current session for use with the Events Search control. The Delete button allows you to remove a recorded session from the LDB. Once again, there is no access control so when you delete a record it is deleting it for everyone.
Events Search Tab This control allows a user to search recorded sessions for specific events or actions by specific people. You can enter in the text you are searching for into the text field, and then use the combo box to choose a specific session to search, or choose to search over all sessions. While the search is in progress, the search button and text field will be disabled. When the search returns, a blank field indicates either no results or that the specific session you are searching did not store it's events in the LDB. If there are hits, then the table will fill out with all the results from the search. Once a specific event is selected, you will have the option to replay that selected event. When this button is activated, the replay for that session will begin, and if that session is marked, the replay will start at the closest mark that is before the selected event.
User ID Tab This control allows you to customize your personal information. Each field is labeled, and the image can be changed through several methods. The image is Drag and Drop enabled, so if you take an image file and drop it onto the current image, it will replace it. You can also right-click on the image and receive options to switch to a previous image, view the image at full size, or change the image manually by browsing to a file. The Edit map button switches the panel to a map of the world and allows you to set your location dot by simply clicking on the map. To return to the information panel, click the Edit info button. The Next button allows you to edit more text fields and fill out more information. To return to the first panel, select the Prev. button. The Apply button actually saves all the data to a file and propagates this change of information to all clients in all sessions, as well as to the LDB Active Sessions control. Note that no changes actually take effect or are saved until one clicks the Apply button. The Reset All button will return all data fields and images to the previously saved information.
Tools Palette Panel
The Tools Palette Panel consists of folders that contain the various synchronous collaborative applications that are available on this client. To open or close a folder, one simply double-click on the folder. In order to launch a given application while in a session, simply double-click on the application's icon. If you are in Template Mode, double-clicking on an applications icon will add it to the list of tools that are to be launched when the current session template is launched. This list of tools to associate with a template can be viewed by opening the Tools in use panel while the desired template is selected.
LDB Explorer
The LDB Explorer provides a way to view and interact with the items that are stored within the Logical Database. The tree control on the left half allows one to view the folders that exist. By selecting a given folder you can view the items in that folder. There is also an "All Items" folder that will allow you to view everything. The right hand side is a table that lists all the items that are contained in the currently selected folder. The buttons on the toolbar at the top of the explorer allow you to interact with the content. Add Item has presents a dialog that allows you to add to a folder for the current session (if you are in a session), an existing selected folder, or to a custom folder of your own. Delete Item removes the selected item from the LDB. Neither of these two buttons use access control so anything that is added or deleted is seen by everyone. Save Locally allows you to save the selected item to your local machine. Load Item attempts to load the selected item by using information from the client's mime type browser.
The explorer is also Drag and Drop enabled. To add an item to a give folder, you can drag the item and drop it on the desired folder, or drag it onto the table portion and drop it into the currently selected folder.
The Collaborative Tools
Telnet
This Hablet is based on
The Java(tm) Telnet Applet. It's a fully featured and documented telnet program that has the ability to dynamically load additional Terminal Emulations and Modules.The authors distribute the software is under
GNU licensing terms which allowed us to downloaded the source code and added the multiuser capability. We did this in a couple of ways: First there a Student/Teacher mode where the teacher is the only person who can type into the Telnet window and everyone else is a spectator. The second mode implements a floor control model in that allows the window control to be passed from one use to another.Original Authors: © 1996, 97
Matthias L. Jugel, Marcus MeißnerHabanero Conversion by NCSA
Chat
This is no ordinary chat tool. This Chat window does not utilize IRC for communication, but uses the Habanero object sharing mechanism. It also has the ability to log a chat session for future reference.

Author: NCSA
Copyright 1996-1999 University of Illinois
My Neighborhood
This tool allows you to share the contents of a folder during a session. Files can be transferred between session participants using this tool.
Clip-N-Ship
This tool allows for individual files sharing and dynamic installation of new hablets.
Hablet created by NCSA
Copyright 1996-1999 University of Illinois
MpEdit
This Hablet is based on
mpEdit version 1.0. This Java application is an open source text editor. The Hablet version of mpEdit allows you collaboratively view and edit ASCII files.Original Author: © 1997
John JensenHabanero Conversion by NCSA
Molecule Modeler
The Molecular Modeler (Java Lattice Crystallographic Tool) was designed to skeletally view model .pdb (protein data bank files) molecules in 3-dimensions. The original applet is by Tony Fu, while he was at the Department of Biochemistry & Molecular Biology of the University of British Columbia, Vancouver B.C.. The NCSA staff converted the applet to the Habanero framework and made a change to allow the buffering of events to permit faster manipulation of the image.
Original Author: Tai Y. Fu (Tony) Copyright © 1997 Tai Y. Fu
Habanero Conversion by NCSA
VNC
Virtual Network Computing (VNC) is a hablet is based on the
VNC applet created by AT&T Laboratories Cambridge. VNC allows users to remotely control any system running a VNC server. Both VNC clients and servers are freely available for Unix, Windows and Macintosh from http://www.uk.research.att.com/vnc/.The VNC hablet adds the capability for a group of people to view and remotely control another system through its desktop. More information about the VNC Hablet and usage are available from the
VNC overview documentation.Authors:
AT&T Laboratories Cambridge - VNC is Copyright 1999 - AT&T Laboratories CambridgeHablet Conversion by NCSA
The Voting Tool
The Voting Tool brings democracy to a collaborative session. The initiator of the vote defines the question, the answer mode (Yes/No, %, multiple choice), the choices when necessary, and if the result information is anonymous. Once a vote is defined, the group receives a vote window. After the vote is complete each member receives a result window displaying the vote count.
Hablet created by NCSA
Copyright 1996-1999 University of Illinois
WhiteBoard
A tool capable of reading .gif, .jpg & .ppm files both locally and from a URL. It includes a Microsoft Power Point Presentation mode and contains a variety of drawing tools to mark, manipulate, annotate and save the image as a jpeg. The Whiteboard is a layered drawing tool, which means that objects in the Whiteboard can be moved independently from each other.
Hablet created by NCSA
Copyright 1996-1999 University of Illinois
The Demos Folder
The demos include a Calculator, BeZier Plane Simulator, Checkers, Scribble pad, VRML 1.0 Viewer, Tic Tac Toe and the Visible Human.
Appendix A
The Life of a Habanero Event
Habanero uses event replication as its mode of synchronization. Events that are generated in Hablets are caught (before they can act in the Hablet) and sent to the server where they are routed to each client.
From Hablet to Server
The GUI environment of java is event driven. Events that are generated by a mouse click etc… are processed asynchronously by passing the event to an event queue. The event dispatch thread is responsible for taking events from the queue and processing them. For example, when a user clicks on a menu bar an event is generated which goes to the event queue where it is processed by the event dispatch thread causing the submenu drop down list to be displayed.
Habanero 3.0 replaces the event queue in the JVM with its own event queue subclass. Each event that is placed on the event queue is analyzed to see if it is an event that originated at a hablet and therefore needs to be captured. The hablet programmer has the ability to define exactly which events are to be caught this way by defining shipping decision rules. Also, the hablet programmer can send internally generated events directly to the server thereby completely bypassing the event queue mechanism. Events that are caught are forwarded to the client side framework for shipment to the server, but before they can be sent they are wrapped in a StandardActionRequest object.
Every hablet, upon its instantiation on the client side, is assigned an arbitrator. The arbitrators on the client side are usually of the class DistributedArbitrator. The event, after removal from the event queue, is sent to this arbitrator where, in most cases, it is simply passed through. However, some events that are sent from hablets, like floor control events, might not be intended for routing to other clients or may expect an immediate answer form the server. The client side arbitrator is the locus of control for such interactions on the client side.
On the client side events leaving the DistributedArbitrator are next sent to the Session object which in turn forwards them to the communication manager (ClientListenerManager). The communication manager maintains the list of listeners (sockets to the server) for each session. Every session has one main session socket, but hablets can elect to have their own private sockets for efficiency purposes. The communication manager makes sure that the event is sent to the appropriate socket object based on the hablet from which it came.
The socket object (i.e. ClientListener) pushes the object through the socket to the server; however, the object must first pass through several layers of stream objects where additional processing occurs before the object is actually passed out of the client. The Habanero framework contains a rich set of stream classes that can record events, and replace event components for efficient transfer. For instance, Habanero stream classes are used to intercept the event target objects (usually a GUI component) and replace them with a specifier string that can be safely de-serialized on the server side (where no GUI display is active). The specifier string is a means of coding exactly which component in the hablet’s GUI hierarchy should receive this event. Since it is assumed that all of the instances of a hablet on each client are structurally identical, the specifier string is a reliable way of targeting the event to the exact same GUI component on every client. This makes the framework easier to use for the hablet programmer but imposes a certain homogeneity on each client environment. For example, a Chat hablet, running on a PC platform, would probably not be compatible with the same hablet on a handheld device, unless they each used the identical GUI structure and framework code.
As briefly mentioned above, the stream classes are where events are intercepted for recording or other purposes. When recording, events are captured in stream objects as they enter the client from the server. A special stream class called a SplitterStream is used to route events to any number of "observer" classes – memory and/or file recorders being just two examples.
The Journey through the Server
On the server side, events are received in a socket object called a RequestHandler. RequestHandlers are managed by a ServerListener, which in turn, is managed by the ServerListenerManager. In the server, like the client, a group of ServerListeners is defined for each session (one default listener for the session and additional listeners for each hablet that requires its own). Each ServerListener maintains a group of RequestHandlers – one handler for each client in the session.
When events leave the client, the events’ targets (usually a GUI component) are converted by the stream classes into a string structures called a specifiers. When the RequestHandler receives a new event, it decodes this specifier string for the target to determine where to send the event. Within the specifier string is coded the name of the hablet to which it is targeted. Whenever a hablet is started on a client, a hablet object (called a Collobject) and an arbitrator object are started on the server. The server uses the specifier string to identify the abitrator object for that hablet on the server side and sends it the event.
For simple hablets the arbitrator on the server side is nothing more than a router (called a CentralArbitrator). For more complex hablets, needing floor control or other special centralized operations, the hablet programmer can create a subclass of CentralArbitrator and implement a customized event handling mechanism. Hablets like whiteboard use such arbitrators for floor control as previously mentioned. Other hablets like VNC and telnet use special arbitrators that establish one connection to an external resource to be shared by all clients.
Once the arbitrator has finished processing an event it wraps the event in an ActionGranted object and assigns it a ticket number. The ticket is used to ensure that events that are sent to clients arrive and are processed in the proper order. Once a ticket has been assigned, the event is passed to the ServerListener then to the RequestHandler for socket transmission.
Back to the Client(s)
The ClientListener object on the client side receives events from the server. The stream classes on this socket de-serialize the event target and any other objects that are marked with the Specifiable interface. Just as on the server, an arbitrator associated with the target of this event is identified and the event is passed to this arbitrator (DistributedArbitrator) for delivery. The arbitrator passes the event to a Serializer object which checks that the event is serialized properly (based on its ticket number). If an event is received out of order then it is placed on a special wait queue where it is eventually processed when order is re-established. If the event is in order, the Serializer places it on the event queue for processing.
What is actually placed on the event queue at this point is not the event itself but the event wrapped in an ActionGranted object. When the event queue dispatches the ActionGranted, it passes control to the action’s ticket object which in turn calls the act method of the action. The act method of the action then takes the original event and dispatches it to the event queue. Now the event is processed normally as if it had never left the client.
Conclusion
The above describes the journey of a typical event through the Habanero framework. There are of course many exceptions that have to do with special events or session control events that have not been described here. There also exists a communication channel for servers and clients that is not a part of the event routing mechanism. Each SessionManager object (one per server and client) has its own socket for sending messages concerning the management of sessions (creation, joining, leaving). This socket is independent of sessions and therefore exists outside of the listener framework (which is managed by Session objects).
Appendix B
Adding Asynchronous Capability to a Hablet
Before you attempt to provide your tool an asynchronous capability you must realize not all tools have viewable components. The events that are saved must be viewable or accessible through a web browser interface. If the ISAAC services are available, the addition of an asynchronous handler will send clients session events to the LDB after the person leaves the session. Then this person can access the events from a predefined web site using a browser.
The asynchronous handler code is outlined in the following steps:
STEP 1: Create a new class for your tool’s asynchronous handler
The sample uses the asynchronous handler for the Chat tool. First, create a new class, ChatAsynchronousHandler.java. The new class handler should implement AsynchronousHandler. For example:
public class ChatAsynchronousHandler implements AsynchronousHandler {
The new class should include the following import statements and functions:
import ncsa.habanero.*;
import ncsa.env.abstraction.Mail;
import ncsa.env.abstraction.InfoPart;
import java.awt.event.ActionEvent;
import ncsa.isaac.notification.*;
import java.rmi.MarshalledObject;
import java.rmi.RemoteException;
import net.jini.core.lookup.*;
import net.jini.core.entry.*;
import net.jini.core.discovery.*;
import net.jini.lookup.entry.*;
import net.jini.discovery.*;
The new class should also include the following methods and fields. Refer to the sample code found at the end of this section for implementation details.
STEP 2: Add an asynchronous handler property to the Bean properties for the tool
Within the tool's Properties file, ie. ChatProperties.java, add the line:
STEP 3: Add a ClassNameFilter in SessionParticipant for the tool, adding it to the list of event filters
Within the SessionParticipant.java file, add the line below to the constructor:
Sample Asynchronous Handler Code from the Chat tool
package Chat;
import ncsa.habanero.*;
import ncsa.env.abstraction.Mail;
import ncsa.env.abstraction.InfoPart;
import java.awt.event.ActionEvent;
import ncsa.isaac.notification.*;
import java.rmi.MarshalledObject;
import java.rmi.RemoteException;
import net.jini.core.lookup.*;
import net.jini.core.entry.*;
import net.jini.core.discovery.*;
import net.jini.lookup.entry.*;
import net.jini.discovery.*;
/**
* This is the class that adds the asynchronous feature to a hablet.
*
* @author NCSA Habanero
* @version 1.0
* @since JDK1.0
*/
public class ChatAsynchronousHandler implements AsynchronousHandler {
private static final long serialVersionUID = 8112623508265000394L;
/**
* Publisher that dispatches the event
*/
Publisher PUB = null;
/**
* flag used to determine if event sent using mail
*/
boolean mailflag = false;
/**
* a reference to a Session
*/
Session toolSession = null;
/**
* Constructor
*/
public ChatAsynchronousHandler() { PUB = getPUB(); }
/**
* function to set the Session
* @param s reference to the particular Session
*/
public void setSession(Session s) { toolSession = s; }
/**
* function that handles which events get dispatched
* @param action the action that has taken place
* @param to the destination of the action
* @param from the source of the action
* @return boolean to say if the event has been handled successfully
*/
public boolean handle(Action action, SessionParticipant to, SessionParticipant from) {
if (mailflag) {
return sendByMail(action, to, from);
} else {
ActionEvent e = (ActionEvent)((AWTEventAction)action).getAWTEvent();
ISAACNotification inot = new ISAACNotification();
inot.setType("ASYNCH");
inot.stampDate();
//session name
if (toolSession == null){
inot.add("session_name","unknown");
} else {
inot.add("session_name", toolSession.getCollectionName());
}
//from name
inot.add("from_name", from.getName());
//action description
inot.add("action_description",e.getActionCommand());
//tool name
inot.add("tool_name", "Chat");
System.out.println("Sending ASYNCH notification");
try {
getPUB().sendNotification(inot);
} catch (Exception e1) {
PUB = null;
try {
getPUB().sendNotification(inot);
} catch (Exception e2) {
return sendByMail(action, to, from);
}}
return true;
}
}
/**
* function to send the asynchronous notification through email
* @param action the action that has taken place
* @param to the destination of the action
* @param from the source of the action
* @return boolean to signify if the action was sent as mail successfully
*/
protected boolean sendByMail(Action action, SessionParticipant to, SessionParticipant from) {
try {
Mail m = new Mail();
ActionEvent e = (ActionEvent)((AWTEventAction)action).getAWTEvent();
Habanero.println("sending chat to " + to);
m.send(((InfoPart)to).getEmail(),
"Chat from " + from.getName(),
e.getActionCommand());
return true;
} catch (Exception e) {
}
return false;
}
/**
* function to obtain the Publisher
* @return Publisher
*/
protected Publisher getPUB()
{
PUB = SessionManager.getManager().getPUB();
if (PUB == null) {
System.out.println("PUB is null: Chat asynchronous notifications will be sent using email");
mailflag = true;
}
return PUB;
}
}
Appendix C
Creating a Hablet that can open File Extensions:
In order to give your hablet the ability to open file extensions you will have to follow these steps:
In the constructor of your Properties class you will have to add the following line:
setCanLoad(true);
In the class that either extends ncsa.habanero.Hablet or implements ncsa.habanero.Wrapped you will also have to implement ncsa.mime.MimeLoadable. This requires that this class implements the following methods:
public void loadMime(MimeFileObject mfo)
This method gets called right after a Hablet is instantiated and it contains a file that needs to be opened. The MimeFileObject will contain the file name and an associated InputStream with its contents.
public String getMimeType() This method should return the types of files that the hablet can open. Separate each type with a semicolon.
The MimeFileObject has one method and one field that will help out with loading it:
public InputStream getInputStream()
This method returns an InputStream that represents the file's bytes.
MimeFileObject.fileName
A String that represents the name of the file to be loaded.
Launching a File's Application:
There are two methods you can call to load a file's associated extension application but you need to get a MimeAssociations file first. You can do this by calling the following method:
ncsa.mime.MimeAssociations.getMimes()
This static method will return a MimeAssocations object that will allow you to call the following methods in order to load a file:
If an application hasn't been associated with an application a browser will be launched where you can set the appropriate application.