org.springframework.util.PatternMatchUtils Java Examples

The following examples show how to use org.springframework.util.PatternMatchUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImagesForUpdate.java    From haven-platform with Apache License 2.0 6 votes vote down vote up
/**
 * Find image by its name, or id
 * @param name
 * @param imageId
 * @return
 */
public Image findImage(String name, String imageId) {
    Image res = null;
    if(imageId != null) {
        res = imagesByName.get(imageId);
    }
    String withoutTag = ImageName.withoutTagOrNull(name);
    if(res == null && withoutTag != null) {
        res = imagesByName.get(withoutTag);
    }
    if(res == null && (imageId != null || withoutTag != null)) {
        for(Image img: imagesWithPattern) {
            String pattern = img.getName();
            if(withoutTag != null && PatternMatchUtils.simpleMatch(pattern, withoutTag) ||
               imageId != null && PatternMatchUtils.simpleMatch(pattern, imageId)) {
                res = img;
                break;
            }
        }
    }
    return res;
}
 
Example #2
Source File: RequestLoggingFilter.java    From spring-boot-start-current with Apache License 2.0 6 votes vote down vote up
@Override
public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain )
        throws IOException, ServletException {

    if ( PatternMatchUtils.simpleMatch( excludeUrlPatterns , ( ( HttpServletRequest ) request ).getRequestURI() ) ) {
        chain.doFilter( request , response );
        return;
    }


    final BodyReaderWrapper wrapper        = new BodyReaderWrapper( ( HttpServletRequest ) request );
    String                  requestMessage = RequestUtils.getRequestMessage( wrapper );
    if ( ! LogUtils.getLogger().isDebugEnabled() ) {
        requestMessage = StringUtils.replaceAll( requestMessage , PASSWORD_FILTER_REGEX ,
                                                 "enable password protection, if not debug so do not see"
        );
    }
    LogUtils.getLogger().info( requestMessage );
    chain.doFilter( wrapper , response );
}
 
Example #3
Source File: ProxyWebSocketHandler.java    From spring-cloud-netflix-zuul-websocket with Apache License 2.0 6 votes vote down vote up
private ZuulWebSocketProperties.WsBrokerage getWebSocketBrokarage(URI uri) {
    String path = uri.toString();
    if (path.contains(":")) {
        path = UriComponentsBuilder.fromUriString(path).build().getPath();
    }

    for (Map.Entry<String, ZuulWebSocketProperties.WsBrokerage> entry : zuulWebSocketProperties
            .getBrokerages().entrySet()) {
        ZuulWebSocketProperties.WsBrokerage wsBrokerage = entry.getValue();
        if (wsBrokerage.isEnabled()) {
            for (String endPoint : wsBrokerage.getEndPoints()) {
                if (PatternMatchUtils.simpleMatch(toPattern(endPoint), path + "/")) {
                    return wsBrokerage;
                }
            }
        }
    }

    return null;
}
 
Example #4
Source File: PermissionService.java    From mall4j with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 判断接口是否有xxx:xxx权限
 *
 * @param permission 权限
 * @return {boolean}
 */
public boolean hasPermission(String permission) {
    if (StrUtil.isBlank(permission)) {
        return false;
    }
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication == null) {
        return false;
    }
    return authentication
            .getAuthorities()
            .stream()
            .map(GrantedAuthority::getAuthority)
            .filter(StringUtils::hasText)
            .anyMatch(x -> PatternMatchUtils.simpleMatch(permission, x));
}
 
Example #5
Source File: SQLErrorCodesFactory.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the {@link SQLErrorCodes} instance for the given database.
 * <p>No need for a database metadata lookup.
 * @param databaseName the database name (must not be {@code null})
 * @return the {@code SQLErrorCodes} instance for the given database
 * @throws IllegalArgumentException if the supplied database name is {@code null}
 */
