Пример #1
0
 /**
  * Return the integer value of a property. If there is no property <code>key</code>, or the value
  * is not an integer, the default value is returned.
  *
  * @param key The key
  * @param def The default value
  */
 public int getIntParameter(String key, int def) {
   int val = def;
   try {
     String v = prop.getProperty(key);
     if (v != null) {
       val = Integer.valueOf(v).intValue();
     }
   } catch (java.lang.NumberFormatException exc) {
   } catch (NullPointerException exc) {
   }
   return val;
 }
Пример #2
0
 public int getPrivProcotol() {
   String param = prop.getProperty(PRIV_PROTOCOL, "DES");
   int proto = SnmpContextv3Face.DES_ENCRYPT;
   if (param != null) {
     char f = param.charAt(0);
     if (f == 'A') {
       proto = SnmpContextv3Face.AES_ENCRYPT;
     } else {
       proto = SnmpContextv3Face.DES_ENCRYPT;
     }
   }
   return proto;
 }
Пример #3
0
 public int getAuthProcotol() {
   String param = prop.getProperty(AUTH_PROTOCOL, "MD5");
   int proto = SnmpContextv3Face.MD5_PROTOCOL;
   if (param != null) {
     char f = param.charAt(0);
     if (f == 'S') {
       proto = SnmpContextv3Face.SHA1_PROTOCOL;
     } else {
       proto = SnmpContextv3Face.MD5_PROTOCOL;
     }
   }
   return proto;
 }
Пример #4
0
  public void loadPropfile(File file) {
    propFile = file;

    try {
      FileInputStream in = new FileInputStream(propFile);
      prop.load(in);
      in.close();
      System.out.println("Util(): Using properties file '" + propFile + "'.");
    } catch (FileNotFoundException exc) {
      propFile = null;
      System.out.println("Util(): FileNotFoundException " + exc.getMessage());
    } catch (IOException exc) {
      propFile = null;
      System.out.println("Util(): IOException " + exc.getMessage());
    }
  }
Пример #5
0
 public String getProperty(String key, String defaultValue) {
   return prop.getProperty(key, defaultValue);
 }
Пример #6
0
 public String getProperty(String key) {
   return prop.getProperty(key);
 }
Пример #7
0
 public String getUserPrivPassword() {
   String passw = prop.getProperty(USER_PRIV_PASSWORD, "PrivPassword");
   return passw;
 }
Пример #8
0
 public String getUserName() {
   String userName = prop.getProperty(USERNAME, "authUser");
   return userName;
 }
Пример #9
0
 public String getUserAuthPassword() {
   String passw = prop.getProperty(USER_AUTH_PASSWORD, "AuthPassword");
   return passw;
 }
Пример #10
0
 public String getContextEngineIdStr() {
   String param = prop.getProperty(CONTEXT_ENGINE_ID);
   return param;
 }
Пример #11
0
 public String getContextName() {
   String contextName = prop.getProperty(CONTEXT_NAME, "");
   return contextName;
 }
Пример #12
0
 /**
  * Returns the <code>oid</code> property.
  *
  * @param def The default value.
  * @return The <code>oid</code> property.
  * @see #OID
  */
 public String getOid(String def) {
   String oid = prop.getProperty(OID, def);
   return oid;
 }
Пример #13
0
 /**
  * Returns the <code>sockettype</code> property. The default value will be the standard socket.
  *
  * @return The <code>sockettype</code> property.
  * @see #SOCKETTYPE
  * @see SnmpContextFace#STANDARD_SOCKET
  */
 public String getSocketType() {
   String socketType = prop.getProperty(SOCKETTYPE, SnmpContextFace.STANDARD_SOCKET);
   return socketType;
 }
Пример #14
0
 /**
  * Returns the <code>port</code> property.
  *
  * @return The <code>port</code> property.
  * @see #PORT
  */
 public String getPort() {
   String port = prop.getProperty(PORT, "" + SnmpContextBasisFace.DEFAULT_PORT);
   return port;
 }
Пример #15
0
 /**
  * Returns the <code>bind</code> property.
  *
  * @return The <code>bind</code> property.
  * @see #BIND
  * @since 4_14
  */
 public String getBindAddress() {
   String bind = prop.getProperty(BIND);
   return bind;
 }
Пример #16
0
 /**
  * Returns the <code>host</code> property.
  *
  * @return The <code>host</code> property.
  * @see #HOST
  */
 public String getHost() {
   String host = prop.getProperty(HOST, myHost());
   return host;
 }