Context Toolkit Installation Guide
This document contains the installation guide for the Context Toolkit. This is
just one piece of the user's guide. There are two other pieces, including a tutorial
and source
code documentation. The installation guide contains information on how to
install the Context
Toolkit and get a simple application up and running.
Installation
- Download and install the Java J2SE
SDK. JDK 1.2.2 or higher is recommended. If you already have Java or a Java IDE installed, you may skip this step.
- Download the Apache Ant build tool and follow the Ant installation instructions. Ant is used as a command-line tool to execute various applications distributed with the CTK.
- Download the latest CTK distribution from sourceforge. The distribution should consist of a file called contexttoolkit-RELEASEDATE.zip.
- Unzip the contexttoolkit-RELEASEDATE.zip file into a directory of your choosing, heretofore referred to as <INSTALLDIR>.
- Inside the <INSTALLDIR> directory should be a jar file, ctk.jar. Add ctk.jar to your general CLASSPATH environment variable. For use in a Java IDE, follow the IDE instructions to add ctk.jar to your project.
- The CTK depends on certain third party libraries, included in the
distribution. Include <INSTALLDIR>/lib in your CLASSPATH or IDE as
detailed for ctk.jar above. gwe.jar is from GWE
Technologies and provides the JDBC access to the MySQL database. aelfred.jar is from Microstar Software and provides XML
decoding. sax.jar is from Megginson Technologies and
provides support for multiple XML decoders. ntp.jar is from Limburgs
Universitair Centrum and provides support for talking to a Network Time
Protocol server. To retrieve ntp.jar, unzip the Ntp.zip file. All of the jar
files are free to use and redistribute.
- When using the CTK in an IDE, it can be convenient to attach source files to libraries to aid in debugging. The distribution includes ctk-src.zip with all CTK source .java files.
- Optionally modify the name of the Network Time Protocol server used in
context.arch.widget.OffsetThread to a local NTP server. Currently, the server
is set to ntp1.gatech.edu. You'll get a faster response, if you use an NTP
server that is fewer network hops from your installation location.
Running a Simple Application
After installing the CTK, try running this sample application. You can run it in one step using the provided Ant target, or run each component by hand. Your machine should have networking enabled (The CTK Discoverer utilizes IP Multicast which requires an active network interface on some operating systems):
- The first way to run the application is to use the Ant. Using a console window, navigate to <INSTALLDIR> and run: ant run-simplePersonPresence. This will start a Discoverer, a WPersonNamePresence2 Widget, and a sample application SimpleApp. You'll see a 6-button GUI that controls the Widget, and text output from the application.
- To better see what the application is doing, you can run each CTK component yourself in separate windows:
- In one window, run the Discoverer: java context.arch.discoverer.Discoverer
- In another window, run the widget:
- To see the widget's parameter list: java
context.arch.widget.WPersonNamePresence2
- Run the widget: java context.arch.widget.WPersonNamePresence2 test 5000
false
- The widget should load a GUI (6 buttons)
-
In another window, run the application:
- To see the application's parameter list: java
context.apps.PersonPresenceApp.SimpleApp
- Run the application: java context.apps.PersonPresenceApp.SimpleApp test
5001 127.0.0.1 5000
- The application will subscribe to the widget
- Now interact with the widget's GUI, pressing buttons to simulate the coming
and going of various people. On the application window, you should see print
statements showing the results of the subscription callbacks.
Running a Simple Enactor Application
Next, try running an application that uses an Enactor component to acquire context data. Like the simple application above, you can run the application easily using a single Ant target, or you can execute all of the components individually on the command line:
- To run the simple enactor application using ant, open a console window, navigate to <INSTALLDIR> and run: ant run-presence-full. This will start a Discoverer, a Presence Enactor, and 3 WPersonNamePresence2 Widgets. You'll see 6-button GUIs for each of the widgets just like in the simple application above, and text output from the enactor.
- To better see what the application is doing, you can run each CTK component yourself in separate windows:
- In one window, run the Discoverer: java context.arch.discoverer.Discoverer
- In another window run the Presence enactor: java edu.berkeley.io.context.home.PresenceEnactor 6759, where 6759 is an arbitrary port number.
- In another 3 windows, run the widgets, choosing a different LOCATION and port paramenter for each:
- Run the widget: java context.arch.widget.WPersonNamePresence2 LOCATION PORT, e.g. java context.arch.widget.WPersonNamePresence2 Kitchen 8938
- The widget should load a GUI (6 buttons)
- Now interact with the widget GUIs, pressing buttons to simulate the coming
and going of various people. On the Enactor output, you should see print
statements showing the results of the subscription callbacks.
Back to the UserGuide
Context Toolkit Home
Last Modified: December 23, 2003
Comments to: contexttoolkit-admins@lists.sourceforge.net