List of usage examples for java.util Map putAll
void putAll(Map<? extends K, ? extends V> m);
From source file:au.edu.anu.portal.portlets.basiclti.adapters.ChemvantageAdapter.java
/** * Currently returns the map of params unchanged (except for adding the default params). * //w w w . java 2 s.c o m * <p> * Note this is currently equivalent to a standard Basic LTI launch. * This adapter has been added to cater for any custom behaviour that ChemVantage may provide in the future. * * @param params map of launch data params * @return the map, unchanged */ @Override public Map<String, String> processLaunchData(Map<String, String> params) { log.debug("ChemvantageAdapter.processLaunchData() called"); //add defaults params.putAll(super.getDefaultParameters()); return params; }
From source file:org.ktunaxa.referral.server.command.email.ValidateTemplateCommand.java
public void execute(ValidateTemplateRequest request, ValidateTemplateResponse response) throws Exception { final TaskDto task = request.getTask(); if (null == task) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "task"); }/* w w w . ja v a2s . c om*/ final Map<String, String> attributes = request.getAttributes(); if (null == attributes) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "attributes"); } final String subject = request.getSubject(); if (null == subject) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "subject"); } final String body = request.getBody(); if (null == body) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "body"); } TemplateFiller filler = new TemplateFiller(); Map<String, String> variables = new HashMap<String, String>(); variables.putAll(task.getVariables()); variables.putAll(attributes); try { filler.fillStringWithData(subject, variables); filler.fillStringWithData(body, variables); response.setValid(true); } catch (IOException e) { log.error(e.getLocalizedMessage(), e); response.setValid(false); } catch (TemplateException te) { log.debug(te.getMessage(), te); response.setValid(false); String[] split = te.getFTLInstructionStack().split("\\$\\{", 2); split = split[1].split("\\}", 2); response.setInvalidPlaceholder("${" + split[0] + "}"); } }
From source file:com.linuxbox.enkive.statistics.services.storage.mongodb.MongoStatsStorageService.java
@Override public void storeStatistics(String service, RawStats data) throws StatsStorageException { Map<String, Object> result = createMap(); result.put(STAT_GATHERER_NAME, service); result.putAll(data.toMap()); coll.insert(new BasicDBObject(result)); }
From source file:net.gplatform.sudoor.server.jpa.autoconfig.EclipselinkJpaAutoConfiguration.java
@Override protected Map<String, Object> getVendorProperties() { Map<String, Object> vendorProperties = new HashMap<String, Object>(); vendorProperties.putAll(eclipselink); return vendorProperties; }
From source file:com.hortonworks.streamline.streams.common.event.correlation.EventCorrelationInjector.java
public StreamlineEvent injectCorrelationInformation(StreamlineEvent event, List<StreamlineEvent> parentEvents, String componentName) {/*w w w . java 2 s.c o m*/ Set<String> rootIds = new HashSet<>(); Set<String> parentIds = new HashSet<>(); if (!parentEvents.isEmpty()) { parentEvents.forEach(parentEvent -> { if (EventCorrelationInjector.containsRootIds(parentEvent)) { Set<String> rootIdsForParent = EventCorrelationInjector.getRootIds(parentEvent); if (rootIdsForParent != null && !rootIdsForParent.isEmpty()) { rootIds.addAll(rootIdsForParent); } else { rootIds.add(parentEvent.getId()); } } else { // assume parent event is the root event if it doesn't have correlation information rootIds.add(parentEvent.getId()); } parentIds.add(parentEvent.getId()); }); } // adding correlation and parent events information Map<String, Object> header = new HashMap<>(); header.putAll(event.getHeader()); header.put(HEADER_KEY_ROOT_IDS, rootIds); header.put(HEADER_KEY_PARENT_IDS, parentIds); if (StringUtils.isNotEmpty(componentName)) { header.put(HEADER_KEY_SOURCE_COMPONENT_NAME, componentName); } return StreamlineEventImpl.builder().from(event).header(header).build(); }
From source file:com.wavemaker.tools.cloudfoundry.spinup.authentication.SharedSecretPropagation.java
/** * Send the specified shared secret to a running cloud foundry application. * /* ww w.j a va2 s . co m*/ * @param client client * @param secret the secret to send * @param application the application to send the secret to */ public void sendTo(CloudFoundryClient client, SharedSecret secret, CloudApplication application) throws CloudFoundryException { Assert.notNull(client, "Client must not be null"); Assert.notNull(application, "Application must not be null"); if (this.logger.isDebugEnabled()) { this.logger.debug("Propagating shared secret to " + application.getName()); } Map<String, String> env = new HashMap<String, String>(); env.putAll(application.getEnvAsMap()); String envValue = Hex.encodeHexString(secret.getBytes()); if (!envValue.equals(env.get(ENV_KEY))) { if (this.logger.isDebugEnabled()) { this.logger.debug("Restarting " + application.getName() + " due to new shared secret"); } env.put(ENV_KEY, envValue); client.updateApplicationEnv(application.getName(), env); client.restartApplication(application.getName()); } }
From source file:com.bstek.dorado.web.resolver.UriResolverMapping.java
@Override protected Object lookupHandler(String urlPath, HttpServletRequest request) throws Exception { Map<String, Object> handlerMap = getHandlerMap(); Object handler = handlerMap.get(urlPath); String bestPatternMatch = urlPath; String pathWithinMapping = urlPath; if (handler == null) { PathMatcher pathMatcher = getPathMatcher(); for (Iterator<String> it = handlerMap.keySet().iterator(); it.hasNext();) { String registeredPath = it.next(); if (pathMatcher.match(registeredPath, urlPath)) { request.setAttribute("originalUrlPath", urlPath); handler = handlerMap.get(registeredPath); bestPatternMatch = registeredPath; pathWithinMapping = pathMatcher.extractPathWithinPattern(bestPatternMatch, urlPath); break; }//from ww w . j av a 2s.c om } } if (handler != null) { PathMatcher pathMatcher = getPathMatcher(); Map<String, String> uriTemplateVariables = new LinkedHashMap<String, String>(); uriTemplateVariables.putAll(pathMatcher.extractUriTemplateVariables(bestPatternMatch, urlPath)); if (logger.isDebugEnabled()) { logger.debug("URI Template variables for request [" + urlPath + "] are " + uriTemplateVariables); } handler = buildPathExposingHandler(handler, bestPatternMatch, pathWithinMapping, uriTemplateVariables); } return handler; }
From source file:io.rhiot.cloudplatform.service.device.MongoDbDeviceRegistry.java
private Device dbObjectToDevice(DBObject dbObject) { Map<String, Object> deviceMap = new HashMap<>(); deviceMap.putAll(dbObject.toMap()); deviceMap.put("id", dbObject.get("_id").toString()); return objectMapper.convertValue(deviceMap, Device.class); }
From source file:it.sonarlint.cli.tools.CommandExecutor.java
public int execute(String[] args, @Nullable Path workingDir, Map<String, String> addEnv) throws IOException { if (!Files.isExecutable(file)) { Set<PosixFilePermission> perms = new HashSet<PosixFilePermission>(); perms.add(PosixFilePermission.OWNER_READ); perms.add(PosixFilePermission.OWNER_EXECUTE); Files.setPosixFilePermissions(file, perms); }//from ww w . j a v a 2 s.c o m ExecuteWatchdog watchdog = new ExecuteWatchdog(TIMEOUT); CommandLine cmd = new CommandLine(file.toFile()); cmd.addArguments(args); DefaultExecutor exec = new DefaultExecutor(); exec.setWatchdog(watchdog); exec.setStreamHandler(createStreamHandler()); exec.setExitValues(null); if (workingDir != null) { exec.setWorkingDirectory(workingDir.toFile()); } in.close(); LOG.info("Executing: {}", cmd.toString()); Map<String, String> env = new HashMap<>(System.getenv()); env.putAll(addEnv); return exec.execute(cmd, env); }
From source file:ch.unibas.fittingwizard.infrastructure.base.PythonScriptRunner.java
public void putEnvironment(Map<String, String> environment) { logger.debug("Setting environment: " + environment); Map<String, String> env = pb.environment(); env.putAll(environment); }