Example usage for org.apache.commons.configuration Configuration getBoolean

List of usage examples for org.apache.commons.configuration Configuration getBoolean

Introduction

In this page you can find the example usage for org.apache.commons.configuration Configuration getBoolean.

Prototype

Boolean getBoolean(String key, Boolean defaultValue);

Source Link

Document

Get a Boolean associated with the given configuration key.

Usage

From source file:com.linkedin.pinot.controller.helix.core.rebalance.DefaultRebalanceSegmentStrategy.java

/**
 * Rebalances ideal state object without updating it
 * @param idealState//w ww  .ja  va 2  s.  co m
 * @param tableConfig
 * @param targetNumReplicas
 * @param rebalanceUserConfig
 * @param newPartitionAssignment
 */
private IdealState rebalanceIdealState(IdealState idealState, TableConfig tableConfig, int targetNumReplicas,
        Configuration rebalanceUserConfig, PartitionAssignment newPartitionAssignment) {
    // if realtime and includeConsuming, then rebalance consuming segments
    if (tableConfig.getTableType().equals(CommonConstants.Helix.TableType.REALTIME)) {
        boolean includeConsuming = rebalanceUserConfig
                .getBoolean(RebalanceUserConfigConstants.INCLUDE_CONSUMING, DEFAULT_INCLUDE_CONSUMING);
        if (includeConsuming) {
            rebalanceConsumingSegments(idealState, newPartitionAssignment);
        }
    }
    // always rebalance serving segments
    rebalanceServingSegments(idealState, tableConfig, targetNumReplicas);
    idealState.setReplicas(Integer.toString(targetNumReplicas));
    return idealState;
}

From source file:gr.abiss.calipso.AppInitializer.java

@PostInitialize
public void init() {
    Configuration config = ConfigurationFactory.getConfiguration();
    boolean initData = config.getBoolean(ConfigurationFactory.INIT_DATA, true);

    if (continentRepository.count() == 0) {
        initContinentsAndCountries();/*www .  ja v a2  s . c  o m*/
    }
    if (initData && this.userService.count() == 0) {

        Role adminRole = new Role(Role.ROLE_ADMIN, "System Administrator.");
        adminRole = roleService.create(adminRole);
        Role siteAdminRole = new Role(Role.ROLE_SITE_OPERATOR, "Site Operator.");
        siteAdminRole = roleService.create(siteAdminRole);
        // this is added to users by user service, just creating it
        Role userRole = new Role(Role.ROLE_USER, "Logged in user");
        userRole = roleService.create(userRole);

        Date now = new Date();

        //         Host h1 = new Host("www.abiss.gr");
        //         h1.addAlias("abiss.gr");
        //         h1 = hostService.create(h1);
        //         Host h2 = new Host("dev.abiss.gr");
        //         h2 = hostService.create(h2);
        //         Host h3 = new Host("calipso.abiss.gr");
        //         h3 = hostService.create(h3);
        //         Text t1 = new Text("test2");

        //         t1.setHost(h2);
        //         t1.setSource("test2");
        //         t1.setSourceContentType(Text.MIME_MARKDOWN);
        //         textService.create(t1);
        //         Text t2 = new Text("test2");
        //         t2.setHost(h1);
        //         t2.setSource("test2");
        //         t2.setSourceContentType(Text.MIME_MARKDOWN);
        //         textService.create(t2);
        //         Text t3 = new Text("test3");
        //         t3.setHost(h1);
        //         t3.setSource("test3");
        //         t3.setSourceContentType(Text.MIME_MARKDOWN);
        //         textService.create(t3);

        User system = new User();
        system.setEmail("system@abiss.gr");
        system.setFirstName("System");
        system.setLastName("User");
        system.setUsername("system");
        system.setPassword("admin");
        system.setLastVisit(now);
        system.setActive(false);
        system.setInactivationDate(now);
        system.setInactivationReason("System user cannot login");
        system = userService.createActive(system);

        User u0 = new User();
        u0.setEmail("info@abiss.gr");
        u0.setFirstName("Admin");
        u0.setLastName("User");
        u0.setUsername("admin");
        u0.setPassword("admin");
        u0.setLastVisit(now);
        u0.addRole(adminRole);
        u0.setCreatedBy(system);
        u0 = userService.createActive(u0);

        for (int i = 0; i < 10; i++) {
            User u = new User();
            u.setEmail("user" + i + "@abiss.gr");
            u.setFirstName("Firstuser" + i);
            u.setLastName("Lastuser" + i);
            u.setUsername("user" + i);
            u.setPassword("user" + i);
            u.setLastVisit(now);
            u.setCreatedBy(system);
            u = userService.createActive(u);

            // notify the admin for each user creation to test notifications
            baseNotificationService.create(new BaseNotification(u, u0, null, now, (i % 2 == 0) ? true : false));
        }

        LOGGER.info("Admin has " + this.baseNotificationService.countUnseen(u0) + " notifications");

    }

}

From source file:ch.epfl.eagle.daemon.nodemonitor.NodeMonitor.java

public void initialize(Configuration conf, int nodeMonitorInternalPort) throws UnknownHostException {
    String mode = conf.getString(EagleConf.DEPLOYMENT_MODE, "unspecified");
    stealing = conf.getBoolean(EagleConf.STEALING, EagleConf.DEFAULT_STEALING);
    maxStealingAttempts = conf.getInt(EagleConf.STEALING_ATTEMPTS, EagleConf.DEFAULT_STEALING_ATTEMPTS);
    smallPartition = conf.getInt(EagleConf.SMALL_PARTITION, EagleConf.DEFAULT_SMALL_PARTITION);
    bigPartition = conf.getInt(EagleConf.BIG_PARTITION, EagleConf.DEFAULT_BIG_PARTITION);
    gossiping = conf.getBoolean(EagleConf.GOSSIPING, EagleConf.DEFAULT_GOSSIPING);

    stealingAttempts = 0;//from   ww w .  j a  v  a2 s .  c  om
    LOG.info("STEALING set to : " + stealing);
    if (mode.equals("standalone")) {
        state = new StandaloneNodeMonitorState();
    } else if (mode.equals("configbased")) {
        state = new ConfigNodeMonitorState();
    } else {
        throw new RuntimeException("Unsupported deployment mode: " + mode);
    }
    try {
        state.initialize(conf);
    } catch (IOException e) {
        LOG.fatal("Error initializing node monitor state.", e);
    }

    longStatusTimestamp = -1;
    // At the beginning all nodes will be free from Long jobs
    notExecutingLong = new ArrayList<String>();
    List<InetSocketAddress> nodeList = Lists.newArrayList(state.getNodeMonitors());
    // TODO EAGLE add itself to the list
    for (InetSocketAddress isa : nodeList)
        notExecutingLong.add(isa.toString());

    int mem = Resources.getSystemMemoryMb(conf);
    LOG.info("Using memory allocation: " + mem);

    ipAddress = Network.getIPAddress(conf);

    int cores = Resources.getSystemCPUCount(conf);
    LOG.info("Using core allocation: " + cores);

    String task_scheduler_type = conf.getString(EagleConf.NM_TASK_SCHEDULER_TYPE, "fifo");
    LOG.info("Task scheduler type: " + task_scheduler_type);
    if (task_scheduler_type.equals("round_robin")) {
        scheduler = new RoundRobinTaskScheduler(cores);
    } else if (task_scheduler_type.equals("fifo")) {
        scheduler = new FifoTaskScheduler(cores, this);
    } else if (task_scheduler_type.equals("priority")) {
        scheduler = new PriorityTaskScheduler(cores);
    } else {
        throw new RuntimeException("Unsupported task scheduler type: " + mode);
    }
    scheduler.initialize(conf, nodeMonitorInternalPort);
    taskLauncherService = new TaskLauncherService();
    taskLauncherService.initialize(conf, scheduler, nodeMonitorInternalPort);
}

From source file:com.boozallen.cognition.ingest.storm.bolt.geo.TwoFishesGeocodeBolt.java

