List of usage examples for java.util Map putAll
void putAll(Map<? extends K, ? extends V> m);
From source file:fedora.server.security.servletfilters.FilterFinalize.java
@Override public boolean doThisSubclass(ExtendedHttpServletRequest request, HttpServletResponse response) throws Throwable { String method = "doThisSubclass() "; if (log.isDebugEnabled()) { log.debug(enter(method));//from ww w . j a v a 2 s . c o m } super.doThisSubclass(request, response); request.lockWrapper(); if (REQUEST_ATTRIBUTE_INPUT_NAME != null) { Object testFedoraAuxSubjectAttributes = request.getAttribute(REQUEST_ATTRIBUTE_INPUT_NAME); if (testFedoraAuxSubjectAttributes == null) { if (log.isDebugEnabled()) { log.debug(format(method, "no aux subject attributes found")); } } else if (!(testFedoraAuxSubjectAttributes instanceof Map)) { if (log.isErrorEnabled()) { log.error(format(method, "aux subject attributes found, but not a Map")); } } else { boolean errorsInMap = false; Map auxSubjectRoles = (Map) testFedoraAuxSubjectAttributes; Iterator auxSubjectRoleKeys = auxSubjectRoles.keySet().iterator(); while (auxSubjectRoleKeys.hasNext()) { Object name = auxSubjectRoleKeys.next(); if (!(name instanceof String)) { if (log.isErrorEnabled()) { log.error(format(method, "key not a String " + name)); } errorsInMap = true; break; } else { Object value = auxSubjectRoles.get(name); if (!(value instanceof String[])) { if (log.isErrorEnabled()) { log.error(format(method, "value not a String" + value)); } errorsInMap = true; break; } } } if (errorsInMap) { if (log.isDebugEnabled()) { log.debug(format(method, "errors in map")); } } else { if (log.isDebugEnabled()) { log.debug(format(method, "no errors in map")); } request.addAttributes(REQUEST_ATTRIBUTE_INPUT_AUTHORITY, auxSubjectRoles); } } } if (log.isDebugEnabled()) { log.debug(format(method, "before stashing")); } request.audit(); Map subjectAttributesMap = new Hashtable(); subjectAttributesMap.putAll(request.getAllAttributes()); for (Iterator it = subjectAttributesMap.keySet().iterator(); it.hasNext();) { String name = (String) it.next(); Object value = subjectAttributesMap.get(name); log.debug("IN FILTER MAP HAS ATTRIBUTE " + name + "==" + value + " " + value.getClass().getName()); } log.debug("IN FILTER ROLE eduPersonAffiliation?==" + request.isUserInRole("eduPersonAffiliation")); request.setAttribute(DELIVERY_NAME, subjectAttributesMap); return false; // i.e., don't signal to terminate servlet filter chain }
From source file:com.callidusrobotics.droptables.model.ResultEntry.java
@JsonProperty("parameters") public void setParameters(Map<String, String> parameters) { this.parameters = new LinkedHashMap<String, String>(); parameters.putAll(parameters); }
From source file:com.blackducksoftware.integration.hub.api.HubRequest.java
public void addQueryParameters(final Map<String, String> queryParameters) { queryParameters.putAll(queryParameters); }
From source file:com.pactera.edg.am.metamanager.extractor.dao.helper.ModifyHarvestMetadataHelper.java
private Map<String, String> genUpdateAttrs(ModifyMetadata metadata, Map<String, String> attrs) { Map<Operation, Map<String, String>> modifyAttrs = metadata.getModifyAttrs(); // ??:,,???/*ww w .j av a2 s . co m*/ Map<String, String> updateAttrs = new HashMap<String, String>(); Map<String, String> createAttrs = modifyAttrs.get(Operation.CREATE); if (createAttrs != null) { updateAttrs.putAll(createAttrs); } Map<String, String> changelessAttrs = modifyAttrs.get(Operation.CHANGELESS); if (changelessAttrs != null) { updateAttrs.putAll(changelessAttrs); } List<ModifyAttribute> changeAttrs = metadata.getMAttrs(); if (changeAttrs != null) { updateAttrs.putAll(genChangeAttrs(changeAttrs)); } return updateAttrs; }
From source file:com.googlecode.starflow.core.script.spel.SpelScriptEngine.java
private Map<String, Object> getVariables(ScriptContext scriptContext) { Map<String, Object> variables = new HashMap<String, Object>(); if (scriptContext.getBindings(ScriptContext.GLOBAL_SCOPE) != null) { variables.putAll(scriptContext.getBindings(ScriptContext.GLOBAL_SCOPE)); }/* w w w .j a va 2 s. c o m*/ if (scriptContext.getBindings(ScriptContext.ENGINE_SCOPE) != null) { variables.putAll(scriptContext.getBindings(ScriptContext.ENGINE_SCOPE)); } return variables; }
From source file:com.github.fhirschmann.clozegen.cli.Main.java
/** * Runs the command line interface./* w w w .ja va2s . com*/ * * <p> * You will need to pass a {@link ClozeTestGenerator} to this method. This * will allow you to, for example, add new input reader. * </p> * * @param gen the {@link ClozeTestGenerator} to use * @param args the arguments to the CLI */ public void run(final ClozeTestGenerator gen, final String[] args) { CommandLineParser parser = new PosixParser(); options.addOption("h", "help", false, "print help message and exit"); options.addOption("g", "generators", true, "generators to activate"); options.addOption("l", "language", true, "language of the input file"); options.addOption(null, "list-generators", false, "list all available gap generators"); options.addOption(null, "list-input-methods", false, "list all available input methods"); options.addOption(null, "list-output-methods", false, "list all available output methods"); options.addOption("d", "debug", false, "enable debug mode"); boolean debug = true; try { CommandLine line = parser.parse(options, args); if (line.hasOption("debug")) { Logger.getRootLogger().setLevel(Level.DEBUG); } else { Logger.getRootLogger().setLevel(Level.INFO); debug = false; } if (line.hasOption("help")) { printHelp(); System.exit(0); } if (line.hasOption("list-generators")) { for (AnnotatorRegisterEntry entry : Registers.annotator()) { System.out.println(String.format("[%s]%s %s", entry.getIdentifier(), entry.getSupportedLanguages(), entry.getName())); } } else if (line.hasOption("list-input-methods")) { for (ReaderRegisterEntry entry : Registers.reader()) { System.out.println(String.format("[.%s] %s", entry.getIdentifier(), entry.getName())); } } else if (line.hasOption("list-output-methods")) { for (WriterRegisterEntry entry : Registers.writer()) { System.out.println(String.format("[.%s] %s", entry.getIdentifier(), entry.getName())); } } else { checkArgument(line.getArgs().length == 2, "Exactly two arguments are required!"); Map<String, Integer> generators = Maps.newHashMap(); if (line.hasOption("generators")) { generators.putAll(Utils.parseGapClasses(line.getOptionValue("generators"))); } gen.activate(generators); File inputFile = new File(line.getArgs()[0]); File outputFile = new File(line.getArgs()[1]); gen.run(inputFile.toURI().toURL(), outputFile.toURI().toURL(), line.hasOption("language") ? line.getOptionValue("language") : "en"); } } catch (Exception exp) { if (debug) { exp.printStackTrace(); } else { System.err.println("ERROR: " + exp.getMessage()); } printHelp(); } }
From source file:com.izforge.izpack.installer.unpacker.Pack200FileUnpacker.java
private Pack200.Unpacker createPack200Unpacker(PackFile packFile) { Pack200.Unpacker unpacker = Pack200.newUnpacker(); Map<String, String> defaultUnpackerProperties = unpacker.properties(); Map<String, String> localPackerProperties = packFile.getPack200Properties(); if (localPackerProperties != null) { defaultUnpackerProperties.putAll(localPackerProperties); }//from w w w . ja v a2s . com return unpacker; }
From source file:org.usrz.libs.webtools.exceptions.ExceptionWrapper.java
@Override public Map<String, Object> compute(TemplateFactory templates) { final Map<String, Object> map = new HashMap<>(); if (scope != null) map.putAll(scope.compute(templates)); /* Status is always here, the other we normalize */ map.put("status_code", status.getStatusCode()); map.put("status_reason", status.getReasonPhrase()); map.put("reference", reference); /* Exception cause */ if (cause != null) { map.put("exception_type", cause.getClass().getName()); map.put("exception_message", cause.getMessage()); } else {//from www. j a v a 2s. c om map.remove("exception_type"); map.remove("exception_message"); } /* Message */ if (message != null) { map.put("message", message); } else { map.remove("message"); } /* Method */ if (method != null) { map.put("request_method", method); } else { map.remove("request_method"); } /* Location */ if (location != null) { map.put("request_uri", location); } else { map.remove("request_uri"); } /* Done */ return map; }
From source file:net.lshift.diffa.adapter.scanning.DigestBuilder.java
/** * Adds a new version into the builder./*from ww w .j a v a 2 s .co m*/ * @param id the id of the entity being added * @param attributes the attributes of the entity being added. The builder expects that an attribute will be present * for each of the aggregations specified. * @param vsn the version of the entity */ public void add(String id, Map<String, String> attributes, String vsn) { log.trace("Adding to bucket: " + id + ", " + attributes + ", " + vsn); if (!isCorrectlyOrdered(id)) { throw new OutOfOrderException(previousId, id); } previousId = id; Map<String, String> partitions = new HashMap<String, String>(); partitions.putAll(attributes); // Default partitions to the initial attribute set for (ScanAggregation aggregation : aggregations) { String attrVal = attributes.get(aggregation.getAttributeName()); if (attrVal == null) { throw new MissingAttributeException(id, aggregation.getAttributeName()); } String bucket = aggregation.bucket(attrVal); partitions.put(aggregation.getAttributeName(), bucket); } BucketKey key = new BucketKey(partitions); Bucket bucket = digestBuckets.get(key); if (bucket == null) { bucket = new Bucket(key, partitions); digestBuckets.put(key, bucket); } bucket.add(vsn); }
From source file:io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageOsgiConfigPostProcessor.java
@Override public List<FileContext> apply(FileContext fileContext, PostProcessorContext context) { File file = fileContext.getFile(); Logger logger = context.getLogger(); Map<String, Object> options = context.getOptions(); try {//w ww .j a v a 2s .c om // extract file header FileHeaderContext fileHeader = extractFileHeader(fileContext, context); // generate OSGi configurations Model model = ProvisioningUtil.getModel(fileContext); // create AEM content package with configurations File zipFile = new File(file.getParentFile(), FilenameUtils.getBaseName(file.getName()) + ".zip"); logger.info("Generate " + zipFile.getCanonicalPath()); String rootPath = ContentPackageUtil.getMandatoryProp(options, PROPERTY_PACKAGE_ROOT_PATH); ContentPackageBuilder builder = ContentPackageUtil.getContentPackageBuilder(options, fileHeader); try (ContentPackage contentPackage = builder.build(zipFile)) { // always create folder for root path contentPackage.addContent(rootPath, ImmutableMap.of("jcr:primaryType", "nt:folder")); generateOsgiConfigurations(model, contentPackage, rootPath, fileHeader, context); } // delete provisioning file after transformation file.delete(); // set force to true by default for CONGA-generated packages (but allow override from role definition) Map<String, Object> modelOptions = new HashMap<>(); modelOptions.put("force", true); modelOptions.putAll(fileContext.getModelOptions()); return ImmutableList.of(new FileContext().file(zipFile).modelOptions(modelOptions)); } catch (IOException ex) { throw new GeneratorException("Unable to post-process sling provisioning OSGi configurations.", ex); } }