Contents
Ponder2 Installation
This page describes how to install and run Ponder2 using the ponder2.jar file and supporting libraries. You need Java 1.5 or above to run Ponder2. The change log contains details about the various releases and about new, upcoming changes.
Installation is very simple.
The Ponder2Downloads page contains the source and binary download files. Download the one that you require. The binary zip file is all that is necessary. The source zip file simply creates the same Jar files that are found in the binary zip, in fact the source zip file was used to create the binary zip.
Extract the files with unzip. Use the unzip program on Unix1, Windows may automatically unzip the file otherwise double-click on it. All the files will be extracted to a directory/folder called ponder2
If you have the binary distribution then that's it! You will find an ant build file in the ponder2 directory along with the necessary library Jar files. If you have the source distribution, you need to build the Jar library files as follows:
Step |
Command |
Description |
1 |
cd ponder2/p2src |
Change to the Ponder2 core source directory. |
2 |
ant install |
Compile the sources and build the Ponder2 and Ponder2Comms library Jar files. You will see some errors concerning net.ponder2.Shell, do not worry about these. The Sun Java compiler is sorting out the order of compilation and it comes back to net.ponder2.Shell and compiles it successfully later. There are also errors about duplicate index.html and ponder2.css files, these may be ignored as well. |
3 |
cd .. |
You now have the same setup as if you had used the Ponder2 binary distribution. The p2src directory is no longer needed unless you want to refer to or change the sources. |
Now follow the instructions below to test your installation. Further information regarding interacting with Ponder2 and writing your own Managed Objects can be found from the front page of this site.
Distribution Layout
There are several files and directories at the top level of the distribution, these are:
File/Directory |
Description |
src/ |
This is for your sources. There is an example in net/ponder/managedobject/SampleObject.java and resource/SampleObject.p2 |
lib/ |
Directory containing necessary Jar files. Your own Jar files may be added here if required |
doc/ |
HTML documentation for the Ponder2 system. There are three sub-directories, described below |
doc/api/ |
The JavaDoc API description of all the Ponder2 source files |
doc/pondertalk/ |
The PonderTalk documentation for all the Ponder2 Managed Objects |
doc/user/ |
The PonderTalk documentation for all the Managed Objects underneath the src directory. The documentation is updated every time the src directory is compiled |
build.xml |
The ant build and run script for simple invocations of the Ponder2 system. By default it compiles the files under the src directory and then runs Ponder2 |
p2src/ |
The Ponder2 core source files. This optional directory is only present if the source distribution was unzipped. It is not necessary for running Ponder2 |
Running Ponder2
After downloading the Ponder2 files, Ponder2 can be run as either a stand-alone application or can be started within a Java VM. However it is started, there are some simple tests to ensure that it is running correctly. Ponder2 can be instantiated using Apache Ant, in which case you need Ant version 1.7 or later. If you don't have the appropriate version you can still run Ponder2 by following the instructions for running without ant.
Running with Ant
In the ponder2 directory is an Ant build.xml file. It provides the basic glue to run Ponder2 in a simple manner and should be sufficient for most work. To build and run the basic system simply enter the command
ant run
If all is well, you will see
Shell: trying port 13570 Reading boot.p2 Shell port 13570 ready
If you need to run the RMI communications then you can use the folowing command which will give the Ponder2 SMC the address of "rmi://localhost/Ponder2":
ant run -Drmi=Ponder2
The Sun rmiregistry program is required to use RMI and the Ant build script will test for its presence and start it in the background if necessary. If Ant has trouble starting rmiregistry then it will have to be started by hand first.
In addition to the above commands you may want Ponder2 to read your PonderTalk files so that you can start up your own programs. You can do this with the -Dboot option. The argument is a comma separated list of PonderTalk files. For instance to run the example SampleObject PonderTalk file included in the src directory you can use:
ant run -Dboot=SampleObject.p2
If you want to run a PonderTalk file and then exit you can use the special exit.p2 PonderTalk file following your own by using a file list e.g.
$ ant run -Dboot=SampleObject.p2,exit.p2 ... run: [java] Shell: trying port 13570 [java] Reading boot.p2 [java] Reading SampleObject.p2 [java] Adding: A line of text [java] Retrieved: A line of text [java] Reading exit.p2 $
If you want to use Web Services for Ponder2 communications you need a more complex set-up. In this case follow the communications instructions.
Running without Ant
To run the basic system you need ponder2.jar, antlr-runtime.jar and qdparser.jar in your classpath. If you need to run the RMI communications or you want to use Web Services for Ponder2 communications you need a more complex setup. In either of these cases follow the communications instructions.
NB All these commands assume that your current directory is the ponder2 directory created by unzipping the distribution file(s).
To run Ponder2 as a stand alone application all that is needed is
Operating System |
Command |
Unix |
java -cp lib/antlr-runtime.jar:lib/qdparser.jar:lib/ponder2.jar net.ponder2.SelfManagedCell [arguments] |
Windows |
java -cp lib\antlr-runtime.jar;lib\qdparser.jar;lib\ponder2.jar net.ponder2.SelfManagedCell [arguments] |
(See startup arguments for argument information)
If all is well, you will see
Shell: trying port 13570 Reading boot.p2 Shell port 13570 ready
Ponder2 within a Java VM
To start Ponder2 with a Java VM you need to call the main method from a new Thread. To start Ponder2 with a port number of 13570 (the default.) See startup arguments for argument information.
1 String args[] = { "-port", "13570" };
2 net.ponder2.SelfManagedCell.main(args);
Method calls are available to interact with Ponder2 to create event types and policies and to inject new events.
Simple Tests
To test Ponder2, open a new terminal session and connect to port 13570 on your computer:
$ telnet localhost 13570
You will get a shell prompt from Ponder2's built-in, Unix-like shell (but it is not a real Unix shell!). Now enter
$ read testsetup.p2
This will load and execute the testsetup PonderTalk file which runs some PonderTalk and prints out a few messages. It the defines an event type and a policy which accepts that event. You can now create events causing the policy to be activated. The policy will simply print something out to show that it is working. The policy takes the name of a colour and a value. If the value is over 50 then the policy responds and prints out the event.
You can now try creating an event and sending it into the SMC (Self Managed Cell)
$ event colourevent "red" 60
This will print out an alert message (in the server window) and shows you that the policy server is running correctly. You should see:
$ event colourevent red 23 Command is event Received event: colour=red intensity=60
Use ^C to kill the Ponder2 server. An easier way of starting the policy service so that it reads a PonderTalk file immediately is to use the -boot option. You will still need, however, the Telnet session to be able to enter the event command.
$ java <java options> -boot testsetup.p2
Using Ant you can do the same with
$ ant run -Dboot=testsetup.p2
Startup arguments
Ponder2 comprises one or more Java jar files depending upon what you want to do. The main Ponder2 jar file (ponder2.jar) will pick Managed Objects from other jar files on the classpath as necessary. The basic command to start Ponder2 is (assuming that theclasspath has been set up correctly, including ponder2.jar)
java [java options including classpath] net.ponder2.SelfManagedCell [Ponder2 options] [ - [user options]]
There are several runtime options that can be passed when Ponder2 is started.
Runtime Option |
Multiple Use Allowed? |
Description |
-port <number> |
No |
Sets the port number of the Ponder2Shell socket. If <number> is not available and the multiple option is used, it is continually incremented until a free port is found. The opened port number is reported to standard output. If the port number is not available and the multiple option has not been given, an error is printed on the console. The default port number is 13570. Setting the port to 0 disables it. |
-multiple |
No |
Allows many SMCs to be started on one computer with open shell ports. Ports are tried in numerical succession, starting at the port number given with the port option, to find a free one. |
-boot <filename>[,<filename>...] |
Yes |
Specifies the PonderTalk files to be read when the system starts up. Boot files are evaluated after all other options have been read and acted upon. If there is more than one filename or -boot option then they are executed in order of declaration. The special filename of "-" (i.e. -boot -) cancels the loading of all previous boot files including the Ponder2 boot file. Subsequent -boot options will still be read |
-address <url> |
Yes |
Sets the local address of the Ponder2 SMC. If there is more than one -address option then Ponder2 adopts all the addresses as its own. The first address becomes its 'favourite,' the protocol it will prefer to send on if it has a choice. Use of this option forces communications protocols to be loaded. It requires one or more other Jar files to be on the class path because the basic ponder2.jar file has no communication abilities. See Ponder2Comms for more information |
-path <pathname> |
Yes |
Mounts this Ponder2 SMC into another 'master' SMC as pathname. This option is normally used when creating several Ponder2 systems within one single Java VM. The first SMC created becomes the 'master' with the true root domain, the others attach themselves to the main domain hierarchy under the pathname given. NB This option is currently disabled. |
-auth <allow|deny> |
No |
Turns the authorisation system on and sets the default authorisation to allow or deny. See Ponder2Authorisation for more information about this option. |
-version |
|
Prints the version number and exits. |
-trace |
No |
Turns tracing on and prints lots of logging information |
unzip ponder2.zip (1)