@Override
public void configure(Configuration conf) throws ConfigurationException {
    _server = conf.getString(SERVER);// w w w  .j a  v a  2  s .  co m
    coordinatesField = conf.getString(COORDINATES_FIELD, "geo.coordinates");
    _locationFields = new ArrayList<>();
    conf.getList(LOCATION_FIELDS).forEach(x -> _locationFields.add(x.toString()));
    _successCount = 0;
    _failCount = 0;
    _exceptionCount = 0;
    _useMultipleLocations = conf.getBoolean(USE_MULTIPLE_LOCATIONS, false);
}

From source file:dk.itst.oiosaml.sp.service.SPFilter.java

/**
 * Check whether the user is authenticated i.e. having session with a valid
 * assertion. If the user is not authenticated an &lt;AuthnRequest&gt; is sent to
 * the Login Site.//w  ww . ja  va  2  s  . c  om
 * 
 * @param request
 *            The servletRequest
 * @param response
 *            The servletResponse
 */
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    if (log.isDebugEnabled())
        log.debug("OIOSAML-J SP Filter invoked");

    if (!(request instanceof HttpServletRequest)) {
        throw new RuntimeException("Not supported operation...");
    }
    HttpServletRequest servletRequest = ((HttpServletRequest) request);
    Audit.init(servletRequest);

    if (!isFilterInitialized()) {
        try {
            Configuration conf = SAMLConfiguration.getSystemConfiguration();
            setRuntimeConfiguration(conf);
        } catch (IllegalStateException e) {
            request.getRequestDispatcher("/saml/configure").forward(request, response);
            return;
        }
    }
    if (conf.getBoolean(Constants.PROP_DEVEL_MODE, false)) {
        log.warn("Running in debug mode, skipping regular filter");
        develMode.doFilter(servletRequest, (HttpServletResponse) response, chain, conf);
        return;
    }

    if (cleanerRunning.compareAndSet(false, true)) {
        SessionCleaner.startCleaner(sessionHandlerFactory.getHandler(),
                ((HttpServletRequest) request).getSession().getMaxInactiveInterval(), 30);
    }

    SessionHandler sessionHandler = sessionHandlerFactory.getHandler();

    if (servletRequest.getServletPath().equals(conf.getProperty(Constants.PROP_SAML_SERVLET))) {
        log.debug("Request to SAML servlet, access granted");
        chain.doFilter(new SAMLHttpServletRequest(servletRequest, hostname, null), response);
        return;
    }

    final HttpSession session = servletRequest.getSession();
    if (log.isDebugEnabled())
        log.debug("sessionId....:" + session.getId());

    // Is the user logged in?
    if (sessionHandler.isLoggedIn(session.getId())
            && session.getAttribute(Constants.SESSION_USER_ASSERTION) != null) {
        int actualAssuranceLevel = sessionHandler.getAssertion(session.getId()).getAssuranceLevel();
        int assuranceLevel = conf.getInt(Constants.PROP_ASSURANCE_LEVEL);
        if (actualAssuranceLevel < assuranceLevel) {
            sessionHandler.logOut(session);
            log.warn("Assurance level too low: " + actualAssuranceLevel + ", required: " + assuranceLevel);
            throw new RuntimeException(
                    "Assurance level too low: " + actualAssuranceLevel + ", required: " + assuranceLevel);
        }
        UserAssertion ua = (UserAssertion) session.getAttribute(Constants.SESSION_USER_ASSERTION);
        if (log.isDebugEnabled())
            log.debug("Everything is ok... Assertion: " + ua);

        Audit.log(Operation.ACCESS, servletRequest.getRequestURI());

        try {
            UserAssertionHolder.set(ua);
            HttpServletRequestWrapper requestWrap = new SAMLHttpServletRequest(servletRequest, ua, hostname);
            chain.doFilter(requestWrap, response);
            return;
        } finally {
            UserAssertionHolder.set(null);
        }
    } else {
        session.removeAttribute(Constants.SESSION_USER_ASSERTION);
        UserAssertionHolder.set(null);

        String relayState = sessionHandler.saveRequest(Request.fromHttpRequest(servletRequest));

        String protocol = conf.getString(Constants.PROP_PROTOCOL, "saml20");
        String loginUrl = conf.getString(Constants.PROP_SAML_SERVLET, "/saml");

        String protocolUrl = conf.getString(Constants.PROP_PROTOCOL + "." + protocol);
        if (protocolUrl == null) {
            throw new RuntimeException(
                    "No protocol url configured for " + Constants.PROP_PROTOCOL + "." + protocol);
        }
        loginUrl += protocolUrl;
        if (log.isDebugEnabled())
            log.debug("Redirecting to " + protocol + " login handler at " + loginUrl);

        RequestDispatcher dispatch = servletRequest.getRequestDispatcher(loginUrl);
        dispatch.forward(new SAMLHttpServletRequest(servletRequest, hostname, relayState), response);
    }
}

