All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.snmp4j.agent.mo.MOFactoryAdapter Maven / Gradle / Ivy

There is a newer version: 3.8.1
Show newest version
/*_############################################################################
  _## 
  _##  SNMP4J-Agent 3 - MOFactoryAdapter.java  
  _## 
  _##  Copyright (C) 2005-2021  Frank Fock (SNMP4J.org)
  _##  
  _##  Licensed under the Apache License, Version 2.0 (the "License");
  _##  you may not use this file except in compliance with the License.
  _##  You may obtain a copy of the License at
  _##  
  _##      http://www.apache.org/licenses/LICENSE-2.0
  _##  
  _##  Unless required by applicable law or agreed to in writing, software
  _##  distributed under the License is distributed on an "AS IS" BASIS,
  _##  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  _##  See the License for the specific language governing permissions and
  _##  limitations under the License.
  _##  
  _##########################################################################*/
package org.snmp4j.agent.mo;

import org.snmp4j.agent.MOAccess;
import org.snmp4j.agent.mo.snmp.SysUpTime;
import org.snmp4j.agent.mo.snmp.tc.TextualConvention;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.Variable;

/**
 * The {@link MOFactoryAdapter} class wraps a {@link MOFactory} and per default delegates all method calls to that
 * class. User of the adapter can then overwrite and adapt the behavior of the underlying factory for special needs
 * of a certain group of MIB objects, for example during creation of a MIB module.
 *
 * @author Frank Fock
 * @version 3.0.0
 */
public class MOFactoryAdapter implements MOFactory {

    private MOFactory delegateFactory;

    public MOFactoryAdapter(MOFactory delegateFactory) {
        this.delegateFactory = delegateFactory;
    }

    @Override
    public void addTextualConvention(TextualConvention tc) {
        delegateFactory.addTextualConvention(tc);
    }

    @Override
    public void removeTextualConvention(TextualConvention tc) {
        delegateFactory.removeTextualConvention(tc);
    }

    @Override
    public  TextualConvention getTextualConvention(String moduleName, String name) {
        return delegateFactory.getTextualConvention(moduleName, name);
    }

    @Override
    public MOAccess createAccess(int moAccess) {
        return delegateFactory.createAccess(moAccess);
    }

    @Override
    @SuppressWarnings("rawtypes")
    public > MOTable
    createTable(OID oid, MOTableIndex indexDef, MOColumn[] columns) {
        return delegateFactory.createTable(oid, indexDef, columns);
    }

    @Override
    @SuppressWarnings("rawtypes")
    public > MOTable
    createTable(OID oid, MOTableIndex indexDef, MOColumn[] columns, M model) {
        return delegateFactory.createTable(oid, indexDef, columns, model);
    }

    @Override
    public MOTableIndex createIndex(MOTableSubIndex[] subIndexes, boolean impliedLength) {
        return delegateFactory.createIndex(subIndexes, impliedLength);
    }

    @Override
    public MOTableIndex createIndex(MOTableSubIndex[] subIndexes, boolean impliedLength, MOTableIndexValidator validator) {
        return delegateFactory.createIndex(subIndexes, impliedLength, validator);
    }

    @Override
    public MOTableSubIndex createSubIndex(OID oid, int smiSyntax) {
        return delegateFactory.createSubIndex(oid, smiSyntax);
    }

    @Override
    public MOTableSubIndex createSubIndex(OID oid, int smiSyntax, int minLength, int maxLength) {
        return delegateFactory.createSubIndex(oid, smiSyntax, minLength, maxLength);
    }

    @Override
    public  MOColumn createColumn(int columnID, int syntax, MOAccess access) {
        return delegateFactory.createColumn(columnID, syntax, access);
    }

    @Override
    public  MOColumn createColumn(int columnID, int syntax, MOAccess access, String tcModuleName,
                                                         String textualConvention) {
        return delegateFactory.createColumn(columnID, syntax, access, tcModuleName, textualConvention);
    }

    @Override
    public  MOColumn createColumn(int columnID, int syntax, MOAccess access, V defaultValue,
                                                         boolean mutableInService) {
        return delegateFactory.createColumn(columnID, syntax, access, defaultValue, mutableInService);
    }

    @Override
    public  MOColumn createColumn(int columnID, int syntax, MOAccess access, V defaultValue,
                                                         boolean mutableInService, String tcModuleName, String textualConvention) {
        return delegateFactory.createColumn(columnID, syntax, access, defaultValue, mutableInService, tcModuleName, textualConvention);
    }

    @Override
    @SuppressWarnings("rawtypes")
    public > M
    createTableModel(OID tableOID, MOTableIndex indexDef, MOColumn[] columns) {
        return delegateFactory.createTableModel(tableOID, indexDef, columns);
    }

    @Override
    public  MOScalar createScalar(OID id, MOAccess access, V value) {
        return delegateFactory.createScalar(id, access, value);
    }

    @Override
    public  MOScalar createScalar(OID id, MOAccess access, V value, String tcModuleName, String textualConvention) {
        return delegateFactory.createScalar(id, access, value, tcModuleName, textualConvention);
    }

    @Override
    @SuppressWarnings("rawtypes")
    public  MOTableRelation
    createTableRelation(MOTable> baseTable,
                        MOTable> dependentTable) {
        return delegateFactory.createTableRelation(baseTable, dependentTable);
    }

    @Override
    public SysUpTime getSysUpTime(OctetString context) {
        return delegateFactory.getSysUpTime(context);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy