Пример #1
0
 private void setTool(Tool t, String name) {
   if (fTool != null) {
     fTool.deactivate();
   }
   fTool = t;
   if (fTool != null) {
     showStatus(name);
     fTool.activate();
   }
 }
Пример #2
0
  /**
   * A list of dependency generators that are accumulated aaaas (and if) the tool is required to
   * sort the provided grammars into build dependency order. protected Map<String,
   * BuildDependencyGenerator> buildDependencyGenerators;
   */
  public static void main(String[] args) {
    Tool antlr = new Tool(args);

    if (!exitNow) {
      antlr.process();
      if (ErrorManager.getNumErrors() > 0) {
        System.exit(1);
      }
      System.exit(0);
    }
  }
Пример #3
0
  /**
   * Searches for the tool with the given name.
   *
   * @param aToolName the name of the tool to search for, cannot be <code>null</code>.
   * @return the tool with the given name, can be <code>null</code> if no such tool can be found.
   */
  private Tool findToolByName(final String aToolName) {
    Tool tool = null;

    final Collection<Tool> tools = getTools();
    for (Tool _tool : tools) {
      if (aToolName.equals(_tool.getName())) {
        tool = _tool;
        break;
      }
    }
    return tool;
  }
Пример #4
0
  /**
   * Runs the tool denoted by the given name.
   *
   * @param aToolName the name of the tool to run, cannot be <code>null</code>;
   * @param aParent the parent window to use, can be <code>null</code>.
   */
  public void runTool(final String aToolName, final Window aParent) {
    if (LOG.isLoggable(Level.INFO)) {
      LOG.log(Level.INFO, "Running tool: \"{0}\" ...", aToolName);
    }

    final Tool tool = findToolByName(aToolName);
    if (tool == null) {
      JOptionPane.showMessageDialog(
          aParent, "No such tool found: " + aToolName, "Error ...", JOptionPane.ERROR_MESSAGE);
    } else {
      final ToolContext context = createToolContext();
      tool.process(aParent, this.dataContainer, context, this);
    }

    updateActions();
  }
Пример #5
0
  /**
   * Removes the given tool from the list of tools.
   *
   * @param aTool the tool to remove, cannot be <code>null</code>.
   */
  public void removeTool(final Tool aTool) {
    if (this.mainFrame != null) {
      this.mainFrame.removeToolMenuItem(aTool.getName());
    }

    updateActions();
  }
Пример #6
0
 public void run() {
   try {
     InputStreamReader isr = new InputStreamReader(is);
     BufferedReader br = new BufferedReader(isr);
     String line = null;
     while ((line = br.readLine()) != null) {
       if (type == null || type.equals("stdout")) {
         tool.stdout(line);
       } else {
         tool.stderr(line);
       }
     }
   } catch (IOException ioe) {
     ioe.printStackTrace();
   }
 }
Пример #7
0
 protected void printFlagsUsage() {
   System.out.println("    <no option>\tto print same info as Solaris pmap");
   System.out.println("    -heap\tto print java heap summary");
   System.out.println("    -heap:format=b\tto dump java heap in hprof binary format");
   System.out.println("    -histo\tto print histogram of java object heap");
   System.out.println("    -permstat\tto print permanent generation statistics");
   System.out.println("    -finalizerinfo\tto print information on objects awaiting finalization");
   super.printFlagsUsage();
 }
Пример #8
0
 public static InputStream download(int pid, String filename) {
   try {
     return new FileInputStream(rootPath + "data\\" + pid + "\\" + filename);
   } catch (FileNotFoundException e) {
     // e.printStackTrace();
     Tool.debug(rootPath + "data\\" + pid + "\\" + filename + "文件未找到");
   }
   return null;
 }
Пример #9
0
 /**
  * 删除题目测试数据目录下的文件
  *
  * @param pid 题目本地id
  * @param filename 文件名
  * @return true成功、false失败
  */
 public static boolean delFile(int pid, String filename) {
   File file = new File(rootPath + "data\\" + pid + "\\" + filename);
   if (file.isFile()) {
     if (!file.delete()) {
       Tool.log("Can not delete file:" + file.getAbsolutePath());
       return false;
     }
     return true;
   }
   return false;
 }