From source file:keel.Algorithms.Neural_Networks.NNEP_Common.mutators.parametric.ParametricMutator.java

/**
 * <p>/*from w w  w .j a v  a  2s  . c o  m*/
 * Configuration parameters for ParametricMutator are:
 * </p>
 * <ul>
 * <li>
 * <code>[@selective] boolean (default=false)</code></p>
 * If this parameter is set to <code>true</true> only certain randomly
 * selected nodes are parametrically mutated.
 * </li>
 * <li>
 * <code>temperature-exponent[@value] double (default=1)</code></p>
 * Temperature exponent to be used for obtaining temperature
 * of each indivual mutated.
 * </li>
 * <li>
 * <code>amplitude[@value] double (default=5)</code></p>
 * Amplitude factor to increase the range of parametric variations
 * of mutated weights.
 * </li>
 * <li>
 * <code>fitness-difference[@value] double (default=0.0000001)</code></p>
 * Difference between two fitnesses that we consider
  * enoung to say that the fitness has improved
 * </li>
 * <li>
 * <code>initial-alpha-values: complex</code></p> 
 * Initial values of alpha parameters.
 * <ul>
 *       <li>
 *       <code>initial-alpha-values[@input] double (default=0.5)</code></p>
 *       Initial value of alpha parameter used for input weights.
 *       </li>
 *       <li>
 *       <code>initial-alpha-values[@ouput] double (default=1)</code></p>
 *       Initial value of alpha parameter used for output weights.
 *       </li>
 * </ul> 
 * </li>
 * </ul>
 */

public void configure(Configuration settings) {
    // Setup selective
    selective = settings.getBoolean("[@selective]", false);

    // Setup temperExponent
    temperExponent = settings.getDouble("temperature-exponent[@value]", 1);

    // Setup amplitude
    amplitude = settings.getDouble("amplitude[@value]", 5);

    // Setup fitDif
    fitDif = settings.getDouble("fitness-difference[@value]", 0.0000001);

    // Setup alphaInput
    initialAlphaInput = settings.getDouble("initial-alpha-values[@input]", 0.5);

    // Setup alphaOutput
    initialAlphaOutput = settings.getDouble("initial-alpha-values[@output]", 1);

}

From source file:com.evolveum.midpoint.task.quartzimpl.TaskManagerConfiguration.java

