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); } }
private TldMetaData processTld(VirtualFile root, VirtualFile file, Map<String, TldMetaData> tlds, List<TldMetaData> uniqueTlds) throws DeploymentUnitProcessingException { String pathNameRelativeToRoot; try { pathNameRelativeToRoot = file.getPathNameRelativeTo(root); } catch (IllegalArgumentException e) { throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.tldFileNotContainedInRoot(file.getPathName(), root.getPathName()), e); } final TldMetaData value = parseTLD(file); String key = "/" + pathNameRelativeToRoot; uniqueTlds.add(value); if (!tlds.containsKey(key)) { tlds.put(key, value); } return value; }
private String createBeanArchiveId(ResourceRoot resourceRoot) { String beanArchiveId = getDeploymentUnitId(deploymentUnit); if (resourceRoot != null) { final VirtualFile deploymentRootResource = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot(); beanArchiveId += "/" + resourceRoot.getRoot().getPathNameRelativeTo(deploymentRootResource); } return beanArchiveId; } }
child.getPathNameRelativeTo(overlay); return new ServletResource(this, new VirtualFileResource(overlay.getPhysicalFile(), child, canonical)); } catch (IllegalArgumentException ignore) {
if(SubDeploymentMarker.isSubDeployment(root)) { final ResourceRoot parentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final String relativePath = root.getRoot().getPathNameRelativeTo(parentRoot.getRoot()); final ServiceName subDeploymentServiceName = Services.deploymentUnitName(deploymentUnit.getName(), relativePath); final ServiceController<?> subDeploymentController = serviceRegistry.getService(subDeploymentServiceName);
String relativeName = child.getPathNameRelativeTo(deploymentRoot); MountedDeploymentOverlay overlay = overlays.get(relativeName); Closeable closable = NO_OP_CLOSEABLE; ModuleRootMarker.mark(childResource); deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, childResource); resourceRoot.addToAttachmentList(Attachments.INDEX_IGNORE_PATHS, child.getPathNameRelativeTo(deploymentRoot));
String relativeName = child.getPathNameRelativeTo(deploymentRoot); MountedDeploymentOverlay overlay = overlays.get(relativeName); Closeable closable = NO_OP_CLOSEABLE; ModuleRootMarker.mark(childResource); deploymentUnit.addToAttachmentList(Attachments.RESOURCE_ROOTS, childResource); resourceRoot.addToAttachmentList(Attachments.INDEX_IGNORE_PATHS, child.getPathNameRelativeTo(deploymentRoot));
try { String relativeName = archive.getPathNameRelativeTo(deploymentRoot); MountedDeploymentOverlay overlay = overlays.get(relativeName); Closeable closable = null;
List<VirtualFile> libArchives = libDir.getChildren(CHILD_ARCHIVE_FILTER); for (final VirtualFile child : libArchives) { String relativeName = child.getPathNameRelativeTo(deploymentRoot.getRoot()); MountedDeploymentOverlay overlay = overlays.get(relativeName); final MountHandle mountHandle;
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); } }
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); } }
/** * Get the entry name from a VirtualFile. * * @param entry * @return */ private String getEntryName(VirtualFile entry) { return entry.getPathNameRelativeTo(root); }
Optional<Entry> getEntry(VirtualFile mountPoint, VirtualFile target) { String name = target.getPathNameRelativeTo(mountPoint); Entry entry = this.archives.get(name); return Optional.ofNullable(entry); }
Optional<Entry> getEntry(VirtualFile mountPoint, VirtualFile target) { String name = target.getPathNameRelativeTo(mountPoint); Entry entry = this.archives.get(name); return Optional.ofNullable(entry); }
@Override public Resource next() { VirtualFile file = children.next(); URL fileURL; try { fileURL = file.toURL(); } catch (MalformedURLException ex) { throw new IllegalStateException(ex); } return new VFSEntryResource(file.getPathNameRelativeTo(root), file, fileURL); }
@Override public Resource next() { VirtualFile file = children.next(); URL fileURL; try { fileURL = file.toURL(); } catch (MalformedURLException ex) { throw new IllegalStateException(ex); } return new VFSEntryResource(file.getPathNameRelativeTo(root), file, fileURL); }
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()); }
@Override public Resource next() { VirtualFile file = children.next(); URL fileURL; try { fileURL = file.toURL(); } catch (MalformedURLException ex) { throw new IllegalStateException(ex); } return new VFSEntryResource(file.getPathNameRelativeTo(root), file, fileURL); }
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); } }
private ModuleIdentifier createAdditionalModule(final ResourceRoot resourceRoot, final DeploymentUnit topLevelDeployment, final VirtualFile topLevelRoot, final Map<VirtualFile, AdditionalModuleSpecification> additionalModules, final VirtualFile classPathFile, final ArrayDeque<RootEntry> resourceRoots) throws DeploymentUnitProcessingException { final ResourceRoot root = createResourceRoot(classPathFile, topLevelDeployment, topLevelRoot); final String pathName = root.getRoot().getPathNameRelativeTo(topLevelRoot); ModuleIdentifier identifier = ModuleIdentifier.create(ServiceModuleLoader.MODULE_PREFIX + topLevelDeployment.getName() + "." + pathName); AdditionalModuleSpecification module = new AdditionalModuleSpecification(identifier, root); topLevelDeployment.addToAttachmentList(Attachments.ADDITIONAL_MODULES, module); additionalModules.put(classPathFile, module); resourceRoot.addToAttachmentList(Attachments.CLASS_PATH_RESOURCE_ROOTS, root); //add this to the list of roots to be processed, so transitive class path entries will be respected resourceRoots.add(new RootEntry(module, root)); return identifier; }