@PostConstruct public void postConstruct() throws IOException { this.tempDir = this.tempFileProvider.createTempDir("wildfly-swarm-deployments.tmp"); }
@PostConstruct public void postConstruct() throws IOException { this.tempDir = this.tempFileProvider.createTempDir("wildfly-swarm-deployments.tmp"); }
@PostConstruct public void postConstruct() throws IOException { this.tempDir = this.tempFileProvider.createTempDir("wildfly-swarm-deployments.tmp"); }
/** * Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file * system when closed. * * @param zipFile the zip file to mount * @param mountPoint the point at which the filesystem should be mounted * @param tempFileProvider the temporary file provider * @return a handle * @throws IOException if an error occurs */ public static Closeable mountZip(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir(zipFile.getName()); try { final MountHandle handle = doMount(new JavaZipFileSystem(zipFile, tempDir), mountPoint); ok = true; return handle; } finally { if (!ok) { VFSUtils.safeClose(tempDir); } } }
return new TempFileProvider(createTempDir(providerType, "", providerRoot), executor);
@Override public URL getStreamURL() throws IOException { if (vfsFile.isFile() == true) return vfsFile.toURL(); synchronized (this) { if (streamFile == null) { streamDir = tmpProvider.createTempDir("urlstream"); streamFile = streamDir.getFile(getName()); JarOutputStream jarOut = new JarOutputStream(new FileOutputStream(streamFile)); VirtualJarInputStream jarIn = (VirtualJarInputStream) vfsFile.openStream(); ZipEntry nextEntry = jarIn.getNextEntry(); while (nextEntry != null) { jarOut.putNextEntry(nextEntry); VFSUtils.copyStream(jarIn, jarOut); nextEntry = jarIn.getNextEntry(); } jarOut.close(); jarIn.close(); } } return streamFile.toURI().toURL(); }
/** * Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and * close the filesystem when closed. * * @param zipFile the zip file to mount * @param mountPoint the point at which the filesystem should be mounted * @param tempFileProvider the temporary file provider * @return a handle * @throws IOException if an error occurs */ public static Closeable mountZipExpanded(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir(zipFile.getName()); try { final File rootFile = tempDir.getRoot(); VFSUtils.unzip(zipFile, rootFile); final MountHandle handle = doMount(new RealFileSystem(rootFile), mountPoint, tempDir); ok = true; return handle; } finally { if (!ok) { VFSUtils.safeClose(tempDir); } } }
/** * Create and mount a temporary file system, returning a single handle which will unmount and close the filesystem * when closed. * * @param mountPoint the point at which the filesystem should be mounted * @param tempFileProvider the temporary file provider * @return a handle * @throws IOException if an error occurs */ public static Closeable mountTemp(VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir("tmpfs"); try { final MountHandle handle = doMount(new RealFileSystem(tempDir.getRoot()), mountPoint, tempDir); ok = true; return handle; } finally { if (!ok) { VFSUtils.safeClose(tempDir); } } }
/** * Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file * system when closed. * * @param zipData an input stream containing the zip data * @param zipName the name of the archive * @param mountPoint the point at which the filesystem should be mounted * @param tempFileProvider the temporary file provider * @return a handle * @throws IOException if an error occurs */ public static Closeable mountZip(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException { boolean ok = false; try { final TempDir tempDir = tempFileProvider.createTempDir(zipName); try { final MountHandle handle = doMount(new JavaZipFileSystem(zipName, zipData, tempDir), mountPoint); ok = true; return handle; } finally { if (!ok) { VFSUtils.safeClose(tempDir); } } } finally { VFSUtils.safeClose(zipData); } }
try { boolean ok = false; final TempDir tempDir = tempFileProvider.createTempDir(zipName); try { final File zipFile = File.createTempFile(zipName + "-", ".tmp", tempDir.getRoot());