public SQLErrorCodes getErrorCodes(String databaseName) {
	Assert.notNull(databaseName, "Database product name must not be null");

	SQLErrorCodes sec = this.errorCodesMap.get(databaseName);
	if (sec == null) {
		for (SQLErrorCodes candidate : this.errorCodesMap.values()) {
			if (PatternMatchUtils.simpleMatch(candidate.getDatabaseProductNames(), databaseName)) {
				sec = candidate;
				break;
			}
		}
	}
	if (sec != null) {
		checkCustomTranslatorRegistry(databaseName, sec);
		if (logger.isDebugEnabled()) {
			logger.debug("SQL error codes for '" + databaseName + "' found");
		}
		return sec;
	}

	// Could not find the database among the defined ones.
	if (logger.isDebugEnabled()) {
		logger.debug("SQL error codes for '" + databaseName + "' not found");
	}
	return new SQLErrorCodes();
}
 
Example #6
Source File: SQLErrorCodesFactory.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Return the {@link SQLErrorCodes} instance for the given database.
 * <p>No need for a database metadata lookup.
 * @param dbName the database name (must not be {@code null})
 * @return the {@code SQLErrorCodes} instance for the given database
 * @throws IllegalArgumentException if the supplied database name is {@code null}
 */
public SQLErrorCodes getErrorCodes(String dbName) {
	Assert.notNull(dbName, "Database product name must not be null");

	SQLErrorCodes sec = this.errorCodesMap.get(dbName);
	if (sec == null) {
		for (SQLErrorCodes candidate : this.errorCodesMap.values()) {
			if (PatternMatchUtils.simpleMatch(candidate.getDatabaseProductNames(), dbName)) {
				sec = candidate;
				break;
			}
		}
	}
	if (sec != null) {
		checkCustomTranslatorRegistry(dbName, sec);
		if (logger.isDebugEnabled()) {
			logger.debug("SQL error codes for '" + dbName + "' found");
		}
		return sec;
	}

	// Could not find the database among the defined ones.
	if (logger.isDebugEnabled()) {
		logger.debug("SQL error codes for '" + dbName + "' not found");
	}
	return new SQLErrorCodes();
}
 
Example #7
Source File: FileUtil.java    From mica with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 扫描目录下的文件
 *
 * @param path            路径
 * @param fileNamePattern 文件名 * 号
 * @return 文件集合
 */
public static List<File> list(String path, final String fileNamePattern) {
	File file = new File(path);
	return list(file, pathname -> {
		String fileName = pathname.getName();
		return PatternMatchUtils.simpleMatch(fileNamePattern, fileName);
	});
}
 
Example #8
Source File: FileUtil.java    From mica with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 扫描目录下的文件
 *
 * @param file             文件
 * @param fileNamePatterns "xxx*", "*xxx", "*xxx*" and "xxx*yyy"
 * @return 文件集合
 */
public static List<File> list(File file, final String... fileNamePatterns) {
	List<File> fileList = new ArrayList<>();
	return list(file, fileList, pathname -> {
		String fileName = pathname.getName();
		return PatternMatchUtils.simpleMatch(fileNamePatterns, fileName);
	});
}
 
Example #9
Source File: PermissionService.java    From smaker with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 判断接口是否有xxx:xxx权限
 *
 * @param permission 权限
 * @return {boolean}
 */
public boolean hasPermission(String permission) {
	if (StrUtil.isBlank(permission)) {
		return false;
	}
	Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
	if (authentication == null) {
		return false;
	}
	Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
	return authorities.stream()
		.map(GrantedAuthority::getAuthority)
		.filter(StringUtils::hasText)
		.anyMatch(x -> PatternMatchUtils.simpleMatch(permission, x));
}
 
Example #10
Source File: ClassPathBeanDefinitionScanner.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Apply further settings to the given bean definition,
 * beyond the contents retrieved from scanning the component class.
 * @param beanDefinition the scanned bean definition
 * @param beanName the generated bean name for the given bean
 */
protected void postProcessBeanDefinition(AbstractBeanDefinition beanDefinition, String beanName) {
	beanDefinition.applyDefaults(this.beanDefinitionDefaults);
	if (this.autowireCandidatePatterns != null) {
		beanDefinition.setAutowireCandidate(PatternMatchUtils.simpleMatch(this.autowireCandidatePatterns, beanName));
	}
}
 
Example #11
Source File: ClassPathBeanDefinitionScanner.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Apply further settings to the given bean definition,
 * beyond the contents retrieved from scanning the component class.
 * @param beanDefinition the scanned bean definition
 * @param beanName the generated bean name for the given bean
 */
