List of usage examples for java.util Hashtable Hashtable
public Hashtable()
From source file:com.microsoft.applicationinsights.test.framework.telemetries.RequestTelemetryItem.java
/** * Converts JSON object to Request TelemetryItem * @param json The JSON object/*from w w w.j av a 2s . c o 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:at.jku.rdfstats.RDFStatsModelImpl.java
/** * constructor/*w ww. j ava2s . c om*/ * @param model */ @SuppressWarnings("unchecked") protected RDFStatsModelImpl(Model model) { this.model = model; this.cachedHistograms = new Hashtable<Integer, Histogram<?>>(); // sync TDB models upon initialization try { Class graphTDB = Class.forName("com.hp.hpl.jena.tdb.store.GraphTDB"); try { if (graphTDB.isInstance(this.model.getGraph())) { Class classTDB = Class.forName("com.hp.hpl.jena.tdb.TDB"); Method sync = classTDB.getMethod("sync", new Class[] { Model.class }); sync.invoke(null, new Object[] { model }); } } catch (Exception e) { log.error("Failed to sync TDB model.", e); } } catch (Exception ignore) { } log.debug("RDFStatsModel created from existing model."); }
From source file:ch.entwine.weblounge.kernel.command.TestCommand.java
/** * Callback for OSGi's declarative services component activation. * //from www .ja va2 s. co m * @param context * the component context * @throws Exception * if component activation fails */ void activate(ComponentContext context) { BundleContext bundleContext = context.getBundleContext(); logger.debug("Registering test commands"); Dictionary<String, Object> commands = new Hashtable<String, Object>(); commands.put("osgi.command.scope", "weblounge"); commands.put("osgi.command.function", new String[] { "lt", "test", "tests" }); bundleContext.registerService(getClass().getName(), this, commands); }
From source file:jdiff.API.java
/** Default constructor. */ public API() {// w ww . j ava2 s.c om packages_ = new ArrayList(); //PackageAPI[] classes_ = new Hashtable(); //ClassAPI }
From source file:de.juwimm.cms.content.modules.ModuleFactoryStandardImpl.java
public ModuleFactoryStandardImpl() { htModules = new Hashtable<String, Module>(); }
From source file:edu.csun.ecs.cs.multitouchj.application.chopsticks.Chopsticks.java
public Chopsticks() { grabbableControls = new LinkedList<GrabbableControl>(); speeds = new Hashtable<GrabbableControl, Float>(); positionRandom = new Random(new Date().getTime()); speedRandom = new Random(new Date().getTime()); }
From source file:de.ingrid.mdek.mapping.ScriptImportDataMapper.java
public InputStream convert(InputStream data, ProtocolHandler protocolHandler) throws MdekException { Map<String, Object> parameters = new Hashtable<String, Object>(); InputStream targetStream = null; try {/*from w w w. ja v a 2 s. c o m*/ // get DOM-tree from XML-file Document doc = getDomFromSourceData(data, true); // close the input file after it was read data.close(); if (log.isDebugEnabled()) { String sourceString = XMLUtils.toString(doc); log.debug("Input XML:" + sourceString); } // get DOM-tree from template-file Document docTarget = getDomFromSourceData(template.getInputStream(), false); preProcessMapping(docTarget); parameters.put("source", doc); parameters.put("target", docTarget); parameters.put("protocolHandler", protocolHandler); parameters.put("codeListService", codeListService); parameters.put("javaVersion", System.getProperty("java.version")); // the template represents only one object! // Better if docTarget is only header and footer where // new objects made from template will be put into? //parameters.put("template", template); doMap(parameters); String targetString = XMLUtils.toString(docTarget); if (log.isDebugEnabled()) { log.debug("Resulting XML:" + targetString); } targetStream = new ByteArrayInputStream(targetString.getBytes("UTF-8")); } catch (Exception e) { log.error("Error while converting the input data!", e); String msg = "Problems converting file '" + protocolHandler.getCurrentFilename() + "': " + e; protocolHandler.addMessage(msg + "\n"); throw new MdekException(new MdekError(MdekErrorType.IMPORT_PROBLEM, msg)); } return targetStream; }
From source file:edu.rice.cs.bioinfo.programs.phylonet.algos.network.NetworkLikelihoodFromGTTBL.java
private void computePairwiseCoalesceTime(List<Tree> trees, Map<String, List<String>> species2alleles) { _pair2time = new HashMap<UnorderedPair, Double>(); Map<String, String> allele2species = null; if (species2alleles != null) { allele2species = new HashMap<String, String>(); for (Map.Entry<String, List<String>> entry : species2alleles.entrySet()) { for (String allele : entry.getValue()) { allele2species.put(allele, entry.getKey()); }// www . ja v a 2s .c o m } } for (Tree tree : trees) { Map<TNode, Set<String>> node2leaves = new Hashtable<TNode, Set<String>>(); Map<TNode, Double> node2height = new Hashtable<TNode, Double>(); for (TNode node : tree.getNodes()) { Set<String> taxaUnder = new HashSet<String>(); double height = 0; if (node.isLeaf()) { if (allele2species == null) { taxaUnder.add(node.getName()); } else { taxaUnder.add(allele2species.get(node.getName())); } } else { Iterator children = node.getChildren().iterator(); TNode child1 = (TNode) children.next(); taxaUnder.addAll(node2leaves.get(child1)); TNode child2 = (TNode) children.next(); taxaUnder.addAll(node2leaves.get(child2)); height = node2height.get(child1) + child1.getParentDistance(); height = Math.max(height, node2height.get(child2) + child2.getParentDistance()); for (String taxon1 : node2leaves.get(child1)) { for (String taxon2 : node2leaves.get(child2)) { UnorderedPair sp = new UnorderedPair(taxon1, taxon2); Double minTime = _pair2time.get(sp); if (minTime == null || minTime > height) { _pair2time.put(sp, height); } } } } node2leaves.put(node, taxaUnder); node2height.put(node, height); } } }
From source file:ddf.test.itests.catalog.TestSecurityAuditPlugin.java
@Test public void testSecurityAuditPlugin() throws Exception { Configuration config = configAdmin .getConfiguration("org.codice.ddf.catalog.plugin.security.audit.SecurityAuditPlugin", null); List attributes = new ArrayList<>(); attributes.add("description"); Dictionary properties = new Hashtable<>(); properties.put("auditAttributes", attributes); config.update(properties);//from w w w . ja v a 2s .com String logFilePath = System.getProperty("karaf.data") + "/log/security.log"; File securityLog = new File(logFilePath); WaitCondition.expect("Securitylog exists").within(2, TimeUnit.MINUTES).checkEvery(2, TimeUnit.SECONDS) .until(securityLog::exists); WaitCondition.expect("Securitylog has log message: " + configUpdateMessage).within(2, TimeUnit.MINUTES) .checkEvery(2, TimeUnit.SECONDS) .until(() -> getFileContent(securityLog).contains(configUpdateMessage)); String id = ingestXmlFromResourceAndWait("metacard1.xml"); update(id, getResourceAsString("metacard2.xml"), "text/xml"); String expectedLogMessage = String.format(auditMessageFormat, "description", id, "My Description", "My Description (Updated)"); WaitCondition.expect("Securitylog has log message: " + expectedLogMessage).within(2, TimeUnit.MINUTES) .checkEvery(2, TimeUnit.SECONDS) .until(() -> getFileContent(securityLog).contains(expectedLogMessage)); delete(id); }
From source file:gsn.http.ac.ParameterSet.java
public ParameterSet(HttpServletRequest req, String saveDirectory) { try {/*from w w w. j a v a2s.co m*/ this.multipartreq = new MultipartRequest(req, saveDirectory, maxPostSize); paramset = new Hashtable(); Enumeration myenum = multipartreq.getParameterNames(); while (myenum.hasMoreElements()) { String name = (String) myenum.nextElement(); paramset.put(name, multipartreq.getParameter(name)); //printHashtable(name); } } catch (Exception e) { logger.error("ERROR IN ParameterSet"); logger.error(e.getMessage(), e); } }