List of usage examples for java.util Collections unmodifiableMap
public static <K, V> Map<K, V> unmodifiableMap(Map<? extends K, ? extends V> m)
From source file:edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.MultipartHttpServletRequest.java
/** * Parse the multipart request. Store the info about the request parameters * and the uploaded files./*from w w w. ja v a 2s .c om*/ */ public MultipartHttpServletRequest(HttpServletRequest request, int maxFileSize) throws IOException { super(request); Map<String, List<String>> parameters = new HashMap<String, List<String>>(); Map<String, List<FileItem>> files = new HashMap<String, List<FileItem>>(); File tempDir = figureTemporaryDirectory(request); ServletFileUpload upload = createUploadHandler(maxFileSize, tempDir); parseQueryString(request.getQueryString(), parameters); try { List<FileItem> items = parseRequestIntoFileItems(request, upload); for (FileItem item : items) { // Process a regular form field if (item.isFormField()) { addToParameters(parameters, item.getFieldName(), item.getString("UTF-8")); log.debug("Form field (parameter) " + item.getFieldName() + "=" + item.getString()); } else { addToFileItems(files, item); log.debug("File " + item.getFieldName() + ": " + item.getName()); } } } catch (FileUploadException e) { fileUploadException = e; request.setAttribute(FileUploadServletRequest.FILE_UPLOAD_EXCEPTION, e); } this.parameters = Collections.unmodifiableMap(parameters); log.debug("Parameters are: " + this.parameters); this.files = Collections.unmodifiableMap(files); log.debug("Files are: " + this.files); request.setAttribute(FILE_ITEM_MAP, this.files); }
From source file:edu.cornell.mannlib.vitro.webapp.triplesource.impl.BasicShortTermCombinedTripleSource.java
private Map<WhichService, RDFService> populateRdfServicesMap() { Map<WhichService, RDFService> map = new EnumMap<>(WhichService.class); for (WhichService which : WhichService.values()) { map.put(which, parent.getRDFServiceFactory(which).getShortTermRDFService()); }/*from w w w .j a va 2 s .c om*/ return Collections.unmodifiableMap(map); }
From source file:org.kitesdk.apps.scheduled.Schedule.java
Schedule(Class<? extends SchedulableJob> jobClass, String name, String frequency, Instant startTime, Map<String, ViewTemplate> views) { this.jobClass = jobClass; this.name = name; this.frequency = frequency; this.startTime = startTime; this.views = Collections.unmodifiableMap(views); }
From source file:com.thoughtworks.go.config.materials.AbstractMaterialConfig.java
@Override public final Map<String, Object> getAttributesForScope() { Map<String, Object> map = new LinkedHashMap<>(); map.put("type", type); map.put("autoUpdate", isAutoUpdate()); appendCriteria(map);/*ww w . jav a 2 s . c om*/ return Collections.unmodifiableMap(map); }
From source file:com.sinnerschrader.s2b.accounttool.logic.component.licences.LicenseSummary.java
private void freeze() { this.dependenciesByType = Collections.unmodifiableMap(this.dependenciesByType); }
From source file:com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.java
private Map<String, ClassConfiguration> buildUsageMap(final BrowserVersion browser) { final Map<String, ClassConfiguration> classMap = new HashMap<>(getClasses().length); for (final Class<? extends SimpleScriptable> klass : getClasses()) { final ClassConfiguration config = getClassConfiguration(klass, browser); if (config != null) { classMap.put(config.getClassName(), config); }//from w w w. j a v a 2 s .c o m } return Collections.unmodifiableMap(classMap); }
From source file:com.genentech.application.property.SDFCalculate.java
private static Map<String, String> createMap() { Map<String, String> result = new LinkedHashMap<String, String>(); result.put("all", "all properties"); result.put("CNS_MPO", "CNS_MPO score, requires cLogP, pKa_MB, cgLogD7.4 "); result.put("Charge", "ionized by MoKa at pH7.4"); result.put("cIC50atLE0.3", "calculated IC50 at LE 0.3"); result.put("cIC50atLE0.35", "calculated IC50 at LE 0.35"); result.put("cIC50atLE0.4", "calculated IC50 at LE 0.4"); result.put("Heavy_Atoms", "Num of heavy atoms"); result.put("H_polar", "ionized by Moka at pH7.4"); result.put("MW", "neutralized by OpenEye's OEchem"); result.put("N+O", "number of N + number of O"); result.put("NH+OH", "number of NH + OH, NH2 counts as 2"); result.put("Rings", "number of ring systems"); result.put("RotBonds", "number of ratatable bonds"); result.put("RO5", " number of Lipinski's rule of five violations"); result.put("TPSA", "topological polar surface area"); result.put("AromaticFraction", "number of aromatic atoms / number of heavy atoms"); result.put("CarboAromaticFraction", "number of aromatic carbon atoms / number of heavy atoms"); result.put("AromaticRings", "number of 5, 6, or 7 member aromatic rings"); result.put("CarboAromaticRings", "number of 5, 6, or 7 member carboaromatic rings"); result.put("HeteroAromaticRings", "number of 5, 6, or 7 member heteroaromatic rings"); result.put("AliphaticRings", "number of 3,4,5,6,7,or 8 member aliphatic rings "); result.put("CarboAliphaticRings", "number of 3,4,5,6,7,or 8 member carboaliphatic rings "); result.put("HeteroAliphaticRings", "number of 3,4,5,6,7,or 8 member heteroaliphatic rings "); result.put("Solubility_Index", "cgLogD7.4 + AromaticRings"); result.put("Csp3", "number of sp3 carbons"); result.put("Csp3Fraction", "Fraction of sp3 carbons"); result.put("NonSp3Fraction", "fraction of non-sp3 atoms"); return Collections.unmodifiableMap(result); }
From source file:com.thoughtworks.go.config.materials.AbstractMaterial.java
public final Map<String, Object> getAttributesForXml() { if (attributesForXml == null) { Map<String, Object> map = new LinkedHashMap<>(); map.put("type", type); appendAttributes(map);//w w w .j a v a 2 s.c o m attributesForXml = Collections.unmodifiableMap(map); } return attributesForXml; }
From source file:com.threewks.thundr.http.service.gae.HttpResponseImpl.java
@Override public Map<String, List<String>> getHeaders() { response(); return Collections.unmodifiableMap(headers); }
From source file:com.threecrickets.prudence.util.PhpExecutionController.java
public void initialize(ExecutionContext executionContext) throws ExecutionException { Request request = Request.getCurrent(); LazyInitializationGet exposedGet = new LazyInitializationGet(request); LazyInitializationFile exposedFile = new LazyInitializationFile(request, fileItemFactory); LazyInitializationPost exposedPost = new LazyInitializationPost(request, exposedFile); LazyInitializationCookie exposedCookie = new LazyInitializationCookie(request); LazyInitializationRequest exposedRequest = new LazyInitializationRequest(exposedGet, exposedPost, exposedCookie);/*ww w . j a va 2 s. c o m*/ // Note that our maps will only contain the last parameter in case of // duplicates. This is PHP's defined behavior. executionContext.getServices().put("_GET", Collections.unmodifiableMap(exposedGet)); executionContext.getServices().put("_FILE", Collections.unmodifiableMap(exposedFile)); executionContext.getServices().put("_POST", Collections.unmodifiableMap(exposedPost)); executionContext.getServices().put("_COOKIE", Collections.unmodifiableMap(exposedCookie)); executionContext.getServices().put("_REQUEST", Collections.unmodifiableMap(exposedRequest)); }