Example usage for org.apache.commons.exec.util MapUtils merge

List of usage examples for org.apache.commons.exec.util MapUtils merge

Introduction

In this page you can find the example usage for org.apache.commons.exec.util MapUtils merge.

Prototype

public static <K, V> Map<K, V> merge(final Map<K, V> lhs, final Map<K, V> rhs) 

Source Link

Document

Clones the lhs map and add all things from the rhs map.

Usage

From source file:org.apache.storm.daemon.worker.executor.ExecutorUtils.java

@SuppressWarnings("rawtypes")
@ClojureClass(className = "backtype.storm.daemon.executor#normalized-component-conf")
public static Map normalizedComponentConf(Map stormConf, WorkerTopologyContext generalContext,
        String componentId) {/*from  ww w  .  j  av a 2s.  co  m*/
    List<Object> to_remove = ConfigUtil.All_CONFIGS();
    to_remove.remove(Config.TOPOLOGY_DEBUG);
    to_remove.remove(Config.TOPOLOGY_MAX_SPOUT_PENDING);
    to_remove.remove(Config.TOPOLOGY_MAX_TASK_PARALLELISM);
    to_remove.remove(Config.TOPOLOGY_TRANSACTIONAL_ID);
    to_remove.remove(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS);
    to_remove.remove(Config.TOPOLOGY_SLEEP_SPOUT_WAIT_STRATEGY_TIME_MS);
    to_remove.remove(Config.TOPOLOGY_SPOUT_WAIT_STRATEGY);

    Map specConf = new HashMap();
    String jsonConf = generalContext.getComponentCommon(componentId).get_json_conf();
    if (jsonConf != null) {
        specConf = (Map) CoreUtil.from_json(jsonConf);
    }

    for (Object p : to_remove) {
        specConf.remove(p);
    }

    return MapUtils.merge(stormConf, specConf);
}

From source file:org.kuali.kpme.tklm.common.BatchJobServiceImpl.java

@SuppressWarnings("unchecked")
private void scheduleJob(Class<?> jobClass, DateTime jobDate, Map<String, String> jobGroupDataMap,
        Map<String, String> jobDataMap) throws SchedulerException {
    if (jobDate == null) {
        return;/* www. ja v a2s  .  c om*/
    }

    String jobGroupName = BatchJobUtil.getJobGroupName(jobClass, jobGroupDataMap);
    String jobName = BatchJobUtil.getJobName(jobClass, jobDataMap);
    String[] jobNames = getScheduler().getJobNames(jobGroupName);
    if (!ArrayUtils.contains(jobNames, jobName)) {
        jobDataMap.put("date", jobDate.toString());
        Map<String, String> mergedDataMap = MapUtils.merge(jobGroupDataMap, jobDataMap);
        JobDetail jobDetail = new JobDetail(jobName, jobGroupName, jobClass, false, true, false);
        jobDetail.setJobDataMap(new JobDataMap(mergedDataMap));

        String triggerGroupName = BatchJobUtil.getTriggerGroupName(jobClass,
                MapUtils.merge(jobGroupDataMap, jobDataMap));
        String triggerName = BatchJobUtil.getTriggerName(jobClass, jobDate);
        Trigger trigger = new SimpleTrigger(triggerName, triggerGroupName, jobDate.toDate());
        trigger.setJobGroup(jobGroupName);
        trigger.setJobName(jobName);

        LOG.info("Scheduling " + jobDetail.getFullName() + " to be run on " + jobDate);
        this.updateStatus(jobDetail, BatchJobService.SCHEDULED_JOB_STATUS_CODE);
        getScheduler().scheduleJob(jobDetail, trigger);
    }
}