本文整理汇总了Java中org.jboss.vfs.VirtualFileFilter类的典型用法代码示例。如果您正苦于以下问题:Java VirtualFileFilter类的具体用法?Java VirtualFileFilter怎么用?Java VirtualFileFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VirtualFileFilter类属于org.jboss.vfs包,在下文中一共展示了VirtualFileFilter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAssetPaths
import org.jboss.vfs.VirtualFileFilter; //导入依赖的package包/类
@Override
public Set<String> getAssetPaths(URL url, final Pattern filterExpr, ClassLoader... classLoaders) {
HashSet<String> assetPaths = new HashSet<String>();
try {
final VirtualFile virtualFile = VFS.getChild(url.toURI());
List<VirtualFile> children = virtualFile.getChildrenRecursively(new VirtualFileFilter() {
@Override
public boolean accepts(VirtualFile file) {
if (file.isDirectory()) {
return false;
}
int prefixIndex = file.getPathName().indexOf(WEBJARS_PATH_PREFIX);
if (prefixIndex == -1) {
return false;
}
final String relativePath = file.getPathName().substring(prefixIndex);
return file.isFile() && filterExpr.matcher(relativePath).matches();
}
});
for (VirtualFile child : children) {
assetPaths.add(child.getPathName().substring(child.getPathName().indexOf(WEBJARS_PATH_PREFIX)));
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return assetPaths;
}
开发者ID:mwanji,项目名称:webjars-locator-jboss-vfs,代码行数:31,代码来源:JbossUrlProtocolHandler.java
示例2: deploy
import org.jboss.vfs.VirtualFileFilter; //导入依赖的package包/类
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
final String runtimeName = depUnit.getName();
CamelDeploymentSettings depSettings = depUnit.getAttachment(CamelDeploymentSettings.ATTACHMENT_KEY);
if (depSettings.isDisabledByJbossAll() || !depSettings.isDeploymentValid() || runtimeName.endsWith(".ear")) {
return;
}
try {
if (runtimeName.endsWith(CamelConstants.CAMEL_CONTEXT_FILE_SUFFIX)) {
URL fileURL = depUnit.getAttachment(Attachments.DEPLOYMENT_CONTENTS).asFileURL();
addConditionally(depUnit, fileURL);
} else {
VirtualFileFilter filter = new VirtualFileFilter() {
public boolean accepts(VirtualFile child) {
return child.isFile() && child.getName().endsWith(CamelConstants.CAMEL_CONTEXT_FILE_SUFFIX);
}
};
VirtualFile rootFile = depUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
for (VirtualFile vfile : rootFile.getChildrenRecursively(filter)) {
addConditionally(depUnit, vfile.asFileURL());
}
}
if (!depSettings.getCamelContextUrls().isEmpty()) {
LOGGER.info("Camel context descriptors found");
}
} catch (IOException ex) {
throw new IllegalStateException("Cannot create camel context: " + runtimeName, ex);
}
}
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:35,代码来源:CamelContextDescriptorsProcessor.java
注:本文中的org.jboss.vfs.VirtualFileFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论