Imported Upstream version 0.4.8
[platform/upstream/libsmi.git] / test / dumps / jax / System.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: System.java 4432 2006-05-29 16:21:11Z strauss $
6  */
7
8 /**
9     This class represents a Java AgentX (JAX) implementation of
10     the scalar group system defined in SNMPv2-MIB.
11
12     @version 1
13     @author  smidump 0.4.5
14     @see     AgentXGroup, AgentXScalars
15  */
16
17 import java.util.Vector;
18 import java.util.Enumeration;
19 import jax.AgentXOID;
20 import jax.AgentXVarBind;
21 import jax.AgentXSetPhase;
22 import jax.AgentXResponsePDU;
23 import jax.AgentXScalars;
24
25 public class System extends AgentXScalars
26 {
27
28     private final static long[] SystemOID = {1, 3, 6, 1, 2, 1, 1};
29
30     protected AgentXOID SysDescrOID;
31     protected final static long[] SysDescrName = {1, 3, 6, 1, 2, 1, 1, 1, 0};
32     protected byte[] sysDescr = new byte[0];
33     protected AgentXOID SysObjectIDOID;
34     protected final static long[] SysObjectIDName = {1, 3, 6, 1, 2, 1, 1, 2, 0};
35     protected AgentXOID sysObjectID = new AgentXOID();
36     protected AgentXOID SysUpTimeOID;
37     protected final static long[] SysUpTimeName = {1, 3, 6, 1, 2, 1, 1, 3, 0};
38     protected long sysUpTime = 0;
39     protected AgentXOID SysContactOID;
40     protected final static long[] SysContactName = {1, 3, 6, 1, 2, 1, 1, 4, 0};
41     protected byte[] sysContact = new byte[0];
42     protected byte[] undo_sysContact = new byte[0];
43     protected AgentXOID SysNameOID;
44     protected final static long[] SysNameName = {1, 3, 6, 1, 2, 1, 1, 5, 0};
45     protected byte[] sysName = new byte[0];
46     protected byte[] undo_sysName = new byte[0];
47     protected AgentXOID SysLocationOID;
48     protected final static long[] SysLocationName = {1, 3, 6, 1, 2, 1, 1, 6, 0};
49     protected byte[] sysLocation = new byte[0];
50     protected byte[] undo_sysLocation = new byte[0];
51     protected AgentXOID SysServicesOID;
52     protected final static long[] SysServicesName = {1, 3, 6, 1, 2, 1, 1, 7, 0};
53     protected int sysServices = 0;
54     protected AgentXOID SysORLastChangeOID;
55     protected final static long[] SysORLastChangeName = {1, 3, 6, 1, 2, 1, 1, 8, 0};
56     protected long sysORLastChange = 0;
57     public System()
58     {
59         oid = new AgentXOID(SystemOID);
60         data = new Vector();
61         SysDescrOID = new AgentXOID(SysDescrName);
62         data.addElement(SysDescrOID);
63         SysObjectIDOID = new AgentXOID(SysObjectIDName);
64         data.addElement(SysObjectIDOID);
65         SysUpTimeOID = new AgentXOID(SysUpTimeName);
66         data.addElement(SysUpTimeOID);
67         SysContactOID = new AgentXOID(SysContactName);
68         data.addElement(SysContactOID);
69         SysNameOID = new AgentXOID(SysNameName);
70         data.addElement(SysNameOID);
71         SysLocationOID = new AgentXOID(SysLocationName);
72         data.addElement(SysLocationOID);
73         SysServicesOID = new AgentXOID(SysServicesName);
74         data.addElement(SysServicesOID);
75         SysORLastChangeOID = new AgentXOID(SysORLastChangeName);
76         data.addElement(SysORLastChangeOID);
77     }
78
79     public byte[] get_sysDescr()
80     {
81         return sysDescr;
82     }
83
84     public AgentXOID get_sysObjectID()
85     {
86         return sysObjectID;
87     }
88
89     public long get_sysUpTime()
90     {
91         return sysUpTime;
92     }
93
94     public byte[] get_sysContact()
95     {
96         return sysContact;
97     }
98
99     public int set_sysContact(AgentXSetPhase phase, byte[] value)
100     {
101         switch (phase.getPhase()) {
102         case AgentXSetPhase.TEST_SET:
103             break;
104         case AgentXSetPhase.COMMIT:
105             undo_sysContact = sysContact;
106             sysContact = new byte[value.length];
107             for(int i = 0; i < value.length; i++)
108                 sysContact[i] = value[i];
109             break;
110         case AgentXSetPhase.UNDO:
111             sysContact = undo_sysContact;
112             break;
113         case AgentXSetPhase.CLEANUP:
114             undo_sysContact = null;
115             break;
116         default:
117             return AgentXResponsePDU.PROCESSING_ERROR;
118         }
119         return AgentXResponsePDU.NO_ERROR;
120     }
121     public byte[] get_sysName()
122     {
123         return sysName;
124     }
125
126     public int set_sysName(AgentXSetPhase phase, byte[] value)
127     {
128         switch (phase.getPhase()) {
129         case AgentXSetPhase.TEST_SET:
130             break;
131         case AgentXSetPhase.COMMIT:
132             undo_sysName = sysName;
133             sysName = new byte[value.length];
134             for(int i = 0; i < value.length; i++)
135                 sysName[i] = value[i];
136             break;
137         case AgentXSetPhase.UNDO:
138             sysName = undo_sysName;
139             break;
140         case AgentXSetPhase.CLEANUP:
141             undo_sysName = null;
142             break;
143         default:
144             return AgentXResponsePDU.PROCESSING_ERROR;
145         }
146         return AgentXResponsePDU.NO_ERROR;
147     }
148     public byte[] get_sysLocation()
149     {
150         return sysLocation;
151     }
152
153     public int set_sysLocation(AgentXSetPhase phase, byte[] value)
154     {
155         switch (phase.getPhase()) {
156         case AgentXSetPhase.TEST_SET:
157             break;
158         case AgentXSetPhase.COMMIT:
159             undo_sysLocation = sysLocation;
160             sysLocation = new byte[value.length];
161             for(int i = 0; i < value.length; i++)
162                 sysLocation[i] = value[i];
163             break;
164         case AgentXSetPhase.UNDO:
165             sysLocation = undo_sysLocation;
166             break;
167         case AgentXSetPhase.CLEANUP:
168             undo_sysLocation = null;
169             break;
170         default:
171             return AgentXResponsePDU.PROCESSING_ERROR;
172         }
173         return AgentXResponsePDU.NO_ERROR;
174     }
175     public int get_sysServices()
176     {
177         return sysServices;
178     }
179
180     public long get_sysORLastChange()
181     {
182         return sysORLastChange;
183     }
184
185     public AgentXVarBind getScalar(AgentXOID pos, AgentXOID oid)
186     {
187         if ((pos == null) || (pos.compareTo(oid) != 0))
188             return new AgentXVarBind(oid, AgentXVarBind.NOSUCHOBJECT);
189         else {
190             if (pos == SysDescrOID)
191                 return new AgentXVarBind(oid, AgentXVarBind.OCTETSTRING, 
192                                          get_sysDescr());
193             if (pos == SysObjectIDOID)
194                 return new AgentXVarBind(oid, AgentXVarBind.OBJECTIDENTIFIER, 
195                                          get_sysObjectID());
196             if (pos == SysUpTimeOID)
197                 return new AgentXVarBind(oid, AgentXVarBind.TIMETICKS, 
198                                          get_sysUpTime());
199             if (pos == SysContactOID)
200                 return new AgentXVarBind(oid, AgentXVarBind.OCTETSTRING, 
201                                          get_sysContact());
202             if (pos == SysNameOID)
203                 return new AgentXVarBind(oid, AgentXVarBind.OCTETSTRING, 
204                                          get_sysName());
205             if (pos == SysLocationOID)
206                 return new AgentXVarBind(oid, AgentXVarBind.OCTETSTRING, 
207                                          get_sysLocation());
208             if (pos == SysServicesOID)
209                 return new AgentXVarBind(oid, AgentXVarBind.INTEGER, 
210                                          get_sysServices());
211             if (pos == SysORLastChangeOID)
212                 return new AgentXVarBind(oid, AgentXVarBind.TIMETICKS, 
213                                          get_sysORLastChange());
214         }
215         return new AgentXVarBind(oid, AgentXVarBind.NOSUCHOBJECT);
216     }
217
218     public int setScalar(AgentXSetPhase phase, AgentXOID pos,
219                          AgentXVarBind inVb)
220     {
221         if ((pos == null) || (pos.compareTo(inVb.getOID()) != 0))
222             return AgentXResponsePDU.INCONSISTENT_NAME;
223         else {
224             if (pos == SysContactOID)
225                 return set_sysContact(phase, inVb.bytesValue());
226             if (pos == SysNameOID)
227                 return set_sysName(phase, inVb.bytesValue());
228             if (pos == SysLocationOID)
229                 return set_sysLocation(phase, inVb.bytesValue());
230         }
231         return AgentXResponsePDU.NOT_WRITABLE;
232     }
233
234     public AgentXVarBind getNextScalar(AgentXOID pos, AgentXOID oid)
235     {
236         if ((pos == null) || (pos.compareTo(oid) <= 0))
237             return new AgentXVarBind(oid, AgentXVarBind.ENDOFMIBVIEW);
238         else {
239             if (pos == SysDescrOID)
240                 return new AgentXVarBind(pos, AgentXVarBind.OCTETSTRING, 
241                                          get_sysDescr());
242             if (pos == SysObjectIDOID)
243                 return new AgentXVarBind(pos, AgentXVarBind.OBJECTIDENTIFIER, 
244                                          get_sysObjectID());
245             if (pos == SysUpTimeOID)
246                 return new AgentXVarBind(pos, AgentXVarBind.TIMETICKS, 
247                                          get_sysUpTime());
248             if (pos == SysContactOID)
249                 return new AgentXVarBind(pos, AgentXVarBind.OCTETSTRING, 
250                                          get_sysContact());
251             if (pos == SysNameOID)
252                 return new AgentXVarBind(pos, AgentXVarBind.OCTETSTRING, 
253                                          get_sysName());
254             if (pos == SysLocationOID)
255                 return new AgentXVarBind(pos, AgentXVarBind.OCTETSTRING, 
256                                          get_sysLocation());
257             if (pos == SysServicesOID)
258                 return new AgentXVarBind(pos, AgentXVarBind.INTEGER, 
259                                          get_sysServices());
260             if (pos == SysORLastChangeOID)
261                 return new AgentXVarBind(pos, AgentXVarBind.TIMETICKS, 
262                                          get_sysORLastChange());
263         }
264         return new AgentXVarBind(pos, AgentXVarBind.ENDOFMIBVIEW);
265     }
266
267 }
268