SnmpStarter.java
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:1k
- /*
- * @(#)SnmpStarter.java
- * Copyright (c) 2000 AdventNet, Inc. All Rights Reserved.
- */
- package com.adventnet.snmp.weblogic;
- import com.adventnet.snmp.rmi.*;
- import java.util.Hashtable;
- import weblogic.common.*;
- import javax.naming.*;
- import weblogic.jndi.*;
- /**
- * This class is used to start the SNMP Server in Weblogic
- * <p>
- * It registers with JNDI the name specified in the argument.
- */
- public class SnmpStarter implements T3StartupDef {
- public SnmpStarter() {}
-
- private T3ServicesDef services;
-
- public void setServices(T3ServicesDef services) {
- this.services = services;
- }
- public String startup(String name, Hashtable args) throws Exception {
- System.out.println("Starting the SNMP Server: "+name);
- //System.setSecurityManager( new RMISecurityManager() );
- try {
- SnmpEJBServerImpl factory = null;
- String usage = "java SnmpEJBServerImpl [-hp host:port]";
-
- String server = "";
- factory = new SnmpEJBServerImpl();
-
- Environment env = new Environment();
- Context ctx = env.getInitialContext();
- ctx.bind(name, factory);
-
- System.out.println( "Factory is ready" );
-
- } catch( Exception e ) {
- System.err.println("SnmpEJBServerImpl: "+ e.getMessage());
- e.printStackTrace();
- }
-
- return "ok";
- }
- }