void setBasicInformation(MidpointConfiguration masterConfig) throws TaskManagerConfigurationException {
    Configuration c = masterConfig.getConfiguration(TASK_MANAGER_CONFIG_SECTION);

    stopOnInitializationFailure = c.getBoolean(STOP_ON_INITIALIZATION_FAILURE_CONFIG_ENTRY,
            STOP_ON_INITIALIZATION_FAILURE_DEFAULT);

    threads = c.getInt(THREADS_CONFIG_ENTRY, THREADS_DEFAULT);
    clustered = c.getBoolean(CLUSTERED_CONFIG_ENTRY, CLUSTERED_DEFAULT);
    jdbcJobStore = c.getBoolean(JDBC_JOB_STORE_CONFIG_ENTRY, clustered);

    nodeId = System.getProperty(MIDPOINT_NODE_ID_PROPERTY);
    if (StringUtils.isEmpty(nodeId) && !clustered) {
        nodeId = NODE_ID_DEFAULT;/*from   w w w .  j a v  a2 s.c om*/
    }

    jmxHostName = System.getProperty(MIDPOINT_JMX_HOST_NAME_PROPERTY);

    String portString = System.getProperty(JMX_PORT_PROPERTY);
    if (StringUtils.isEmpty(portString)) {
        jmxPort = JMX_PORT_DEFAULT;
    } else {
        try {
            jmxPort = Integer.parseInt(portString);
        } catch (NumberFormatException nfe) {
            throw new TaskManagerConfigurationException(
                    "Cannot get JMX management port - invalid integer value of " + portString, nfe);
        }
    }

    jmxConnectTimeout = c.getInt(JMX_CONNECT_TIMEOUT_CONFIG_ENTRY, JMX_CONNECT_TIMEOUT_DEFAULT);

    if (c.containsKey(TEST_MODE_CONFIG_ENTRY)) {
        midPointTestMode = c.getBoolean(TEST_MODE_CONFIG_ENTRY);
        LOGGER.trace(TEST_MODE_CONFIG_ENTRY + " present, its value = " + midPointTestMode);
    } else {
        LOGGER.trace(TEST_MODE_CONFIG_ENTRY + " NOT present");
        Properties sp = System.getProperties();
        if (sp.containsKey(SUREFIRE_PRESENCE_PROPERTY)) {
            LOGGER.info("Determined to run in a test environment, setting midPointTestMode to 'true'.");
            midPointTestMode = true;
        } else {
            midPointTestMode = false;
        }
    }
    LOGGER.trace("midPointTestMode = " + midPointTestMode);

    String useTI = c.getString(USE_THREAD_INTERRUPT_CONFIG_ENTRY, USE_THREAD_INTERRUPT_DEFAULT);
    try {
        useThreadInterrupt = UseThreadInterrupt.fromValue(useTI);
    } catch (IllegalArgumentException e) {
        throw new TaskManagerConfigurationException(
                "Illegal value for " + USE_THREAD_INTERRUPT_CONFIG_ENTRY + ": " + useTI, e);
    }

    quartzNodeRegistrationCycleTime = c.getInt(QUARTZ_NODE_REGISTRATION_INTERVAL_CONFIG_ENTRY,
            QUARTZ_NODE_REGISTRATION_CYCLE_TIME_DEFAULT);
    nodeRegistrationCycleTime = c.getInt(NODE_REGISTRATION_INTERVAL_CONFIG_ENTRY,
            NODE_REGISTRATION_CYCLE_TIME_DEFAULT);
    nodeTimeout = c.getInt(NODE_TIMEOUT_CONFIG_ENTRY, NODE_TIMEOUT_DEFAULT);

    jmxUsername = c.getString(JMX_USERNAME_CONFIG_ENTRY, JMX_USERNAME_DEFAULT);
    jmxPassword = c.getString(JMX_PASSWORD_CONFIG_ENTRY, JMX_PASSWORD_DEFAULT);

    waitingTasksCheckInterval = c.getInt(WAITING_TASKS_CHECK_INTERVAL_CONFIG_ENTRY,
            WAITING_TASKS_CHECK_INTERVAL_DEFAULT);
    stalledTasksCheckInterval = c.getInt(STALLED_TASKS_CHECK_INTERVAL_CONFIG_ENTRY,
            STALLED_TASKS_CHECK_INTERVAL_DEFAULT);
    stalledTasksThreshold = c.getInt(STALLED_TASKS_THRESHOLD_CONFIG_ENTRY, STALLED_TASKS_THRESHOLD_DEFAULT);
    stalledTasksRepeatedNotificationInterval = c.getInt(
            STALLED_TASKS_REPEATED_NOTIFICATION_INTERVAL_CONFIG_ENTRY,
            STALLED_TASKS_REPEATED_NOTIFICATION_INTERVAL_DEFAULT);
    runNowKeepsOriginalSchedule = c.getBoolean(RUN_NOW_KEEPS_ORIGINAL_SCHEDULE_CONFIG_ENTRY,
            RUN_NOW_KEEPS_ORIGINAL_SCHEDULE_DEFAULT);
}

From source file:com.evolveum.midpoint.task.quartzimpl.cluster.ClusterManager.java

/**
 * Check whether system configuration has not changed in repository (e.g. by another node in cluster).
 * Applies new configuration if so.//  w w  w  .  jav  a 2 s  . com
 *
 * @param parentResult
 */