protected void postProcessBeanDefinition(AbstractBeanDefinition beanDefinition, String beanName) {
	beanDefinition.applyDefaults(this.beanDefinitionDefaults);
	if (this.autowireCandidatePatterns != null) {
		beanDefinition.setAutowireCandidate(PatternMatchUtils.simpleMatch(this.autowireCandidatePatterns, beanName));
	}
}
 
Example #12
Source File: MessageHeaderAccessor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private List<String> getMatchingHeaderNames(String pattern, @Nullable Map<String, Object> headers) {
	if (headers == null) {
		return Collections.emptyList();
	}
	List<String> matchingHeaderNames = new ArrayList<>();
	for (String key : headers.keySet()) {
		if (PatternMatchUtils.simpleMatch(pattern, key)) {
			matchingHeaderNames.add(key);
		}
	}
	return matchingHeaderNames;
}
 
Example #13
Source File: FileUtil.java    From mica with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 扫描目录下的文件
 *
 * @param file            文件
 * @param fileNamePattern "xxx*", "*xxx", "*xxx*" and "xxx*yyy"
 * @return 文件集合
 */
public static List<File> list(File file, final String fileNamePattern) {
	List<File> fileList = new ArrayList<>();
	return list(file, fileList, pathname -> {
		String fileName = pathname.getName();
		return PatternMatchUtils.simpleMatch(fileNamePattern, fileName);
	});
}
 
Example #14
Source File: SQLErrorCodesFactory.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Return the {@link SQLErrorCodes} instance for the given database.
 * <p>No need for a database meta-data lookup.
 * @param databaseName the database name (must not be {@code null})
 * @return the {@code SQLErrorCodes} instance for the given database
 * @throws IllegalArgumentException if the supplied database name is {@code null}
 */
public SQLErrorCodes getErrorCodes(String databaseName) {
	Assert.notNull(databaseName, "Database product name must not be null");

	SQLErrorCodes sec = this.errorCodesMap.get(databaseName);
	if (sec == null) {
		for (SQLErrorCodes candidate : this.errorCodesMap.values()) {
			if (PatternMatchUtils.simpleMatch(candidate.getDatabaseProductNames(), databaseName)) {
				sec = candidate;
				break;
			}
		}
	}
	if (sec != null) {
		checkCustomTranslatorRegistry(databaseName, sec);
		if (logger.isDebugEnabled()) {
			logger.debug("SQL error codes for '" + databaseName + "' found");
		}
		return sec;
	}

	// Could not find the database among the defined ones.
	if (logger.isDebugEnabled()) {
		logger.debug("SQL error codes for '" + databaseName + "' not found");
	}
	return new SQLErrorCodes();
}
 
Example #15
Source File: InternalURIAccessFilter.java    From cloud-service with MIT License 5 votes vote down vote up
@Override
public boolean shouldFilter() {
	RequestContext requestContext = RequestContext.getCurrentContext();
	HttpServletRequest request = requestContext.getRequest();

	return PatternMatchUtils.simpleMatch("*-anon/internal*", request.getRequestURI());
}
 
Example #16
Source File: DefaultSecureExpressionHandler.java    From magic-starter with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 拥有任意权限均可访问
 *
 * @param permissions 权限标识列表
 * @return 满足其中一个权限,返回 true,反之 false
 */
public boolean hasAnyPermission(String... permissions) {
	SecureUser currentUser = secureUtil.getCurrentUser();
	if (currentUser == null) {
		return false;
	}
	// 使用 PatternMatchUtils 支持 * 号
	return currentUser.getPermissions().stream().anyMatch(x -> PatternMatchUtils.simpleMatch(permissions, x));
}
 
Example #17
Source File: MessageHeaderAccessor.java    From java-technology-stack with MIT License 5 votes vote down vote up
private List<String> getMatchingHeaderNames(String pattern, @Nullable Map<String, Object> headers) {
	List<String> matchingHeaderNames = new ArrayList<>();
	if (headers != null) {
		for (String key : headers.keySet()) {
			if (PatternMatchUtils.simpleMatch(pattern, key)) {
				matchingHeaderNames.add(key);
			}
		}
	}
	return matchingHeaderNames;
}
 
