当前位置: 首页>>代码示例>>Java>>正文


Java SNMP4JSettings类代码示例

本文整理汇总了Java中org.snmp4j.SNMP4JSettings的典型用法代码示例。如果您正苦于以下问题:Java SNMP4JSettings类的具体用法?Java SNMP4JSettings怎么用?Java SNMP4JSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SNMP4JSettings类属于org.snmp4j包,在下文中一共展示了SNMP4JSettings类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.snmp4j.SNMP4JSettings; //导入依赖的package包/类
/**
     * Initialize for v3 communications
     */
    private static void initialize() {
        if (s_initialized) {
            return;
        }

//      LogFactory.setLogFactory(new Log4jLogFactory());
            
        MPv3.setEnterpriseID(5813);
        USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
        SecurityModels.getInstance().addSecurityModel(usm);
        
        // Enable extensibility in SNMP4J so that we can subclass some SMI classes to work around
        // agent bugs
        if (System.getProperty("org.snmp4j.smisyntaxes", null) != null) {
        	SNMP4JSettings.setExtensibilityEnabled(true);
        }
        
        if (Boolean.getBoolean("org.opennms.snmp.snmp4j.forwardRuntimeExceptions")) {
        	SNMP4JSettings.setForwardRuntimeExceptions(true);
        }
        
        s_initialized = true;
    }
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:27,代码来源:Snmp4JStrategy.java

示例2: initialize

import org.snmp4j.SNMP4JSettings; //导入依赖的package包/类
/**
 * Initializes the {@link SmiManager} instances used for structed management information (SMI)
 */
public void initialize() {
	try {
		smiManager = new SmiManager(license, new File(repositoryPath));
	    SNMP4JSettings.setOIDTextFormat(smiManager);
	    SNMP4JSettings.setVariableTextFormat(smiManager);

	} catch (IOException e) {
		Log.error("Failed to initialize SmiManager");
		e.printStackTrace();
	}
	// TBD??
    // If you need to disable full index formatting, then choose a different format below and uncomment the line:
    // smiManager.setOidFormat(OIDFormat.ObjectNameAndDecodedIndex4RoundTrip);
}
 
开发者ID:boundary,项目名称:boundary-event-sdk,代码行数:18,代码来源:SmiSupport.java

示例3: useExtendedSmi

import org.snmp4j.SNMP4JSettings; //导入依赖的package包/类
public void useExtendedSmi() {
  SNMP4JSettings.setExtensibilityEnabled(true);
  System.setProperty(
      org.snmp4j.smi.AbstractVariable.SMISYNTAXES_PROPERTIES,
      PROPERTIES_FILE_PATH
  );
}
 
开发者ID:kaitoy,项目名称:sneo,代码行数:8,代码来源:SmiSyntaxesPropertiesManager.java

示例4: extendTransportMappings

import org.snmp4j.SNMP4JSettings; //导入依赖的package包/类
public synchronized void extendTransportMappings() {
  logger.info("Extend TransportMappings.");

  SNMP4JSettings.setExtensibilityEnabled(true);
  System.setProperty(
    TransportMappings.TRANSPORT_MAPPINGS,
    PROPERTIES_FILE_PATH
  );
  extendingTransportMappings = true;
}
 
开发者ID:kaitoy,项目名称:sneo,代码行数:11,代码来源:TransportsPropertiesManager.java

示例5: main

import org.snmp4j.SNMP4JSettings; //导入依赖的package包/类
public static void main(String[] args) {
  LogFactory.setLogFactory(new Log4jLogFactory());
  Log4jPropertiesLoader.getInstance()
    .loadPropertyOf(SneoSnmpRequest.class);

  SmiSyntaxesPropertiesManager.getInstance().useExtendedSmi();

  SNMP4JSettings.setVariableTextFormat(
    SnmpRequestPropertiesLoader.getInstance().getVariableTextFormat()
  );

  SnmpRequest.main(args);
}
 
开发者ID:kaitoy,项目名称:sneo,代码行数:14,代码来源:SneoSnmpRequest.java

示例6: Threading

import org.snmp4j.SNMP4JSettings; //导入依赖的package包/类
/**
 * Constructs a new instance, limiting the total number of threads to count.
 */
public Threading(int count) {
    es = new ThreadPoolExecutor(count, count, 1000L, TimeUnit.MILLISECONDS,
            new LinkedBlockingQueue<Runnable>(100), this, this);
    joinTimeout = SNMP4JSettings.getThreadJoinTimeout();
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:9,代码来源:Threading.java

示例7: initialize

import org.snmp4j.SNMP4JSettings; //导入依赖的package包/类
public void initialize(PluginContext context) throws Exception {
    threading = new Threading(5);
    SNMP4JSettings.setThreadFactory(threading);
    SNMP4JSettings.setTimerFactory(threading);
    org.snmp4j.log.LogFactory.setLogFactory(new Log4jLogFactory());
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:7,代码来源:SnmpPluginLifecycleListener.java

示例8: shutdown

import org.snmp4j.SNMP4JSettings; //导入依赖的package包/类
public void shutdown() {
    threading.close();
    SNMP4JSettings.setThreadFactory(new DefaultThreadFactory());
    SNMP4JSettings.setTimerFactory(new DefaultTimerFactory());
    org.snmp4j.log.LogFactory.setLogFactory(null);
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:7,代码来源:SnmpPluginLifecycleListener.java

示例9: main

import org.snmp4j.SNMP4JSettings; //导入依赖的package包/类
public static void main(String[] args) {
  LogFactory.setLogFactory(new Log4jLogFactory());
  mx4j.log.Log.redirectTo(new Log4JLogger());
  Log4jPropertiesLoader.getInstance().loadPropertyOf(HttpJmxAgent.class);

  if (AgentPropertiesLoader.getInstance().extendSmiSyntaxes()) {
    SmiSyntaxesPropertiesManager.getInstance().useExtendedSmi();
  }
  if (AgentPropertiesLoader.getInstance().extendTransportMappings()) {
    TransportsPropertiesManager.getInstance().extendTransportMappings();
  }

  SNMP4JSettings.setVariableTextFormat(
    ColonSeparatedOidTypeValueVariableTextFormat.getInstance()
  );

  Map<?, ?> params = parseArgs(args);

  final HttpJmxAgent agent
    = new HttpJmxAgent(
        ((Integer)ArgumentParser.getValue(params, "jmxPort", 0)).intValue(),
        ((Integer)ArgumentParser.getValue(params, "rmiPort", 0)).intValue()
      );
  agent.setConfigFilePath((String)ArgumentParser.getValue(params, "f", 0));
  agent.start();

  if (params.get("d") == null) {
    ConsoleBlocker.block("** Hit Enter key to stop simulation **");
    agent.stop();
    try {
      Thread.sleep(2000);
    } catch (InterruptedException e1) {}
  }
  else {
    agent.registerPojo(
      new SimStopper(
        new StopProcedure() {
          public void stop() {
            agent.stop(3000L);
          }
        }
      ),
      "Tools:name=SimStopper"
    );
  }
}
 
开发者ID:kaitoy,项目名称:sneo,代码行数:47,代码来源:HttpJmxAgent.java


注:本文中的org.snmp4j.SNMP4JSettings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。