KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonathan > apis > protocols > ProtocolInfo


1 package org.objectweb.jonathan.apis.protocols;
2
3 import org.objectweb.jonathan.apis.kernel.Context;
4
5 /**
6  * Tree-like structure to hold the protocol stack info at
7  * configuration time. This will be used in the Binder to instanciate
8  * server side protocol graphs.
9  */

10 public class ProtocolInfo {
11     
12     Protocol current;
13     ProtocolInfo[] lower;
14     Context hints = null; // optional!
15

16     /**
17      * Create a leaf ProtocolInfo node.
18      *
19      * @param current the protocol id of this node.
20      */

21     public ProtocolInfo(Protocol current) {
22     this.current = current;
23     lower = new ProtocolInfo[0];
24     }
25
26     /**
27      * Create a non-leaf ProtocolInfo node.
28      *
29      * @param current protocol id of this node.
30      * @param lower the lower nodes.
31      */

32     public ProtocolInfo(Protocol current, ProtocolInfo[] lower) {
33     this.current = current;
34     this.lower = lower;
35     }
36
37     /**
38      * Set the hints that may help things to happen smoothly
39      * (e.g. configure the port in TCP/IP, ...).
40      *
41      * @param hints the new hints.
42      */

43     public void setHints(Context hints) {
44     this.hints = hints;
45     }
46
47     /**
48      * Get the lower nodes.
49      *
50      * @return the lower nodes.
51      */

52     public ProtocolInfo[] getLower() {
53     return lower;
54     }
55
56     /**
57      * Get the protocol id of this node.
58      *
59      * @return the protocol id of this node.
60      */

61     public Protocol getProtocol() {
62     return current;
63     }
64
65     public Context getHints() {
66     return hints;
67     }
68
69     public String JavaDoc toString() {
70     return "ProtocolInfo [ " + current.toString() + ", [ " +lower + " ]]";
71     }
72 }
73
Popular Tags