本文整理了Java中org.jboss.vfs.VFS
类的一些代码示例,展示了VFS
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VFS
类的具体详情如下:
包路径:org.jboss.vfs.VFS
类名称:VFS
[英]Virtual File System
[中]虚拟文件系统
代码示例来源:origin: wildfly/wildfly
throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.compressedRarNotSupportedInModuleRA(moduleName));
} else {
child = VFS.getChild(path.getPath().split("META-INF")[0]);
closable = VFS.mountReal(new File(path.getPath().split("META-INF")[0]), child);
final MountHandle mountHandle = new MountHandle(closable);
final ResourceRoot resourceRoot = new ResourceRoot(child, mountHandle);
final VirtualFile deploymentRoot = resourceRoot.getRoot();
if (deploymentRoot == null || !deploymentRoot.exists())
return;
ConnectorXmlDescriptor connectorXmlDescriptor = RaDeploymentParsingProcessor.process(resolveProperties, deploymentRoot, null, name);
Map<ResourceRoot, Index> annotationIndexes = new HashMap<ResourceRoot, Index>();
ResourceRootIndexer.indexResourceRoot(resourceRoot);
Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX);
if (index != null) {
annotationIndexes.put(resourceRoot, index);
代码示例来源:origin: wildfly/wildfly
final VirtualFile deploymentRoot = resourceRoot.getRoot();
if (deploymentRoot == null || !deploymentRoot.exists()) {
return;
final String deploymentRootName = deploymentRoot.getName().toLowerCase(Locale.ENGLISH);
if (!deploymentRootName.endsWith(SAR_EXTENSION)) {
return;
Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
try {
final List<VirtualFile> childArchives = deploymentRoot.getChildren(CHILD_ARCHIVE_FILTER);
Closeable closable = NO_OP_CLOSEABLE;
if(overlay != null) {
overlay.remountAsZip(false);
} else if(child.isFile()) {
closable = VFS.mountZip(child, child, TempFileProviderService.provider());
final MountHandle mountHandle = new MountHandle(closable);
final ResourceRoot childResource = new ResourceRoot(child, mountHandle);
ModuleRootMarker.mark(childResource);
deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, childResource);
resourceRoot.addToAttachmentList(Attachments.INDEX_IGNORE_PATHS, child.getPathNameRelativeTo(deploymentRoot));
代码示例来源:origin: wildfly/wildfly
private static Closeable mount(VirtualFile moduleFile, boolean explode) throws IOException {
return explode ? VFS.mountZipExpanded(moduleFile, moduleFile, TempFileProviderService.provider())
: VFS.mountZip(moduleFile, moduleFile, TempFileProviderService.provider());
}
代码示例来源:origin: org.wildfly/wildfly-server
case XMLStreamConstants.END_ELEMENT: {
try {
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final VirtualFile deploymentRootFile = deploymentRoot.getRoot();
final VirtualFile child = deploymentRootFile.getChild(path);
Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
MountedDeploymentOverlay overlay = overlays.get(path);
Closeable closable = null;
if(overlay != null) {
overlay.remountAsZip(false);
} else if(child.isFile()) {
closable = VFS.mountZip(child, child, TempFileProviderService.provider());
final MountHandle mountHandle = new MountHandle(closable);
final ResourceRoot resourceRoot = new ResourceRoot(name, child, mountHandle);
for (final FilterSpecification filter : resourceFilters) {
resourceRoot.getExportFilters().add(filter);
resourceRoot.setUsePhysicalCodeSource(usePhysicalCodeSource);
代码示例来源:origin: wildfly/wildfly
final List<ResourceRoot> entries = new ArrayList<ResourceRoot>();
final VirtualFile webinfClasses = deploymentRoot.getChild(WEB_INF_CLASSES);
if (webinfClasses.exists()) {
final ResourceRoot webInfClassesRoot = new ResourceRoot(webinfClasses.getName(), webinfClasses, null);
ModuleRootMarker.mark(webInfClassesRoot);
entries.add(webInfClassesRoot);
Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
final VirtualFile webinfLib = deploymentRoot.getChild(WEB_INF_LIB);
if (webinfLib.exists()) {
Closeable closable = null;
if(overlay != null) {
overlay.remountAsZip(false);
} else if (archive.isFile()) {
closable = VFS.mountZip(archive, archive, TempFileProviderService.provider());
} else {
closable = null;
final ResourceRoot webInfArchiveRoot = new ResourceRoot(archive.getName(), archive, new MountHandle(closable));
ModuleRootMarker.mark(webInfArchiveRoot);
entries.add(webInfArchiveRoot);
代码示例来源:origin: org.wildfly.core/wildfly-server
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
VirtualFile mountPoint = deploymentRoot.getRoot().getChild(path);
VirtualFile parent = mountPoint.getParent();
while (!parent.exists()) {
parent = parent.getParent();
Closeable closable = VFS.mountTemp(file, TempFileProviderService.provider());
deploymentUnit.addToAttachmentList(MOUNTED_FILES, closable);
Closeable handle = VFS.mountReal(content.getPhysicalFile(), mountPoint);
MountedDeploymentOverlay mounted = new MountedDeploymentOverlay(handle, content.getPhysicalFile(), mountPoint, TempFileProviderService.provider());
deploymentUnit.addToAttachmentList(MOUNTED_FILES, mounted);
mounts.put(path, mounted);
} else {
代码示例来源:origin: org.projectodd/polyglot-core
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (deploymentUnit.getAttachment( Attachments.DEPLOYMENT_ROOT ) != null ||
!deploymentUnit.getName().endsWith( this.fileSuffix )) {
return;
final DeploymentMountProvider deploymentMountProvider = deploymentUnit.getAttachment( Attachments.SERVER_DEPLOYMENT_REPOSITORY );
if(deploymentMountProvider == null) {
throw new DeploymentUnitProcessingException( "No deployment repository available." );
String deploymentName = deploymentUnit.getName();
final VirtualFile deploymentRoot = VFS.getChild( "content/" + deploymentName );
Closeable handle = null;
final MountHandle mountHandle;
try {
handle = deploymentMountProvider.mountDeploymentContent( deploymentContents, deploymentRoot, MountType.REAL );
mountHandle = new MountHandle( handle );
} catch (IOException e) {
failed = true;
final ResourceRoot resourceRoot = new ResourceRoot( deploymentRoot, mountHandle );
deploymentUnit.putAttachment( Attachments.DEPLOYMENT_ROOT, resourceRoot );
deploymentUnit.putAttachment( DESCRIPTOR_ROOT, resourceRoot );
代码示例来源:origin: org.wildfly/wildfly-server
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
deploymentUnit.putAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS, mounts);
final AttachmentList<ResourceRoot> rootList = deploymentUnit.getAttachment(Attachments.RESOURCE_ROOTS);
resourceRootMap.put(root.getRoot().getPathNameRelativeTo(deploymentRoot.getRoot()), root);
VirtualFile mountPoint = deploymentRoot.getRoot().getChild(override.getPath());
copyFile(override.getContentHash().getPhysicalFile(), mountPoint.getPhysicalFile());
Closeable handle = VFS.mountReal(override.getContentHash().getPhysicalFile(), mountPoint);
MountedDeploymentOverlay mounted = new MountedDeploymentOverlay(handle, override.getContentHash().getPhysicalFile(), mountPoint, TempFileProviderService.provider());
deploymentUnit.addToAttachmentList(MOUNTED_FILES, mounted);
mounts.put(override.getPath(), mounted);
代码示例来源:origin: org.jboss.as/jboss-as-server
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (deploymentUnit.getParent() != null) {
return;
}
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final Set<String> paths = new HashSet<String>();
for (final DeploymentOverlayService deploymentOverlay : indexService.getOverrides(deploymentUnit.getName())) {
for (final ContentService override : deploymentOverlay.getContentServices()) {
if (!paths.contains(override.getPath())) {
paths.add(override.getPath());
try {
Closeable handle = VFS.mountReal(override.getContentHash().getPhysicalFile(), deploymentRoot.getRoot().getChild(override.getPath()));
deploymentUnit.addToAttachmentList(MOUNTED_FILES, handle);
} catch (IOException e) {
throw ServerMessages.MESSAGES.deploymentOverlayFailed(e, deploymentOverlay.getName(), override.getPath());
}
}
}
}
}
代码示例来源:origin: org.jboss.ejb3.embedded/jboss-ejb3-embedded-impl-base
final VirtualFile file = VFS.getChild(candidate);
Closeable handle = null;
TempFileProvider provider = null;
if (file.exists())
if (file.isDirectory())
handle = VFS.mountReal(file.getPhysicalFile(), file);
handle = VFS.mountZip(file.getPhysicalFile(), file, provider);
代码示例来源:origin: wildfly/wildfly
private void traverse(String dir, String padding, boolean first)
throws java.io.IOException {
VirtualFile path = VFS.getChild(dir);
buf.append(path.getName());
buf.append("\n");
List<VirtualFile> files = path.getChildren();
for (VirtualFile f : files ) {
count += 1;
if (f.getPathName().startsWith(".")) {
continue;
代码示例来源:origin: org.wildfly.core/wildfly-server
/**
* Creates a {@link ResourceRoot} for the passed {@link VirtualFile file} and adds it to the list of {@link ResourceRoot}s
* in the {@link DeploymentUnit deploymentUnit}
*
*
* @param file The file for which the resource root will be created
* @return Returns the created {@link ResourceRoot}
* @throws java.io.IOException
*/
private synchronized ResourceRoot createResourceRoot(final VirtualFile file, final DeploymentUnit deploymentUnit, final VirtualFile deploymentRoot) throws DeploymentUnitProcessingException {
try {
Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
String relativeName = file.getPathNameRelativeTo(deploymentRoot);
MountedDeploymentOverlay overlay = overlays.get(relativeName);
Closeable closable = null;
if(overlay != null) {
overlay.remountAsZip(false);
} else if(file.isFile()) {
closable = VFS.mountZip(file, file, TempFileProviderService.provider());
}
final MountHandle mountHandle = new MountHandle(closable);
final ResourceRoot resourceRoot = new ResourceRoot(file, mountHandle);
ModuleRootMarker.mark(resourceRoot);
ResourceRootIndexer.indexResourceRoot(resourceRoot);
return resourceRoot;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: wildfly/wildfly
private VirtualFile getFile(URL url) {
try {
return VFS.getChild(url.toURI());
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
代码示例来源:origin: wildfly/wildfly-core
/**
* Creates a {@link ResourceRoot} for the passed {@link VirtualFile file} and adds it to the list of {@link ResourceRoot}s
* in the {@link DeploymentUnit deploymentUnit}
*
*
* @param file The file for which the resource root will be created
* @return Returns the created {@link ResourceRoot}
* @throws java.io.IOException
*/
private synchronized ResourceRoot createResourceRoot(final VirtualFile file, final DeploymentUnit deploymentUnit, final VirtualFile deploymentRoot) throws DeploymentUnitProcessingException {
try {
Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
String relativeName = file.getPathNameRelativeTo(deploymentRoot);
MountedDeploymentOverlay overlay = overlays.get(relativeName);
Closeable closable = null;
if(overlay != null) {
overlay.remountAsZip(false);
} else if(file.isFile()) {
closable = VFS.mountZip(file, file, TempFileProviderService.provider());
}
final MountHandle mountHandle = MountHandle.create(closable);
final ResourceRoot resourceRoot = new ResourceRoot(file, mountHandle);
ModuleRootMarker.mark(resourceRoot);
ResourceRootIndexer.indexResourceRoot(resourceRoot);
return resourceRoot;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: wildfly/wildfly
public VFSArchive(URL rootUrl, String descriptorLocation) throws URISyntaxException, IOException {
this.rootUrl = rootUrl;
this.descriptorLocation = descriptorLocation;
root = VFS.getChild(rootUrl.toURI());
List<VirtualFile> children = root.getChildrenRecursively(new VirtualFileFilter() {
@Override
public boolean accepts(VirtualFile file) {
return file.isFile();
}
});
files = new HashMap<String, VirtualFile>();
for (VirtualFile file : children) {
files.put(file.getPathNameRelativeTo(root), file);
}
}
代码示例来源:origin: org.wildfly.core/wildfly-cli
static MountHandle extractArchive(File archive,
TempFileProvider tempFileProvider, String name) throws IOException {
return ((MountHandle) VFS.mountZipExpanded(archive, VFS.getChild(name),
tempFileProvider));
}
代码示例来源:origin: org.jboss.osgi.vfs/jbosgi-vfs30
VirtualFileAdaptor30(String name, InputStream input) throws IOException {
this(VFS.getChild(name));
if (input == null)
throw MESSAGES.illegalArgumentNull("input");
mount = VFS.mountZip(input, vfsFile.getName(), vfsFile, tmpProvider);
}
代码示例来源:origin: org.jboss/jboss-vfs
/**
* Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file
* system when closed.
*
* @param zipFile a zip file in the VFS
* @param mountPoint the point at which the filesystem should be mounted
* @param tempFileProvider the temporary file provider
* @return a handle
* @throws IOException if an error occurs
*/
public static Closeable mountZip(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
return mountZip(zipFile.openStream(), zipFile.getName(), mountPoint, tempFileProvider);
}
代码示例来源:origin: org.jboss/jboss-vfs
/**
* Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and
* close the filesystem when closed. The given zip data stream is closed.
*
* @param zipFile a zip file in the VFS
* @param mountPoint the point at which the filesystem should be mounted
* @param tempFileProvider the temporary file provider
* @return a handle
* @throws IOException if an error occurs
*/
public static Closeable mountZipExpanded(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
return mountZipExpanded(zipFile.openStream(), zipFile.getName(), mountPoint, tempFileProvider);
}
代码示例来源:origin: org.wildfly.swarm/wildfly-swarm-container-runtime
VirtualFile mountPoint = VFS.getRootVirtualFile().getChild(deployment.getName());
Closeable closeable = VFS.mountZipExpanded(in, deployment.getName(), mountPoint, tempFileProvider);
this.mountPoints.add(closeable);
内容来源于网络,如有侵权,请联系作者删除!