Example #18
Source File: MessageHeaderAccessor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private List<String> getMatchingHeaderNames(String pattern, Map<String, Object> headers) {
	List<String> matchingHeaderNames = new ArrayList<String>();
	if (headers != null) {
		for (String key : headers.keySet()) {
			if (PatternMatchUtils.simpleMatch(pattern, key)) {
				matchingHeaderNames.add(key);
			}
		}
	}
	return matchingHeaderNames;
}
 
Example #19
Source File: ClassPathBeanDefinitionScanner.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Apply further settings to the given bean definition,
 * beyond the contents retrieved from scanning the component class.
 * @param beanDefinition the scanned bean definition
 * @param beanName the generated bean name for the given bean
 */
protected void postProcessBeanDefinition(AbstractBeanDefinition beanDefinition, String beanName) {
	beanDefinition.applyDefaults(this.beanDefinitionDefaults);
	if (this.autowireCandidatePatterns != null) {
		beanDefinition.setAutowireCandidate(PatternMatchUtils.simpleMatch(this.autowireCandidatePatterns, beanName));
	}
}
 
Example #20
Source File: ProxyWebSocketHandler.java    From spring-cloud-netflix-zuul-websocket with Apache License 2.0 5 votes vote down vote up
private String getWebSocketServerPath(ZuulWebSocketProperties.WsBrokerage wsBrokerage,
                                      URI uri) {
    String path = uri.toString();
    if (path.contains(":")) {
        path = UriComponentsBuilder.fromUriString(path).build().getPath();
    }

    for (String endPoint : wsBrokerage.getEndPoints()) {
        if (PatternMatchUtils.simpleMatch(toPattern(endPoint), path + "/")) {
            return endPoint;
        }
    }

    return null;
}
 
Example #21
Source File: SQLErrorCodesFactory.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Return the {@link SQLErrorCodes} instance for the given database.
 * <p>No need for a database meta-data lookup.
 * @param databaseName the database name (must not be {@code null})
 * @return the {@code SQLErrorCodes} instance for the given database
 * @throws IllegalArgumentException if the supplied database name is {@code null}
 */
public SQLErrorCodes getErrorCodes(String databaseName) {
	Assert.notNull(databaseName, "Database product name must not be null");

	SQLErrorCodes sec = this.errorCodesMap.get(databaseName);
	if (sec == null) {
		for (SQLErrorCodes candidate : this.errorCodesMap.values()) {
			if (PatternMatchUtils.simpleMatch(candidate.getDatabaseProductNames(), databaseName)) {
				sec = candidate;
				break;
			}
		}
	}
	if (sec != null) {
		checkCustomTranslatorRegistry(databaseName, sec);
		if (logger.isDebugEnabled()) {
			logger.debug("SQL error codes for '" + databaseName + "' found");
		}
		return sec;
	}

	// Could not find the database among the defined ones.
	if (logger.isDebugEnabled()) {
		logger.debug("SQL error codes for '" + databaseName + "' not found");
	}
	return new SQLErrorCodes();
}
 
Example #22
Source File: BladeHttpHeadersContextHolder.java    From blade-tool with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Nullable
public static HttpHeaders toHeaders(
	@Nullable BladeHystrixAccountGetter accountGetter,
	BladeHystrixHeadersProperties properties) {
	HttpServletRequest request = WebUtil.getRequest();
	if (request == null) {
		return null;
	}
	HttpHeaders headers = new HttpHeaders();
	String accountHeaderName = properties.getAccount();
	// 如果配置有 account 读取器
	if (accountGetter != null) {
		String xAccountHeader = accountGetter.get(request);
		if (StringUtil.isNotBlank(xAccountHeader)) {
			headers.add(accountHeaderName, xAccountHeader);
		}
	}
	List<String> allowHeadsList = new ArrayList<>(Arrays.asList(ALLOW_HEADS));
	// 如果有传递 account header 继续往下层传递
	allowHeadsList.add(accountHeaderName);
	// 传递请求头
	Enumeration<String> headerNames = request.getHeaderNames();
	if (headerNames != null) {
		List<String> allowed = properties.getAllowed();
		String pattern = properties.getPattern();
		while (headerNames.hasMoreElements()) {
			String key = headerNames.nextElement();
			// 只支持配置的 header
			if (allowHeadsList.contains(key) || allowed.contains(key) || PatternMatchUtils.simpleMatch(pattern, key)) {
				String values = request.getHeader(key);
				// header value 不为空的 传递
				if (StringUtil.isNotBlank(values)) {
					headers.add(key, values);
				}
			}

		}
	}
	return headers.isEmpty() ? null : headers;
}
 
