List of usage examples for java.util Hashtable values
Collection values
To view the source code for java.util Hashtable values.
Click Source Link
From source file:io.cloudslang.content.database.services.dbconnection.DBConnectionManager.java
/** * @param aDbType a db type/* w w w .ja v a 2s .c o m*/ * @param aDbUrl a connection url * @return how many check out connections for dbms */ public int getCheckedOutConnectionSize(DBType aDbType, String aDbUrl) throws SQLException { int retTotal = 0; String dbmsPoolKey = aDbType + "." + aDbUrl; Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsPoolKey); PooledDataSourceProvider provider = this.getProvider(dbmsPoolKey); if (dsTable != null) { for (DataSource ds : dsTable.values()) { retTotal = retTotal + provider.getCheckedOutConnectionNumber(ds); } } return retTotal; }
From source file:io.cloudslang.content.database.services.dbconnection.DBConnectionManager.java
/** * @param aDbType type of db//from ww w .j a va 2s . co m * @param aDbUrl a connection url string * @return how many connections for dbms */ public int getConnectionSize(DBType aDbType, String aDbUrl) throws SQLException { int retTotal = 0; String dbmsPoolKey = aDbType + "." + aDbUrl; Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsPoolKey); PooledDataSourceProvider provider = this.getProvider(dbmsPoolKey); if (dsTable != null) { for (DataSource ds : dsTable.values()) { retTotal = retTotal + provider.getAllConnectionNumber(ds); } } return retTotal; }
From source file:io.cloudslang.content.database.services.dbconnection.DBConnectionManager.java
/** * @param aDbType a db type// w w w .j a v a 2 s .c o m * @param aDbUrl a connection url * @return how many check in connections for dbms */ public int getCheckedInConnectionSize(DBType aDbType, String aDbUrl) throws SQLException { int retTotal = 0; String dbmsPoolKey = aDbType + "." + aDbUrl; Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsPoolKey); PooledDataSourceProvider provider = this.getProvider(dbmsPoolKey); if (dsTable != null) { for (DataSource ds : dsTable.values()) { retTotal = retTotal + provider.getCheckedInConnectionNumber(ds); } } return retTotal; }
From source file:io.cloudslang.content.database.services.dbconnection.DBConnectionManager.java
/** * @return all the checked in connections in for all dbms *///from w ww .j av a2 s . c o m public int getTotalCheckedInConnectionSize() throws SQLException { int retTotal = 0; Enumeration<String> allDbmsKeys = dbmsPoolTable.keys(); while (allDbmsKeys.hasMoreElements()) { String dbmsPoolKey = allDbmsKeys.nextElement(); Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsPoolKey); PooledDataSourceProvider provider = this.getProvider(dbmsPoolKey); if (dsTable != null) { for (DataSource ds : dsTable.values()) { retTotal = retTotal + provider.getCheckedInConnectionNumber(ds); } } } return retTotal; }
From source file:io.cloudslang.content.database.services.dbconnection.DBConnectionManager.java
/** * @return all the connections in for all dbms */// w w w . j a va 2 s. c om public int getTotalConnectionSize() throws SQLException { int retTotal = 0; Enumeration<String> allDbmsKeys = dbmsPoolTable.keys(); while (allDbmsKeys.hasMoreElements()) { String dbmsPoolKey = allDbmsKeys.nextElement(); Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsPoolKey); PooledDataSourceProvider provider = this.getProvider(dbmsPoolKey); if (dsTable != null) { for (DataSource ds : dsTable.values()) { retTotal = retTotal + provider.getAllConnectionNumber(ds); } } } return retTotal; }
From source file:io.cloudslang.content.database.services.dbconnection.DBConnectionManager.java
/** * @return all the checked out connections in for all dbms *//*from w w w. j av a2 s . co m*/ public int getTotalCheckedOutConnectionSize() throws SQLException { int retTotal = 0; Enumeration<String> allDbmsKeys = dbmsPoolTable.keys(); while (allDbmsKeys.hasMoreElements()) { String dbmsPoolKey = allDbmsKeys.nextElement(); Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsPoolKey); PooledDataSourceProvider provider = this.getProvider(dbmsPoolKey); if (dsTable != null) { for (DataSource ds : dsTable.values()) { retTotal = retTotal + provider.getCheckedOutConnectionNumber(ds); } } } return retTotal; }
From source file:ambit.data.qmrf.QMRFObject.java
/** * Masks as selected only items with a idref somwehere * *//*from ww w .j a va2 s.c o m*/ public void cleanCatalogs() { Hashtable<String, Catalog> c = getCatalogs(); Iterator<Catalog> cc = c.values().iterator(); while (cc.hasNext()) { Catalog a = cc.next(); for (int k = 0; k < a.size(); k++) a.getItem(k).setSelected(false); } for (int i = 0; i < chapters.size(); i++) { AmbitList subchapters = chapters.get(i).getSubchapters(); for (int j = 0; j < subchapters.size(); j++) if (subchapters.getItem(j) instanceof QMRFSubChapterReference) { CatalogReference ref = ((QMRFSubChapterReference) subchapters.getItem(j)).getCatalogReference(); for (int k = 0; k < ref.size(); k++) { ref.getItem(k).setSelected(true); } } } /* cc = c.values().iterator(); while (cc.hasNext()) { Catalog a = cc.next(); for (int k=a.size()-1; k >= 0;k--) if (!a.getItem(k).isSelected()) { a.remove(k); } } */ }
From source file:libra.common.kmermatch.KmerMatchInputFormat.java
public List<InputSplit> getSplits(JobContext job) throws IOException { KmerMatchInputFormatConfig inputFormatConfig = KmerMatchInputFormatConfig .createInstance(job.getConfiguration()); // generate splits List<InputSplit> splits = new ArrayList<InputSplit>(); List<FileStatus> files = listStatus(job); List<Path> kmerIndexFiles = new ArrayList<Path>(); for (FileStatus file : files) { Path path = file.getPath(); kmerIndexFiles.add(path);/* w ww. ja va 2s . c o m*/ } LOG.info("# of Split input file : " + kmerIndexFiles.size()); for (int i = 0; i < kmerIndexFiles.size(); i++) { LOG.info("> " + kmerIndexFiles.get(i).toString()); } Path[] kmerIndexFilePath = kmerIndexFiles.toArray(new Path[0]); // histogram List<KmerHistogram> histograms = new ArrayList<KmerHistogram>(); for (int i = 0; i < kmerIndexFiles.size(); i++) { String fastaFileName = KmerIndexHelper.getFastaFileName(kmerIndexFilePath[i]); Path histogramPath = new Path(inputFormatConfig.getKmerHistogramPath(), KmerHistogramHelper.makeKmerHistogramFileName(fastaFileName)); FileSystem fs = histogramPath.getFileSystem(job.getConfiguration()); if (fs.exists(histogramPath)) { KmerHistogram histogram = KmerHistogram.createInstance(fs, histogramPath); histograms.add(histogram); } else { throw new IOException("k-mer histogram is not found in given paths"); } } // merge histogram Hashtable<String, KmerHistogramRecord> histogramRecords = new Hashtable<String, KmerHistogramRecord>(); long kmerCounts = 0; for (int i = 0; i < histograms.size(); i++) { Collection<KmerHistogramRecord> records = histograms.get(i).getSortedRecord(); kmerCounts += histograms.get(i).getTotalKmerCount(); for (KmerHistogramRecord rec : records) { KmerHistogramRecord ext_rec = histogramRecords.get(rec.getKmer()); if (ext_rec == null) { histogramRecords.put(rec.getKmer(), rec); } else { ext_rec.increaseFrequency(rec.getFrequency()); } } } List<KmerHistogramRecord> histogramRecordsArr = new ArrayList<KmerHistogramRecord>(); histogramRecordsArr.addAll(histogramRecords.values()); Collections.sort(histogramRecordsArr, new KmerHistogramRecordComparator()); KmerRangePartitioner partitioner = new KmerRangePartitioner(inputFormatConfig.getKmerSize(), inputFormatConfig.getPartitionNum()); KmerRangePartition[] partitions = partitioner .getHistogramPartitions(histogramRecordsArr.toArray(new KmerHistogramRecord[0]), kmerCounts); for (KmerRangePartition partition : partitions) { splits.add(new KmerMatchInputSplit(kmerIndexFilePath, partition)); } // Save the number of input files in the job-conf job.getConfiguration().setLong(NUM_INPUT_FILES, files.size()); LOG.debug("Total # of splits: " + splits.size()); return splits; }
From source file:edu.ku.brc.specify.utilapps.RegProcessor.java
/** * /* w w w. ja v a2s. c om*/ */ protected void buildTree() { String[] regList = { "Institution", "Division", "Discipline", "Collection" }; /*Hashtable<String, RegProcEntry> hh = typeHash.get(regList[0]); for (RegProcEntry entry : hh.values()) { System.out.println(entry.getId()+" "+entry.get("Institution_number")); }*/ for (String key : regList) { System.out.println("\n" + key); Hashtable<String, RegProcEntry> h = typeHash.get(key); if (h == null || h.values() == null) { System.out.println("Skipping: " + key); continue; } System.out.println("Adding: " + key); Vector<RegProcEntry> items = new Vector<RegProcEntry>(h.values()); Collections.sort(items); for (RegProcEntry entry : items) { String reg_type = entry.get("reg_type"); if (reg_type.equals("Collection")) { String dspNum = entry.get("Discipline_number"); Hashtable<String, RegProcEntry> hash = typeHash.get("Discipline"); if (hash != null) { RegProcEntry parent = typeHash.get("Discipline").get(dspNum); if (entry != null && parent != null) { parent.getKids().add(entry); entry.setParent(parent); System.out.println(parent.getName() + " " + entry.getName()); } else { System.err.println("Couldn't find Discipline Num[" + dspNum + "]"); } } } else if (reg_type.equals("Discipline")) { String divNum = entry.get("Division_number"); RegProcEntry parent = typeHash.get("Division").get(divNum); if (entry != null && parent != null) { parent.getKids().add(entry); entry.setParent(parent); } else { System.err.println("Couldn't find Division Num[" + divNum + "]"); } } else if (reg_type.equals("Division")) { String instNum = entry.get("Institution_number"); RegProcEntry parent = typeHash.get("Institution").get(instNum); if (entry != null && parent != null) { parent.getKids().add(entry); entry.setParent(parent); } else { System.err.println("Couldn't find Inst Num[" + instNum + "]"); } } else if (reg_type.equals("Institution")) { root.getKids().add(entry); entry.setParent(root); } else { System.err.println("Unknown"); } } } }
From source file:org.hyperic.hq.product.RtPlugin.java
public Collection getTimes(Integer svcID, Properties alreadyParsedFiles, String logdir, String logmask, String logfmt, int svcType, String transforms, ArrayList noLog, boolean collectIPs) throws IOException { Hashtable urls = new Hashtable(); lp = getParser();/*from w w w .jav a2s . c om*/ lp.setTimeMultiplier(this.getTimeMultiplier()); lp.urlDontLog(noLog); ParsedFile[] flist = generateFileList(alreadyParsedFiles, logdir, logmask); for (int i = 0; i < flist.length; i++) { long flen[] = new long[1]; ParsedFile f = flist[i]; this.log.debug("Parsing log: " + f.fname); Hashtable rv = lp.parseLog(f.fname, convertFormat(logfmt), f.oldLen, svcID, svcType, flen, collectIPs); this.log.debug("Done parsing log, " + rv.keySet().size() + " elements in table"); alreadyParsedFiles.put(f.fname, Long.toString(flen[0])); combineUrls(rv, urls, transforms); } this.log.debug("Returning parsed data " + urls.values().size() + " entries"); return urls.values(); }