Java Code Examples for org.jboss.vfs.VirtualFile#getPathNameRelativeTo()
The following examples show how to use
org.jboss.vfs.VirtualFile#getPathNameRelativeTo() .
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: DeploymentOverlayDeploymentUnitProcessor.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private boolean isExplodedSubUnitOverlay(DeploymentUnit deploymentUnit, VirtualFile mountPoint, String path) { final List<ResourceRoot> childRes = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); if (childRes != null) { for (ResourceRoot rs: childRes) { if (path.startsWith(rs.getRoot().getName())) { String relativePath = mountPoint.getPathNameRelativeTo(rs.getRoot()); if (relativePath != null && relativePath.length() > 0 && SubExplodedDeploymentMarker.isSubExplodedResourceRoot(rs)) { return true; } } } } return false; }
Example 2
Source File: ManifestClassPathProcessor.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * 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); } }
Example 3
Source File: LoggingConfigDeploymentProcessor.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private static String resolveRelativePath(final ResourceRoot root, final VirtualFile configFile) { // Get the parent of the root resource so the deployment name will be included in the path final VirtualFile deployment = root.getRoot().getParent(); if (deployment != null) { return configFile.getPathNameRelativeTo(deployment); } // This shouldn't be reached, but a fallback is always safe return configFile.getPathNameRelativeTo(root.getRoot()); }
Example 4
Source File: VfsProcessApplicationScanner.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
private void addResource(VirtualFile virtualFile, VirtualFile processArchiveRoot, Map<String, byte[]> resources) { String resourceName = virtualFile.getPathNameRelativeTo(processArchiveRoot); try { InputStream inputStream = virtualFile.openStream(); byte[] bytes = IoUtil.readInputStream(inputStream, resourceName); IoUtil.closeSilently(inputStream); resources.put(resourceName, bytes); } catch (IOException e) { LOG.cannotReadInputStreamForFile(resourceName, processArchiveRoot, e); } }
Example 5
Source File: ShrinkWrapFileSystem.java From thorntail with Apache License 2.0 | 4 votes |
Optional<Entry> getEntry(VirtualFile mountPoint, VirtualFile target) { String name = target.getPathNameRelativeTo(mountPoint); Entry entry = this.archives.get(name); return Optional.ofNullable(entry); }