1 /**
2 * This file is part of GoldenGate Project (named also GoldenGate or GG).
3 *
4 * Copyright 2009, Frederic Bregier, and individual contributors by the @author
5 * tags. See the COPYRIGHT.txt in the distribution for a full listing of
6 * individual contributors.
7 *
8 * All GoldenGate Project is free software: you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * GoldenGate is distributed in the hope that it will be useful, but WITHOUT ANY
14 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * GoldenGate . If not, see <http://www.gnu.org/licenses/>.
19 */
20 package goldengate.snmp.utils;
21
22 import org.snmp4j.agent.MOAccess;
23 import org.snmp4j.agent.MOScope;
24 import org.snmp4j.agent.mo.MOScalar;
25 import org.snmp4j.agent.request.SubRequest;
26 import org.snmp4j.smi.OID;
27 import org.snmp4j.smi.Variable;
28
29 /**
30 * GoldenGate MOScalar implementation
31 *
32 * @author Frederic Bregier
33 *
34 */
35 public class GgMOScalar extends MOScalar<Variable> {
36 public GgMORow row;
37
38 /**
39 * @param id
40 * @param access
41 * @param value
42 */
43 public GgMOScalar(OID id, MOAccess access, Variable value, GgMORow row) {
44 super(id, access, value);
45 this.row = row;
46 this.setVolatile(true);
47 }
48
49 /**
50 * Called when a direct external access is done to this scalar. Therefore
51 * this function can be override to host update check.
52 *
53 * @see org.snmp4j.agent.mo.MOScalar#get(org.snmp4j.agent.request.SubRequest)
54 */
55 @Override
56 public void get(@SuppressWarnings("rawtypes") SubRequest request) {
57 row.mib.updateServices(this);
58 super.get(request);
59 }
60
61 /**
62 * Called when a multiple external access is done to this scalar and the
63 * following. Therefore this function can be override to host update check.
64 *
65 * @see org.snmp4j.agent.mo.MOScalar#find(org.snmp4j.agent.MOScope)
66 */
67 @Override
68 public OID find(MOScope range) {
69 row.mib.updateServices(range);
70 return super.find(range);
71 }
72
73 }