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:com.webtide.jetty.load.generator.jenkins.AlpnBootVersions.java
private AlpnBootVersions() { Map<String, String> map = new HashMap<>(); try {//from w ww.j ava 2 s . co m try (InputStream inputStream = this.getClass().getResourceAsStream("/jetty/jetty-project.pom")) { SAXReader reader = new SAXReader(); Document document = reader.read(inputStream); Map<String, String> namespaceMap = new HashMap<>(); namespaceMap.put("mvn", "http://maven.apache.org/POM/4.0.0"); XPath xpath = document.createXPath("//mvn:profiles/mvn:profile"); xpath.setNamespaceURIs(namespaceMap); List<DefaultElement> nodes = xpath.selectNodes(document); for (DefaultElement o : nodes) { if (StringUtils.startsWith((String) o.element("id").getData(), "8u")) { // olamy well a bit fragile way to parse if more than one property... //"//mvn:properties/mvn:alpn.version" // o.selectSingleNode( "//properties/alpn.version" ); Node version = o.element("properties").element("alpn.version"); //"//mvn:activation/mvn:property/mvn:value" //o.selectSingleNode( "//activation/property/value" ); Node javaVersion = o.element("activation").element("property").element("value"); map.put(javaVersion.getStringValue(), version.getStringValue()); } } } } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } jdkVersionAlpnBootVersion = Collections.unmodifiableMap(map); }
From source file:com.moz.fiji.mapreduce.kvstore.KeyValueStoreReaderFactory.java
/** * Creates a KeyValueStoreReaderFactory backed by a map of specific store bindings. * * @param storeBindings defines the set of KeyValueStores available, and the * names by which they are registered. *///from w w w. ja v a2 s. c o m private KeyValueStoreReaderFactory(Map<String, KeyValueStore<?, ?>> storeBindings) { mKeyValueStores = Collections.unmodifiableMap(new HashMap<String, KeyValueStore<?, ?>>(storeBindings)); mKVStoreReaderCache = Maps.newConcurrentMap(); }
From source file:de.codesourcery.threadwatcher.FileReader.java
public FileReader(File file) throws IOException { if (file == null) { throw new IllegalArgumentException("file must not be NULL."); }/*ww w . j av a 2 s. c o m*/ this.file = file; final FileScanner visitor = new FileScanner(); visit(visitor); this.dataInterval = visitor.getInterval(); this.threadNamesByID = Collections.unmodifiableMap(visitor.threadNamesByID); this.fileOffsetsByMilliseconds = Collections.unmodifiableMap(visitor.fileOffsetsByMilliseconds); final Map<Integer, HiResInterval> tmp = new HashMap<>(); for (Entry<Integer, HiResTimestamp> entry : visitor.threadStartTimes.entrySet()) { HiResTimestamp end = visitor.threadDeathTimes.get(entry.getKey()); if (end == null) { end = visitor.lastEvent; } tmp.put(entry.getKey(), new HiResInterval(entry.getValue(), end)); } this.threadLifetimes = Collections.unmodifiableMap(tmp); if (DEBUG) { System.out.println("Time interval: " + getInterval()); System.out.println("Threads: \n" + getThreadNamesByID()); System.out.println("Offsets: " + StringUtils.join(fileOffsetsByMilliseconds.entrySet(), "\n")); System.out.println("Lifetimes: \n" + StringUtils.join(threadLifetimes.entrySet(), "\n")); } }
From source file:com.amazonaws.hal.client.HalLinkMap.java
HalLinkMap(HalResource halResource, String relation, KeyField keyField, Class<T> type, HalClient halClient) { Map<String, T> resources = new HashMap<>(); HalLink halLink;/* ww w. j a v a 2s .c om*/ int index = 0; String indexedRelation = indexedRelation(relation, index); while ((halLink = halResource.getLink(indexedRelation)) != null) { String key = keyField == KeyField.Title ? halLink.getTitle() : halLink.getName(); if (key == null) { log.warn("No key value for mapped link. Using '" + indexedRelation + "' instead"); resources.put(indexedRelation, halClient.getResource(halResource, type, halLink.getHref(), true)); } else { resources.put(key, halClient.getResource(halResource, type, halLink.getHref(), true)); } indexedRelation = indexedRelation(relation, index++); } // Handle case when there was a single item and therefore was not mapped to an array if (resources.size() == 0 && (halLink = halResource.getLink(relation)) != null) { String key = keyField == KeyField.Title ? halLink.getTitle() : halLink.getName(); if (key == null) { log.warn("No key value for mapped link. Using '" + relation + "' instead"); resources.put(relation, halClient.getResource(halResource, type, halLink.getHref(), true)); } else { resources.put(key, halClient.getResource(halResource, type, halLink.getHref(), true)); } } inner = Collections.unmodifiableMap(resources); }
From source file:com.pp.couchdblib.couchbase.lite.internal.Body.java
@SuppressWarnings("unchecked") public Map<String, Object> getProperties() { Object object = getObject();//from w w w. j a v a 2 s.c om if (object instanceof Map) { Map<String, Object> map = (Map<String, Object>) object; return Collections.unmodifiableMap(map); } return null; }
From source file:com.anrisoftware.sscontrol.scripts.locale.ubuntu.UbuntuInstallLocale.java
public Map<String, Object> getArgs() { return Collections.unmodifiableMap(args); }
From source file:com.github.woonsan.jackrabbit.migration.datastore.batch.MigrationJobExecutionStates.java
public Map<DataIdentifier, MigrationRecordExecutionStates> getExecutionStatesMap() { if (executionStatesMap == null) { return Collections.emptyMap(); }//from w w w . j a v a 2s. c om return Collections.unmodifiableMap(executionStatesMap); }
From source file:fr.zcraft.zbanque.structure.items_groups.ItemsGroup.java
public Map<BlockType, Double> getRelativeAmounts() { return Collections.unmodifiableMap(relativeAmounts); }
From source file:eu.stratosphere.addons.visualization.swt.JobFailurePatternExecutor.java
JobFailurePatternExecutor(final Display timer, final ExtendedManagementProtocol jobManager, final ManagementGraph managementGraph, final JobFailurePattern failurePattern, final long referenceTime) { this.timer = timer; this.jobManager = jobManager; this.jobID = managementGraph.getJobID(); final long now = System.currentTimeMillis(); this.offset = (int) (now - referenceTime); final Map<String, ManagementVertexID> tmpMap = new HashMap<String, ManagementVertexID>(); final Iterator<ManagementVertex> it = new ManagementGraphIterator(managementGraph, true); while (it.hasNext()) { final ManagementVertex vertex = it.next(); tmpMap.put(SWTFailurePatternsManager.getSuggestedName(vertex), vertex.getID()); }//from w ww . j a v a 2s.c o m this.nameToIDMap = Collections.unmodifiableMap(tmpMap); this.eventIterator = failurePattern.iterator(); scheduleNextEvent(); }
From source file:com.anrisoftware.sscontrol.debug.internal.DebugModuleImpl.java
@Override public Map<String, Object> getProperties() { return Collections.unmodifiableMap(properties); }