@Override public boolean accepts(VirtualFile file) { return file.getPathName().endsWith(s); } };
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; }
@Override public boolean accepts(VirtualFile file) { return pattern.matches(file.getPathName()); } };
/** * Creates and returns a {@link XMLStreamReader} for the passed {@link VirtualFile ejb-jar.xml} * * @param stream The input stream * @param ejbJarXml * @return * @throws DeploymentUnitProcessingException * */ private static XMLStreamReader getXMLStreamReader(InputStream stream, VirtualFile ejbJarXml, XMLResolver resolver) throws DeploymentUnitProcessingException { try { final XMLInputFactory inputFactory = XMLInputFactory.newInstance(); inputFactory.setXMLResolver(resolver); XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(stream); return xmlReader; } catch (XMLStreamException xmlse) { throw EjbLogger.ROOT_LOGGER.failedToParse(xmlse, "ejb-jar.xml: " + ejbJarXml.getPathName()); } }
public boolean accepts(VirtualFile file) { String name = exact ? file.getName() : file.getPathName(); return accepts(name); }
private void check(VirtualFile f) throws NoSuchAlgorithmException { try { MessageDigest alg = MessageDigest.getInstance("md5"); byte [] buffer = Utils.toBytes(f); alg.update(buffer); String sum = new BigInteger(1, alg.digest()).toString(16); this.buffer.append( f.getPathName().replace(this.env.getJbossHome(), "JBOSSHOME") + "\n" + sum + "\n" + getManifestString(f) + "==="); } catch( java.util.zip.ZipException ze ) { // skip } catch( java.io.FileNotFoundException fnfe ) { ROOT_LOGGER.debug(fnfe); } catch( java.io.IOException ioe ) { ROOT_LOGGER.debug(ioe); } }
count += 1; if (f.getPathName().startsWith(".")) { continue; buf.append(f.getName()); buf.append(" -> "); buf.append(f.getPathName()); buf.append("\n"); traverse(f.getPathName(), padding + " "); traverse(f.getPathName(), padding + "|");
final String name = child.getPathName(); final String relativeName = path + child.getName(); final InputStreamAccess inputStreamAccess = new VirtualFileInputStreamAccess( name, child );
final String name = child.getPathName(); final String relativeName = path + child.getName(); final InputStreamAccess inputStreamAccess = new VirtualFileInputStreamAccess( name, child );
final String name = child.getPathName(); final String relativeName = path + child.getName(); final InputStreamAccess inputStreamAccess = new VirtualFileInputStreamAccess( name, child );
final String name = child.getPathName(); final String relativeName = path + child.getName(); final InputStreamAccess inputStreamAccess = new VirtualFileInputStreamAccess( name, child );
return ejbJarMetaData; } catch (XMLStreamException xmlse) { throw EjbLogger.ROOT_LOGGER.failedToParse(xmlse, "ejb-jar.xml: " + descriptor.getPathName()); } finally { try {
private static EjbJarMetaData parseJBossEjb3Xml(final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { final VirtualFile deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot(); // Locate the descriptor final VirtualFile descriptor = getDescriptor(deploymentRoot, JBOSS_EJB3_XML); if (descriptor == null) { // no descriptor found //but there may have been an ejb-jar element in jboss-all.xml return deploymentUnit.getAttachment(EjbJarJBossAllParser.ATTACHMENT_KEY); } // get the XMLStreamReader and parse the descriptor MetaDataElementParser.DTDInfo dtdInfo = new MetaDataElementParser.DTDInfo(); InputStream stream = open(descriptor); try { XMLStreamReader reader = getXMLStreamReader(stream, descriptor, dtdInfo); final JBossEjb3MetaDataParser parser = new JBossEjb3MetaDataParser(createJbossEjbJarParsers()); final EjbJarMetaData ejbJarMetaData = parser.parse(reader, dtdInfo, JBossDescriptorPropertyReplacement.propertyReplacer(deploymentUnit)); return ejbJarMetaData; } catch (XMLStreamException xmlse) { throw EjbLogger.ROOT_LOGGER.failedToParse(xmlse, JBOSS_EJB3_XML + ": " + descriptor.getPathName()); } finally { try { stream.close(); } catch (IOException ioe) { EjbLogger.DEPLOYMENT_LOGGER.failToCloseFile(ioe); } } }
EeLogger.ROOT_LOGGER.subdeploymentIgnored(descriptorFile.getPathName()); return;
/** * Get the absolute VFS full path name (/xxx/yyy/foo.ear/baz.jar/org/jboss/X.java) * * @return the VFS full path name */ public String getPathName() { return getPathName(false); }
/** * Get file's URI as a directory. There will always be a trailing {@code "/"} character. * * @return the uri * @throws URISyntaxException if the URI is somehow malformed */ public URI asDirectoryURI() throws URISyntaxException { final String pathName = getPathName(false); return new URI(VFSUtils.VFS_PROTOCOL, "", parent == null ? pathName : pathName + "/", null); }
/** * Get file's URL as a directory. There will always be a trailing {@code "/"} character. * * @return the url * @throws MalformedURLException if the URL is somehow malformed */ public URL asDirectoryURL() throws MalformedURLException { final String pathName = getPathName(false); return new URL(VFSUtils.VFS_PROTOCOL, "", -1, parent == null ? pathName : pathName + "/", VFSUtils.VFS_URL_HANDLER); }
/** * Get file's URL as a file. There will be no trailing {@code "/"} character unless this {@code VirtualFile} * represents a root. * * @return the url * @throws MalformedURLException if the URL is somehow malformed */ public URL asFileURL() throws MalformedURLException { return new URL(VFSUtils.VFS_PROTOCOL, "", -1, getPathName(false), VFSUtils.VFS_URL_HANDLER); }
/** * Get file's URI as a file. There will be no trailing {@code "/"} character unless this {@code VirtualFile} * represents a root. * * @return the url * @throws URISyntaxException if the URI is somehow malformed */ public URI asFileURI() throws URISyntaxException { return new URI(VFSUtils.VFS_PROTOCOL, "", getPathName(false), null); }
private VirtualFile getExistingFile(final VirtualFile mountPoint, final VirtualFile target) throws FileNotFoundException { final VirtualFile assemblyFile = assembly.getFile(mountPoint, target); if (assemblyFile == null) { throw new FileNotFoundException(target.getPathName()); } return assemblyFile; } }