Пример #10
0
  public void run() {
    Tool tool = null;
    switch (mode) {
      case MODE_HEAP_SUMMARY:
        tool = new HeapSummary();
        break;

      case MODE_HISTOGRAM:
        tool = new ObjectHistogram();
        break;

      case MODE_PERMSTAT:
        tool = new PermStat();
        break;

      case MODE_PMAP:
        tool = new PMap();
        break;

      case MODE_HEAP_GRAPH_HPROF_BIN:
        writeHeapHprofBin();
        return;

      case MODE_HEAP_GRAPH_GXL:
        writeHeapGXL();
        return;

      case MODE_FINALIZERINFO:
        tool = new FinalizerInfo();
        break;

      default:
        usage();
        break;
    }

    tool.setAgent(getAgent());
    tool.setDebugeeType(getDebugeeType());
    tool.run();
  }
Пример #11
0
	/**
	 * 
	 * @创建人: yinxm
	 * @时间 : 2014-05-13 11:52:23 
	 * @功能 : TODO 2、支付完成,处理银行支付结果通知
	 * @param Map<String, String[]> parametersMap
	 * @return
	 */
	public String handPayResult(Map<String, String[]> parametersMap) {
		if (log.isDebugEnabled()) {	log.debug("【 handPayResult 光大银行支付结果处理 ");}
		String rtnMsg = "您的订单支付成功!";
		
		try {
/***********获取支付结果通知信息**********************/				


//	Plain	明文 
//	Signature	密文 

			String Plain = ((String[])parametersMap.get("Plain"))[0];		//明文 
			String Signature = ((String[])parametersMap.get("Signature"))[0];		//密文 


//	transId	交易代码Char4 
//	merchantId	商户ID Char12 
//	orderId	订单号Char30 
//	transAmt	交易金额Decimal13,2 
//	transDateTime	交易时间Char14 
//	currencyType	币种Char2 
//	customerName	订货人姓名Char25    预留字段,默认空值 
//	productInfo	商品信息Char100    预留字段,默认空值 
//	customerEMail	订货人EMAILChar60    预留字段,默认空值 
//	transSeqNo	支付系统交易流水号 Char12 
//	ppDateTime	支付系统交易时间 Char8 
//	clearingDate	清算日期Char8 
//	respCode	响应代码Char7    预留字段,默认空值 
//	msgExt	附加信息Char30    预留字段,默认空值 
//	payAcctType	客户账户类型 Char  1    D:  借记卡或活期一本通 C:  贷记卡 

			String transId = rtnMap.get("transId");
			String merchantId = rtnMap.get("merchantId");
			String orderId = rtnMap.get("orderId");
			String transAmt = rtnMap.get("transAmt");
			String transDateTime = rtnMap.get("transDateTime");
			String currencyType = rtnMap.get("currencyType");
			String customerName = rtnMap.get("customerName");
			String productInfo = rtnMap.get("productInfo");
			String customerEMail = rtnMap.get("customerEMail");
			String transSeqNo = rtnMap.get("transSeqNo");
			String ppDateTime = rtnMap.get("ppDateTime");
			String clearingDate = rtnMap.get("clearingDate");
			String respCode = rtnMap.get("respCode");
			String msgExt = rtnMap.get("msgExt");
			String payAcctType = rtnMap.get("payAcctType");

			
				
			String respBankplain = null;	//银行返回通知支付结果的明文
			String respBankSign = null;	//银行返回通知支付结果的签名
			String signXsm  = null; 	//xms本地签名结果
			
			//将订单号从交易编号总截取出来,支付时订单号为:订单编号+P+支付日志后三位,退款时订单编号为:订单编号+R+支付日志后三位
			String coNum = new String(rtnOrderCoNum);
			if ('P'==coNum.charAt(coNum.length()-4) || 'R'==coNum.charAt(coNum.length()-4)){
				coNum = coNum.substring(0,coNum.length()-4);
			}
/***********获取该订单的支付日志,银行表配置信息**********************/	
			//查询支付日志,取到的是日志号最大的那一条记录
			EcPayLogView payLogView = getPayLogService().getEcPayLogViewByOrder(coNum);
			if (payLogView == null || payLogView.equals("")) {
				rtnMsg="该交易未记录支付日志!银行返回订单号为:"+orderno;
				return rtnMsg;
			}
			//获取数据库配置信息
			EcOrgCeb orgceb = getEcOrgCebDomain().getEcOrgCeb(payLogView.getOrgCode(),PayUtil.CEB);
			
			
/***********本地 验证签名*********************/			
			StringBuffer sb = new StringBuffer();
			
			
			plainXsm = sb.toString();
if (log.isDebugEnabled()) {log.debug("明文plainXsm="+plainXsm);	}	//调试用,上线后注释掉
			signXsm = Tool.sign(plainXsm);
if (log.isDebugEnabled()) {log.debug("密文signXsm="+signXsm);}	//调试用,上线后注释掉
			
			//验证签名是否成功
			if (respBankSign == null || respBankSign.equals("") || !signXsm.equals(respBankSign)) {	//验证签名失败
				rtnMsg="该交易结果验证签名失败!银行返回订单号为:"+orderno;
				if (log.isDebugEnabled()) {log.debug(rtnMsg);}
				return rtnMsg;
			}
			if (log.isDebugEnabled()) {log.debug("验证签名成功!");}
			
			String payFlag = EcPayLogView.PAY_FLAG_REQUEST;	//支付状态
			String paySeq = "";	//支付流水
/*****************验证签名成功,解析支付状态码******************/
			if (respCode.equals("00")){	//支付成功
				payFlag = EcPayLogView.PAY_FLAG_SUCCESS;
				
				String paySeq = "";	//记录银行支付流水
				
				rtnMsg = "您的订单已支付成功,请等待发货!";
			} else if (respCode.equals("02")){	//本次交易失败
				payFlag = EcPayLogView.PAY_FLAG_FAULT;
				rtnMsg = "您的订单支付失败,请稍后重试或联系管理员!";
				
			} else {								//支付异常									
				
				payFlag = EcPayLogView.PAY_FLAG_REQUEST;
				rtnMsg = "您的订单查询异常,请稍后重试或联系管理员!";
			}
		
			String orgCode = payLogView.getOrgCode();
			BigDecimal amount = payLogView.getAmount();
			String custCode = payLogView.getCustCode();

/**************************记录 交互日志*********************/	
			//记录交互日志  
			EcPayExchangeLogView payExLogView = getPayExchangeLogViewForVerifyPayResult(amount, coNum, custCode, orgCode, "银行返回支付结果", PayUtil.CEB,"XSM","");
			try {
				insertPayExchangeLog(payExLogView);
			} catch (Exception e) {
				if(log.isErrorEnabled()) {log.error("记录银行返回支付结果交互日志出错");}
				logException(e);
			}
			
/***********************修改 支付日志****************************************/
			try {
				//光大银行返回的支付结果不为EcPayLogView.PAY_FLAG_REQUEST,并且跟支付日志不一样,则要修改支付结果.
				if ( ! (payFlag.equals(EcPayLogView.PAY_FLAG_REQUEST))) {//支付结果为成功、失败
					if ( ! (payFlag.equals(payLogView.getPayFlag())) ){//支付结果与支付日志不一样,更新为成功或失败
						EcPayLog paylog = EcPayLogViewUtils.getEcPayLog(payLogView);
						paylog.setPayFlag(payFlag);

						paylog.setPaySeq(paySeq);//光大银行支付交易流水号

						if (EcPayLogView.PAY_FLAG_SUCCESS.equals(payFlag)) {//支付成功
							rtnMsg = "订单支付成功!";
						} else {//支付失败
							rtnMsg = "订单支付失败!";
						}
						paylog.setNote(rtnMsg);
						
						//采用统一方法更新新商盟订单支付状态和通知业务系统
						//这部分程序在各个银行的支付程序中都差不多,于是提出作为公共程序
						recordAndNoticeBusi(paylog);
						
					} else {//支付结果与支付日志是一样的,说明  光大银行 已经通知过一次了
						rtnMsg = "您的订单状态已经同步过一次,请在当前订单查看支付结果";
					}
				} else {//支付结果不确定,EcPayLogView.PAY_FLAG_REQUEST
					rtnMsg = "订单支付结果不确定,请稍候在当前订单查看支付结果!!!";
				}
			} catch (Exception e) {				
				rtnMsg = "修改订单支付信息或记录支付日志时出错";
				logException(e);
			}
		} catch (Exception e) {
			rtnMsg = "您好!处理 光大银行 支付结果出错,请在【当前订单】再次支付已确认是否支付成功!"; 
			logException(e);
		}
		if (log.isDebugEnabled()) {log.debug("中信银行支付结果处理 】\n"+rtnMsg);}
		
		return rtnMsg;
	}
