Imported Upstream version 0.4.8
[platform/upstream/libsmi.git] / test / dumps / jax / ProtocolDirTable.java
1 /*
2  * This Java file has been generated by smidump 0.4.5. Do not edit!
3  * It is intended to be used within a Java AgentX sub-agent environment.
4  *
5  * $Id: ProtocolDirTable.java 4432 2006-05-29 16:21:11Z strauss $
6  */
7
8 /**
9     This class represents a Java AgentX (JAX) implementation of
10     the table protocolDirTable defined in RMON2-MIB.
11
12     @version 1
13     @author  smidump 0.4.5
14     @see     AgentXTable
15  */
16
17 import java.util.Vector;
18
19 import jax.AgentXOID;
20 import jax.AgentXVarBind;
21 import jax.AgentXResponsePDU;
22 import jax.AgentXSetPhase;
23 import jax.AgentXTable;
24 import jax.AgentXEntry;
25
26 public class ProtocolDirTable extends AgentXTable
27 {
28
29     // entry OID
30     private final static long[] OID = {1, 3, 6, 1, 2, 1, 16, 11, 2, 1};
31
32     // constructors
33     public ProtocolDirTable()
34     {
35         oid = new AgentXOID(OID);
36
37         // register implemented columns
38         columns.addElement(new Long(3));
39         columns.addElement(new Long(4));
40         columns.addElement(new Long(5));
41         columns.addElement(new Long(6));
42         columns.addElement(new Long(7));
43         columns.addElement(new Long(8));
44         columns.addElement(new Long(9));
45         columns.addElement(new Long(10));
46     }
47
48     public ProtocolDirTable(boolean shared)
49     {
50         super(shared);
51
52         oid = new AgentXOID(OID);
53
54         // register implemented columns
55         columns.addElement(new Long(3));
56         columns.addElement(new Long(4));
57         columns.addElement(new Long(5));
58         columns.addElement(new Long(6));
59         columns.addElement(new Long(7));
60         columns.addElement(new Long(8));
61         columns.addElement(new Long(9));
62         columns.addElement(new Long(10));
63     }
64
65     public AgentXVarBind getVarBind(AgentXEntry entry, long column)
66     {
67         AgentXOID oid = new AgentXOID(getOID(), column, entry.getInstance());
68
69         switch ((int)column) {
70         case 3: // protocolDirLocalIndex
71         {
72             int value = ((ProtocolDirEntry)entry).get_protocolDirLocalIndex();
73             return new AgentXVarBind(oid, AgentXVarBind.INTEGER, value);
74         }
75         case 4: // protocolDirDescr
76         {
77             byte[] value = ((ProtocolDirEntry)entry).get_protocolDirDescr();
78             return new AgentXVarBind(oid, AgentXVarBind.OCTETSTRING, value);
79         }
80         case 5: // protocolDirType
81         {
82             byte[] value = ((ProtocolDirEntry)entry).get_protocolDirType();
83             return new AgentXVarBind(oid, AgentXVarBind.OCTETSTRING, value);
84         }
85         case 6: // protocolDirAddressMapConfig
86         {
87             int value = ((ProtocolDirEntry)entry).get_protocolDirAddressMapConfig();
88             return new AgentXVarBind(oid, AgentXVarBind.INTEGER, value);
89         }
90         case 7: // protocolDirHostConfig
91         {
92             int value = ((ProtocolDirEntry)entry).get_protocolDirHostConfig();
93             return new AgentXVarBind(oid, AgentXVarBind.INTEGER, value);
94         }
95         case 8: // protocolDirMatrixConfig
96         {
97             int value = ((ProtocolDirEntry)entry).get_protocolDirMatrixConfig();
98             return new AgentXVarBind(oid, AgentXVarBind.INTEGER, value);
99         }
100         case 9: // protocolDirOwner
101         {
102             byte[] value = ((ProtocolDirEntry)entry).get_protocolDirOwner();
103             return new AgentXVarBind(oid, AgentXVarBind.OCTETSTRING, value);
104         }
105         case 10: // protocolDirStatus
106         {
107             int value = ((ProtocolDirEntry)entry).get_protocolDirStatus();
108             return new AgentXVarBind(oid, AgentXVarBind.INTEGER, value);
109         }
110         }
111
112         return null;
113     }
114
115     public int setEntry(AgentXSetPhase phase,
116                         AgentXEntry entry,
117                         long column,
118                         AgentXVarBind vb)
119     {
120
121         switch ((int)column) {
122         case 4: // protocolDirDescr
123         {
124             if (vb.getType() != AgentXVarBind.OCTETSTRING)
125                 return AgentXResponsePDU.WRONG_TYPE;
126             else
127                 return ((ProtocolDirEntry)entry).set_protocolDirDescr(phase, vb.bytesValue());
128         }
129         case 6: // protocolDirAddressMapConfig
130         {
131             if (vb.getType() != AgentXVarBind.INTEGER)
132                 return AgentXResponsePDU.WRONG_TYPE;
133             else
134                 return ((ProtocolDirEntry)entry).set_protocolDirAddressMapConfig(phase, vb.intValue());
135         }
136         case 7: // protocolDirHostConfig
137         {
138             if (vb.getType() != AgentXVarBind.INTEGER)
139                 return AgentXResponsePDU.WRONG_TYPE;
140             else
141                 return ((ProtocolDirEntry)entry).set_protocolDirHostConfig(phase, vb.intValue());
142         }
143         case 8: // protocolDirMatrixConfig
144         {
145             if (vb.getType() != AgentXVarBind.INTEGER)
146                 return AgentXResponsePDU.WRONG_TYPE;
147             else
148                 return ((ProtocolDirEntry)entry).set_protocolDirMatrixConfig(phase, vb.intValue());
149         }
150         case 9: // protocolDirOwner
151         {
152             if (vb.getType() != AgentXVarBind.OCTETSTRING)
153                 return AgentXResponsePDU.WRONG_TYPE;
154             else
155                 return ((ProtocolDirEntry)entry).set_protocolDirOwner(phase, vb.bytesValue());
156         }
157         case 10: // protocolDirStatus
158         {
159             if (vb.getType() != AgentXVarBind.INTEGER)
160                 return AgentXResponsePDU.WRONG_TYPE;
161             else
162                 return ((ProtocolDirEntry)entry).set_protocolDirStatus(phase, vb.intValue());
163         }
164         }
165
166         return AgentXResponsePDU.NOT_WRITABLE;
167     }
168
169 }
170