@Override public ReadableArchive getSubArchive(String name) throws IOException { for (ReadableArchive ra : archives) { final ReadableArchive subArchive = ra.getSubArchive(name); if (subArchive != null) { return subArchive; } } return null; }
private static ReadableArchive getSubArchive(ReadableArchive parentArchive, String path, boolean expectAbscenceOfSubArchive) { ReadableArchive returnedArchive = null; try { returnedArchive = parentArchive.getSubArchive(path); } catch (IOException ioe) { // if there is any problem in opening the subarchive, and the subarchive is expected to be present, log the exception if(!expectAbscenceOfSubArchive) { st_logger.log(Level.SEVERE, ioe.getMessage(), ioe); } } return returnedArchive; }
public ReadableArchive getSubArchive(String name) throws IOException { if (filter.accept(delegate, name)) { return delegate.getSubArchive(name); } return null; }
private static ReadableArchive getSubArchive(ReadableArchive parentArchive, String path, boolean expectAbscenceOfSubArchive) { ReadableArchive returnedArchive = null; try { returnedArchive = parentArchive.getSubArchive(path); } catch (IOException ioe) { // if there is any problem in opening the subarchive, and the subarchive is expected to be present, log the exception if(!expectAbscenceOfSubArchive) { LogRecord lr = new LogRecord(Level.SEVERE, EXCEPTION_CAUGHT); Object args[] = { ioe.getMessage(), path }; lr.setParameters(args); lr.setThrown(ioe); deplLogger.log(lr); } } return returnedArchive; }
protected boolean scanForPURootsInLibDir(ReadableArchive parentArchive, String libLocation) { boolean puRootPresent = false; if (libLocation != null && !libLocation.isEmpty()) { // if an application disables lib dir by specifying <library-directory></library-directory>, do not attempt to scan lib dir Enumeration<String> entries = parentArchive.entries(libLocation); while (entries.hasMoreElements() && !puRootPresent) { String entryName = entries.nextElement(); if (entryName.endsWith(JAR_SUFFIX) && // a jar in lib dir entryName.indexOf(SEPERATOR_CHAR, libLocation.length() + 1 ) == -1 ) { // && not WEB-INf/lib/foo/bar.jar try { ReadableArchive jarInLib = parentArchive.getSubArchive(entryName); puRootPresent = isEntryPresent(jarInLib, META_INF_PERSISTENCE_XML); jarInLib.close(); } catch (IOException e) { // Something went wrong while reading the jar. Do not attempt to scan it } // catch } // if (entryName.endsWith(JAR_SUFFIX)) } // while } return puRootPresent; }
private void collectRarInfo(ReadableArchive archive) throws IOException, ClassNotFoundException { if (logger.isLoggable(FINE)) { logger.log(FINE, CDILoggerInfo.COLLECTING_RAR_INFO, new Object[]{archive.getURI()}); } Enumeration<String> entries = archive.entries(); while (entries.hasMoreElements()) { String entry = entries.nextElement(); if (entry.endsWith(JAR_SUFFIX)) { ReadableArchive jarArchive = archive.getSubArchive(entry); collectJarInfo(jarArchive, true, true); } else { handleEntry(archive, entry, true, true); } } }
if (is!=null) { is.close(); probablePersitenceArchives.put(CLASSES_DIR, warArchive.getSubArchive(CLASSES_DIR));
ReadableArchive jarSubArchive = null; try { jarSubArchive = archive.getSubArchive(entryName); Enumeration<String> jarEntries = jarSubArchive.entries();
if (is!=null) { is.close(); probablePersitenceArchives.put(CLASSES_DIR, warArchive.getSubArchive(CLASSES_DIR));
public void retrieveAllResourcesXMLs(Map<String, String> fileNames, ReadableArchive archive, String actualArchiveName) throws IOException { if(DeploymentUtils.isEAR(archive)){ //Look for top-level META-INF/glassfish-resources.xml if(archive.exists(RESOURCES_XML_META_INF)){ String archivePath = archive.getURI().getPath(); String fileName = archivePath + RESOURCES_XML_META_INF; if(_logger.isLoggable(Level.FINEST)){ _logger.finest("GlassFish-Resources Deployer - fileName : " + fileName + " - parent : " + archive.getName()); } fileNames.put(actualArchiveName, fileName); } //Lok for sub-module level META-INF/glassfish-resources.xml and WEB-INF/glassfish-resources.xml Enumeration<String> entries = archive.entries(); while(entries.hasMoreElements()){ String element = entries.nextElement(); if(element.endsWith(".jar") || element.endsWith(".war") || element.endsWith(".rar") || element.endsWith("_jar") || element.endsWith("_war") || element.endsWith("_rar")){ ReadableArchive subArchive = archive.getSubArchive(element); if(subArchive != null ){ retrieveResourcesXMLFromArchive(fileNames, subArchive, subArchive.getName()); } } } }else{ //Look for standalone archive's META-INF/glassfish-resources.xml and WEB-INF/glassfish-resources.xml retrieveResourcesXMLFromArchive(fileNames, archive, actualArchiveName); } }
public void retrieveAllResourcesXMLs(Map<String, String> fileNames, ReadableArchive archive, String actualArchiveName) throws IOException { if(DeploymentUtils.isArchiveOfType(archive, DOLUtils.earType(), locator)){ //Look for top-level META-INF/glassfish-resources.xml if(archive.exists(RESOURCES_XML_META_INF)){ String archivePath = archive.getURI().getPath(); String fileName = archivePath + RESOURCES_XML_META_INF; if(_logger.isLoggable(Level.FINEST)){ _logger.finest("GlassFish-Resources Deployer - fileName : " + fileName + " - parent : " + archive.getName()); } fileNames.put(actualArchiveName, fileName); } //Lok for sub-module level META-INF/glassfish-resources.xml and WEB-INF/glassfish-resources.xml Enumeration<String> entries = archive.entries(); while(entries.hasMoreElements()){ String element = entries.nextElement(); if(element.endsWith(".jar") || element.endsWith(".war") || element.endsWith(".rar") || element.endsWith("_jar") || element.endsWith("_war") || element.endsWith("_rar")){ ReadableArchive subArchive = archive.getSubArchive(element); if(subArchive != null ){ retrieveResourcesXMLFromArchive(fileNames, subArchive, subArchive.getName()); } } } }else{ //Look for standalone archive's META-INF/glassfish-resources.xml and WEB-INF/glassfish-resources.xml retrieveResourcesXMLFromArchive(fileNames, archive, actualArchiveName); } }
entryName.indexOf(SEPARATOR_CHAR, libDir.length() + 1 ) == -1 ) { try { ReadableArchive jarInLib = archive.getSubArchive(entryName); if (jarInLib.exists(META_INF_BEANS_XML) || WeldUtils.isImplicitBeanArchive(context, jarInLib)) { if (libJars == null) {
if (!archive.exists(explodedName)) { final ReadableArchive subArchive = archive.getSubArchive(name); if (subArchive==null) { logger.log(Level.SEVERE, KernelLoggerInfo.cantOpenSubArchive,
if(element.endsWith(".jar") || element.endsWith(".war") || element.endsWith(".rar") || element.endsWith("_jar") || element.endsWith("_war") || element.endsWith("_rar")){ ReadableArchive subArchive = archive.getSubArchive(element); boolean answer = (subArchive != null && hasResourcesXML(subArchive)); if (subArchive != null) {
for (ModuleDescriptor aModule : a.getModules()) { entriesAdded.add(aModule.getArchiveUri()); ReadableArchive subSource = source.getSubArchive(aModule.getArchiveUri()); WritableArchive subTarget = target.createSubArchive(aModule.getArchiveUri()); Archivist newArchivist = archivistFactory.get().getPrivateArchivistFor(aModule.getModuleType());
/** * Perform Optional packages dependencies checking on an archive */ @Override public boolean performOptionalPkgDependenciesCheck(ReadableArchive archive) throws IOException { if (!super.performOptionalPkgDependenciesCheck(archive)) return false; // now check sub modules if (descriptor==null) { throw new IOException("Application object not set on archivist"); } boolean returnValue = true; for (ModuleDescriptor md : descriptor.getModules()) { ReadableArchive sub = archive.getSubArchive(md.getArchiveUri()); if (sub!=null) { Archivist subArchivist = archivistFactory.get().getArchivist(md.getModuleType()); if (!subArchivist.performOptionalPkgDependenciesCheck(sub)) returnValue = false; } } return returnValue; }
for (ModuleDescriptor aModule : a.getModules()) { entriesAdded.add(aModule.getArchiveUri()); ReadableArchive subSource = source.getSubArchive(aModule.getArchiveUri()); WritableArchive subTarget = target.createSubArchive(aModule.getArchiveUri()); Archivist newArchivist = archivistFactory.get().getArchivist(aModule.getModuleType());
/** * Perform Optional packages dependencies checking on an archive */ @Override public boolean performOptionalPkgDependenciesCheck(ReadableArchive archive) throws IOException { if (!super.performOptionalPkgDependenciesCheck(archive)) return false; // now check sub modules if (descriptor==null) { throw new IOException("Application object not set on archivist"); } boolean returnValue = true; for (ModuleDescriptor md : descriptor.getModules()) { ReadableArchive sub = archive.getSubArchive(md.getArchiveUri()); if (sub!=null) { Archivist subArchivist = archivistFactory.get().getPrivateArchivistFor(md.getModuleType()); if (!subArchivist.performOptionalPkgDependenciesCheck(sub)) returnValue = false; } } return returnValue; }
/** * writes an application deployment descriptors * @param the application object * @param the abstract archive */ public void write(Application application, ReadableArchive in, WritableArchive out) throws IOException { if (application.isVirtual()) { ModuleDescriptor aModule = (ModuleDescriptor) application.getModules().iterator().next(); Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType()); write((BundleDescriptor)aModule.getDescriptor(), moduleArchivist, in, out); } else { // this is a real application. // let's start by writing out all submodules deployment descriptors for (ModuleDescriptor aModule : application.getModules()) { Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType()); WritableArchive moduleArchive = out.createSubArchive(aModule.getArchiveUri()); ReadableArchive moduleArchive2 = in.getSubArchive(aModule.getArchiveUri()); write((BundleDescriptor)aModule.getDescriptor(), moduleArchivist, moduleArchive2, moduleArchive); } // now let's write the application descriptor ApplicationArchivist archivist = archivistProvider.get(); archivist.setDescriptor(application); archivist.writeDeploymentDescriptors(in, out); } }
archivist.setRuntimeXMLValidationLevel( this.getRuntimeXMLValidationLevel()); ReadableArchive subArchive = archive.getSubArchive(md.getArchiveUri()); if (md.getAlternateDescriptor()!=null) { DOLUtils.readAlternativeRuntimeDescriptor(archive, subArchive, archivist, (BundleDescriptor)md.getDescriptor(), md.getAlternateDescriptor());