예제 #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;
  }
    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;
  }