VirtualFile moduleParentFile = moduleFile.getParent(); if (moduleParentFile != null) { if (libDir.equals(moduleParentFile)) {
protected void scanRoot(VirtualFile processArchiveRoot, final String[] additionalResourceSuffixes, Map<String, byte[]> resources) { try { List<VirtualFile> processes = processArchiveRoot.getChildrenRecursively(new VirtualFileFilter() { public boolean accepts(VirtualFile file) { return file.isFile() && ProcessApplicationScanningUtil.isDeployable(file.getName(), additionalResourceSuffixes); } }); for (final VirtualFile process : processes) { addResource(process, processArchiveRoot, resources); // find diagram(s) for process List<VirtualFile> diagrams = process.getParent().getChildren(new VirtualFileFilter() { public boolean accepts(VirtualFile file) { return ProcessApplicationScanningUtil.isDiagram(file.getName(), process.getName()); } }); for (VirtualFile diagram : diagrams) { addResource(diagram, processArchiveRoot, resources); } } } catch (IOException e) { LOG.cannotScanVfsRoot(processArchiveRoot, e); } }
protected void scanRoot(VirtualFile processArchiveRoot, final String[] additionalResourceSuffixes, Map<String, byte[]> resources) { try { List<VirtualFile> processes = processArchiveRoot.getChildrenRecursively(new VirtualFileFilter() { public boolean accepts(VirtualFile file) { return file.isFile() && ProcessApplicationScanningUtil.isDeployable(file.getName(), additionalResourceSuffixes); } }); for (final VirtualFile process : processes) { addResource(process, processArchiveRoot, resources); // find diagram(s) for process List<VirtualFile> diagrams = process.getParent().getChildren(new VirtualFileFilter() { public boolean accepts(VirtualFile file) { return ProcessApplicationScanningUtil.isDiagram(file.getName(), process.getName()); } }); for (VirtualFile diagram : diagrams) { addResource(diagram, processArchiveRoot, resources); } } } catch (IOException e) { LOG.cannotScanVfsRoot(processArchiveRoot, e); } }
/** * Get file tokens. * * @param file the file to tokenize * @return file's tokens */ protected List<VirtualFile> tokens(VirtualFile file) { List<VirtualFile> tokens = new ArrayList<VirtualFile>(); while(file != null) { tokens.add(0, file); file = file.getParent(); } return tokens; }
@Override public VirtualFile getParent() { org.jboss.vfs.VirtualFile parent = vfsFile.getParent(); return parent != null ? new VirtualFileAdaptor30(parent) : null; }
public String getRelativePath() { if (relativePath == null) { StringBuffer sb = new StringBuffer(); for (VirtualFile f = file; f != null && !root.equals(f); f = f.getParent()) { if (sb.length() > 0) sb.insert(0, '/'); sb.insert(0, f.getName()); } relativePath = sb.toString(); } return relativePath; }
private static URL getRelativeURL(VirtualFile persistence_xml, String jar) { try { return new URL(jar); } catch (MalformedURLException e) { try { VirtualFile deploymentUnitFile = persistence_xml; //we need the parent 3 units up, 1 is META-INF, 2nd is the actual jar, 3rd is the jar files parent VirtualFile parent = deploymentUnitFile.getParent().getParent().getParent(); VirtualFile baseDir = (parent != null ? parent : deploymentUnitFile); VirtualFile jarFile = baseDir.getChild(jar); if (jarFile == null) throw JpaLogger.ROOT_LOGGER.childNotFound(jar, baseDir); return jarFile.toURL(); } catch (Exception e1) { throw JpaLogger.ROOT_LOGGER.relativePathNotFound(e1, jar); } } }
private ZipNode find(VirtualFile mountPoint, VirtualFile target) { if (mountPoint.equals(target)) { return this; } else { final ZipNode parent = find(mountPoint, target.getParent()); if (parent == null) { return null; } final Map<String, ZipNode> children = parent.children; if (children == null) { return null; } return children.get(target.getName()); } } }
private ZipNode find(VirtualFile mountPoint, VirtualFile target) { if (mountPoint.equals(target)) { return this; } else { final ZipNode parent = find(mountPoint, target.getParent()); if (parent == null) { return null; } final Map<String, ZipNode> children = parent.children; if (children == null) { return null; } return children.get(target.getName()); } } }
private ZipNode find(VirtualFile mountPoint, VirtualFile target) { if (mountPoint.equals(target)) { return this; } else { final ZipNode parent = find(mountPoint, target.getParent()); if (parent == null) { return null; } final Map<String, ZipNode> children = parent.children; if (children == null) { return null; } return children.get(target.getName()); } } }
private ZipNode find(VirtualFile mountPoint, VirtualFile target) { if (mountPoint.equals(target)) { return this; } else { final ZipNode parent = find(mountPoint, target.getParent()); if (parent == null) { return null; } final Map<String, ZipNode> children = parent.children; if (children == null) { return null; } return children.get(target.getName()); } } }
protected void mountLinks(StructureContext context, String path) throws IOException { VirtualFile root = context.getFile(); VirtualFile link = root.getChild(path + VFS_LINK_PROPERTIES_SUFFIX); if (link.exists()) { List<LinkInfo> links = new ArrayList<LinkInfo>(); parseLinkProperties(link, links); mountLinks(context, link.getParent(), path, links); } else { log.warn("No " + VFS_LINK_PROPERTIES_SUFFIX + " match for link: " + path); } }
private static void mount(VirtualFile target) throws IOException { if(target.exists()) { Automounter.mount(target); return; } mount(target.getParent()); Automounter.mount(target); }
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()); }
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()); }