Mercurial > hg > blitz_condensed
comparison docs/stats_example.html @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3dc0c5604566 |
---|---|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
2 <html> | |
3 <head> | |
4 <title>Blitz Stats Example</title> | |
5 </head> | |
6 <body> | |
7 <h1>Blitz Stats Example</h1> | |
8 | |
9 <h2>Introduction</h2> | |
10 | |
11 This example provides a simple demonstration of how to use the <code>org.dancres.blitz.stats</code> package. | |
12 | |
13 <h2>Compiling</h2> | |
14 | |
15 The example consists of two classes: | |
16 | |
17 <ol> | |
18 <li><a href="../examples/statsclient/stats/Lookup.java">Lookup</a> which handles service lookup.</li> | |
19 <li><a href="../examples/statsclient/stats/TestClient.java">TestClient</a> which actually manipulates the stats interfaces.</li> | |
20 </ol> | |
21 | |
22 In order to compile these classes you will require the following <code>.jar</code>'s: | |
23 | |
24 <ul> | |
25 <li><code>jsk-platform.jar, jsk-lib.jar</code> from the JINI 2.x distribution.</li> | |
26 <li><code>stats.jar</code> from the Blitz distribution. This <code>.jar</code> contains classes which <em>must</em> be available to the client when it is run (they cannot be downloaded). Note that the proxy code in <code>blitz-dl.jar</code> will be downloaded as usual.</li> | |
27 </ul> | |
28 | |
29 Assuming that your JINI 2.x distribution is in <code>/jini2_1</code> and your Blitz distribution is in <code>/blitz</code>, you can compile the example as follows: | |
30 | |
31 <pre> | |
32 cd /blitz/examples/statsclient | |
33 | |
34 javac -classpath /jini2_1/lib/jsk-lib.jar:/jini/jini2_1/lib/jsk-platform.jar:/blitz/lib/stats.jar *.java | |
35 </pre> | |
36 | |
37 <h2>Running</h2> | |
38 | |
39 <p>Before starting the example, ensure that you have a Blitz instance running in a public lookup group - see the <a href="install_guide.html">Installation Guide</a>. This is necessary because the <code>Lookup</code> class does a single lookup and discover step - it does not register with discovered lookup services. Thus, if a Blitz instance isn't registered beforehand, it will not be found (I'll fix this in a future release!).</p> | |
40 | |
41 Having compiled the example, you can run it as follows (with the same assumptions about installation locations as above): | |
42 | |
43 <pre> | |
44 cd /blitz | |
45 | |
46 java -Djava.security.policy=config/policy.all -classpath /jini2_1/lib/jsk-lib.jar:/jini2_1/lib/jsk-platform.jar:/blitz/examples/statsclient:/blitz/lib/stats.jar stats.TestClient | |
47 </pre> | |
48 | |
49 <h2>Configuring Defaults</h2> | |
50 | |
51 In addition to passing an array of Switch objects to Blitz via the StatsAdmin interface, it's possible to configure default settings via the config file using an entry like: | |
52 | |
53 <pre> | |
54 // Default Stats to make available | |
55 stats = new Switch[] {new OpSwitch(OpSwitch.ALL_TYPES, OpSwitch.TAKE_OPS, true), | |
56 new OpSwitch(OpSwitch.ALL_TYPES, OpSwitch.READ_OPS, true), | |
57 new OpSwitch(OpSwitch.ALL_TYPES, OpSwitch.WRITE_OPS, true)}; | |
58 </pre> | |
59 | |
60 <p><div align="center"><a href="../index.html">Back to Documentation</a></div></p> | |
61 </body> | |
62 </html> |