Example #23
Source File: FileUtil.java    From blade-tool with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 扫描目录下的文件
 *
 * @param path   路径
 * @param fileNamePattern 文件名 * 号
 * @return 文件集合
 */
public static List<File> list(String path, final String fileNamePattern) {
	File file = new File(path);
	return list(file, pathname -> {
		String fileName = pathname.getName();
		return PatternMatchUtils.simpleMatch(fileNamePattern, fileName);
	});
}
 
Example #24
Source File: FileUtil.java    From blade-tool with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 扫描目录下的文件
 *
 * @param file   文件
 * @param fileNamePattern Spring AntPathMatcher 规则
 * @return 文件集合
 */
public static List<File> list(File file, final String fileNamePattern) {
	List<File> fileList = new ArrayList<>();
	return list(file, fileList, pathname -> {
		String fileName = pathname.getName();
		return PatternMatchUtils.simpleMatch(fileNamePattern, fileName);
	});
}
 
Example #25
Source File: PermissionService.java    From albedo with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 判断接口是否有xxx:xxx权限
 *
 * @param permission 权限
 * @return {boolean}
 */
public boolean hasPermission(String permission) {
	if (StrUtil.isBlank(permission)) {
		return false;
	}
	Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
	if (authentication == null) {
		return false;
	}
	Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
	return authorities.stream()
		.map(GrantedAuthority::getAuthority)
		.filter(StringUtils::hasText)
		.anyMatch(x -> PatternMatchUtils.simpleMatch(permission, x));
}
 
Example #26
Source File: PatternFilter.java    From haven-platform with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean innerTest(CharSequence text) {
    if(text == null) {
        //obviously that '*' math null strings too
        return "*".equals(pattern);
    }
    return PatternMatchUtils.simpleMatch(pattern, text.toString());
}
 
Example #27
Source File: ClassPathBeanDefinitionScanner.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Apply further settings to the given bean definition,
 * beyond the contents retrieved from scanning the component class.
 * @param beanDefinition the scanned bean definition
 * @param beanName the generated bean name for the given bean
 */
protected void postProcessBeanDefinition(AbstractBeanDefinition beanDefinition, String beanName) {
	beanDefinition.applyDefaults(this.beanDefinitionDefaults);
	if (this.autowireCandidatePatterns != null) {
		beanDefinition.setAutowireCandidate(PatternMatchUtils.simpleMatch(this.autowireCandidatePatterns, beanName));
	}
}
 
Example #28
Source File: ImagesForUpdate.java    From haven-platform with Apache License 2.0 5 votes vote down vote up
private static boolean match(String pattern, String image, String imageId) {
    if(isAll(pattern)) {
        return true;
    }
    boolean isPattern = isPattern(pattern);
    if(ImageName.isId(image) && !isPattern) {
        return pattern.equals(imageId == null? image : imageId);
    }
    String imageVersion = ContainerUtils.getImageVersion(image);
    if(isPattern) {
        return PatternMatchUtils.simpleMatch(pattern, imageVersion);
    } else {
        return pattern.equals(imageVersion);
    }
}
 
Example #29
Source File: BeanDefinitionParserDelegate.java    From blog_demos with Apache License 2.0 4 votes vote down vote up
/**
 * Apply the attributes of the given bean element to the given bean * definition.
 * @param ele bean declaration element
 * @param beanName bean name
 * @param containingBean containing bean definition
 * @return a bean definition initialized according to the bean element attributes
 */
