List of usage examples for java.util Hashtable get
@SuppressWarnings("unchecked") public synchronized V get(Object key)
From source file:com.fiorano.openesb.application.aps.InPortInst.java
protected void populate(FioranoStaxParser parser) throws XMLStreamException, FioranoException { if (parser.markCursor(APSConstants.INPORT_INST)) { // Get Attributes if needs to accessed later. This MUST be done before accessing any data of element. Hashtable attributes = parser.getAttributes(); m_bIsSyncRequestType = XMLUtils//from w w w . ja va 2 s .c o m .getStringAsBoolean((String) attributes.get(APSConstants.IS_SYNC_REQUEST_TYPE));//XMLDmiUtil.getAttributeAsBoolean(port, "isSyncRequestType"); m_bisDisabled = XMLUtils.getStringAsBoolean((String) attributes.get(APSConstants.IS_DISABLED));//XMLDmiUtil.getAttributeAsBoolean(port, "isSyncRequestType"); while (parser.nextElement()) { String nodeName = parser.getLocalName(); if (nodeName.equalsIgnoreCase("Name")) { m_strPortName = parser.getText();//XMLUtils.getNodeValueAsString(child).toUpperCase(); } if (nodeName.equalsIgnoreCase("Description")) { m_strDscription = parser.getText();//XMLUtils.getNodeValueAsString(child); } if (nodeName.equalsIgnoreCase(PortInstConstants.PORT_XSD)) { m_strXSD = parser.getCData();//XMLUtils.getNodeValueAsString(child); } if (nodeName.equalsIgnoreCase(PortInstConstants.PORT_XSDREF)) { m_strXSDRef = parser.getText();//XMLUtils.getNodeValueAsString(child); } if (nodeName.equalsIgnoreCase("JavaClass")) { m_strJavaClass = parser.getText();//XMLUtils.getNodeValueAsString(child); } if (nodeName.equalsIgnoreCase("Param")) { Param paramDmi = new Param(); paramDmi.setFieldValues(parser); addParam(paramDmi); } } if (attributes != null) { attributes.clear(); attributes = null; } } validate(); }
From source file:com.alfaariss.oa.profile.aselect.logout.LogoutManager.java
private UserEvent sendSLogout(String logoutCall) { GetMethod method = null;/*from w w w . j a va 2 s. com*/ try { method = new GetMethod(logoutCall); _logger.debug("Sending message: " + logoutCall); int statusCode = _httpClient.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { StringBuffer sbWarn = new StringBuffer("Received invalid http status '"); sbWarn.append(method.getStatusLine()); sbWarn.append("' while sending: "); sbWarn.append(logoutCall); _logger.warn(sbWarn.toString()); throw new OAException(SystemErrors.ERROR_RESOURCE_CONNECT); } // Read the response body. byte[] responseBody = method.getResponseBody(); if (responseBody != null) { String sResponseMessage = new String(responseBody).trim(); _logger.debug("Received response: " + sResponseMessage); Hashtable<String, String> htResponse = convertCGI(sResponseMessage); String sResultCode = htResponse.get(ASelectProcessor.PARAM_RESULT_CODE); if (sResultCode == null) { _logger.debug("No result code in response, logout failed"); return UserEvent.USER_LOGOUT_FAILED; } else if (!sResultCode.equals(ASelectErrors.ERROR_ASELECT_SUCCESS)) { if (sResultCode.equals(ASelectErrors.ERROR_LOGOUT_PARTIALLY)) { _logger.debug("Logout parially in response from server"); return UserEvent.USER_LOGOUT_PARTIALLY; } _logger.debug("Logout failed, result code: " + sResultCode); return UserEvent.USER_LOGOUT_FAILED; } } } catch (OAException e) { return UserEvent.USER_LOGOUT_FAILED; } catch (Exception e) { _logger.warn("Could not send synchronous logout", e); return UserEvent.USER_LOGOUT_FAILED; } finally { try { // Release the connection. if (method != null) method.releaseConnection(); } catch (Exception e) { _logger.error("Could not close the connection reader", e); } } return UserEvent.USER_LOGGED_OUT; }
From source file:edu.ku.brc.specify.toycode.BugParse.java
public BugParse() { parse("20060901_.txt"); parse("20070901_.txt"); parse("20080301_.txt"); parse("20080701_.txt"); parse("Now_.txt"); String eng = "meg"; boolean doPriority = false; int cnt = 0;//from w w w . ja v a 2 s . c o m Vector<Integer> keys = new Vector<Integer>(bugHash.keySet()); Collections.sort(keys); for (Bug bug : bugHash.values()) { if ((eng == null || bug.getEngineer().startsWith(eng)) && (!doPriority || bug.getPriority().equals("P1") || bug.getPriority().equals("P1"))) { process(hashNew, bug.getOpenYear(), bug.getOpenMon()); if (bug.isClosed) { process(hashRes, bug.getModYear(), bug.getModMon()); } System.out.println(bug.getNumber() + " " + bug.getOpenDate() + " " + bug.getModDate() + " " + bug.isClosed()); cnt++; } } System.err.println(cnt); StringBuilder yearStr = new StringBuilder(); StringBuilder dataStr = new StringBuilder(); for (int year = 2005; year < 2009; year++) { int start = year == 2005 ? 7 : 1; int end = year == 2008 ? 11 : 13; Hashtable<Integer, Integer> yearHashNew = hashNew.get(year); for (int mon = start; mon < end; mon++) { Integer monNew = yearHashNew != null ? yearHashNew.get(mon) : null; if (monNew == null) { monNew = 0; } if (yearStr.length() > 0) yearStr.append(','); yearStr.append(mon + "/" + Integer.toString(year - 2000)); if (dataStr.length() > 0) dataStr.append(','); dataStr.append(monNew); } } List<String> dataLines = new Vector<String>(); dataLines.add(yearStr.toString()); dataLines.add(dataStr.toString()); System.out.println(yearStr.toString()); System.out.println(dataStr.toString()); yearStr = new StringBuilder(); dataStr = new StringBuilder(); StringBuilder dataStrDif = new StringBuilder(); int diffTotal = 0; for (int year = 2005; year < 2009; year++) { int start = year == 2005 ? 7 : 1; int end = year == 2008 ? 11 : 13; Hashtable<Integer, Integer> yearHashNew = hashNew.get(year); Hashtable<Integer, Integer> yearHashRes = hashRes.get(year); for (int mon = start; mon < end; mon++) { Integer monNew = yearHashNew != null ? yearHashNew.get(mon) : null; if (monNew == null) { monNew = 0; } Integer monRes = yearHashRes != null ? yearHashRes.get(mon) : null; if (monRes == null) { monRes = 0; } if (yearStr.length() > 0) yearStr.append(','); yearStr.append(mon + "/" + Integer.toString(year - 2000)); if (dataStr.length() > 0) dataStr.append(','); dataStr.append(monRes); diffTotal += monNew - monRes; System.out.println("> " + diffTotal + " " + year + " " + mon + " " + monNew + " " + monRes); if (dataStrDif.length() > 0) dataStrDif.append(','); dataStrDif.append(diffTotal); //System.out.println(year+" "+mon+" "+monNew); } } System.out.println(dataStr.toString()); System.out.println(dataStrDif.toString()); dataLines.add(dataStr.toString()); dataLines.add(dataStrDif.toString()); createChart(dataLines, eng == null ? "All" : eng); }
From source file:net.sourceforge.floggy.persistence.fr2422928.FR2422928MigrationTest.java
/** * DOCUMENT ME!//from www . j a v a 2 s .c o m * * @throws Exception DOCUMENT ME! */ public void testRemaingField() throws Exception { MigrationManager um = MigrationManager.getInstance(); Enumeration enumeration = um.start(FR2422928.class, null); try { while (enumeration.hasMoreElements()) { Hashtable data = (Hashtable) enumeration.nextElement(); assertFalse("Should not be empty!", data.isEmpty()); assertEquals(name, (String) data.get("name")); assertEquals(checkpoint, data.get("checkpoint")); } } finally { um.finish(FR2422928.class); } }
From source file:com.alfaariss.oa.authentication.remote.aselect.logout.LogoutManager.java
private UserEvent sendSLogout(String logoutCall) { GetMethod method = null;/*from w w w .j a v a2s. c o m*/ try { method = new GetMethod(logoutCall); _logger.debug("Sending message: " + logoutCall); int statusCode = _httpClient.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { StringBuffer sbWarn = new StringBuffer("Received invalid http status '"); sbWarn.append(method.getStatusLine()); sbWarn.append("' while sending: "); sbWarn.append(logoutCall); _logger.warn(sbWarn.toString()); throw new OAException(SystemErrors.ERROR_RESOURCE_CONNECT); } // Read the response body. byte[] responseBody = method.getResponseBody(); if (responseBody != null) { String sResponseMessage = new String(responseBody).trim(); _logger.debug("Received response: " + sResponseMessage); Hashtable<String, String> htResponse = convertCGI(sResponseMessage); String sResultCode = htResponse.get(PARAM_RESULTCODE); if (sResultCode == null) { _logger.debug("No result code in response, logout failed"); return UserEvent.USER_LOGOUT_FAILED; } else if (!sResultCode.equals(ERROR_ASELECT_LOGOUT_SUCCESS)) { if (sResultCode.equals(ERROR_ASELECT_LOGOUT_PARTIALLY)) { _logger.debug("Logout parially in response from server"); return UserEvent.USER_LOGOUT_PARTIALLY; } _logger.debug("Logout failed, result code: " + sResultCode); return UserEvent.USER_LOGOUT_FAILED; } } } catch (OAException e) { return UserEvent.USER_LOGOUT_FAILED; } catch (Exception e) { _logger.warn("Could not send synchronous logout", e); return UserEvent.INTERNAL_ERROR; } finally { try { // Release the connection. if (method != null) method.releaseConnection(); } catch (Exception e) { _logger.error("Could not close the connection reader", e); } } return UserEvent.USER_LOGGED_OUT; }
From source file:net.sourceforge.floggy.persistence.fr2422928.FR2422928MigrationTest.java
/** * DOCUMENT ME!/*from w ww . ja v a 2 s . c om*/ * * @throws Exception DOCUMENT ME! */ public void testMissingField() throws Exception { MigrationManager um = MigrationManager.getInstance(); Enumeration enumeration = um.start(FR2422928.class, null); try { while (enumeration.hasMoreElements()) { Hashtable data = (Hashtable) enumeration.nextElement(); assertFalse("Should not be empty!", data.isEmpty()); assertEquals(new Long(id), (Long) data.get("id")); } } finally { um.finish(FR2422928.class); } }
From source file:com.jaspersoft.jasperserver.export.RemoveDuplicatedDisplayName.java
private boolean hashNames(List objects) { Hashtable ht = new Hashtable(); for (int i = 0; i < objects.size(); i++) { String curDisplayName = ((Resource) objects.get(i)).getLabel(); if (!ht.containsKey(curDisplayName)) { ArrayList checkList = new ArrayList(); checkList.add(objects.get(i)); ht.put(curDisplayName, checkList); } else {/*from www . ja va 2 s.c om*/ ((List) (ht.get(curDisplayName))).add(objects.get(i)); } } updateDuplicateNames(ht); return true; }
From source file:eionet.gdem.conversion.odf.OdsReader.java
@Override public Map<String, String> getSheetSchemas() { Map<String, String> resultMap = new LinkedHashMap<String, String>(); Hashtable userMetadata = metadata.getUserDefined(); if (userMetadata.containsKey(TBL_SCHEMAS_ATTR_NAME)) { String ret = (String) userMetadata.get(TBL_SCHEMAS_ATTR_NAME); if (Utils.isNullStr(ret)) { return resultMap; }// w ww. j av a 2 s . c o m StringTokenizer stTbl = new StringTokenizer(ret, TBL_SEPARATOR); if (stTbl.countTokens() == 0) { return resultMap; } resultMap = new HashMap<String, String>(); while (stTbl.hasMoreTokens()) { String tbl = stTbl.nextToken(); StringTokenizer stTblProps = new StringTokenizer(tbl, TBL_PROPERTIES_SEPARATOR); if (stTblProps.countTokens() < 2) { continue; } String tblName = null; String tblSchema = null; while (stTblProps.hasMoreTokens()) { String token = stTblProps.nextToken(); if (token.startsWith(TABLE_NAME)) { tblName = token.substring(TABLE_NAME.length()); } if (token.startsWith(TABLE_SCHEMA_URL)) { tblSchema = token.substring(TABLE_SCHEMA_URL.length()); } } if (Utils.isNullStr(tblName) || Utils.isNullStr(tblSchema)) { continue; } // check if table exists if (spreadsheet != null && !spreadsheet.tableExists(tblName)) { continue; } if (!resultMap.containsKey(tblName)) { resultMap.put(tblName, tblSchema); } } } return resultMap; }
From source file:hu.sztaki.lpds.portal.util.stream.HttpClient.java
/** * File upload//from w ww .jav a2 s . co m * @param pFile file to be uploaded * @param uploadName upload naem * @param pValue parameters used during the connection * @return http answer code * @throws java.lang.Exception communication error */ public int fileUpload(File pFile, String uploadName, Hashtable pValue) throws Exception { int res = 0; MultipartEntity reqEntity = new MultipartEntity(); // file parameter if (uploadName != null) { FileBody bin = new FileBody(pFile); reqEntity.addPart(uploadName, bin); } //text parameters Enumeration<String> enm = pValue.keys(); String key; while (enm.hasMoreElements()) { key = enm.nextElement(); reqEntity.addPart(key, new StringBody("" + pValue.get(key))); } httpPost.setEntity(reqEntity); HttpResponse response = httpclient.execute(httpPost); HttpEntity resEntity = response.getEntity(); res = response.getStatusLine().getStatusCode(); close(); return res; }
From source file:a1deployer.Axis1Deployer.java
public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException { log.info("Deploying - " + deploymentFileData.getName()); ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader(); try {/*from w ww . j a va 2s. c om*/ File file = deploymentFileData.getFile(); File parentFile = file.getParentFile(); ClassLoader classLoader = Utils.getClassLoader(configCtx.getAxisConfiguration().getSystemClassLoader(), parentFile); Thread.currentThread().setContextClassLoader(classLoader); FileProvider config = new FileProvider(deploymentFileData.getAbsolutePath()); AxisServer server = new AxisServer(config); WSDLSupplier supplier = new A1WSDLSupplier(server); config.getDeployedServices(); // ensure everything's set up WSDDService[] services = config.getDeployment().getServices(); AxisServiceGroup serviceGroup = new AxisServiceGroup(); serviceGroup.addParameter("service.axis1.server", server); for (int i = 0; i < services.length; i++) { ServiceDesc service = services[i].getServiceDesc(); log.info("Deploying Axis1 service -- " + service.getName()); AxisService axisService; org.apache.axis.MessageContext mc = new MessageContext(server); String wsdlString; try { mc.setTargetService(service.getName()); mc.setProperty(MessageContext.TRANS_URL, REPLACEME); server.generateWSDL(mc); Document wsdlDoc = (Document) mc.getProperty("WSDL"); wsdlString = DOM2Writer.nodeToString(wsdlDoc, true); } catch (Exception e) { log.error(e); continue; } try { ByteArrayInputStream bis = new ByteArrayInputStream(wsdlString.getBytes()); WSDL11ToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(bis); axisService = builder.populateService(); axisService.getEndpoints().clear(); axisService.setBindingName(null); axisService.setEndpointName(null); } catch (Exception e) { String serviceName = service.getName(); if (REPLACEME.equals(service.getDefaultNamespace())) { service.setDefaultNamespace(null); } log.info("Couldn't process WSDL for Axis1 service '" + serviceName + "', defaulting to passthrough mode."); // Couldn't process WSDL (RPC/enc?), so set up passthrough axisService = new AxisService(serviceName); // Ensure dispatch works. axisService.addParameter("supportSingleOperation", Boolean.TRUE); // Add WSDL supplier axisService.addParameter("WSDLSupplier", supplier); AxisOperation op = new InOutAxisOperation(new QName("invokeAxis1Service")); op.setDocumentation("This operation is a 'passthrough' for all operations in " + "an RPC/encoded Axis1 service."); axisService.addOperation(op); } axisService.setName(service.getName()); axisService.setClassLoader(classLoader); // Put all the parameters from the A1 service into the A2 service Hashtable params = services[i].getParametersTable(); Enumeration paramKeys = params.keys(); while (paramKeys.hasMoreElements()) { String key = (String) paramKeys.nextElement(); axisService.addParameter(key, params.get(key)); } Axis1InOutMessageReceiver receiver = new Axis1InOutMessageReceiver(); AxisConfiguration axisConfig = configCtx.getAxisConfiguration(); PhasesInfo phaseInfo = axisConfig.getPhasesInfo(); for (Iterator ops = axisService.getOperations(); ops.hasNext();) { AxisOperation op = (AxisOperation) ops.next(); op.setMessageReceiver(receiver); phaseInfo.setOperationPhases(op); } // axisService.addMessageReceiver(WSDL2Constants.MEP_URI_IN_OUT, // new Axis1InOutMessageReceiver()); // Add service type axisService.addParameter("serviceType", "axis1_service"); axisService.setFileName(deploymentFileData.getFile().toURL()); axisService.addParameterObserver(new Axis1ParameterObserver(service)); serviceGroup.addService(axisService); } serviceGroup.setServiceGroupName(deploymentFileData.getName()); configCtx.getAxisConfiguration().addServiceGroup(serviceGroup); } catch (ConfigurationException e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); // If we get here, we couldn't start the AxisServer, so create a faulty service configCtx.getAxisConfiguration().getFaultyServices().put(deploymentFileData.getFile().getAbsolutePath(), sw.getBuffer().toString()); throw new DeploymentException(e); } catch (AxisFault e) { throw new DeploymentException(e); } catch (MalformedURLException e) { throw new DeploymentException(e); } finally { if (threadClassLoader != null) { Thread.currentThread().setContextClassLoader(threadClassLoader); } } }