public void checkSystemConfigurationChanged(OperationResult parentResult) {

    OperationResult result = parentResult.createSubresult(CHECK_SYSTEM_CONFIGURATION_CHANGED);

    PrismObject<SystemConfigurationType> systemConfiguration;
    try {
        PrismObject<SystemConfigurationType> config = getRepositoryService().getObject(
                SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, result);

        String versionInRepo = config.getVersion();
        String versionApplied = LoggingConfigurationManager.getCurrentlyUsedVersion();

        // we do not try to determine which one is "newer" - we simply use the one from repo
        if (!versionInRepo.equals(versionApplied)) {

            Configuration systemConfigFromFile = taskManager.getMidpointConfiguration()
                    .getConfiguration(MidpointConfiguration.SYSTEM_CONFIGURATION_SECTION);
            boolean skip = false;
            if (systemConfigFromFile != null && versionApplied == null) {
                skip = systemConfigFromFile.getBoolean(
                        LoggingConfigurationManager.SYSTEM_CONFIGURATION_SKIP_REPOSITORY_LOGGING_SETTINGS,
                        false);
            }
            if (skip) {
                LOGGER.warn(
                        "Skipping application of repository logging configuration because {}=true (version={})",
                        LoggingConfigurationManager.SYSTEM_CONFIGURATION_SKIP_REPOSITORY_LOGGING_SETTINGS,
                        versionInRepo);
                // But pretend that this was applied so the next update works normally
                LoggingConfigurationManager.setCurrentlyUsedVersion(versionInRepo);
            } else {
                LoggingConfigurationType loggingConfig = ProfilingConfigurationManager
                        .checkSystemProfilingConfiguration(config);
                LoggingConfigurationManager.configure(loggingConfig, versionInRepo, result);
            }

            SystemConfigurationHolder.setCurrentConfiguration(config.asObjectable()); // we rely on LoggingConfigurationManager to correctly record the current version
        } else {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace(
                        "System configuration change check: version in repo = version currently applied = {}",
                        versionApplied);
            }
        }

        if (result.isUnknown()) {
            result.computeStatus();
        }

    } catch (ObjectNotFoundException e) {
        LoggingConfigurationManager.resetCurrentlyUsedVersion(); // because the new config (if any) will have version number probably starting at 1 - so to be sure to read it when it comes [hope this never occurs :)]
        String message = "No system configuration found, skipping application of system settings";
        LOGGER.error(message + ": " + e.getMessage(), e);
        result.recordWarning(message, e);
    } catch (SchemaException e) {
        String message = "Schema error in system configuration, skipping application of system settings";
        LOGGER.error(message + ": " + e.getMessage(), e);
        result.recordWarning(message, e);
    } catch (RuntimeException e) {
        String message = "Runtime exception in system configuration processing, skipping application of system settings";
        LOGGER.error(message + ": " + e.getMessage(), e);
        result.recordWarning(message, e);
    }

}

From source file:com.knowbout.epg.processor.ScheduleParser.java

private void loadLineups() {
    log.debug("Processing lineups for schedules");
    int lineupCount = config.getList("lineups.lineup.name").size();
    Session session = HibernateUtil.currentSession();
    TransactionManager.beginTransaction();
    for (int i = 0; i < lineupCount; i++) {
        Configuration lineupConfig = config.subset("lineups.lineup(" + i + ")");
        String name = lineupConfig.getString("name");
        String id = lineupConfig.getString("id");
        boolean digital = lineupConfig.getBoolean("digital", false);
        int delay = lineupConfig.getInt("delay", 0);
        int affiliateDelay = lineupConfig.getInt("affiliateDelay", 0);
        NetworkLineup sl = null;/*from   w w w  .ja va  2 s .com*/
        boolean found = false;
        try {
            sl = (NetworkLineup) session.get(NetworkLineup.class, id);
            found = (sl != null);
        } catch (Exception e) {

        }

        if (!found) {
            sl = new NetworkLineup();
            sl.setId(id);
        }
        sl.setName(name);
        sl.setId(id);
        sl.setDigital(digital);
        sl.setDelay(delay);
        sl.setAffiliateDelay(affiliateDelay);
        if (!found) {
            sl.insert();
        }
    }
    TransactionManager.commitTransaction();
    log.debug("finished Processing lineups for schedules");

}

