List of usage examples for java.util HashMap values
public Collection<V> values()
From source file:net.javacrumbs.smock.axis2.client.SmockClient.java
public static void bootstrap() { try {/*from w w w . jav a 2 s . com*/ ConfigurationContext configurationContext = ConfigurationContextFactory .createConfigurationContextFromFileSystem(null, null); HashMap<String, TransportOutDescription> transportsOut = configurationContext.getAxisConfiguration() .getTransportsOut(); for (TransportOutDescription tod : transportsOut.values()) { setSender(tod); } ListenerManager.defaultConfigurationContext = configurationContext; } catch (AxisFault e) { throw new IllegalStateException("Can not set ListenerManager.defaultConfigurationContext.", e); } }
From source file:net.sqs2.omr.master.sqm.PDFAttachmentExtractor.java
@SuppressWarnings("unchecked") private static byte[] extractAttachmentFiles(PdfReader reader, String suffix) throws IOException { PdfDictionary catalog = reader.getCatalog(); PdfDictionary names = (PdfDictionary) PdfReader.getPdfObject(catalog.get(PdfName.NAMES)); if (names != null) { PdfDictionary embFiles = (PdfDictionary) PdfReader .getPdfObject(names.get(new PdfName("EmbeddedFiles"))); if (embFiles != null) { HashMap<?, PdfObject> embMap = PdfNameTree.readTree(embFiles); for (Iterator<PdfObject> i = embMap.values().iterator(); i.hasNext();) { PdfDictionary filespec = (PdfDictionary) PdfReader.getPdfObject(i.next()); byte[] ret = unpackFile(reader, filespec, suffix); if (ret != null) { return ret; }//from w w w .j a v a 2 s .c o m } } } for (int k = 1; k <= reader.getNumberOfPages(); ++k) { PdfArray annots = (PdfArray) PdfReader.getPdfObject(reader.getPageN(k).get(PdfName.ANNOTS)); if (annots == null) { continue; } for (Iterator<PdfObject> i = annots.listIterator(); i.hasNext();) { PdfDictionary annot = (PdfDictionary) PdfReader.getPdfObject(i.next()); PdfName subType = (PdfName) PdfReader.getPdfObject(annot.get(PdfName.SUBTYPE)); if (!PdfName.FILEATTACHMENT.equals(subType)) { continue; } PdfDictionary filespec = (PdfDictionary) PdfReader.getPdfObject(annot.get(PdfName.FS)); byte[] ret = unpackFile(reader, filespec, suffix); if (ret != null) { return ret; } } } return null; }
From source file:edu.vt.vbi.patric.dao.HibernateHelper.java
public static void closeSessions() throws HibernateException { HashMap<String, Session> sessionMaps = sessionMapsThreadLocal.get(); sessionMapsThreadLocal.set(null);/*from www . j a v a 2 s . com*/ if (sessionMaps != null) { for (Session session : sessionMaps.values()) { if (session.isOpen()) session.close(); } ; } }
From source file:com.house365.build.util.CsvUtil.java
/** * ?./*from w w w . j a v a 2s . c o m*/ * * @param csvContent * @throws IOException */ public static void printlnCsv(ArrayList<LinkedHashMap<String, String>> csvContent) throws IOException { TableBuilder tb = new TableBuilder(); ArrayList<String> headerNames = new ArrayList<>(); LinkedHashMap<String, String> linkedHashMap = csvContent.get(0); for (Map.Entry<String, String> entry : linkedHashMap.entrySet()) { headerNames.add(entry.getKey()); } String[] names = new String[headerNames.size()]; headerNames.toArray(names); tb.addRow(names); for (HashMap<String, String> mapRecord : csvContent) { names = new String[headerNames.size()]; mapRecord.values().toArray(names); tb.addRow(names); } tb.toString(); BufferedReader reader = new BufferedReader(new StringReader(tb.toString())); String line = reader.readLine(); System.out.println(AnsiColor.ANSI_YELLOW + line + AnsiColor.ANSI_RESET); for (line = reader.readLine(); line != null; line = reader.readLine()) { System.out.println(AnsiColor.ANSI_GREEN + line + AnsiColor.ANSI_RESET); } }
From source file:org.apache.axis2.context.ConfigurationContextFactory.java
/** * Initializes TransportSenders and TransportListeners with appropriate configuration information * * @param configContext : ConfigurationContext *///from www . j av a2 s. co m private static void initTransportSenders(ConfigurationContext configContext) { AxisConfiguration axisConf = configContext.getAxisConfiguration(); // Initialize Transport Outs HashMap transportOuts = axisConf.getTransportsOut(); Iterator values = transportOuts.values().iterator(); while (values.hasNext()) { TransportOutDescription transportOut = (TransportOutDescription) values.next(); TransportSender sender = transportOut.getSender(); if (sender != null) { try { sender.init(configContext, transportOut); } catch (AxisFault axisFault) { log.info(Messages.getMessage("transportiniterror", transportOut.getName())); } } } }
From source file:edu.utexas.cs.tactex.utils.BrokerUtils.java
public static <K> Double sumMapValues(HashMap<K, Double> hashMap) { Double totalSubs = 0.0;// w w w.j a v a 2 s.c o m for (Double subs : hashMap.values()) { totalSubs += subs; } return totalSubs; }
From source file:org.apache.axis2.context.ConfigurationContextFactory.java
/** * Initializes the modules. If the module needs to perform some recovery process * it can do so in init and this is different from module.engage(). * * @param context : ConfigurationContext *///from w ww. j a v a 2 s .com private static void initModules(ConfigurationContext context) { AxisConfiguration configuration = context.getAxisConfiguration(); HashMap modules = configuration.getModules(); Collection col = modules.values(); Map faultyModule = new HashMap(); for (Iterator iterator = col.iterator(); iterator.hasNext();) { AxisModule axismodule = (AxisModule) iterator.next(); Module module = axismodule.getModule(); if (module != null) { try { module.init(context, axismodule); } catch (AxisFault axisFault) { log.info(axisFault.getMessage()); faultyModule.put(axismodule, axisFault); } } } //Checking whether we have found any faulty services during the module initilization , // if so we need to mark them as fautyModule and need to remove from the modules list if (faultyModule.size() > 0) { Iterator axisModules = faultyModule.keySet().iterator(); while (axisModules.hasNext()) { AxisModule axisModule = (AxisModule) axisModules.next(); String fileName; if (axisModule.getFileName() != null) { fileName = axisModule.getFileName().toString(); } else { fileName = axisModule.getName(); } configuration.getFaultyModules().put(fileName, faultyModule.get(axisModule).toString()); //removing from original list configuration.removeModule(axisModule.getName(), axisModule.getName()); } } }
From source file:org.apache.axis2.context.ConfigurationContextFactory.java
private static void addModuleService(ConfigurationContext configCtx) throws AxisFault { AxisConfiguration axisConfig = configCtx.getAxisConfiguration(); HashMap modules = axisConfig.getModules(); if (modules != null && modules.size() > 0) { Iterator mpduleItr = modules.values().iterator(); while (mpduleItr.hasNext()) { AxisModule axisModule = (AxisModule) mpduleItr.next(); Utils.deployModuleServices(axisModule, configCtx); }// w ww.ja v a 2s . com } }
From source file:net.antidot.semantic.rdf.rdb2rdf.dm.core.DirectMapper.java
private static void convertNextTuple(SesameDataSet result, TupleExtractor te, DirectMappingEngine dme, DriverType driver, String baseURI) throws UnsupportedEncodingException { Tuple tuple = te.getCurrentTuple();//from ww w.ja va 2s .com //Tuple tuple = null; log.debug("[DirectMapper:convertNextTuple] Tuple extracted : " + tuple); try { // Extract referenced rows HashMap<Key, Tuple> referencedTuples = te.getReferencedTuples(driver, tuple); // Extract primary-is-foreign Key Key primaryIsForeignKey = te.getCurrentPrimaryIsForeignKey(referencedTuples.keySet(), tuple); log.debug("[DirectMapper:convertNextTuple] Number of referenced tuples generated : " + referencedTuples.values().size()); HashSet<Statement> statements = dme.extractTriplesFrom(tuple, referencedTuples, primaryIsForeignKey, baseURI); for (Statement triple : statements) { log.debug("[DirectMapper:convertNextTuple] Triple generated : " + triple); result.add(triple.getSubject(), triple.getPredicate(), triple.getObject()); nbTriples++; } if (nbTriples / 50000 > lastModulo) { log.info(nbTriples + " triples has already been extracted."); lastModulo = nbTriples / 50000; } } catch (UnsupportedEncodingException e) { log.error("[DirectMapper:generateDirectMapping] Encoding not supported."); e.printStackTrace(); } }
From source file:org.apache.hadoop.hbase.backup.util.BackupClientUtil.java
/** * Get the min value for all the Values a map. * @param map map//from w ww. j a v a 2 s .c o m * @return the min value */ public static <T> Long getMinValue(HashMap<T, Long> map) { Long minTimestamp = null; if (map != null) { ArrayList<Long> timestampList = new ArrayList<Long>(map.values()); Collections.sort(timestampList); // The min among all the RS log timestamps will be kept in hbase:backup table. minTimestamp = timestampList.get(0); } return minTimestamp; }