KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snmp4j > agent > mo > snmp > tc > TimeStampTC


1 /*_############################################################################
2   _##
3   _## SNMP4J-Agent - TimeStampTC.java
4   _##
5   _## Copyright (C) 2005-2007 Frank Fock (SNMP4J.org)
6   _##
7   _## Licensed under the Apache License, Version 2.0 (the "License");
8   _## you may not use this file except in compliance with the License.
9   _## You may obtain a copy of the License at
10   _##
11   _## http://www.apache.org/licenses/LICENSE-2.0
12   _##
13   _## Unless required by applicable law or agreed to in writing, software
14   _## distributed under the License is distributed on an "AS IS" BASIS,
15   _## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   _## See the License for the specific language governing permissions and
17   _## limitations under the License.
18   _##
19   _##########################################################################*/

20
21 package org.snmp4j.agent.mo.snmp.tc;
22
23 import org.snmp4j.agent.*;
24 import org.snmp4j.agent.mo.*;
25 import org.snmp4j.smi.*;
26 import org.snmp4j.agent.mo.snmp.TimeStamp;
27 import org.snmp4j.agent.mo.snmp.TimeStampScalar;
28 import org.snmp4j.agent.mo.snmp.SNMPv2MIB;
29 import org.snmp4j.agent.mo.snmp.SNMPv2TC;
30
31 public class TimeStampTC implements TextualConvention {
32
33   private OctetString defaultContext;
34
35   public TimeStampTC() {
36   }
37
38   /**
39    * Creates a <code>TimestampTC</code> that uses sysUpTime from the specified
40    * context.
41    *
42    * @param defaultContext
43    * the context to be used to provide the sysUpTime for time stamp TCs
44    * created by this factory.
45    * @since 1.1
46    */

47   public TimeStampTC(OctetString defaultContext) {
48     this.defaultContext = defaultContext;
49   }
50
51   public MOColumn createColumn(int columnID, int syntax, MOAccess access,
52                                Variable defaultValue,
53                                boolean mutableInService) {
54     return new TimeStamp(columnID, access,
55                          SNMPv2MIB.getSysUpTime(defaultContext));
56   }
57
58   public MOScalar createScalar(OID oid, MOAccess access, Variable value) {
59     return new TimeStampScalar(oid, access,
60                                SNMPv2MIB.getSysUpTime(defaultContext));
61   }
62
63   public String JavaDoc getModuleName() {
64     return SNMPv2TC.MODULE_NAME;
65   }
66
67   public String JavaDoc getName() {
68     return SNMPv2TC.TIMESTAMP;
69   }
70 }
71
Popular Tags