Ejemplo n.º 1
0
  protected Properties convertProperties(Map<String, Object> m) {
    Properties res = null;

    {
      if (m != null) {
        res = new Properties();

        Set<String> keys = m.keySet();
        for (String key : keys) {
          String value = null;

          // Set 'value':
          {
            Object o = m.get(key);
            if (o != null) {
              value = o.toString();
            }
          }

          res.setProperty(key, value);
        }
      }
    }

    return res;
  }
Ejemplo n.º 2
0
  protected void addPropertiesWithPrefix(
      Properties properties, String prefix, Properties suffixProperties) {
    if (properties != null) {
      if (prefix != null) {
        if (suffixProperties != null) {
          Set<Object> keys = suffixProperties.keySet();
          if (keys != null) {
            for (Object key : keys) {
              String k = key.toString();
              String v = suffixProperties.getProperty(k);

              String pk = prefix + k;
              properties.put(pk, v);
            }
          }
        }
      }
    }
  }
Ejemplo n.º 3
0
  public Properties getProperties() throws IOException {
    Properties res = null;

    {
      res = super.getProperties();

      if (res == null) {
        res = new Properties();
      }

      Integer sessionCount = null;
      Integer sessionCountMax = null;
      Long sessionCountMaxTime = null;

      synchronized (lookupSessionById) {
        sessionCount = lookupSessionById.size();
        sessionCountMax = this.sessionCountMax;
        sessionCountMaxTime = this.sessionCountMaxTime;
      }

      if (sessionCount != null) {
        res.setProperty("session.count", Integer.toString(sessionCount));
      }

      if (sessionCountMax != null) {
        res.setProperty("session.count-max", Integer.toString(sessionCountMax));
      }

      if (sessionCountMaxTime != null) {
        String sessionCountMaxTimeText =
            ApplicationConstants.FORMAT_DATE.format(sessionCountMaxTime);
        res.setProperty("session.count-max.timestamp", sessionCountMaxTimeText);
      }
    }

    return res;
  }