Пример #12
0
	/**
	 * 
	 * @创建人: yinxm
	 * @时间 : 2014-05-13 11:52:23 
	 * @功能 : TODO 1.2.2 对B2C请求支付参数 进行签名加密处理
	 * @param orgceb 银行Bean
	 * @param orderData		支付参数Bean
	 * @return Map "rtn" rtn[0]000:请求成功;rtn[1]支付地址	"parmsRequestMap" 支付请求参数	
	 */
	private Map<String, Object> paySignB2C(EcOrgCeb orgceb,CEBPayData orderData) {
		if(log.isDebugEnabled()) {log.debug("【paySignB2C");}
		String rtn[] = new String[]{"999",""};
		Map<String, Object>  rtnMap  = new HashMap<String, Object>();
		//组织plain
		StringBuffer sb = new StringBuffer();

		String plainXsm = null;	//明文
		String signXsm = null;		//密文
		String payUrl = null;	//支付请求地址
		//向银行请求的参数
		Map<String,String> parmsRequestMap = new HashMap<String,String>();
		
		try {
			
/*******组织签名数据*****************/						


//	transId	交易代码 Char4  IPER/EPER 
//	merchantId	商户代码  Char12 
//	orderId	订单号Char  30 
//	transAmt	交易金额Decimal 13,2 
//	transDateTime	交易时间Char14 
//	currencyType	币种Char2 
//	customerName	订货人姓名Char  25    (非必输) 
//	merSecName	二级商户Char30 二级商户名称(非必输) 
//	productInfo	商品信息Char30  商户信息描述(非必输) 
//	customerEMail	订货人EMAIL  Char  60    (非必输) 
//	merURL	商户URL Char  256    用于后台通知商户 
//	merURL1	商户URL1Char  256    用于后台通知商户失败或者默认情况下,引导客户回商户页面支付地址 
//	payIp	Char  64    客户在商户网站上生成订单时的客户IP(非必输) 
//	msgExt	附加信息Char  30(非必输) 

			sb.append("transId=").append(orderData.getTransid());
			sb.append("~|~").append("merchantId=").append(orderData.getMerchantid());
			sb.append("~|~").append("orderId=").append(orderData.getOrderid());
			sb.append("~|~").append("transAmt=").append(orderData.getTransamt());
			sb.append("~|~").append("transDateTime=").append(orderData.getTransdatetime());
			sb.append("~|~").append("currencyType=").append(orderData.getCurrencytype());
			sb.append("~|~").append("customerName=").append(orderData.getCustomername());
			sb.append("~|~").append("merSecName=").append(orderData.getMersecname());
			sb.append("~|~").append("productInfo=").append(orderData.getProductinfo());
			sb.append("~|~").append("customerEMail=").append(orderData.getCustomeremail());
			sb.append("~|~").append("merURL=").append(orderData.getMerurl());
			sb.append("~|~").append("merURL1=").append(orderData.getMerurl1());
			sb.append("~|~").append("payIp=").append(orderData.getPayip());
			sb.append("~|~").append("msgExt=").append(orderData.getMsgext());

	/*******组织请求支付传送参数*****************/
			String TransName = "";		//IPER 
			String Plain = "";		//明文 
			String Signature = "";		//密文 

			parmsRequestMap.put("TransName", TransName);
			parmsRequestMap.put("Plain", Plain);
			parmsRequestMap.put("Signature", Signature);

	

			plainXsm = sb.toString();
if (log.isDebugEnabled()) {log.debug("明文plainXsm="+plainXsm);	}	//调试用,上线后注释掉
			try {
					signXsm = Tool.sign(plainXsm);
				} catch (Exception e) {
					if (log.isDebugEnabled()) {	log.error("签名数据出错!");	}
					logException(e);
					throw new RuntimeException(e);
				}
			
if (log.isDebugEnabled()) {log.debug("密文signXsm="+signXsm);}	//调试用,上线后注释掉

			payUrl = orgceb.getPayUrl();	//从  光大银行 银行表中记录请求支付地址
			if (payUrl == null || payUrl.equals("")){
				rtn[0] = "999";
			} else {
				rtn[0] = "000";		//组织请求数据签名成功
				rtn[1] = payUrl;	//记录请求支付地址
			}
		} catch (Exception e) {
			rtn[0] = "999";
			rtn[1] = "";
			if (log.isDebugEnabled()) {	log.debug("获取支付地址或者签名数据出错");}
			logException(e);
		}
	
		rtnMap.put("rtn", rtn);
		rtnMap.put("parmsRequestMap", parmsRequestMap);
		
		if(log.isDebugEnabled()) {log.debug("paySignB2C】");}
		return rtnMap;
	}