Source Code Cross Referenced for AgentppTestMib.java in  » Net » snmp4j » org » snmp4j » agent » agentx » subagent » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » snmp4j » org.snmp4j.agent.agentx.subagent.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*_############################################################################
002:          _## 
003:          _##  SNMP4J-AgentX - AgentppTestMib.java  
004:          _## 
005:          _##  Copyright (C) 2005-2007  Frank Fock (SNMP4J.org)
006:          _##  
007:          _##  This program is free software; you can redistribute it and/or modify
008:          _##  it under the terms of the GNU General Public License version 2 as 
009:          _##  published by the Free Software Foundation.
010:          _##
011:          _##  This program is distributed in the hope that it will be useful,
012:          _##  but WITHOUT ANY WARRANTY; without even the implied warranty of
013:          _##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:          _##  GNU General Public License for more details.
015:          _##
016:          _##  You should have received a copy of the GNU General Public License
017:          _##  along with this program; if not, write to the Free Software
018:          _##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
019:          _##  MA  02110-1301  USA
020:          _##  
021:          _##########################################################################*/
022:
023:        package org.snmp4j.agent.agentx.subagent.test;
024:
025:        //--AgentGen BEGIN=_BEGIN
026:        //--AgentGen END
027:
028:        import org.snmp4j.smi.*;
029:        import org.snmp4j.mp.SnmpConstants;
030:        import org.snmp4j.agent.*;
031:        import org.snmp4j.agent.mo.*;
032:        import org.snmp4j.agent.mo.snmp.*;
033:        import org.snmp4j.agent.mo.snmp.smi.*;
034:        import org.snmp4j.agent.request.*;
035:        import org.snmp4j.log.LogFactory;
036:        import org.snmp4j.log.LogAdapter;
037:        import org.snmp4j.agent.agentx.subagent.DefaultAgentXSharedMOTable;
038:        import org.snmp4j.agent.agentx.subagent.AgentXSharedMOTableSupport;
039:        import org.snmp4j.agent.agentx.subagent.index.AnyNewIndexOID;
040:        import java.util.GregorianCalendar;
041:
042:        //--AgentGen BEGIN=_IMPORT
043:        //--AgentGen END
044:
045:        public class AgentppTestMib
046:        //--AgentGen BEGIN=_EXTENDS
047:                //--AgentGen END
048:                implements  MOGroup
049:        //--AgentGen BEGIN=_IMPLEMENTS
050:        //--AgentGen END
051:        {
052:
053:            private static final LogAdapter LOGGER = LogFactory
054:                    .getLogger(AgentppTestMib.class);
055:
056:            //--AgentGen BEGIN=_STATIC
057:            //--AgentGen END
058:
059:            // Factory
060:            private MOFactory moFactory = DefaultMOFactory.getInstance();
061:
062:            // Constants
063:            public static final OID oidAgentppTestTimeout = new OID(new int[] {
064:                    1, 3, 6, 1, 4, 1, 4976, 6, 3, 1, 1, 0 });
065:
066:            // Scalars
067:            private MOScalar agentppTestTimeout;
068:
069:            // Tables
070:            public static final OID oidAgentppTestSharedEntry = new OID(
071:                    new int[] { 1, 3, 6, 1, 4, 1, 4976, 6, 3, 1, 3, 1 });
072:
073:            // Index OID definitions
074:            public static final OID oidAgentppTestSharedTableIndex = new OID(
075:                    new int[] { 1, 3, 6, 1, 4, 1, 4976, 6, 3, 1, 3, 1, 1 });
076:
077:            // Column TC defintions for agentppTestSharedEntry:
078:            public static final String tcModuleSNMPv2Tc = "SNMPv2-TC";
079:            public static final String tcDefDateAndTime = "DateAndTime";
080:            public static final String tcDefRowStatus = "RowStatus";
081:
082:            // Column sub-identifer defintions for agentppTestSharedEntry:
083:            public static final int colAgentppTestSharedTableCreationTime = 2;
084:            public static final int colAgentppTestSharedTableDelay = 3;
085:            public static final int colAgentppTestSharedTableSession = 4;
086:            public static final int colAgentppTestSharedTableRowStatus = 5;
087:
088:            // Column index defintions for agentppTestSharedEntry:
089:            public static final int idxAgentppTestSharedTableCreationTime = 0;
090:            public static final int idxAgentppTestSharedTableDelay = 1;
091:            public static final int idxAgentppTestSharedTableSession = 2;
092:            public static final int idxAgentppTestSharedTableRowStatus = 3;
093:
094:            private MOTableSubIndex[] agentppTestSharedEntryIndexes;
095:            private MOTableIndex agentppTestSharedEntryIndex;
096:
097:            private MOTable agentppTestSharedEntry;
098:            private MOTableModel agentppTestSharedEntryModel;
099:            public static final OID oidAgentppTestSessionsEntry = new OID(
100:                    new int[] { 1, 3, 6, 1, 4, 1, 4976, 6, 3, 1, 4, 1 });
101:
102:            // Index OID definitions
103:            public static final OID oidAgentppTestSessionIndex = new OID(
104:                    new int[] { 1, 3, 6, 1, 4, 1, 4976, 6, 3, 1, 4, 1, 1 });
105:
106:            // Column TC defintions for agentppTestSessionsEntry:
107:
108:            // Column sub-identifer defintions for agentppTestSessionsEntry:
109:            public static final int colAgentppTestRowCreation = 2;
110:
111:            // Column index defintions for agentppTestSessionsEntry:
112:            public static final int idxAgentppTestRowCreation = 0;
113:
114:            private MOTableSubIndex[] agentppTestSessionsEntryIndexes;
115:            private MOTableIndex agentppTestSessionsEntryIndex;
116:
117:            private MOTable agentppTestSessionsEntry;
118:            private MOTableModel agentppTestSessionsEntryModel;
119:            public static final OID oidAgentppTestSparseEntry = new OID(
120:                    new int[] { 1, 3, 6, 1, 4, 1, 4976, 6, 3, 1, 5, 1 });
121:
122:            // Index OID definitions
123:            public static final OID oidAgentppTestSparseIndex = new OID(
124:                    new int[] { 1, 3, 6, 1, 4, 1, 4976, 6, 3, 1, 5, 1, 1 });
125:
126:            // Column TC defintions for agentppTestSparseEntry:
127:
128:            // Column sub-identifer defintions for agentppTestSparseEntry:
129:            public static final int colAgentppTestSparseCol1 = 2;
130:            public static final int colAgentppTestSparseCol2 = 3;
131:            public static final int colAgentppTestSparseCol3 = 4;
132:            public static final int colAgentppTestSparseRowStatus = 5;
133:
134:            // Column index defintions for agentppTestSparseEntry:
135:            public static final int idxAgentppTestSparseCol1 = 0;
136:            public static final int idxAgentppTestSparseCol2 = 1;
137:            public static final int idxAgentppTestSparseCol3 = 2;
138:            public static final int idxAgentppTestSparseRowStatus = 3;
139:
140:            private MOTableSubIndex[] agentppTestSparseEntryIndexes;
141:            private MOTableIndex agentppTestSparseEntryIndex;
142:
143:            private MOTable agentppTestSparseEntry;
144:            private MOTableModel agentppTestSparseEntryModel;
145:
146:            //--AgentGen BEGIN=_MEMBERS
147:            //--AgentGen END
148:
149:            /**
150:             * Constructs a AgentppTestMib instance without actually creating its
151:             * <code>ManagedObject</code> instances. This has to be done in a
152:             * sub-class constructor or after construction by calling
153:             * {@link #createMO(MOFactory moFactory)}.
154:             */
155:            protected AgentppTestMib() {
156:                //--AgentGen BEGIN=_DEFAULTCONSTRUCTOR
157:                //--AgentGen END
158:            }
159:
160:            /**
161:             * Constructs a AgentppTestMib instance and actually creates its
162:             * <code>ManagedObject</code> instances using the supplied
163:             * <code>MOFactory</code> (by calling
164:             * {@link #createMO(MOFactory moFactory)}).
165:             * @param moFactory
166:             *    the <code>MOFactory</code> to be used to create the
167:             *    managed objects for this module.
168:             */
169:            public AgentppTestMib(MOFactory moFactory) {
170:                createMO(moFactory);
171:                //--AgentGen BEGIN=_FACTORYCONSTRUCTOR
172:                //--AgentGen END
173:            }
174:
175:            //--AgentGen BEGIN=_CONSTRUCTORS
176:            //--AgentGen END
177:
178:            /**
179:             * Create the ManagedObjects defined for this MIB module
180:             * using the specified {@link MOFactory}.
181:             * @param moFactory
182:             *    the <code>MOFactory</code> instance to use for object
183:             *    creation.
184:             */
185:            protected void createMO(MOFactory moFactory) {
186:                agentppTestTimeout = new AgentppTestTimeout(
187:                        oidAgentppTestTimeout,
188:                        moFactory
189:                                .createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_WRITE));
190:                agentppTestTimeout
191:                        .addMOValueValidationListener(new AgentppTestTimeoutValidator());
192:                createAgentppTestSharedEntry(moFactory);
193:                createAgentppTestSessionsEntry(moFactory);
194:                createAgentppTestSparseEntry(moFactory);
195:            }
196:
197:            public MOTable getAgentppTestSharedEntry() {
198:                return agentppTestSharedEntry;
199:            }
200:
201:            private void createAgentppTestSharedEntry(MOFactory moFactory) {
202:                // Index definition
203:                agentppTestSharedEntryIndexes = new MOTableSubIndex[] { moFactory
204:                        .createSubIndex(oidAgentppTestSharedTableIndex,
205:                                SMIConstants.SYNTAX_INTEGER, 1, 1) };
206:
207:                agentppTestSharedEntryIndex = moFactory.createIndex(
208:                        agentppTestSharedEntryIndexes, false,
209:                        new MOTableIndexValidator() {
210:                            public boolean isValidIndex(OID index) {
211:                                boolean isValidIndex = true;
212:                                //--AgentGen BEGIN=agentppTestSharedEntry::isValidIndex
213:                                //--AgentGen END
214:                                return isValidIndex;
215:                            }
216:                        });
217:
218:                // Columns
219:                MOColumn[] agentppTestSharedEntryColumns = new MOColumn[4];
220:                agentppTestSharedEntryColumns[idxAgentppTestSharedTableCreationTime] = moFactory
221:                        .createColumn(
222:                                colAgentppTestSharedTableCreationTime,
223:                                SMIConstants.SYNTAX_OCTET_STRING,
224:                                moFactory
225:                                        .createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_ONLY),
226:                                tcModuleSNMPv2Tc, tcDefDateAndTime);
227:                agentppTestSharedEntryColumns[idxAgentppTestSharedTableDelay] = moFactory
228:                        .createColumn(
229:                                colAgentppTestSharedTableDelay,
230:                                SMIConstants.SYNTAX_INTEGER32,
231:                                moFactory
232:                                        .createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE),
233:                                new Integer32(0), true);
234:                ValueConstraint agentppTestSharedTableDelayVC = new ConstraintsImpl();
235:                ((ConstraintsImpl) agentppTestSharedTableDelayVC)
236:                        .add(new Constraint(0L, 6000L));
237:                ((MOMutableColumn) agentppTestSharedEntryColumns[idxAgentppTestSharedTableDelay])
238:                        .addMOValueValidationListener(new ValueConstraintValidator(
239:                                agentppTestSharedTableDelayVC));
240:                ((MOMutableColumn) agentppTestSharedEntryColumns[idxAgentppTestSharedTableDelay])
241:                        .addMOValueValidationListener(new AgentppTestSharedTableDelayValidator());
242:                agentppTestSharedEntryColumns[idxAgentppTestSharedTableSession] = moFactory
243:                        .createColumn(
244:                                colAgentppTestSharedTableSession,
245:                                SMIConstants.SYNTAX_GAUGE32,
246:                                moFactory
247:                                        .createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_ONLY));
248:                agentppTestSharedEntryColumns[idxAgentppTestSharedTableRowStatus] = moFactory
249:                        .createColumn(
250:                                colAgentppTestSharedTableRowStatus,
251:                                SMIConstants.SYNTAX_INTEGER,
252:                                moFactory
253:                                        .createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE),
254:                                tcModuleSNMPv2Tc, tcDefRowStatus);
255:                ((MOMutableColumn) agentppTestSharedEntryColumns[idxAgentppTestSharedTableRowStatus])
256:                        .addMOValueValidationListener(new AgentppTestSharedTableRowStatusValidator());
257:                // Table model
258:                agentppTestSharedEntryModel = moFactory.createTableModel(
259:                        oidAgentppTestSharedEntry, agentppTestSharedEntryIndex,
260:                        agentppTestSharedEntryColumns);
261:                ((MOMutableTableModel) agentppTestSharedEntryModel)
262:                        .setRowFactory(new AgentppTestSharedEntryRowFactory());
263:                agentppTestSharedEntry = moFactory.createTable(
264:                        oidAgentppTestSharedEntry, agentppTestSharedEntryIndex,
265:                        agentppTestSharedEntryColumns,
266:                        agentppTestSharedEntryModel);
267:            }
268:
269:            public MOTable getAgentppTestSessionsEntry() {
270:                return agentppTestSessionsEntry;
271:            }
272:
273:            private void createAgentppTestSessionsEntry(MOFactory moFactory) {
274:                // Index definition
275:                agentppTestSessionsEntryIndexes = new MOTableSubIndex[] { moFactory
276:                        .createSubIndex(oidAgentppTestSessionIndex,
277:                                SMIConstants.SYNTAX_INTEGER, 1, 1) };
278:
279:                agentppTestSessionsEntryIndex = moFactory.createIndex(
280:                        agentppTestSessionsEntryIndexes, false,
281:                        new MOTableIndexValidator() {
282:                            public boolean isValidIndex(OID index) {
283:                                boolean isValidIndex = true;
284:                                //--AgentGen BEGIN=agentppTestSessionsEntry::isValidIndex
285:                                //--AgentGen END
286:                                return isValidIndex;
287:                            }
288:                        });
289:
290:                // Columns
291:                MOColumn[] agentppTestSessionsEntryColumns = new MOColumn[1];
292:                agentppTestSessionsEntryColumns[idxAgentppTestRowCreation] = moFactory
293:                        .createColumn(
294:                                colAgentppTestRowCreation,
295:                                SMIConstants.SYNTAX_GAUGE32,
296:                                moFactory
297:                                        .createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_WRITE),
298:                                new UnsignedInteger32(0), true);
299:                ((MOMutableColumn) agentppTestSessionsEntryColumns[idxAgentppTestRowCreation])
300:                        .addMOValueValidationListener(new AgentppTestRowCreationValidator());
301:                // Table model
302:                agentppTestSessionsEntryModel = moFactory.createTableModel(
303:                        oidAgentppTestSessionsEntry,
304:                        agentppTestSessionsEntryIndex,
305:                        agentppTestSessionsEntryColumns);
306:                ((MOMutableTableModel) agentppTestSessionsEntryModel)
307:                        .setRowFactory(new AgentppTestSessionsEntryRowFactory());
308:                agentppTestSessionsEntry = moFactory.createTable(
309:                        oidAgentppTestSessionsEntry,
310:                        agentppTestSessionsEntryIndex,
311:                        agentppTestSessionsEntryColumns,
312:                        agentppTestSessionsEntryModel);
313:            }
314:
315:            public MOTable getAgentppTestSparseEntry() {
316:                return agentppTestSparseEntry;
317:            }
318:
319:            private void createAgentppTestSparseEntry(MOFactory moFactory) {
320:                // Index definition
321:                agentppTestSparseEntryIndexes = new MOTableSubIndex[] { moFactory
322:                        .createSubIndex(oidAgentppTestSparseIndex,
323:                                SMIConstants.SYNTAX_OCTET_STRING, 0, 255) };
324:
325:                agentppTestSparseEntryIndex = moFactory.createIndex(
326:                        agentppTestSparseEntryIndexes, false,
327:                        new MOTableIndexValidator() {
328:                            public boolean isValidIndex(OID index) {
329:                                boolean isValidIndex = true;
330:                                //--AgentGen BEGIN=agentppTestSparseEntry::isValidIndex
331:                                //--AgentGen END
332:                                return isValidIndex;
333:                            }
334:                        });
335:
336:                // Columns
337:                MOColumn[] agentppTestSparseEntryColumns = new MOColumn[4];
338:                agentppTestSparseEntryColumns[idxAgentppTestSparseCol1] = moFactory
339:                        .createColumn(
340:                                colAgentppTestSparseCol1,
341:                                SMIConstants.SYNTAX_INTEGER32,
342:                                moFactory
343:                                        .createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE),
344:                                new Integer32(1), true);
345:                ((MOMutableColumn) agentppTestSparseEntryColumns[idxAgentppTestSparseCol1])
346:                        .addMOValueValidationListener(new AgentppTestSparseCol1Validator());
347:                agentppTestSparseEntryColumns[idxAgentppTestSparseCol2] = moFactory
348:                        .createColumn(
349:                                colAgentppTestSparseCol2,
350:                                SMIConstants.SYNTAX_GAUGE32,
351:                                moFactory
352:                                        .createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE),
353:                                new Gauge32(2), true);
354:                ((MOMutableColumn) agentppTestSparseEntryColumns[idxAgentppTestSparseCol2])
355:                        .addMOValueValidationListener(new AgentppTestSparseCol2Validator());
356:                agentppTestSparseEntryColumns[idxAgentppTestSparseCol3] = moFactory
357:                        .createColumn(
358:                                colAgentppTestSparseCol3,
359:                                SMIConstants.SYNTAX_OCTET_STRING,
360:                                moFactory
361:                                        .createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE),
362:                                new OctetString(new byte[] { (byte) 51 }), true);
363:                ValueConstraint agentppTestSparseCol3VC = new ConstraintsImpl();
364:                ((ConstraintsImpl) agentppTestSparseCol3VC).add(new Constraint(
365:                        0L, 255L));
366:                ((MOMutableColumn) agentppTestSparseEntryColumns[idxAgentppTestSparseCol3])
367:                        .addMOValueValidationListener(new ValueConstraintValidator(
368:                                agentppTestSparseCol3VC));
369:                ((MOMutableColumn) agentppTestSparseEntryColumns[idxAgentppTestSparseCol3])
370:                        .addMOValueValidationListener(new AgentppTestSparseCol3Validator());
371:                agentppTestSparseEntryColumns[idxAgentppTestSparseRowStatus] = moFactory
372:                        .createColumn(
373:                                colAgentppTestSparseRowStatus,
374:                                SMIConstants.SYNTAX_INTEGER,
375:                                moFactory
376:                                        .createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE),
377:                                tcModuleSNMPv2Tc, tcDefRowStatus);
378:                ((MOMutableColumn) agentppTestSparseEntryColumns[idxAgentppTestSparseRowStatus])
379:                        .addMOValueValidationListener(new AgentppTestSparseRowStatusValidator());
380:                // Table model
381:                agentppTestSparseEntryModel = moFactory.createTableModel(
382:                        oidAgentppTestSparseEntry, agentppTestSparseEntryIndex,
383:                        agentppTestSparseEntryColumns);
384:                ((MOMutableTableModel) agentppTestSparseEntryModel)
385:                        .setRowFactory(new AgentppTestSparseEntryRowFactory());
386:                agentppTestSparseEntry = moFactory.createTable(
387:                        oidAgentppTestSparseEntry, agentppTestSparseEntryIndex,
388:                        agentppTestSparseEntryColumns,
389:                        agentppTestSparseEntryModel);
390:            }
391:
392:            public void registerMOs(MOServer server, OctetString context)
393:                    throws DuplicateRegistrationException {
394:                // Scalar Objects
395:                server.register(this .agentppTestTimeout, context);
396:                server.register(this .agentppTestSharedEntry, context);
397:                server.register(this .agentppTestSessionsEntry, context);
398:                server.register(this .agentppTestSparseEntry, context);
399:                //--AgentGen BEGIN=_registerMOs
400:                for (int i = 0; i < 10; i++) {
401:                    Variable[] vbs = agentppTestSparseEntry.getDefaultValues();
402:                    vbs[idxAgentppTestSparseRowStatus] = new Integer32(
403:                            RowStatus.active);
404:                    MOTableRow row = agentppTestSparseEntry.createRow(
405:                            new AnyNewIndexOID(new int[] { 1, i }), vbs);
406:                    agentppTestSparseEntry.addRow(row);
407:                }
408:                //--AgentGen END
409:            }
410:
411:            public void unregisterMOs(MOServer server, OctetString context) {
412:                // Scalar Objects
413:                server.unregister(this .agentppTestTimeout, context);
414:                server.unregister(this .agentppTestSharedEntry, context);
415:                server.unregister(this .agentppTestSessionsEntry, context);
416:                server.unregister(this .agentppTestSparseEntry, context);
417:                //--AgentGen BEGIN=_unregisterMOs
418:                //--AgentGen END
419:            }
420:
421:            // Notifications
422:
423:            // Scalars
424:            public class AgentppTestTimeout extends MOScalar {
425:                AgentppTestTimeout(OID oid, MOAccess access) {
426:                    super (oid, access, new UnsignedInteger32());
427:                    //--AgentGen BEGIN=agentppTestTimeout
428:                    //--AgentGen END
429:                }
430:
431:                public int isValueOK(SubRequest request) {
432:                    Variable newValue = request.getVariableBinding()
433:                            .getVariable();
434:                    int valueOK = super .isValueOK(request);
435:                    if (valueOK != SnmpConstants.SNMP_ERROR_SUCCESS) {
436:                        return valueOK;
437:                    }
438:                    long v = ((UnsignedInteger32) newValue).getValue();
439:                    if (!(((v >= 0L) && (v <= 1000000L)))) {
440:                        valueOK = SnmpConstants.SNMP_ERROR_WRONG_VALUE;
441:                    }
442:                    //--AgentGen BEGIN=agentppTestTimeout::isValueOK
443:                    //--AgentGen END
444:                    return valueOK;
445:                }
446:
447:                public Variable getValue() {
448:                    //--AgentGen BEGIN=agentppTestTimeout::getValue
449:                    //--AgentGen END
450:                    return super .getValue();
451:                }
452:
453:                public int setValue(Variable newValue) {
454:                    //--AgentGen BEGIN=agentppTestTimeout::setValue
455:                    //--AgentGen END
456:                    return super .setValue(newValue);
457:                }
458:
459:                //--AgentGen BEGIN=agentppTestTimeout::_METHODS
460:                //--AgentGen END
461:
462:            }
463:
464:            // Value Validators
465:            /**
466:             * The <code>AgentppTestTimeoutValidator</code> implements the value
467:             * validation for <code>AgentppTestTimeout</code>.
468:             */
469:            static class AgentppTestTimeoutValidator implements 
470:                    MOValueValidationListener {
471:
472:                public void validate(MOValueValidationEvent validationEvent) {
473:                    Variable newValue = validationEvent.getNewValue();
474:                    long v = ((UnsignedInteger32) newValue).getValue();
475:                    if (!(((v >= 0L) && (v <= 1000000L)))) {
476:                        validationEvent
477:                                .setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_VALUE);
478:                        return;
479:                    }
480:                    //--AgentGen BEGIN=agentppTestTimeout::validate
481:                    //--AgentGen END
482:                }
483:            }
484:
485:            /**
486:             * The <code>AgentppTestSharedTableDelayValidator</code> implements the value
487:             * validation for <code>AgentppTestSharedTableDelay</code>.
488:             */
489:            static class AgentppTestSharedTableDelayValidator implements 
490:                    MOValueValidationListener {
491:
492:                public void validate(MOValueValidationEvent validationEvent) {
493:                    Variable newValue = validationEvent.getNewValue();
494:                    long v = ((Integer32) newValue).getValue();
495:                    if (!(((v >= 0L) && (v <= 6000L)))) {
496:                        validationEvent
497:                                .setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_VALUE);
498:                        return;
499:                    }
500:                    //--AgentGen BEGIN=agentppTestSharedTableDelay::validate
501:                    //--AgentGen END
502:                }
503:            }
504:
505:            /**
506:             * The <code>AgentppTestSharedTableRowStatusValidator</code> implements the value
507:             * validation for <code>AgentppTestSharedTableRowStatus</code>.
508:             */
509:            static class AgentppTestSharedTableRowStatusValidator implements 
510:                    MOValueValidationListener {
511:
512:                public void validate(MOValueValidationEvent validationEvent) {
513:                    Variable newValue = validationEvent.getNewValue();
514:                    //--AgentGen BEGIN=agentppTestSharedTableRowStatus::validate
515:                    //--AgentGen END
516:                }
517:            }
518:
519:            /**
520:             * The <code>AgentppTestRowCreationValidator</code> implements the value
521:             * validation for <code>AgentppTestRowCreation</code>.
522:             */
523:            static class AgentppTestRowCreationValidator implements 
524:                    MOValueValidationListener {
525:
526:                public void validate(MOValueValidationEvent validationEvent) {
527:                    Variable newValue = validationEvent.getNewValue();
528:                    //--AgentGen BEGIN=agentppTestRowCreation::validate
529:                    //--AgentGen END
530:                }
531:            }
532:
533:            /**
534:             * The <code>AgentppTestSparseCol1Validator</code> implements the value
535:             * validation for <code>AgentppTestSparseCol1</code>.
536:             */
537:            static class AgentppTestSparseCol1Validator implements 
538:                    MOValueValidationListener {
539:
540:                public void validate(MOValueValidationEvent validationEvent) {
541:                    Variable newValue = validationEvent.getNewValue();
542:                    //--AgentGen BEGIN=agentppTestSparseCol1::validate
543:                    //--AgentGen END
544:                }
545:            }
546:
547:            /**
548:             * The <code>AgentppTestSparseCol2Validator</code> implements the value
549:             * validation for <code>AgentppTestSparseCol2</code>.
550:             */
551:            static class AgentppTestSparseCol2Validator implements 
552:                    MOValueValidationListener {
553:
554:                public void validate(MOValueValidationEvent validationEvent) {
555:                    Variable newValue = validationEvent.getNewValue();
556:                    //--AgentGen BEGIN=agentppTestSparseCol2::validate
557:                    //--AgentGen END
558:                }
559:            }
560:
561:            /**
562:             * The <code>AgentppTestSparseCol3Validator</code> implements the value
563:             * validation for <code>AgentppTestSparseCol3</code>.
564:             */
565:            static class AgentppTestSparseCol3Validator implements 
566:                    MOValueValidationListener {
567:
568:                public void validate(MOValueValidationEvent validationEvent) {
569:                    Variable newValue = validationEvent.getNewValue();
570:                    OctetString os = (OctetString) newValue;
571:                    if (!(((os.length() >= 0) && (os.length() <= 255)))) {
572:                        validationEvent
573:                                .setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_LENGTH);
574:                        return;
575:                    }
576:                    //--AgentGen BEGIN=agentppTestSparseCol3::validate
577:                    //--AgentGen END
578:                }
579:            }
580:
581:            /**
582:             * The <code>AgentppTestSparseRowStatusValidator</code> implements the value
583:             * validation for <code>AgentppTestSparseRowStatus</code>.
584:             */
585:            static class AgentppTestSparseRowStatusValidator implements 
586:                    MOValueValidationListener {
587:
588:                public void validate(MOValueValidationEvent validationEvent) {
589:                    Variable newValue = validationEvent.getNewValue();
590:                    //--AgentGen BEGIN=agentppTestSparseRowStatus::validate
591:                    //--AgentGen END
592:                }
593:            }
594:
595:            // Rows and Factories
596:            public class AgentppTestSharedEntryRow extends
597:                    DefaultMOMutableRow2PC {
598:                public AgentppTestSharedEntryRow(OID index, Variable[] values) {
599:                    super (index, values);
600:                }
601:
602:                public OctetString getAgentppTestSharedTableCreationTime() {
603:                    return (OctetString) getValue(idxAgentppTestSharedTableCreationTime);
604:                }
605:
606:                public void setAgentppTestSharedTableCreationTime(
607:                        OctetString newValue) {
608:                    setValue(idxAgentppTestSharedTableCreationTime, newValue);
609:                }
610:
611:                public Integer32 getAgentppTestSharedTableDelay() {
612:                    return (Integer32) getValue(idxAgentppTestSharedTableDelay);
613:                }
614:
615:                public void setAgentppTestSharedTableDelay(Integer32 newValue) {
616:                    setValue(idxAgentppTestSharedTableDelay, newValue);
617:                }
618:
619:                public UnsignedInteger32 getAgentppTestSharedTableSession() {
620:                    return (UnsignedInteger32) getValue(idxAgentppTestSharedTableSession);
621:                }
622:
623:                public void setAgentppTestSharedTableSession(
624:                        UnsignedInteger32 newValue) {
625:                    setValue(idxAgentppTestSharedTableSession, newValue);
626:                }
627:
628:                public Integer32 getAgentppTestSharedTableRowStatus() {
629:                    return (Integer32) getValue(idxAgentppTestSharedTableRowStatus);
630:                }
631:
632:                public void setAgentppTestSharedTableRowStatus(
633:                        Integer32 newValue) {
634:                    setValue(idxAgentppTestSharedTableRowStatus, newValue);
635:                }
636:
637:                //--AgentGen BEGIN=agentppTestSharedEntry::Row
638:
639:                private void delayRequest() {
640:                    long delay = values[idxAgentppTestSharedTableDelay].toInt() * 10;
641:                    if (delay > 0) {
642:                        try {
643:                            Thread.sleep(delay);
644:                        } catch (InterruptedException ex) {
645:                        }
646:                    }
647:                }
648:
649:                public Variable getValue(int column) {
650:                    delayRequest();
651:                    return super .getValue(column);
652:                }
653:
654:                public void commit(SubRequest subRequest, MOTableRow changeSet,
655:                        int column) {
656:                    delayRequest();
657:                    super .commit(subRequest, changeSet, column);
658:                }
659:
660:                //--AgentGen END
661:            }
662:
663:            class AgentppTestSharedEntryRowFactory extends
664:                    DefaultMOMutableRow2PCFactory {
665:                public synchronized MOTableRow createRow(OID index,
666:                        Variable[] values) throws UnsupportedOperationException {
667:                    AgentppTestSharedEntryRow row = new AgentppTestSharedEntryRow(
668:                            index, values);
669:                    //--AgentGen BEGIN=agentppTestSharedEntry::createRow
670:                    //--AgentGen END
671:                    return row;
672:                }
673:
674:                public synchronized void freeRow(MOTableRow row) {
675:                    //--AgentGen BEGIN=agentppTestSharedEntry::freeRow
676:                    //--AgentGen END
677:                }
678:
679:                //--AgentGen BEGIN=agentppTestSharedEntry::RowFactory
680:                //--AgentGen END
681:            }
682:
683:            public class AgentppTestSessionsEntryRow extends
684:                    DefaultMOMutableRow2PC {
685:                public AgentppTestSessionsEntryRow(OID index, Variable[] values) {
686:                    super (index, values);
687:                }
688:
689:                public UnsignedInteger32 getAgentppTestRowCreation() {
690:                    return (UnsignedInteger32) getValue(idxAgentppTestRowCreation);
691:                }
692:
693:                public void setAgentppTestRowCreation(UnsignedInteger32 newValue) {
694:                    setValue(idxAgentppTestRowCreation, newValue);
695:                }
696:
697:                //--AgentGen BEGIN=agentppTestSessionsEntry::Row
698:                public void commitRow(SubRequest subRequest,
699:                        MOTableRow changeSet) {
700:                    int newRowIndex = changeSet.getValue(
701:                            idxAgentppTestRowCreation).toInt();
702:                    if (newRowIndex != 0) {
703:                        OID newIndex = new OID(new int[] { newRowIndex });
704:                        Variable[] values = agentppTestSharedEntry
705:                                .getDefaultValues();
706:                        values[idxAgentppTestSharedTableRowStatus] = new Integer32(
707:                                RowStatus.active);
708:                        values[idxAgentppTestSharedTableCreationTime] = DateAndTime
709:                                .makeDateAndTime(new GregorianCalendar());
710:                        values[idxAgentppTestSharedTableSession] = new UnsignedInteger32(
711:                                getIndex().get(0));
712:                        MOTableRow row = agentppTestSharedEntry.createRow(
713:                                newIndex, values);
714:                        if (row != null) {
715:                            if (!agentppTestSharedEntry.addRow(row)) {
716:                                ((UnsignedInteger32) changeSet
717:                                        .getValue(idxAgentppTestRowCreation))
718:                                        .setValue(0);
719:                            }
720:                        } else {
721:                            ((UnsignedInteger32) changeSet
722:                                    .getValue(idxAgentppTestRowCreation))
723:                                    .setValue(0);
724:                        }
725:                    }
726:                }
727:                //--AgentGen END
728:            }
729:
730:            class AgentppTestSessionsEntryRowFactory extends
731:                    DefaultMOMutableRow2PCFactory {
732:                public synchronized MOTableRow createRow(OID index,
733:                        Variable[] values) throws UnsupportedOperationException {
734:                    AgentppTestSessionsEntryRow row = new AgentppTestSessionsEntryRow(
735:                            index, values);
736:                    //--AgentGen BEGIN=agentppTestSessionsEntry::createRow
737:                    //--AgentGen END
738:                    return row;
739:                }
740:
741:                public synchronized void freeRow(MOTableRow row) {
742:                    //--AgentGen BEGIN=agentppTestSessionsEntry::freeRow
743:                    //--AgentGen END
744:                }
745:
746:                //--AgentGen BEGIN=agentppTestSessionsEntry::RowFactory
747:                //--AgentGen END
748:            }
749:
750:            public class AgentppTestSparseEntryRow extends
751:                    DefaultMOMutableRow2PC {
752:                public AgentppTestSparseEntryRow(OID index, Variable[] values) {
753:                    super (index, values);
754:                }
755:
756:                public Integer32 getAgentppTestSparseCol1() {
757:                    return (Integer32) getValue(idxAgentppTestSparseCol1);
758:                }
759:
760:                public void setAgentppTestSparseCol1(Integer32 newValue) {
761:                    setValue(idxAgentppTestSparseCol1, newValue);
762:                }
763:
764:                public Gauge32 getAgentppTestSparseCol2() {
765:                    return (Gauge32) getValue(idxAgentppTestSparseCol2);
766:                }
767:
768:                public void setAgentppTestSparseCol2(Gauge32 newValue) {
769:                    setValue(idxAgentppTestSparseCol2, newValue);
770:                }
771:
772:                public OctetString getAgentppTestSparseCol3() {
773:                    return (OctetString) getValue(idxAgentppTestSparseCol3);
774:                }
775:
776:                public void setAgentppTestSparseCol3(OctetString newValue) {
777:                    setValue(idxAgentppTestSparseCol3, newValue);
778:                }
779:
780:                public Integer32 getAgentppTestSparseRowStatus() {
781:                    return (Integer32) getValue(idxAgentppTestSparseRowStatus);
782:                }
783:
784:                public void setAgentppTestSparseRowStatus(Integer32 newValue) {
785:                    setValue(idxAgentppTestSparseRowStatus, newValue);
786:                }
787:
788:                //--AgentGen BEGIN=agentppTestSparseEntry::Row
789:
790:                public void setValue(int column, Variable value) {
791:                    if (column != idxAgentppTestSparseRowStatus) {
792:                        if (value.equals(getValue(column))) {
793:                            super .setValue(column, null);
794:                            return;
795:                        }
796:                    }
797:                    super .setValue(column, value);
798:                }
799:
800:                //--AgentGen END
801:            }
802:
803:            class AgentppTestSparseEntryRowFactory extends
804:                    DefaultMOMutableRow2PCFactory {
805:                public synchronized MOTableRow createRow(OID index,
806:                        Variable[] values) throws UnsupportedOperationException {
807:                    AgentppTestSparseEntryRow row = new AgentppTestSparseEntryRow(
808:                            index, values);
809:                    //--AgentGen BEGIN=agentppTestSparseEntry::createRow
810:                    //--AgentGen END
811:                    return row;
812:                }
813:
814:                public synchronized void freeRow(MOTableRow row) {
815:                    //--AgentGen BEGIN=agentppTestSparseEntry::freeRow
816:                    //--AgentGen END
817:                }
818:
819:                //--AgentGen BEGIN=agentppTestSparseEntry::RowFactory
820:                //--AgentGen END
821:            }
822:
823:            //--AgentGen BEGIN=_METHODS
824:            public static MOFactory getSharedTableFactory() {
825:                return new AgentppTestMOFactory();
826:            }
827:
828:            //--AgentGen END
829:
830:            //--AgentGen BEGIN=_CLASSES
831:            static class AgentppTestMOFactory extends DefaultMOFactory {
832:                public MOTable createTable(OID oid, MOTableIndex indexDef,
833:                        MOColumn[] columns) {
834:                    if (oidAgentppTestSessionsEntry.equals(oid)) {
835:                        return new DefaultAgentXSharedMOTable(oid, indexDef,
836:                                columns) {
837:                            public void setAgentXSharedMOTableSupport(
838:                                    AgentXSharedMOTableSupport sharedTableSupport) {
839:                                super 
840:                                        .setAgentXSharedMOTableSupport(sharedTableSupport);
841:                                ((MOMutableTableModel) model).clear();
842:                                OID index = new OID(
843:                                        new int[] { sharedTableSupport
844:                                                .getSession().getSessionID() });
845:                                MOTableRow row = createRow(index);
846:                                if (row != null) {
847:                                    addRow(row);
848:                                }
849:                            }
850:                        };
851:                    }
852:                    return new DefaultAgentXSharedMOTable(oid, indexDef,
853:                            columns);
854:                }
855:
856:                public MOTable createTable(OID oid, MOTableIndex indexDef,
857:                        MOColumn[] columns, MOTableModel model) {
858:                    DefaultAgentXSharedMOTable table = (DefaultAgentXSharedMOTable) createTable(
859:                            oid, indexDef, columns);
860:                    table.setModel(model);
861:                    return table;
862:                }
863:
864:            }
865:            //--AgentGen END
866:
867:            //--AgentGen BEGIN=_END
868:            //--AgentGen END
869:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.