@Override public Closeable mountDeploymentContent( final VirtualFile contents, VirtualFile mountPoint, MountType type) throws IOException { // according to the javadoc contents can not be null assert contents != null : "null contents"; switch (type) { case ZIP: return VFS.mountZip(contents, mountPoint, tempFileProvider); case EXPANDED: return VFS.mountZipExpanded(contents, mountPoint, tempFileProvider); case REAL: return VFS.mountReal(contents.getPhysicalFile(), mountPoint); default: throw ServerMessages.MESSAGES.unknownMountType(type); } }
@Override public Closeable mountDeploymentContent( String name, String runtimeName, byte[] deploymentHash, VirtualFile mountPoint, boolean mountExpanded) throws IOException { // Internal deployments have no hash, and are unique by name if (deploymentHash == null) { File file = new File(systemDeployDir, name); return VFS.mountZip(file, mountPoint, tempFileProvider); } final File external = getExternalFileReference(deploymentHash, false); if (external.exists()) { final InputStream is = new FileInputStream(external); try { final BufferedReader reader = new BufferedReader(new InputStreamReader(is)); final String fileName = reader.readLine(); final File realRoot = new File(fileName); if (!realRoot.exists()) { throw new FileNotFoundException(fileName); } return VFS.mountReal(realRoot, mountPoint); } finally { safeClose(is); } } final File content = getDeploymentContentFile(deploymentHash); if (mountExpanded) { return VFS.mountZipExpanded(content, mountPoint, tempFileProvider); } else { return VFS.mountZip(content, mountPoint, tempFileProvider); } }