Our warrant has a netlet descriptor embedded in it, so we'll create
the descriptor first and then the warrant:
% ls
hello1.jar helloserver.jar
% jtrixmaker -type netlet -outfile hello-server.xml \
-jardirs . -jars helloserver.jar \
-classname org.jtrix.project.helloworld.HelloServer
% ls
hello-server.xml hello1.jar helloserver.jar
% jtrixmaker -type warrant -descriptor-in hello-server.xml \
-outfile hello-local-warrant.xml
% ls
hello-local-warrant.xml hello-server.xml hello1.jar helloserver.jar
%
The first call to jtrixmaker creates the descriptor for the
netlet we've just written. We give it this information:
- What type of file we're creating, in this case a netlet descriptor.
- What file it should be output to.
- What directories to look in for the JARs. In this case, just the current
directory.
- What JARs need to go in the netlet descriptor. In this case, just
helloserver.jar. Of course, the code also makes use of jtrix.jar,
but we are guaranteed this will always be available on any Jtrix node
we run on, so we don't need to carry it with us.
- The class which implements the INetlet interface.
Once we've got the descriptor, the second call to jtrixmaker
creates the warrant. We give it this information:
- What type of file we're creating, in this case a warrant.
- What descriptor should go in the warrant. In this case the file hello-server.xml
we've just created. Other options to jtrixmaker allow us to
point to a SAS, instead, which will serve the descriptor.
- What the resulting warrant file should be called.
Now we can create the netlet descriptor for the client netlet. Why
should we do this, you may ask, after all, aren't we using the same
client netlet from before? The answer is Yes, but look back to where
we created that descriptor (Section
).
Notice that we put the warrant inside it as a parameter. So now we
must recreate it, this time using our new warrant as the parameter:
% ls
hello-local-warrant.xml hello-server.xml hello1.jar helloserver.jar
% jtrixmaker -type netlet -outfile hello1-client.xml \
-jardirs /usr/lib/jtrix . -jars libjtrix.jar hello1.jar \
-classname org.jtrix.project.helloworld.Hello1Client \
-param {warrant:hello-local-warrant.xml}
% ls
hello-local-warrant.xml hello1-client.xml helloserver.jar
hello-server.xml hello1.jar
%
In a future chapter (Chapter
) we'll
write a client netlet that reads in its warrant parameter from the
command line. But that's for later. For now, let's get on and run
our example.
Nik Silver
2002-03-09