public boolean containsAnnotation(ReadableArchive archive, String entryName) throws IOException { return containsAnnotation(archive.getEntry(entryName), archive.getEntrySize(entryName)); }
public boolean containsAnnotation(ReadableArchive archive, String entryName) throws IOException { return containsAnnotation(archive.getEntry(entryName), archive.getEntrySize(entryName)); }
@Override public InputStream getEntry(String name) throws IOException { for (ReadableArchive ra : archives) { final InputStream is = ra.getEntry(name); if (is != null) { return is; } } return null; }
public boolean hasStandardDeploymentDescriptor(ReadableArchive archive) throws IOException { InputStream stIs = archive.getEntry(getDeploymentDescriptorPath()); if (stIs != null) { stIs.close(); return true; } return false; }
public InputStream getEntry(String name) throws IOException { if (filter.accept(delegate, name)) { return delegate.getEntry(name); } return null; }
public boolean hasStandardDeploymentDescriptor(ReadableArchive archive) throws IOException { InputStream stIs = archive.getEntry(getDeploymentDescriptorPath()); if (stIs != null) { stIs.close(); return true; } return false; }
public MemoryMappedArchive(ReadableArchive source) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); JarOutputStream jos = new JarOutputStream(baos); for (Enumeration elements = source.entries();elements.hasMoreElements();) { String elementName = (String) elements.nextElement(); InputStream is = source.getEntry(elementName); jos.putNextEntry(new ZipEntry(elementName)); ArchivistUtils.copyWithoutClose(is, jos); is.close(); jos.flush(); jos.closeEntry(); } jos.close(); file = baos.toByteArray(); }
/** * extract a entry of this archive to a file * * @param entryName entry name * @param out file to copy the entry into */ public void extractEntry(String entryName, File out) throws IOException { ReadableArchive archive = archiveFactory.openArchive(new File(path)); InputStream is = archive.getEntry(entryName); OutputStream os = new BufferedOutputStream(new FileOutputStream(out)); ArchivistUtils.copy(new BufferedInputStream(is), os); archive.close(); }
protected void handleEntry(String name, Entry entry, Logger logger /*ignored*/, EntryTask entryTask) throws IOException { InputStream is = null; try { try { is = archive.getEntry(name); if (is==null) { alogger.log(Level.SEVERE, KernelLoggerInfo.invalidInputStream, name); return; } entryTask.on(entry, is); } catch (Exception e) { alogger.log(Level.SEVERE, KernelLoggerInfo.exceptionWhileParsing, new Object[] { entry.name, archive.getURI(), entry.size, e}); } } finally { if (is!=null) is.close(); } }
/** * read and parse a J2EE Deployment Descriptor input file and * return the constructed DOL descriptors for the J2EE Module * * @param descriptor the read is incremental, the descriptor to apply the DDs to * @param in the input archive abstraction for the XML file * @return the DOL descriptor for the J2EE Module */ public T read(T descriptor, ReadableArchive in) throws IOException, SAXException { InputStream is = in.getEntry(getDeploymentDescriptorPath()); try { return read(descriptor, is); } finally { is.close(); } }
/** * read and parse a J2EE Deployment Descriptor input file and * return the constructed DOL descriptors for the J2EE Module * * @param descriptor the read is incremental, the descriptor to apply the DDs to * @param in the input archive abstraction for the XML file * @return the DOL descriptor for the J2EE Module */ public T read(T descriptor, ReadableArchive in) throws IOException, SAXParseException { InputStream is = in.getEntry(getDeploymentDescriptorPath()); try { return read(descriptor, is); } finally { is.close(); } }
public boolean hasRuntimeDeploymentDescriptor(ReadableArchive archive) throws IOException { //check null: since .par archive does not have runtime dds if (getConfigurationDDFile() != null) { InputStream runIs = archive.getEntry( getConfigurationDDFile().getDeploymentDescriptorPath()); if (runIs != null) { runIs.close(); return true; } } if (getSunConfigurationDDFile() != null) { InputStream runIs = archive.getEntry( getSunConfigurationDDFile().getDeploymentDescriptorPath()); if (runIs != null) { runIs.close(); return true; } } return false; }
/** * copy all contents of a jar file to a new jar file except * for all the deployment descriptors files * * @param in jar file * @param out jar file * @param ignoreList vector of entry name to not copy from to source jar file */ protected void copyJarElements(ReadableArchive in, WritableArchive out, Vector ignoreList) throws IOException { Enumeration entries = in.entries(); if (entries != null) { for (; entries.hasMoreElements();) { String anEntry = (String) entries.nextElement(); if (ignoreList == null || !ignoreList.contains(anEntry)) { InputStream is = in.getEntry(anEntry); if (is != null) { OutputStream os = out.putNextEntry(anEntry); ArchivistUtils.copyWithoutClose(is, os); is.close(); } out.closeEntry(); } } } }
public void copyAnEntry(ReadableArchive in, WritableArchive out, String entryName) throws IOException { InputStream is = null; InputStream is2 = null; ReadableArchive in2 = archiveFactory.openArchive(out.getURI()); try { is = in.getEntry(entryName); is2 = in2.getEntry(entryName); if (is != null && is2 == null) { OutputStream os = out.putNextEntry(entryName); ArchivistUtils.copyWithoutClose(is, os); } } finally { /* *Close any streams that were opened. */ in2.close(); if (is != null) { is.close(); } if (is2 != null) { is2.close(); } out.closeEntry(); } }
public void copyAnEntry(ReadableArchive in, WritableArchive out, String entryName) throws IOException { InputStream is = null; InputStream is2 = null; ReadableArchive in2 = archiveFactory.openArchive(out.getURI()); try { is = in.getEntry(entryName); is2 = in2.getEntry(entryName); if (is != null && is2 == null) { OutputStream os = out.putNextEntry(entryName); ArchivistUtils.copyWithoutClose(is, os); } } finally { /* *Close any streams that were opened. */ in2.close(); if (is != null) { is.close(); } if (is2 != null) { is2.close(); } out.closeEntry(); } }
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 the runtime deployment descriptors (can contained in one or * many file) from a deployment plan archive, set the corresponding * information in the passed descriptor. */ protected void readRuntimeDDFromDeploymentPlan( String entry, ReadableArchive planArchive, T descriptor) throws IOException, SAXParseException { InputStream is = null; try { is = planArchive.getEntry(entry); DeploymentDescriptorFile confDD = getConfigurationDDFile(); if (is != null && confDD != null) { if (planArchive.getURI() != null) { confDD.setErrorReportingString(planArchive.getURI().getSchemeSpecificPart()); } confDD.setXMLValidation(getXMLValidation()); confDD.read(descriptor, is); } } finally { if (is != null) { try { is.close(); } catch (IOException ioe) { } } } }
public Object open(Archivist main, ReadableArchive archive, RootDeploymentDescriptor descriptor) throws IOException, SAXParseException { DeploymentDescriptorFile confDD = getStandardDDFile(descriptor); if (archive.getURI() != null) { confDD.setErrorReportingString(archive.getURI().getSchemeSpecificPart()); } InputStream is = null; try { is = archive.getEntry(confDD.getDeploymentDescriptorPath()); if (is == null) { if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Deployment descriptor: " + confDD.getDeploymentDescriptorPath(), " does not exist in archive: " + archive.getURI().getSchemeSpecificPart()); } } else { confDD.setXMLValidation(main.getXMLValidation()); confDD.setXMLValidationLevel(main.getXMLValidationLevel()); return confDD.read(descriptor, is); } } finally { if (is != null) { is.close(); } } return null; }