List of usage examples for java.util Hashtable keySet
Set keySet
To view the source code for java.util Hashtable keySet.
Click Source Link
From source file:org.kepler.kar.KARBuilder.java
private Hashtable<KAREntry, InputStream> queryKAREntryHandlers( Vector<KeplerLSID> lsidsOfEntriesReturnedFromPreviousIteration, TableauFrame tableauFrame) throws Exception { Hashtable<KAREntry, InputStream> entriesForThisIteration = new Hashtable<KAREntry, InputStream>(); Collection<KAREntryHandler> allHandlers = CacheManager.getInstance().getKAREntryHandlers(); // Loop through the KAREntryHandlers for (KAREntryHandler keh : allHandlers) { if (isDebugging) log.debug(keh.getClass().getName()); // Get the KAREntries from each handler Hashtable<KAREntry, InputStream> entries = keh.save(lsidsOfEntriesReturnedFromPreviousIteration, _karLSID, tableauFrame); if (entries != null) { for (KAREntry entry : entries.keySet()) { entry.setHandler(keh.getClass().getName()); entriesForThisIteration.put(entry, entries.get(entry)); }/*from w w w . jav a 2 s. com*/ } } return entriesForThisIteration; }
From source file:com.microsoft.applicationinsights.test.framework.telemetries.RequestTelemetryItem.java
/** * Converts JSON object to Request TelemetryItem * @param json The JSON object/*from www . j a v a2 s. co m*/ */ private void initRequestTelemetryItem(JSONObject json) throws URISyntaxException, JSONException { System.out.println("Converting JSON object to RequestTelemetryItem"); JSONObject requestProperties = json.getJSONArray("request").getJSONObject(0); String address = requestProperties.getString("url"); Integer port = requestProperties.getJSONObject("urlData").getInt("port"); Integer responseCode = requestProperties.getInt("responseCode"); String requestName = requestProperties.getString("name"); JSONArray parameters = requestProperties.getJSONObject("urlData").getJSONArray("queryParameters"); Hashtable<String, String> queryParameters = new Hashtable<String, String>(); for (int i = 0; i < parameters.length(); ++i) { JSONObject parameterPair = parameters.getJSONObject(i); String name = parameterPair.getString("parameter"); String value = parameterPair.getString("value"); queryParameters.put(name, value); } this.setProperty("uri", address); this.setProperty("port", port.toString()); this.setProperty("responseCode", responseCode.toString()); this.setProperty("requestName", requestName); for (String key : queryParameters.keySet()) { this.setProperty("queryParameter." + key, queryParameters.get(key)); } }
From source file:com.alfaariss.oa.engine.user.provisioning.translator.standard.StandardProfile.java
/** * Returns the user object, using the provided ExternalStorage * as userstore//ww w. j av a 2 s . c om */ public ProvisioningUser getUser(IExternalStorage oExternalStorage, String sOrganization, String id) throws UserException { ProvisioningUser oProvisioningUser = null; try { Hashtable<String, Object> htFields = oExternalStorage.getFields(id, _vAllFields); Boolean boolEnabled = (Boolean) getValue(_itemEnabled, htFields); oProvisioningUser = new ProvisioningUser(sOrganization, id, boolEnabled); /* 2011/03/10; dopey adds: */ // Remember fetched attributes from _itemEnabled-list to oProvisioningUser's // attributes collection: Iterator<String> itFields = htFields.keySet().iterator(); String sCurrentField; while (itFields.hasNext()) { sCurrentField = itFields.next(); oProvisioningUser.getAttributes().put(sCurrentField, htFields.get(sCurrentField)); } Enumeration enumMethodIDs = _htProfile.keys(); while (enumMethodIDs.hasMoreElements()) { String sMethodID = (String) enumMethodIDs.nextElement(); ProfileItem itemRegistered = _htProfile.get(sMethodID); Boolean boolRegistered = (Boolean) getValue(itemRegistered, htFields); oProvisioningUser.putRegistered(sMethodID, boolRegistered); } } catch (UserException e) { throw e; } catch (Exception e) { _logger.fatal("Could not retrieve user information for user with id: " + id, e); throw new UserException(SystemErrors.ERROR_INTERNAL); } return oProvisioningUser; }
From source file:com.apatar.flickr.function.UploadPhotoFlickrTable.java
public List<KeyInsensitiveMap> execute(FlickrNode node, Hashtable<String, Object> values, String strApi, String strSecret) throws IOException, XmlRpcException { byte[] photo = (byte[]) values.get("photo"); int size = values.size() + 2; values.remove("photo"); File newFile = ApplicationData.createFile("flicr", photo); PostMethod post = new PostMethod("http://api.flickr.com/services/upload"); Part[] parts = new Part[size]; parts[0] = new FilePart("photo", newFile); parts[1] = new StringPart("api_key", strApi); int i = 2;//from w w w .jav a 2 s . c o m for (String key : values.keySet()) parts[i++] = new StringPart(key, values.get(key).toString()); values.put("api_key", strApi); parts[i] = new StringPart("api_sig", FlickrUtils.Sign(values, strApi, strSecret)); post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams())); HttpClient client = new HttpClient(); client.getHttpConnectionManager().getParams().setConnectionTimeout(5000); int status = client.executeMethod(post); if (status != HttpStatus.SC_OK) { JOptionPane.showMessageDialog(ApatarUiMain.MAIN_FRAME, "Upload failed, response=" + HttpStatus.getStatusText(status)); return null; } else { InputStream is = post.getResponseBodyAsStream(); try { return createKeyInsensitiveMapFromElement(FlickrUtils.getRootElementFromInputStream(is)); } catch (Exception e) { e.printStackTrace(); } } return null; }
From source file:fr.paris.lutece.plugins.search.solr.business.SolrSearchEngine.java
/** * Get the field//from w w w .j av a2 s .c o m * @param strName */ private Field getField(Hashtable<Field, List<String>> values, String strName) { Field fieldReturn = null; for (Field tmp : values.keySet()) { if (tmp.getName().equalsIgnoreCase(strName)) fieldReturn = tmp; } return fieldReturn; }
From source file:org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.rm.defaults.DefaultDescribe.java
protected ReservationInfoType[] getAllReservations(VM[] vms, String ownerID) throws CannotTranslateException { if (vms == null) { throw new CannotTranslateException("vms may not be null"); }//from ww w . java2s. c o m final List riits = new LinkedList(); // assuming sorting will resolve any orphans final Hashtable sorted = this.sort(vms); final Set keys = sorted.keySet(); final Iterator iter = keys.iterator(); while (iter.hasNext()) { final String key = (String) iter.next(); final List list = (List) sorted.get(key); riits.add(this.getOneReservation(key, list, ownerID)); } return (ReservationInfoType[]) riits.toArray(new ReservationInfoType[riits.size()]); }
From source file:edu.uga.cs.fluxbuster.features.FeatureCalculator.java
/** * Calculates the previous cluster ratio feature for each cluster generated * on a specific run date and stores them in the database. * * @param log_date the run date//from w ww . ja v a 2 s .c om * @throws SQLException if the feature values can not be stored in the database */ public void updatePrevClusterRatios(Date log_date) throws SQLException { Hashtable<Integer, List<Double>> ratios = this.calculatePrevClusterRatios(log_date, Integer.parseInt(properties.getProperty(PREVCLUSTER_WINDOWKEY))); for (int clusterid : ratios.keySet()) { List<Double> ratiovals = ratios.get(clusterid); StringBuffer querybuf = new StringBuffer(); Formatter formatter = new Formatter(querybuf); formatter.format(properties.getProperty(PREVCLUSTER_QUERY4KEY), df.format(log_date), ratiovals.get(0).toString(), ratiovals.get(1).toString(), Integer.toString(clusterid)); dbi.executeQueryNoResult(querybuf.toString()); formatter.close(); } }
From source file:imapi.IMAPIClass.java
public void printResultInstances(Hashtable<Float, Vector<ResultSourceTargetPair>> resultInstances) { int resultsCounter = 0; if (resultInstances.size() == 0) { System.out.println("0 results found."); } else {/*from w w w. ja v a 2s. c o m*/ Vector<Float> sortBySimilarityVec = new Vector<Float>(resultInstances.keySet()); Collections.sort(sortBySimilarityVec); Collections.reverse(sortBySimilarityVec); for (int i = 0; i < sortBySimilarityVec.size(); i++) { float sim = sortBySimilarityVec.get(i); Vector<ResultSourceTargetPair> stPairs = resultInstances.get(sim); Collections.sort(stPairs); for (int k = 0; k < stPairs.size(); k++) { ResultSourceTargetPair resultInfo = stPairs.get(k); SourceTargetPair pair = resultInfo.getSourceTargetPair(); SequenceSimilarityResultVector tripVec = resultInfo.getSimilarityResultsVector(); System.out.println((++resultsCounter) + ".\t" + Utilities.df.format(sim) + "\t" + pair.getSourceInstance().getSourceName() + " " + pair.getSourceInstance().getInstanceUri() + " " + pair.getTargetInstance().getSourceName() + " " + pair.getTargetInstance().getInstanceUri()); //check if uri similarity is encoutered if (pair.getSourceInstance().getInstanceUri() .equals(pair.getTargetInstance().getInstanceUri())) { System.out.println("\t\t\turi similarity 1\n"); continue; } else { this.printSimilaritiesData(tripVec); } System.out.println(); } } } }
From source file:adams.ml.Dataset.java
public Vector<String> getDistinctStrings(String columnname) { Hashtable<String, Boolean> ht = new Hashtable<>(); Vector<String> ret = new Vector<>(); for (int i = 0; i < count(); i++) { DataRow dr = getSafe(i);//w w w .jav a2 s . c o m if (dr == null) { continue; } String cll = dr.getAsString(columnname); if (cll != null) { if (!ht.containsKey(cll)) { ht.put(cll, true); } } } for (String s : ht.keySet()) { ret.add(s); } return (ret); }
From source file:org.gridchem.client.gui.charts.UsageChart.java
/** * Returns a dataset representing the current usage of this project * and the unused portion of the allocation. * /*from ww w . j a va 2 s .c om*/ * @param project * @return */ private DefaultPieDataset createProjectDataset( Hashtable<ProjectBean, List<CollaboratorBean>> projectUsageTable) { DefaultPieDataset pds = new DefaultPieDataset(); // for every project for (ProjectBean project : projectUsageTable.keySet()) { pds.setValue("Used", new Double(project.getUsage().getUsed())); // pds.setValue("Available", new Double((project.getUsage().getAllocated() // - project.getUsage().getUsed()))); } return pds; }