From source file:eu.socialsensor.main.BenchmarkConfiguration.java

public BenchmarkConfiguration(Configuration appconfig) {
    if (appconfig == null) {
        throw new IllegalArgumentException("appconfig may not be null");
    }// w  w  w .ja  va  2s. com

    Configuration eu = appconfig.subset("eu");
    Configuration socialsensor = eu.subset("socialsensor");

    //metrics
    final Configuration metrics = socialsensor.subset(GraphDatabaseConfiguration.METRICS_NS.getName());

    final Configuration graphite = metrics.subset(GRAPHITE);
    this.graphiteHostname = graphite.getString(GRAPHITE_HOSTNAME, null);
    this.graphiteReportingInterval = graphite.getLong(GraphDatabaseConfiguration.GRAPHITE_INTERVAL.getName(),
            1000 /*default 1sec*/);

    final Configuration csv = metrics.subset(CSV);
    this.csvReportingInterval = metrics.getLong(CSV_INTERVAL, 1000 /*ms*/);
    this.csvDir = csv.containsKey(CSV_DIR)
            ? new File(csv.getString(CSV_DIR, System.getProperty("user.dir") /*default*/))
            : null;

    Configuration dynamodb = socialsensor.subset("dynamodb");
    this.dynamodbWorkerThreads = dynamodb.getInt("workers", 25);
    Configuration credentials = dynamodb.subset(CREDENTIALS);
    this.dynamodbPrecreateTables = dynamodb.getBoolean("precreate-tables", Boolean.FALSE);
    this.dynamodbTps = Math.max(1, dynamodb.getLong(TPS, 750 /*default*/));
    this.dynamodbConsistentRead = dynamodb.containsKey(CONSISTENT_READ) ? dynamodb.getBoolean(CONSISTENT_READ)
            : false;
    this.dynamodbDataModel = dynamodb.containsKey("data-model")
            ? BackendDataModel.valueOf(dynamodb.getString("data-model"))
            : null;
    this.dynamodbCredentialsFqClassName = credentials.containsKey(CLASS_NAME)
            ? credentials.getString(CLASS_NAME)
            : null;
    this.dynamodbCredentialsCtorArguments = credentials.containsKey(CONSTRUCTOR_ARGS)
            ? credentials.getString(CONSTRUCTOR_ARGS)
            : null;
    this.dynamodbEndpoint = dynamodb.containsKey(ENDPOINT) ? dynamodb.getString(ENDPOINT) : null;
    this.dynamodbTablePrefix = dynamodb.containsKey(TABLE_PREFIX) ? dynamodb.getString(TABLE_PREFIX)
            : Constants.DYNAMODB_TABLE_PREFIX.getDefaultValue();

    Configuration orient = socialsensor.subset("orient");
    orientLightweightEdges = orient.containsKey(LIGHTWEIGHT_EDGES) ? orient.getBoolean(LIGHTWEIGHT_EDGES)
            : null;

    Configuration sparksee = socialsensor.subset("sparksee");
    sparkseeLicenseKey = sparksee.containsKey(LICENSE_KEY) ? sparksee.getString(LICENSE_KEY) : null;

    Configuration titan = socialsensor.subset(TITAN); //TODO(amcp) move dynamodb ns into titan
    bufferSize = titan.getInt(BUFFER_SIZE, GraphDatabaseConfiguration.BUFFER_SIZE.getDefaultValue());
    blocksize = titan.getInt(IDS_BLOCKSIZE, GraphDatabaseConfiguration.IDS_BLOCK_SIZE.getDefaultValue());
    pageSize = titan.getInt(PAGE_SIZE, GraphDatabaseConfiguration.PAGE_SIZE.getDefaultValue());

    // database storage directory
    if (!socialsensor.containsKey(DATABASE_STORAGE_DIRECTORY)) {
        throw new IllegalArgumentException("configuration must specify database-storage-directory");
    }
    dbStorageDirectory = new File(socialsensor.getString(DATABASE_STORAGE_DIRECTORY));
    dataset = validateReadableFile(socialsensor.getString(DATASET), DATASET);

    // load the dataset
    DatasetFactory.getInstance().getDataset(dataset);

    if (!socialsensor.containsKey(PERMUTE_BENCHMARKS)) {
        throw new IllegalArgumentException("configuration must set permute-benchmarks to true or false");
    }
    permuteBenchmarks = socialsensor.getBoolean(PERMUTE_BENCHMARKS);

    List<?> benchmarkList = socialsensor.getList("benchmarks");
    benchmarkTypes = new ArrayList<BenchmarkType>();
    for (Object str : benchmarkList) {
        benchmarkTypes.add(BenchmarkType.valueOf(str.toString()));
    }

    selectedDatabases = new TreeSet<GraphDatabaseType>();
    for (Object database : socialsensor.getList("databases")) {
        if (!GraphDatabaseType.STRING_REP_MAP.keySet().contains(database.toString())) {
            throw new IllegalArgumentException(
                    String.format("selected database %s not supported", database.toString()));
        }
        selectedDatabases.add(GraphDatabaseType.STRING_REP_MAP.get(database));
    }
    scenarios = permuteBenchmarks ? Ints.checkedCast(CombinatoricsUtils.factorial(selectedDatabases.size()))
            : 1;

    resultsPath = new File(System.getProperty("user.dir"), socialsensor.getString("results-path"));
    if (!resultsPath.exists() && !resultsPath.mkdirs()) {
        throw new IllegalArgumentException("unable to create results directory");
    }
    if (!resultsPath.canWrite()) {
        throw new IllegalArgumentException("unable to write to results directory");
    }

    randomNodes = socialsensor.getInteger(RANDOM_NODES, new Integer(100));

    if (this.benchmarkTypes.contains(BenchmarkType.CLUSTERING)) {
        if (!socialsensor.containsKey(NODES_COUNT)) {
            throw new IllegalArgumentException("the CW benchmark requires nodes-count integer in config");
        }
        nodesCount = socialsensor.getInt(NODES_COUNT);

        if (!socialsensor.containsKey(RANDOMIZE_CLUSTERING)) {
            throw new IllegalArgumentException("the CW benchmark requires randomize-clustering bool in config");
        }
        randomizedClustering = socialsensor.getBoolean(RANDOMIZE_CLUSTERING);

        if (!socialsensor.containsKey(ACTUAL_COMMUNITIES)) {
            throw new IllegalArgumentException("the CW benchmark requires a file with actual communities");
        }
        actualCommunities = validateReadableFile(socialsensor.getString(ACTUAL_COMMUNITIES),
                ACTUAL_COMMUNITIES);

        final boolean notGenerating = socialsensor.containsKey(CACHE_VALUES);
        if (notGenerating) {
            List<?> objects = socialsensor.getList(CACHE_VALUES);
            cacheValues = new ArrayList<Integer>(objects.size());
            cacheValuesCount = null;
            cacheIncrementFactor = null;
            for (Object o : objects) {
                cacheValues.add(Integer.valueOf(o.toString()));
            }
        } else if (socialsensor.containsKey(CACHE_VALUES_COUNT)
                && socialsensor.containsKey(CACHE_INCREMENT_FACTOR)) {
            cacheValues = null;
            // generate the cache values with parameters
            if (!socialsensor.containsKey(CACHE_VALUES_COUNT)) {
                throw new IllegalArgumentException(
                        "the CW benchmark requires cache-values-count int in config when cache-values not specified");
            }
            cacheValuesCount = socialsensor.getInt(CACHE_VALUES_COUNT);

            if (!socialsensor.containsKey(CACHE_INCREMENT_FACTOR)) {
                throw new IllegalArgumentException(
                        "the CW benchmark requires cache-increment-factor int in config when cache-values not specified");
            }
            cacheIncrementFactor = socialsensor.getDouble(CACHE_INCREMENT_FACTOR);
        } else {
            throw new IllegalArgumentException(
                    "when doing CW benchmark, must provide cache-values or parameters to generate them");
        }
    } else {
        randomizedClustering = null;
        nodesCount = null;
        cacheValuesCount = null;
        cacheIncrementFactor = null;
        cacheValues = null;
        actualCommunities = null;
    }
}