@Override public URI getURI() { /* * This is not arbitrary. By convention, the facade ReadableArchive * will be listed first when the MultiReadableArchive is created. * The URI returned from this method is, for example, added to a * class path. The facade JAR points to the client JAR so adding * the facade URI to a class path essentially adds both. */ return archives[0].getURI(); }
public ReadableArchiveScannerAdapter(Parser parser, ReadableArchive archive) { this.archive = archive; this.parser = parser; this.uri = archive.getURI(); this.parent = null; }
private ReadableArchiveScannerAdapter(ReadableArchiveScannerAdapter parent, ReadableArchive archive, URI uri) { this.parent = parent; this.archive = archive; this.parser = parent.parser; this.uri = uri==null?archive.getURI():uri; }
public URI getURI(final int slot) { return archives[slot].getURI(); }
/** * Returns the classpath URIs for this archive. * * @param archive file * @return classpath URIs for this archive */ public List<URI> getClassPathURIs(ReadableArchive archive) { List<URI> uris = new ArrayList<URI>(); // add the archive itself uris.add(archive.getURI()); return uris; }
private URL getBeansXMLFileURL(ReadableArchive archive, String beansXMLPath) throws IOException { URL url = null; File file = new File(archive.getURI().getPath()); if (file.isDirectory()) { file = new File(file, beansXMLPath); url = file.toURI().toURL(); } else { url = new URL("jar:" + file.toURI() + "!/" + beansXMLPath); } return url; }
/** * {@inheritDoc} */ public File getSourceDir() { return new File(getSource().getURI()); }
@Override public void run() { try { if (logger.isLoggable(level)) logger.log(level, "Closing sub archive " + subArchive.getURI()); adapter.close(); } catch (IOException e) { logger.log(Level.SEVERE, KernelLoggerInfo.exceptionWhileClosing, new Object[] { name, e }); } } });
private void addScanTargetsFromURIList(final ReadableArchive archive, final String relativeURIList, final Map<String,ReadableArchive> candidates) throws IOException { if (relativeURIList == null || relativeURIList.isEmpty()) { return; } final String[] relativeURIs = relativeURIList.split(" "); for (String uriText : relativeURIs) { final URI scanTargetURI = archive.getURI().resolve(uriText); candidates.put(uriText, archiveFactory.openArchive(scanTargetURI)); } }
private void addScanTargetsFromURIList(final ReadableArchive archive, final String relativeURIList, final Map<String,ReadableArchive> candidates) throws IOException { if (relativeURIList == null || relativeURIList.isEmpty()) { return; } final String[] relativeURIs = relativeURIList.split(" "); for (String uriText : relativeURIs) { final URI scanTargetURI = archive.getURI().resolve(uriText); candidates.put(uriText, archiveFactory.openArchive(scanTargetURI)); } }
/** * Open a jar file and return an application object for the modules contained * in the archive. If the archive is a standalone module, this API will * create an empty application and add the standalone module to it * * @param archivist to use to open the archive file * @param in the archive abstraction * @param handleRuntimeInfo true to read configuration deployment descriptors * @return the application object */ public Application openArchive(Archivist archivist, ReadableArchive in, boolean handleRuntimeInfo) throws IOException, SAXException { return openArchive(in.getURI().getSchemeSpecificPart(), archivist, in, handleRuntimeInfo); }
private void collectJarInfo(ReadableArchive archive, boolean isBeanArchive, boolean hasBeansXml) throws IOException, ClassNotFoundException { if (logger.isLoggable(FINE)) { logger.log(FINE, CDILoggerInfo.COLLECTING_JAR_INFO, new Object[]{archive.getURI()}); } Enumeration<String> entries = archive.entries(); while (entries.hasMoreElements()) { String entry = entries.nextElement(); handleEntry(archive, entry, isBeanArchive, hasBeansXml); } }
private String getModuleLocation(ModuleDescriptor module) throws IOException { String moduleLocation = (new File(rootLocation_.getURI())).getAbsolutePath(); if( !module.isStandalone() ) { // If this is an ear, get module jar by adding the module path // to the root directory. String archiveUri = module.getArchiveUri(); archiveUri = archiveUri.replace('.', '_'); moduleLocation = moduleLocation + File.separator + archiveUri; } return moduleLocation; }
private String getModuleLocation(ModuleDescriptor module) throws IOException { String moduleLocation = (new File(rootLocation_.getURI())).getAbsolutePath(); if( !module.isStandalone() ) { // If this is an ear, get module jar by adding the module path // to the root directory. String archiveUri = module.getArchiveUri(); archiveUri = archiveUri.replace('.', '_'); moduleLocation = moduleLocation + File.separator + archiveUri; } return moduleLocation; }
@Override public File getScratchDir(String subDirName) { String modulePortion = Util.getURIName( getSource().getURI()); return (new File(super.getScratchDir(subDirName), modulePortion)); }
@Override public File getScratchDir(String subDirName) { String modulePortion = Util.getURIName( getSource().getURI()); return (new File(super.getScratchDir( subDirName), modulePortion)); } };
public void process(ReadableArchive archiveFile, T bundleDesc, ClassLoader classLoader, Parser parser) throws IOException { File file = new File(archiveFile.getURI()); setParser(parser); process(file, bundleDesc, classLoader); completeProcess(bundleDesc, archiveFile); calculateResults(bundleDesc); }
WebXmlParser(ReadableArchive archive) throws XMLStreamException, IOException { if (archive.exists(getXmlFileName())) { try (InputStream is = archive.getEntry(getXmlFileName())) { init(is); } catch (Throwable t) { String msg = localStrings.getLocalString("web.deployment.exception_parsing_webxml", "Error in parsing {0} for archive [{1}]: {2}", getXmlFileName(), archive.getURI(), t.getMessage()); throw new RuntimeException(msg); } } }
/** * Read all Java EE deployment descriptors and annotations * * @return the initialized descriptor */ private T readDeploymentDescriptors(ReadableArchive descriptorArchive, ReadableArchive contentArchive, Application app) throws IOException, SAXException { // read the standard deployment descriptors T descriptor = readStandardDeploymentDescriptor(descriptorArchive); descriptor.setApplication(app); ModuleDescriptor newModule = createModuleDescriptor(descriptor); newModule.setArchiveUri(contentArchive.getURI().getSchemeSpecificPart()); return readRestDeploymentDescriptors(descriptor, descriptorArchive, contentArchive, app); }
private T readDeploymentDescriptors(ReadableArchive descriptorArchive, ReadableArchive contentArchive, Application app) throws IOException, SAXParseException { // read the standard deployment descriptors T descriptor = readStandardDeploymentDescriptor(descriptorArchive); if (descriptor instanceof BundleDescriptor) { ((BundleDescriptor)descriptor).setApplication(app); } ModuleDescriptor newModule = createModuleDescriptor(descriptor); newModule.setArchiveUri(contentArchive.getURI().getSchemeSpecificPart()); return readRestDeploymentDescriptors(descriptor, descriptorArchive, contentArchive, app); }