예제 #1
0
 /** Tie in the router's config as properties, as well as whatever the I2PAppContext says. */
 @Override
 public String getProperty(String propName, String defaultVal) {
   if (_router != null) {
     String val = _router.getConfigSetting(propName);
     if (val != null) return val;
   }
   return super.getProperty(propName, defaultVal);
 }
예제 #2
0
 /**
  * Return a long with a long default
  *
  * @since 0.9.4
  */
 @Override
 public long getProperty(String propName, long defaultVal) {
   if (_router != null) {
     String val = _router.getConfigSetting(propName);
     if (val != null) {
       long rv = defaultVal;
       try {
         rv = Long.parseLong(val);
       } catch (NumberFormatException nfe) {
       }
       return rv;
     }
   }
   return super.getProperty(propName, defaultVal);
 }
예제 #3
0
 /** Return an int with an int default */
 @Override
 public int getProperty(String propName, int defaultVal) {
   if (_router != null) {
     String val = _router.getConfigSetting(propName);
     if (val != null) {
       int ival = defaultVal;
       try {
         ival = Integer.parseInt(val);
       } catch (NumberFormatException nfe) {
       }
       return ival;
     }
   }
   return super.getProperty(propName, defaultVal);
 }
예제 #4
0
 /**
  * @return new Properties with system and context properties
  * @since 0.8.4
  */
 @Override
 public Properties getProperties() {
   Properties rv = super.getProperties();
   if (_router != null) rv.putAll(_router.getConfigMap());
   return rv;
 }
예제 #5
0
 /**
  * Convenience method for getting the router hash. Equivalent to
  * context.router().getRouterInfo().getIdentity().getHash()
  *
  * @return may be null if called very early
  */
 public Hash routerHash() {
   if (_router == null) return null;
   RouterInfo ri = _router.getRouterInfo();
   if (ri == null) return null;
   return ri.getIdentity().getHash();
 }