@Override public CloseableFile getCloseableFile(String ext) throws IOException { return blob.getCloseableFile(ext); }
@Override public CloseableFile getCloseableFile() throws IOException { return blob.getCloseableFile(); }
@Override public ImageInfo getImageInfo(Blob blob) { ImageInfo imageInfo = null; try { String ext = blob.getFilename() == null ? ".tmp" : "." + FilenameUtils.getExtension(blob.getFilename()); try (CloseableFile cf = blob.getCloseableFile(ext)) { imageInfo = ImageIdentifier.getInfo(cf.getFile().getAbsolutePath()); } } catch (CommandNotAvailable | CommandException e) { log.error("Failed to get ImageInfo for file " + blob.getFilename(), e); } catch (IOException e) { log.error("Failed to transfer file " + blob.getFilename(), e); } return imageInfo; }
public void uploadPackage() throws IOException { if (packageToUpload == null) { facesMessages.add(StatusMessage.Severity.WARN, "label.connect.nofile"); return; } PackageUpdateService pus = Framework.getService(PackageUpdateService.class); try (CloseableFile cfile = packageToUpload.getCloseableFile()) { pus.addPackage(cfile.getFile()); } catch (PackageException e) { log.warn(e, e); facesMessages.add(StatusMessage.Severity.ERROR, messages.get("label.connect.wrong.package") + ":" + e.getMessage()); return; } finally { packageFileName = null; packageToUpload = null; } }
public void uploadPackage() throws IOException { if (packageToUpload == null) { facesMessages.add(StatusMessage.Severity.WARN, "label.connect.nofile"); return; } PackageUpdateService pus = Framework.getLocalService(PackageUpdateService.class); try (CloseableFile cfile = packageToUpload.getCloseableFile()) { pus.addPackage(cfile.getFile()); } catch (PackageException e) { log.warn(e, e); facesMessages.add(StatusMessage.Severity.ERROR, messages.get("label.connect.wrong.package") + ":" + e.getMessage()); return; } finally { packageFileName = null; packageToUpload = null; } }
public static VideoInfo getVideoInfo(Blob video) { if (video == null || video.getLength() == 0) { return null; } try { ExecResult result; try (CloseableFile cf = video.getCloseableFile("." + FilenameUtils.getExtension(video.getFilename()))) { CommandLineExecutorService cles = Framework.getService(CommandLineExecutorService.class); CmdParameters params = cles.getDefaultCmdParameters(); params.addNamedParameter("inFilePath", cf.getFile().getAbsolutePath()); // read the duration with a first command to adjust the best rate: result = cles.execCommand(FFMPEG_INFO_COMMAND_LINE, params); } if (!result.isSuccessful()) { throw result.getError(); } return VideoInfo.fromFFmpegOutput(result.getOutput()); } catch (CommandNotAvailable | CommandException | IOException e) { throw new NuxeoException(e); } }
Blob blob = context.getBlob(); ZipFile zip; try (CloseableFile source = blob.getCloseableFile()) { zip = getArchiveFileIfValid(source.getFile()); if (zip == null) {
try (CloseableFile source = blob.getCloseableFile()) { CmdParameters params = cles.getDefaultCmdParameters(); String size = parameters == null ? THUMBNAIL_DEFAULT_SIZE
CoreSession session = context.getSession(); Blob blob = context.getBlob(); try (CloseableFile source = blob.getCloseableFile()) { ZipFile zip = getArchiveFileIfValid(source.getFile()); if (zip == null) {
@Override public DocumentModel createOrUpdate(FileImporterContext context) throws IOException { try (CloseableFile source = context.getBlob().getCloseableFile()) { ZipFile zip = getArchiveFileIfValid(source.getFile()); if (zip == null) {