List of usage examples for java.util Hashtable Hashtable
Hashtable(Void dummy)
From source file:Main.java
/** * Converts the names of mechanisms to their long value code. * * @param mechansimName The name of the mechanism to get the code; e.g. * "CKM_RSA_PKCS".//from w ww. j a v a 2 s .c o m * @return The code of the mechanism or null, if this name is unknown. * @preconditions (mechansimName <> null) * @postconditions */ public static Long mechanismCodeToString(String mechansimName) { if (mechansimName == null) { throw new NullPointerException("Argument \"mechansimName\" must not be null."); } Long mechanismCode; if (mechansimName.startsWith("0x")) { // we try to parse it as hex encoded long mechanismCode = new Long(Long.parseLong(mechansimName, 16)); } else { if (mechansimCodes_ == null) { mechansimCodes_ = new Hashtable(160); mechansimCodes_.put("CKM_RSA_PKCS_KEY_PAIR_GEN", new Long(0x00000000)); mechansimCodes_.put("CKM_RSA_PKCS", new Long(0x00000001)); mechansimCodes_.put("CKM_RSA_9796", new Long(0x00000002)); mechansimCodes_.put("CKM_RSA_X_509", new Long(0x00000003)); mechansimCodes_.put("CKM_MD2_RSA_PKCS", new Long(0x00000004)); mechansimCodes_.put("CKM_MD5_RSA_PKCS", new Long(0x00000005)); mechansimCodes_.put("CKM_SHA1_RSA_PKCS", new Long(0x00000006)); mechansimCodes_.put("CKM_RIPEMD128_RSA_PKCS", new Long(0x00000007)); mechansimCodes_.put("CKM_RIPEMD160_RSA_PKCS", new Long(0x00000008)); mechansimCodes_.put("CKM_RSA_PKCS_OAEP", new Long(0x00000009)); mechansimCodes_.put("CKM_DSA_KEY_PAIR_GEN", new Long(0x00000010)); mechansimCodes_.put("CKM_DSA", new Long(0x00000011)); mechansimCodes_.put("CKM_DSA_SHA1", new Long(0x00000012)); mechansimCodes_.put("CKM_DH_PKCS_KEY_PAIR_GEN", new Long(0x00000020)); mechansimCodes_.put("CKM_DH_PKCS_DERIVE", new Long(0x00000021)); mechansimCodes_.put("CKM_RC2_KEY_GEN", new Long(0x00000100)); mechansimCodes_.put("CKM_RC2_ECB", new Long(0x00000101)); mechansimCodes_.put("CKM_RC2_CBC", new Long(0x00000102)); mechansimCodes_.put("CKM_RC2_MAC", new Long(0x00000103)); mechansimCodes_.put("CKM_RC2_MAC_GENERAL", new Long(0x00000104)); mechansimCodes_.put("CKM_RC2_CBC_PAD", new Long(0x00000105)); mechansimCodes_.put("CKM_RC4_KEY_GEN", new Long(0x00000110)); mechansimCodes_.put("CKM_RC4", new Long(0x00000111)); mechansimCodes_.put("CKM_DES_KEY_GEN", new Long(0x00000120)); mechansimCodes_.put("CKM_DES_ECB", new Long(0x00000121)); mechansimCodes_.put("CKM_DES_CBC", new Long(0x00000122)); mechansimCodes_.put("CKM_DES_MAC", new Long(0x00000123)); mechansimCodes_.put("CKM_DES_MAC_GENERAL", new Long(0x00000124)); mechansimCodes_.put("CKM_DES_CBC_PAD", new Long(0x00000125)); mechansimCodes_.put("CKM_DES2_KEY_GEN", new Long(0x00000130)); mechansimCodes_.put("CKM_DES3_KEY_GEN", new Long(0x00000131)); mechansimCodes_.put("CKM_DES3_ECB", new Long(0x00000132)); mechansimCodes_.put("CKM_DES3_CBC", new Long(0x00000133)); mechansimCodes_.put("CKM_DES3_MAC", new Long(0x00000134)); mechansimCodes_.put("CKM_DES3_MAC_GENERAL", new Long(0x00000135)); mechansimCodes_.put("CKM_DES3_CBC_PAD", new Long(0x00000136)); mechansimCodes_.put("CKM_CDMF_KEY_GEN", new Long(0x00000140)); mechansimCodes_.put("CKM_CDMF_ECB", new Long(0x00000141)); mechansimCodes_.put("CKM_CDMF_CBC", new Long(0x00000142)); mechansimCodes_.put("CKM_CDMF_MAC", new Long(0x00000143)); mechansimCodes_.put("CKM_CDMF_MAC_GENERAL", new Long(0x00000144)); mechansimCodes_.put("CKM_CDMF_CBC_PAD", new Long(0x00000145)); mechansimCodes_.put("CKM_MD2", new Long(0x00000200)); mechansimCodes_.put("CKM_MD2_HMAC", new Long(0x00000201)); mechansimCodes_.put("CKM_MD2_HMAC_GENERAL", new Long(0x00000202)); mechansimCodes_.put("CKM_MD5", new Long(0x00000210)); mechansimCodes_.put("CKM_MD5_HMAC", new Long(0x00000211)); mechansimCodes_.put("CKM_MD5_HMAC_GENERAL", new Long(0x00000212)); mechansimCodes_.put("CKM_SHA_1", new Long(0x00000220)); mechansimCodes_.put("CKM_SHA_1_HMAC", new Long(0x00000221)); mechansimCodes_.put("CKM_SHA_1_HMAC_GENERAL", new Long(0x00000222)); mechansimCodes_.put("CKM_RIPEMD128", new Long(0x00000230)); mechansimCodes_.put("CKM_RIPEMD128_HMAC", new Long(0x00000231)); mechansimCodes_.put("CKM_RIPEMD128_HMAC_GENERAL", new Long(0x00000232)); mechansimCodes_.put("CKM_RIPEMD160", new Long(0x00000240)); mechansimCodes_.put("CKM_RIPEMD160_HMAC", new Long(0x00000241)); mechansimCodes_.put("CKM_RIPEMD160_HMAC_GENERAL", new Long(0x00000242)); mechansimCodes_.put("CKM_CAST_KEY_GEN", new Long(0x00000300)); mechansimCodes_.put("CKM_CAST_ECB", new Long(0x00000301)); mechansimCodes_.put("CKM_CAST_CBC", new Long(0x00000302)); mechansimCodes_.put("CKM_CAST_MAC", new Long(0x00000303)); mechansimCodes_.put("CKM_CAST_MAC_GENERAL", new Long(0x00000304)); mechansimCodes_.put("CKM_CAST_CBC_PAD", new Long(0x00000305)); mechansimCodes_.put("CKM_CAST3_KEY_GEN", new Long(0x00000310)); mechansimCodes_.put("CKM_CAST3_ECB", new Long(0x00000311)); mechansimCodes_.put("CKM_CAST3_CBC", new Long(0x00000312)); mechansimCodes_.put("CKM_CAST3_MAC", new Long(0x00000313)); mechansimCodes_.put("CKM_CAST3_MAC_GENERAL", new Long(0x00000314)); mechansimCodes_.put("CKM_CAST3_CBC_PAD", new Long(0x00000315)); mechansimCodes_.put("CKM_CAST5_KEY_GEN", new Long(0x00000320)); mechansimCodes_.put("CKM_CAST128_KEY_GEN", new Long(0x00000320)); mechansimCodes_.put("CKM_CAST5_ECB", new Long(0x00000321)); mechansimCodes_.put("CKM_CAST128_ECB", new Long(0x00000321)); mechansimCodes_.put("CKM_CAST5_CBC", new Long(0x00000322)); mechansimCodes_.put("CKM_CAST128_CBC", new Long(0x00000322)); mechansimCodes_.put("CKM_CAST5_MAC", new Long(0x00000323)); mechansimCodes_.put("CKM_CAST128_MAC", new Long(0x00000323)); mechansimCodes_.put("CKM_CAST5_MAC_GENERAL", new Long(0x00000324)); mechansimCodes_.put("CKM_CAST128_MAC_GENERAL", new Long(0x00000324)); mechansimCodes_.put("CKM_CAST5_CBC_PAD", new Long(0x00000325)); mechansimCodes_.put("CKM_CAST128_CBC_PAD", new Long(0x00000325)); mechansimCodes_.put("CKM_RC5_KEY_GEN", new Long(0x00000330)); mechansimCodes_.put("CKM_RC5_ECB", new Long(0x00000331)); mechansimCodes_.put("CKM_RC5_CBC", new Long(0x00000332)); mechansimCodes_.put("CKM_RC5_MAC", new Long(0x00000333)); mechansimCodes_.put("CKM_RC5_MAC_GENERAL", new Long(0x00000334)); mechansimCodes_.put("CKM_RC5_CBC_PAD", new Long(0x00000335)); mechansimCodes_.put("CKM_IDEA_KEY_GEN", new Long(0x00000340)); mechansimCodes_.put("CKM_IDEA_ECB", new Long(0x00000341)); mechansimCodes_.put("CKM_IDEA_CBC", new Long(0x00000342)); mechansimCodes_.put("CKM_IDEA_MAC", new Long(0x00000343)); mechansimCodes_.put("CKM_IDEA_MAC_GENERAL", new Long(0x00000344)); mechansimCodes_.put("CKM_IDEA_CBC_PAD", new Long(0x00000345)); mechansimCodes_.put("CKM_GENERIC_SECRET_KEY_GEN", new Long(0x00000350)); mechansimCodes_.put("CKM_CONCATENATE_BASE_AND_KEY", new Long(0x00000360)); mechansimCodes_.put("CKM_CONCATENATE_BASE_AND_DATA", new Long(0x00000362)); mechansimCodes_.put("CKM_CONCATENATE_DATA_AND_BASE", new Long(0x00000363)); mechansimCodes_.put("CKM_XOR_BASE_AND_DATA", new Long(0x00000364)); mechansimCodes_.put("CKM_EXTRACT_KEY_FROM_KEY", new Long(0x00000365)); mechansimCodes_.put("CKM_SSL3_PRE_MASTER_KEY_GEN", new Long(0x00000370)); mechansimCodes_.put("CKM_SSL3_MASTER_KEY_DERIVE", new Long(0x00000371)); mechansimCodes_.put("CKM_SSL3_KEY_AND_MAC_DERIVE", new Long(0x00000372)); mechansimCodes_.put("CKM_SSL3_MD5_MAC", new Long(0x00000380)); mechansimCodes_.put("CKM_SSL3_SHA1_MAC", new Long(0x00000381)); mechansimCodes_.put("CKM_MD5_KEY_DERIVATION", new Long(0x00000390)); mechansimCodes_.put("CKM_MD2_KEY_DERIVATION", new Long(0x00000391)); mechansimCodes_.put("CKM_SHA1_KEY_DERIVATION", new Long(0x00000392)); mechansimCodes_.put("CKM_PBE_MD2_DES_CBC", new Long(0x000003A0)); mechansimCodes_.put("CKM_PBE_MD5_DES_CBC", new Long(0x000003A1)); mechansimCodes_.put("CKM_PBE_MD5_CAST_CBC", new Long(0x000003A2)); mechansimCodes_.put("CKM_PBE_MD5_CAST3_CBC", new Long(0x000003A3)); mechansimCodes_.put("CKM_PBE_MD5_CAST5_CBC", new Long(0x000003A4)); mechansimCodes_.put("CKM_PBE_MD5_CAST128_CBC", new Long(0x000003A4)); mechansimCodes_.put("CKM_PBE_SHA1_CAST5_CBC", new Long(0x000003A5)); mechansimCodes_.put("CKM_PBE_SHA1_CAST128_CBC", new Long(0x000003A5)); mechansimCodes_.put("CKM_PBE_SHA1_RC4_128", new Long(0x000003A6)); mechansimCodes_.put("CKM_PBE_SHA1_RC4_40", new Long(0x000003A7)); mechansimCodes_.put("CKM_PBE_SHA1_DES3_EDE_CBC", new Long(0x000003A8)); mechansimCodes_.put("CKM_PBE_SHA1_DES2_EDE_CBC", new Long(0x000003A9)); mechansimCodes_.put("CKM_PBE_SHA1_RC2_128_CBC", new Long(0x000003AA)); mechansimCodes_.put("CKM_PBE_SHA1_RC2_40_CBC", new Long(0x000003AB)); mechansimCodes_.put("CKM_PKCS5_PBKD2", new Long(0x000003B0)); mechansimCodes_.put("CKM_PBA_SHA1_WITH_SHA1_HMAC", new Long(0x000003C0)); mechansimCodes_.put("CKM_KEY_WRAP_LYNKS", new Long(0x00000400)); mechansimCodes_.put("CKM_KEY_WRAP_SET_OAEP", new Long(0x00000401)); mechansimCodes_.put("CKM_SKIPJACK_KEY_GEN", new Long(0x00001000)); mechansimCodes_.put("CKM_SKIPJACK_ECB64", new Long(0x00001001)); mechansimCodes_.put("CKM_SKIPJACK_CBC64", new Long(0x00001002)); mechansimCodes_.put("CKM_SKIPJACK_OFB64", new Long(0x00001003)); mechansimCodes_.put("CKM_SKIPJACK_CFB64", new Long(0x00001004)); mechansimCodes_.put("CKM_SKIPJACK_CFB32", new Long(0x00001005)); mechansimCodes_.put("CKM_SKIPJACK_CFB16", new Long(0x00001006)); mechansimCodes_.put("CKM_SKIPJACK_CFB8", new Long(0x00001007)); mechansimCodes_.put("CKM_SKIPJACK_WRAP", new Long(0x00001008)); mechansimCodes_.put("CKM_SKIPJACK_PRIVATE_WRAP", new Long(0x00001009)); mechansimCodes_.put("CKM_SKIPJACK_RELAYX", new Long(0x0000100a)); mechansimCodes_.put("CKM_KEA_KEY_PAIR_GEN", new Long(0x00001010)); mechansimCodes_.put("CKM_KEA_KEY_DERIVE", new Long(0x00001011)); mechansimCodes_.put("CKM_FORTEZZA_TIMESTAMP", new Long(0x00001020)); mechansimCodes_.put("CKM_BATON_KEY_GEN", new Long(0x00001030)); mechansimCodes_.put("CKM_BATON_ECB128", new Long(0x00001031)); mechansimCodes_.put("CKM_BATON_ECB96", new Long(0x00001032)); mechansimCodes_.put("CKM_BATON_CBC128", new Long(0x00001033)); mechansimCodes_.put("CKM_BATON_COUNTER", new Long(0x00001034)); mechansimCodes_.put("CKM_BATON_SHUFFLE", new Long(0x00001035)); mechansimCodes_.put("CKM_BATON_WRAP", new Long(0x00001036)); mechansimCodes_.put("CKM_ECDSA_KEY_PAIR_GEN", new Long(0x00001040)); mechansimCodes_.put("CKM_ECDSA", new Long(0x00001041)); mechansimCodes_.put("CKM_ECDSA_SHA1", new Long(0x00001042)); mechansimCodes_.put("CKM_JUNIPER_KEY_GEN", new Long(0x00001060)); mechansimCodes_.put("CKM_JUNIPER_ECB128", new Long(0x00001061)); mechansimCodes_.put("CKM_JUNIPER_CBC128", new Long(0x00001062)); mechansimCodes_.put("CKM_JUNIPER_COUNTER", new Long(0x00001063)); mechansimCodes_.put("CKM_JUNIPER_SHUFFLE", new Long(0x00001064)); mechansimCodes_.put("CKM_JUNIPER_WRAP", new Long(0x00001065)); mechansimCodes_.put("CKM_FASTHASH", new Long(0x00001070)); mechansimCodes_.put("CKM_VENDOR_DEFINED", new Long(0x80000000)); } mechanismCode = (Long) mechansimCodes_.get(mechansimName); } return mechanismCode; }
From source file:de.java2html.util.HtmlUtilities.java
protected static void buildEntityTables() { entityTableEncode = new Hashtable(ENTITIES.length); for (int i = 0; i < ENTITIES.length; i += 2) { if (!entityTableEncode.containsKey(ENTITIES[i + 1])) entityTableEncode.put(ENTITIES[i + 1], ENTITIES[i]); }/*from w w w .jav a 2 s . c o m*/ }
From source file:LRUCache.java
public LRUCache(int i) { currentSize = 0; cacheSize = i; nodes = new Hashtable(i); }
From source file:Main.java
/** * Method getDropDownOptions./* w ww . j av a 2 s . c o m*/ * * @param vector Vector * @param valueGetter String * @param textGetter String * @param selectedValues Vector * @return String * @throws NoSuchMethodException * @throws IllegalAccessException * @throws InvocationTargetException */ public static String getDropDownOptions(Vector vector, String valueGetter, String textGetter, Vector selectedValues) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Hashtable selectedValuesHashtable = new Hashtable(selectedValues.size()); for (int i = 0; i < selectedValues.size(); i++) { selectedValuesHashtable.put(selectedValues.elementAt(i).toString(), ""); } StringBuffer dropDownOptions = new StringBuffer(""); String optionValue = null; String optionText = null; Class[] clsParms = new Class[0]; Object[] objParms = new Object[0]; Method getterMethod = null; Object vectorElement = null; for (int i = 0; i < vector.size(); i++) { vectorElement = vector.elementAt(i); getterMethod = vectorElement.getClass().getMethod(valueGetter, clsParms); optionValue = getterMethod.invoke(vectorElement, objParms).toString(); getterMethod = vectorElement.getClass().getMethod(textGetter, clsParms); optionText = getterMethod.invoke(vectorElement, objParms).toString(); dropDownOptions.append("<option value=\"" + optionValue + "\""); if (selectedValuesHashtable.containsKey(optionValue)) { dropDownOptions.append(" selected"); } dropDownOptions.append(">" + optionText); } return dropDownOptions.toString(); }
From source file:de.kaiserpfalzEdv.commons.jee.jndi.SimpleContextFactory.java
@Override public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { Hashtable<Object, Object> env = new Hashtable<>(environment.size()); for (Object key : environment.keySet()) { env.put(key, environment.get(key)); }// w ww . j a v a2 s . co m String configPath = System.getProperty(CONFIG_FILE_NAME_PROPERTY); if (isNotBlank(configPath)) { env.remove(org.osjava.sj.SimpleContext.SIMPLE_ROOT); env.put(org.osjava.sj.SimpleContext.SIMPLE_ROOT, configPath); } else { configPath = (String) env.get(org.osjava.sj.SimpleContext.SIMPLE_ROOT); } LOG.trace("***** Loading configuration from: {}", configPath); return new SimpleContext(env); }
From source file:edu.harvard.mcz.imagecapture.BarcodeReadTest.java
public static String checkForBarcode(BufferedImage image) { // Check the entire image for a barcode and return. String returnValue = ""; LuminanceSource source = new BufferedImageLuminanceSource(image); Result result;//from w w w . ja v a 2 s. co m BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); try { QRCodeReader reader = new QRCodeReader(); Hashtable<DecodeHintType, Object> hints = null; hints = new Hashtable<DecodeHintType, Object>(3); hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); result = reader.decode(bitmap, hints); returnValue = result.getText(); } catch (ReaderException e) { e.printStackTrace(); returnValue = ""; } return returnValue; }
From source file:com.jaspersoft.jasperserver.api.security.externalAuth.ldap.JSLdapContextSource.java
public DirContext getReadWriteContext(String userDn, Object credentials) { Hashtable env = new Hashtable(getAnonymousEnv()); env.put(Context.SECURITY_PRINCIPAL, userDn); env.put(Context.SECURITY_CREDENTIALS, credentials); env.remove(SUN_LDAP_POOLING_FLAG);//from ww w . j ava 2 s . c om if (logger.isDebugEnabled()) { logger.debug("Creating context with principal: '" + userDn + "'"); } return createContext(env); }
From source file:CustomFileFilter.java
public void addExtension(String extension) { if (filters == null) { filters = new Hashtable(5); }/* w w w . j a v a2 s . c o m*/ filters.put(extension.toLowerCase(), this); fullDescription = null; }
From source file:com.rapidsist.portal.cliente.editor.SimpleUploaderServlet.java
/** * Initialize the servlet.<br>/* www. ja v a 2s.c o m*/ * Retrieve from the servlet configuration the "baseDir" which is the root of the file repository:<br> * If not specified the value of "/UserFiles/" will be used.<br> * Also it retrieve all allowed and denied extensions to be handled. * */ public void init() throws ServletException { System.out.println("PASO POR EL METODO init DEL SERVLET SimpleUploaderServlet"); baseDir = getInitParameter("baseDir"); enabled = (new Boolean(getInitParameter("enabled"))).booleanValue(); if (baseDir == null) baseDir = "/UserFiles/"; String realBaseDir = getServletContext().getRealPath(baseDir); File baseFile = new File(realBaseDir); if (!baseFile.exists()) { baseFile.mkdir(); } allowedExtensions = new Hashtable(3); deniedExtensions = new Hashtable(3); allowedExtensions.put("File", stringToArrayList(getInitParameter("AllowedExtensionsFile"))); deniedExtensions.put("File", stringToArrayList(getInitParameter("DeniedExtensionsFile"))); allowedExtensions.put("Image", stringToArrayList(getInitParameter("AllowedExtensionsImage"))); deniedExtensions.put("Image", stringToArrayList(getInitParameter("DeniedExtensionsImage"))); allowedExtensions.put("Flash", stringToArrayList(getInitParameter("AllowedExtensionsFlash"))); deniedExtensions.put("Flash", stringToArrayList(getInitParameter("DeniedExtensionsFlash"))); }
From source file:cn.itcast.fredck.FCKeditor.uploader.SimpleUploaderServlet.java
/** * Initialize the servlet.<br>/* w ww . ja va 2 s . co m*/ * Retrieve from the servlet configuration the "baseDir" which is the root of the file repository:<br> * If not specified the value of "/UserFiles/" will be used.<br> * Also it retrieve all allowed and denied extensions to be handled. * */ @Override public void init() throws ServletException { debug = (new Boolean(getInitParameter("debug"))).booleanValue(); if (debug) System.out.println("\r\n---- SimpleUploaderServlet initialization started ----"); baseDir = getInitParameter("baseDir"); enabled = (new Boolean(getInitParameter("enabled"))).booleanValue(); if (baseDir == null) baseDir = "/UserFiles/"; String realBaseDir = getServletContext().getRealPath(baseDir); File baseFile = new File(realBaseDir); if (!baseFile.exists()) { baseFile.mkdir(); } allowedExtensions = new Hashtable(3); deniedExtensions = new Hashtable(3); allowedExtensions.put("File", stringToArrayList(getInitParameter("AllowedExtensionsFile"))); deniedExtensions.put("File", stringToArrayList(getInitParameter("DeniedExtensionsFile"))); allowedExtensions.put("Image", stringToArrayList(getInitParameter("AllowedExtensionsImage"))); deniedExtensions.put("Image", stringToArrayList(getInitParameter("DeniedExtensionsImage"))); allowedExtensions.put("Flash", stringToArrayList(getInitParameter("AllowedExtensionsFlash"))); deniedExtensions.put("Flash", stringToArrayList(getInitParameter("DeniedExtensionsFlash"))); if (debug) System.out.println("---- SimpleUploaderServlet initialization completed ----\r\n"); }