コード例 #1
3
  protected boolean getShowLinearCurve() throws IOException {
    boolean res = false;

    {
      ConfigFactory f = DefaultConfigFactory.getInstance();
      Config c = f.getConfig();

      String configNameLinearCurve = getConfigNameLinearCurve();
      boolean configValueDefault = false;

      // Set 'configValueDefault':
      {
        String mode = c.getProperty("mode");
        if (mode != null) {
          if ("Test".equals(mode)) {
            configValueDefault = true;
          }
        }
      }

      res = c.getPropertyAsBoolean(configNameLinearCurve, configValueDefault);
    }

    return res;
  }
コード例 #2
1
    protected void init() {
      // Create link to backing-store:
      {
        BackingStore<String, DSLAMProviderRequest, C> backingStore =
            new DSLAMProviderContextBackingStore();

        setBackingStore(backingStore);
      }

      // Set renew-time and cache-time:
      {
        int renewTime = TIME_RENEW_DEFAULT;
        int cacheTime = TIME_CACHE_DEFAULT;

        {
          try {
            ConfigFactory f = DefaultConfigFactory.getInstance();
            Config c = f.getConfig();

            if (c != null) {
              renewTime =
                  c.getPropertyAsInt("provider.allocator.context-cache.time.renew", renewTime);
              cacheTime =
                  c.getPropertyAsInt("provider.allocator.context-cache.time.cache", cacheTime);
            }
          } catch (IOException ex) {
            // Ignore!
          }
        }

        setRenewTime(renewTime);
        setCacheTime(cacheTime);
      }
    }
コード例 #3
0
  protected List<String> getUserRolesFromConfig(String property) throws IOException {
    List<String> res = null;

    {
      if (property != null) {
        ConfigFactory f = DefaultConfigFactory.getInstance();
        Config c = f.getConfig();

        String v = c.getProperty(property); // re-read; marks property read in 'Config'-impl. cache

        res = parseStringList(v);
      }
    }

    return res;
  }
コード例 #4
0
  protected String getUserPresentationNameFromConfig(Principal userPrincipal) throws IOException {
    String res = null;

    {
      if (userPrincipal != null) {
        String userName = PrincipalUtil.getNameStripped(userPrincipal);

        if (userName != null) {
          String property = "security.authorization.user." + userName + ".presentation-name";

          ConfigFactory f = DefaultConfigFactory.getInstance();
          Config c = f.getConfig();

          res = c.getProperty(property);
        }
      }
    }

    return res;
  }
コード例 #5
0
  @Override
  public Integer getThreadPoolSizeMinimum() throws IOException {
    Integer res = null;

    {
      final Integer defaultValue = THREAD_POOL_SIZE_MINIMUM_DEFAULT;

      res = config.getPropertyAsInt("thread-pool.size-minimum", defaultValue);

      if (res == null) {
        res = super.getThreadPoolSizeMinimum();
      }

      if (res == null) {
        res = defaultValue;
      }
    }

    return res;
  }
コード例 #6
0
  @Override
  public Integer getQueueCapacity() throws IOException {
    Integer res = null;

    {
      final Integer defaultValue = THREAD_QUEUE_CAPACITY_DEFAULT;

      res = config.getPropertyAsInt("thread-pool.queue-capacity", defaultValue);

      if (res == null) {
        res = super.getQueueCapacity();
      }

      if (res == null) {
        res = defaultValue;
      }
    }

    return res;
  }
コード例 #7
0
  @Override
  public Long getThreadKeepAliveTime() throws IOException {
    Long res = null;

    {
      final Long defaultValue = THREAD_KEEP_ALIVE_TIME_DEFAULT;

      res = config.getPropertyAsLong("thread-pool.time-keep-alive", defaultValue);

      if (res == null) {
        res = super.getThreadKeepAliveTime();
      }

      if (res == null) {
        res = defaultValue;
      }
    }

    return res;
  }