Exemple #1
0
	/**
	 * 判断方法是否与当前方法匹配
	 * 注意:本方法已经不考虑老版系统管理中直接通过方法名称指定同步方法的使用模式,因此如果
	 * 老版迁移到新版时,需要明确地指定方法的名称和方法的参数才能正常运行
	 * @param method 方法对象,如果method为null,将报空指针异常
	 * @param methodUUID 方法惟一标识
	 * @return true-匹配上
	 *         false-没有匹配上
	 *         
	 */
	public boolean match(Method method,String methodUUID)
	{
		try
		{			
	    	boolean match = false;
			if(isPattern())
			{
				if(pattern.equals("*")) //如果模式为*,表示匹配所有的方法
					return true;
				String methodname = method.getName();
				match = RegexUtil.isMatch(methodname, this.getPattern());	
				return match;
			}
			if(methodUUID == null)
				methodUUID = SynchronizedMethod.buildMethodUUID(method);
			if(this.getUUID().equals(methodUUID))
			{
				match = true;
			}
			return match;
		}
		catch(Exception e)
		{
//			e.printStackTrace();
			log.error(e.getMessage(),e);
			return false;
		}
    	
	}
  private void initPermissionInfo(ServiceID id, String method, Class[] types) {
    // SecurityContext securityContext = method_call.getSecurityContext();

    // ServiceID id = (ServiceID)method_call.getArgs()[0];
    // if(securityContext == null)
    // return;
    setServiceid(id.getService());
    // String method = (String)method_call.getArgs()[1];
    // Class[] types = (Class[])method_call.getArgs()[3];
    setServiceid(id.getService());
    setMethodop(SynchronizedMethod.buildMethodUUID(method, types));
  }