List of usage examples for java.util Hashtable Hashtable
public Hashtable()
From source file:net.oauth.j2me.OAuthMessage.java
public OAuthMessage() { requestMethod = "POST"; version = "1.0"; signatureMethod = "PLAINTEXT"; Date d = new Date(); timestamp = Long.toString(d.getTime() / 1000); // long timestamp instead of double Nonce n = new Nonce(); nonce = n.getNonce();/*from ww w . ja va2s. c o m*/ requestParameters = new Hashtable(); //start with empty rather than null tokenSecret = ""; //empty string better than null }
From source file:gsn.http.ac.ParameterSet.java
/*************************************************************************************************/ /* constructor for processing parameters of a normal form */ public ParameterSet(HttpServletRequest req) { paramset = new Hashtable(); Enumeration myenum = req.getParameterNames(); while (myenum.hasMoreElements()) { String name = (String) myenum.nextElement(); String values[] = req.getParameterValues(name); if (values != null) { if (values.length <= 1) { paramset.put(name, req.getParameter(name)); }//from www. j a v a 2 s. c om } else { paramset.put(name, req.getParameter(name)); } } }
From source file:algorithm.BagItPackagingTest.java
@Test public void bagItPackagingTest() { try {//from w w w . ja v a 2s.c om File carrier = TestDataProvider.TXT_FILE; File payload1 = TestDataProvider.TXT_FILE_2; File payload2 = TestDataProvider.XML_FILE; List<File> payloadList = new ArrayList<File>(); payloadList.add(payload1); payloadList.add(payload2); BagItPackaging algorithm = new BagItPackaging(); // Test encapsulation: File outputFile = algorithm.encapsulate(carrier, payloadList); assertNotNull(outputFile); assertTrue(outputFile.length() > carrier.length()); // Test restore: Hashtable<String, RestoredFile> outputHash = new Hashtable<String, RestoredFile>(); for (RestoredFile file : algorithm.restore(outputFile)) { outputHash.put(file.getName(), file); } assertEquals(3, outputHash.size()); RestoredFile restoredCarrier = outputHash.get(carrier.getName()); RestoredFile restoredPayload1 = outputHash.get(payload1.getName()); RestoredFile restoredPayload2 = outputHash.get(payload2.getName()); assertNotNull(restoredCarrier); assertNotNull(restoredPayload1); assertNotNull(restoredPayload2); assertEquals(FileUtils.checksumCRC32(carrier), FileUtils.checksumCRC32(restoredCarrier)); assertEquals(FileUtils.checksumCRC32(payload1), FileUtils.checksumCRC32(restoredPayload1)); assertEquals(FileUtils.checksumCRC32(payload2), FileUtils.checksumCRC32(restoredPayload2)); // check restoration metadata: // (original file paths are not stored with BagIt) assertEquals(algorithm, restoredCarrier.algorithm); assertTrue(restoredCarrier.checksumValid); assertTrue(restoredPayload1.checksumValid); assertTrue(restoredPayload2.checksumValid); assertTrue(restoredCarrier.wasCarrier); assertFalse(restoredCarrier.wasPayload); assertTrue(restoredPayload1.wasPayload); assertFalse(restoredPayload1.wasCarrier); assertTrue(restoredPayload2.wasPayload); assertFalse(restoredPayload2.wasCarrier); assertTrue(restoredCarrier.relatedFiles.contains(restoredPayload1)); assertTrue(restoredCarrier.relatedFiles.contains(restoredPayload2)); assertFalse(restoredCarrier.relatedFiles.contains(restoredCarrier)); assertTrue(restoredPayload1.relatedFiles.contains(restoredCarrier)); assertTrue(restoredPayload1.relatedFiles.contains(restoredPayload2)); assertFalse(restoredPayload1.relatedFiles.contains(restoredPayload1)); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.wso2telco.dep.mediator.internal.ApiUtils.java
/** * Instantiates a new api utils. */ public ApiUtils() { loadProperties(); processors = new Hashtable<String, Processor>(); }
From source file:com.salas.bbservice.service.forum.ForumHandler.java
/** * Returns the list of forums available for posting. The map contains * Forum-ID to Forum-Name mapping.//from w w w .j av a 2 s .c om * * @return list of available forums. */ public Hashtable getForums() { IForumDao forumDao = getForumDao(); Hashtable forums = new Hashtable(); List forumsList = forumDao.listForums(); for (int i = 0; i < forumsList.size(); i++) { Forum forum = (Forum) forumsList.get(i); forums.put(Integer.toString(forum.getId()), forum.getName()); } return forums; }
From source file:com.justcloud.osgifier.SpringContextHolder.java
@SuppressWarnings({ "rawtypes", "unchecked" }) public void registerContext(String name, OsgiBundleXmlApplicationContext context) { contexts.put(name, context);/*from ww w.j a va 2 s. c om*/ context.refresh(); BundleContext bc = FrameworkUtil.getBundle(SpringContextHolder.class).getBundleContext(); Hashtable properties = new Hashtable(); properties.put("name", name); regs.add(bc.registerService(OsgiBundleXmlApplicationContext.class.getName(), context, properties)); }
From source file:MapBitmapManager.java
public MapBitmapManager() { mBitmaps = new Hashtable<Integer, BitmapHolder>(); }
From source file:gov.nih.nci.cabig.caaers.tools.JMXBeansRegistrar.java
/** * @return/*from w w w. ja v a 2 s . c o m*/ * @throws MalformedObjectNameException * @throws NullPointerException */ private ObjectName prepareObjectName(SessionFactory sessionFactory) throws MalformedObjectNameException, NullPointerException { Hashtable tb = new Hashtable(); tb.put("type", "statistics"); tb.put("sessionFactory", "Session Factory #" + sessionFactories.indexOf(sessionFactory)); ObjectName on = new ObjectName("hibernate", tb); // MBean object // name return on; }
From source file:com.whizzosoftware.hobson.openweathermap.OpenWeatherMapPluginTest.java
@Test public void testInitWithConfiguration() { MockVariableManager vm = new MockVariableManager(); OpenWeatherMapPlugin plugin = new OpenWeatherMapPlugin("id"); plugin.setVariableManager(vm);//from w w w. j a v a 2s .c o m assertEquals(PluginStatus.Status.INITIALIZING, plugin.getStatus().getStatus()); Hashtable config = new Hashtable(); config.put(OpenWeatherMapPlugin.PROP_CITY_STATE, "Denver, CO"); plugin.onStartup(config); assertEquals(PluginStatus.Status.RUNNING, plugin.getStatus().getStatus()); Collection<HobsonVariable> vars = vm.getGlobalVariables(UserUtil.DEFAULT_USER, UserUtil.DEFAULT_HUB); assertEquals(2, vars.size()); Iterator<HobsonVariable> it = vars.iterator(); HobsonVariable v0 = it.next(); HobsonVariable v1 = it.next(); assertEquals(null, v0.getValue()); assertTrue(v0.getName().equals(VariableConstants.TEMP_F) || v0.getName().equals(VariableConstants.TEMP_C)); assertEquals(null, v1.getValue()); assertTrue(v1.getName().equals(VariableConstants.TEMP_F) || v1.getName().equals(VariableConstants.TEMP_C)); }
From source file:algorithm.TxtInformationFrameTest.java
@Test public void textInformationFrameAlgorithmTest() { try {//from ww w . j ava 2 s .c om File carrier = TestDataProvider.TXT_FILE; File payload1 = TestDataProvider.TXT_FILE_2; File payload2 = TestDataProvider.XML_FILE; List<File> payloadList = new ArrayList<File>(); payloadList.add(payload1); payloadList.add(payload2); TextInformationFrame algorithm = new TextInformationFrame(); // Test encapsulation: File outputFile = algorithm.encapsulate(carrier, payloadList); assertNotNull(outputFile); assertTrue(outputFile.length() > carrier.length()); // Test restore: Hashtable<String, RestoredFile> outputHash = new Hashtable<String, RestoredFile>(); for (RestoredFile file : algorithm.restore(outputFile)) { outputHash.put(file.getName(), file); } assertEquals(3, outputHash.size()); RestoredFile restoredCarrier = outputHash.get(carrier.getName()); RestoredFile restoredPayload1 = outputHash.get(payload1.getName()); RestoredFile restoredPayload2 = outputHash.get(payload2.getName()); assertNotNull(restoredCarrier); assertNotNull(restoredPayload1); assertNotNull(restoredPayload2); assertEquals(FileUtils.checksumCRC32(carrier), FileUtils.checksumCRC32(restoredCarrier)); assertEquals(FileUtils.checksumCRC32(payload1), FileUtils.checksumCRC32(restoredPayload1)); assertEquals(FileUtils.checksumCRC32(payload2), FileUtils.checksumCRC32(restoredPayload2)); // check restoration metadata: assertEquals("" + carrier.getAbsolutePath(), restoredCarrier.originalFilePath); assertEquals("" + payload1.getAbsolutePath(), restoredPayload1.originalFilePath); assertEquals("" + payload2.getAbsolutePath(), restoredPayload2.originalFilePath); assertEquals(algorithm, restoredCarrier.algorithm); assertTrue(restoredCarrier.checksumValid); assertTrue(restoredPayload1.checksumValid); assertTrue(restoredPayload2.checksumValid); assertTrue(restoredCarrier.wasCarrier); assertFalse(restoredCarrier.wasPayload); assertTrue(restoredPayload1.wasPayload); assertFalse(restoredPayload1.wasCarrier); assertTrue(restoredPayload2.wasPayload); assertFalse(restoredPayload2.wasCarrier); assertTrue(restoredCarrier.relatedFiles.contains(restoredPayload1)); assertTrue(restoredCarrier.relatedFiles.contains(restoredPayload2)); assertFalse(restoredCarrier.relatedFiles.contains(restoredCarrier)); assertTrue(restoredPayload1.relatedFiles.contains(restoredCarrier)); assertTrue(restoredPayload1.relatedFiles.contains(restoredPayload2)); assertFalse(restoredPayload1.relatedFiles.contains(restoredPayload1)); } catch (IOException e) { e.printStackTrace(); } }