@Override public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException { return getEntry(mountPoint, target) .map(e -> e.archive.as(ZipExporter.class).exportAsInputStream()).orElse(null); }
@Override public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException { return getEntry(mountPoint, target) .map(e -> e.archive.as(ZipExporter.class).exportAsInputStream()).orElse(null); }
@Override public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException { return getEntry(mountPoint, target) .map(e -> e.archive.as(ZipExporter.class).exportAsInputStream()).orElse(null); }
File getFile(Entry entry) { if (entry.file == null) { try { entry.file = this.tempDir.createFile(entry.archive.getName(), entry.archive.as(ZipExporter.class).exportAsInputStream()); } catch (IOException e) { e.printStackTrace(); } } return entry.file; }
File getFile(Entry entry) { if (entry.file == null) { try { entry.file = this.tempDir.createFile(entry.archive.getName(), entry.archive.as(ZipExporter.class).exportAsInputStream()); } catch (IOException e) { e.printStackTrace(); } } return entry.file; }
File getFile(Entry entry) { if (entry.file == null) { try { entry.file = this.tempDir.createFile(entry.archive.getName(), entry.archive.as(ZipExporter.class).exportAsInputStream()); } catch (IOException e) { e.printStackTrace(); } } return entry.file; }
private List<String> getAuxiliaryArchivesPackages( Collection<Archive<?>> auxiliaryArchives) throws IOException { List<String> packages = new ArrayList<>(); for (Archive auxiliaryArchive : auxiliaryArchives) { ZipExporter zipExporter = auxiliaryArchive.as(ZipExporter.class); InputStream auxiliaryArchiveInputStream = zipExporter.exportAsInputStream(); Jar jar = new Jar( auxiliaryArchive.getName(), auxiliaryArchiveInputStream); packages.addAll(jar.getPackages()); } return packages; }
public byte[] addContent(Archive<?> archive) throws IOException, URISyntaxException { try { MessageDigest messageDigest = MessageDigest.getInstance("SHA-1"); byte[] sha1Bytes; messageDigest.reset(); BufferedInputStream bis = new BufferedInputStream(archive.as(ZipExporter.class).exportAsInputStream()); byte[] bytes = new byte[8192]; int read; while ((read = bis.read(bytes)) > -1) { messageDigest.update(bytes, 0, read); } sha1Bytes = messageDigest.digest(); String key = toKey(sha1Bytes); this.fs.addArchive(archive.getName(), archive); this.index.put(key, this.fsMount.getChild(archive.getName()).toURI()); return sha1Bytes; } catch (NoSuchAlgorithmException e) { throw new IOException(e); } }
public byte[] addContent(Archive<?> archive) throws IOException, URISyntaxException { try { MessageDigest messageDigest = MessageDigest.getInstance("SHA-1"); byte[] sha1Bytes; messageDigest.reset(); BufferedInputStream bis = new BufferedInputStream(archive.as(ZipExporter.class).exportAsInputStream()); byte[] bytes = new byte[8192]; int read; while ((read = bis.read(bytes)) > -1) { messageDigest.update(bytes, 0, read); } sha1Bytes = messageDigest.digest(); String key = toKey(sha1Bytes); this.fs.addArchive(archive.getName(), archive); this.index.put(key, this.fsMount.getChild(archive.getName()).toURI()); return sha1Bytes; } catch (NoSuchAlgorithmException e) { throw new IOException(e); } }
@Override public InputStream openStream() { return new WebInfLibFilteringArchive(this.asset.getArchive(), this.resolvedDependencies).as(ZipExporter.class).exportAsInputStream(); } }
@Override public InputStream openStream() { return new WebInfLibFilteringArchive(this.asset.getArchive(), this.resolvedDependencies).as(ZipExporter.class).exportAsInputStream(); } }
private String deployInternal(Archive<?> archive) throws DeploymentException { final InputStream input = archive.as(ZipExporter.class).exportAsInputStream(); try { return deployInternal(archive.getName(), input); } finally { if (input != null) try { input.close(); } catch (IOException e) { log.warnf(e, "Failed to close resource %s", input); } } }
private VirtualFile toVirtualFile(Archive<?> archive) throws IOException { ZipExporter exporter = archive.as(ZipExporter.class); return AbstractVFS.toVirtualFile(archive.getName(), exporter.exportAsInputStream()); }
private String deployInternal(Archive<?> archive) throws DeploymentException { final InputStream input = archive.as(ZipExporter.class).exportAsInputStream(); try { return deployInternal(archive.getName(), input); } finally { if (input != null) try { input.close(); } catch (IOException e) { log.warnf(e, "Failed to close resource %s", input); } } }
public void deploy(final Archive<?> archive, final String runtimeName) throws ServerDeploymentHelper.ServerDeploymentException { getDeploymentHelper().deploy(runtimeName, archive.as(ZipExporter.class).exportAsInputStream()); }
@Override public InputStream openStream() { return filter(ShrinkWrap.create(ZipImporter.class) .importFrom(this.delegate.openStream()) .as(JavaArchive.class)) .as(ZipExporter.class) .exportAsInputStream(); }
private String deployInternal(Archive<?> archive) throws DeploymentException { checkState(); final InputStream input = archive.as(ZipExporter.class).exportAsInputStream(); try { return deployInternal(archive.getName(), input); } finally { if (input != null) try { input.close(); } catch (IOException e) { log.warnf(e, "Failed to close resource %s", input); } } }
private String deployInternal(Archive<?> archive) throws DeploymentException { checkState(); final InputStream input = archive.as(ZipExporter.class).exportAsInputStream(); try { return deployInternal(archive.getName(), input); } finally { if (input != null) try { input.close(); } catch (IOException e) { log.warnf(e, "Failed to close resource %s", input); } } }
/** * Test to ensure that the {@link ZipExporter} does not accept an empty archive as input * * SHRINKWRAP-93 * * @throws Exception */ @Test(expected = IllegalArgumentException.class) public void exportEmptyArchiveAsZip() throws Exception { // Attempt to export an empty archive, should fail ShrinkWrap.create(JavaArchive.class, NAME_ARCHIVE).as(ZipExporter.class).exportAsInputStream(); }
@Override public InputStream getDeployment(String name) { DeploymentScenario scenario = deploymentScenario.get(); if (scenario == null) { throw new IllegalArgumentException("No deployment scenario in context"); } Deployment deployment = scenario.deployment(new DeploymentTargetDescription(name)); if (deployment == null) { throw new IllegalArgumentException("No deployment in context found with name " + name); } DeploymentDescription description = deployment.getDescription(); if (description.isArchiveDeployment()) { Archive<?> archive = description.testable() ? description.getTestableArchive() : description.getArchive(); return archive.as(ZipExporter.class).exportAsInputStream(); } else { return new ByteArrayInputStream(description.getDescriptor().exportAsString().getBytes()); } } }