public AbstractBeanDefinition parseBeanDefinitionAttributes(Element ele, String beanName,
		BeanDefinition containingBean, AbstractBeanDefinition bd) {

	if (ele.hasAttribute(SCOPE_ATTRIBUTE)) {
		bd.setScope(ele.getAttribute(SCOPE_ATTRIBUTE));
	}
	else if (containingBean != null) {
		// Take default from containing bean in case of an inner bean definition.
		bd.setScope(containingBean.getScope());
	}

	if (ele.hasAttribute(ABSTRACT_ATTRIBUTE)) {
		bd.setAbstract(TRUE_VALUE.equals(ele.getAttribute(ABSTRACT_ATTRIBUTE)));
	}

	String lazyInit = ele.getAttribute(LAZY_INIT_ATTRIBUTE);
	if (DEFAULT_VALUE.equals(lazyInit)) {
		lazyInit = this.defaults.getLazyInit();
	}
	bd.setLazyInit(TRUE_VALUE.equals(lazyInit));

	String autowire = ele.getAttribute(AUTOWIRE_ATTRIBUTE);
	bd.setAutowireMode(getAutowireMode(autowire));

	String dependencyCheck = ele.getAttribute(DEPENDENCY_CHECK_ATTRIBUTE);
	bd.setDependencyCheck(getDependencyCheck(dependencyCheck));

	if (ele.hasAttribute(DEPENDS_ON_ATTRIBUTE)) {
		String dependsOn = ele.getAttribute(DEPENDS_ON_ATTRIBUTE);
		bd.setDependsOn(StringUtils.tokenizeToStringArray(dependsOn, MULTI_VALUE_ATTRIBUTE_DELIMITERS));
	}

	String autowireCandidate = ele.getAttribute(AUTOWIRE_CANDIDATE_ATTRIBUTE);
	if ("".equals(autowireCandidate) || DEFAULT_VALUE.equals(autowireCandidate)) {
		String candidatePattern = this.defaults.getAutowireCandidates();
		if (candidatePattern != null) {
			String[] patterns = StringUtils.commaDelimitedListToStringArray(candidatePattern);
			bd.setAutowireCandidate(PatternMatchUtils.simpleMatch(patterns, beanName));
		}
	}
	else {
		bd.setAutowireCandidate(TRUE_VALUE.equals(autowireCandidate));
	}

	if (ele.hasAttribute(PRIMARY_ATTRIBUTE)) {
		bd.setPrimary(TRUE_VALUE.equals(ele.getAttribute(PRIMARY_ATTRIBUTE)));
	}

	if (ele.hasAttribute(INIT_METHOD_ATTRIBUTE)) {
		String initMethodName = ele.getAttribute(INIT_METHOD_ATTRIBUTE);
		if (!"".equals(initMethodName)) {
			bd.setInitMethodName(initMethodName);
		}
	}
	else {
		if (this.defaults.getInitMethod() != null) {
			bd.setInitMethodName(this.defaults.getInitMethod());
			bd.setEnforceInitMethod(false);
		}
	}

	if (ele.hasAttribute(DESTROY_METHOD_ATTRIBUTE)) {
		String destroyMethodName = ele.getAttribute(DESTROY_METHOD_ATTRIBUTE);
		if (!"".equals(destroyMethodName)) {
			bd.setDestroyMethodName(destroyMethodName);
		}
	}
	else {
		if (this.defaults.getDestroyMethod() != null) {
			bd.setDestroyMethodName(this.defaults.getDestroyMethod());
			bd.setEnforceDestroyMethod(false);
		}
	}

	if (ele.hasAttribute(FACTORY_METHOD_ATTRIBUTE)) {
		bd.setFactoryMethodName(ele.getAttribute(FACTORY_METHOD_ATTRIBUTE));
	}
	if (ele.hasAttribute(FACTORY_BEAN_ATTRIBUTE)) {
		bd.setFactoryBeanName(ele.getAttribute(FACTORY_BEAN_ATTRIBUTE));
	}

	return bd;
}
 
Example #30
Source File: ReadWriteDataSourceProcessor.java    From AsuraFramework with Apache License 2.0 4 votes vote down vote up
protected boolean isMatch(String methodName, String mappedName) {
    return PatternMatchUtils.simpleMatch(mappedName, methodName);
}