1 /* 2 * This file is part of Waarp Project (named also Waarp or GG). 3 * 4 * Copyright (c) 2019, Waarp SAS, 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 Waarp 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 * Waarp 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 * Waarp . If not, see <http://www.gnu.org/licenses/>. 19 */ 20 package org.waarp.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 public class WaarpMOScalar extends MOScalar<Variable> { 33 final WaarpMORow row; 34 35 /** 36 * @param id 37 * @param access 38 * @param value 39 */ 40 public WaarpMOScalar(final OID id, final MOAccess access, 41 final Variable value, final WaarpMORow row) { 42 super(id, access, value); 43 this.row = row; 44 setVolatile(true); 45 } 46 47 /** 48 * Called when a direct external access is done to this scalar. Therefore 49 * this 50 * function can be override to 51 * host update check. 52 * 53 * @see MOScalar#get(SubRequest) 54 */ 55 @Override 56 public final void get(final 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 64 * can be override to host update check. 65 * 66 * @see MOScalar#find(MOScope) 67 */ 68 @Override 69 public final OID find(final MOScope range) { 70 row.mib.updateServices(range); 71 return super.find(range); 72 } 73 74 }