List of usage examples for com.liferay.portal.kernel.util PropsKeys XUGGLER_ENABLED
String XUGGLER_ENABLED
To view the source code for com.liferay.portal.kernel.util PropsKeys XUGGLER_ENABLED.
Click Source Link
From source file:com.liferay.portlet.admin.action.EditServerAction.java
License:Open Source License
protected void updateExternalServices(ActionRequest actionRequest, PortletPreferences preferences) throws Exception { boolean imageMagickEnabled = ParamUtil.getBoolean(actionRequest, "imageMagickEnabled"); String imageMagickPath = ParamUtil.getString(actionRequest, "imageMagickPath"); boolean openOfficeEnabled = ParamUtil.getBoolean(actionRequest, "openOfficeEnabled"); int openOfficePort = ParamUtil.getInteger(actionRequest, "openOfficePort"); boolean xugglerEnabled = ParamUtil.getBoolean(actionRequest, "xugglerEnabled"); preferences.setValue(PropsKeys.IMAGEMAGICK_ENABLED, String.valueOf(imageMagickEnabled)); preferences.setValue(PropsKeys.IMAGEMAGICK_GLOBAL_SEARCH_PATH, imageMagickPath); preferences.setValue(PropsKeys.OPENOFFICE_SERVER_ENABLED, String.valueOf(openOfficeEnabled)); preferences.setValue(PropsKeys.OPENOFFICE_SERVER_PORT, String.valueOf(openOfficePort)); preferences.setValue(PropsKeys.XUGGLER_ENABLED, String.valueOf(xugglerEnabled)); preferences.store();//from w ww . j ava 2 s . c o m PDFProcessorUtil.reset(); }
From source file:com.liferay.portlet.documentlibrary.util.AudioProcessorImpl.java
License:Open Source License
public boolean isSupported(String mimeType) { if (Validator.isNull(mimeType)) { return false; }/*from w w w .jav a2 s . co m*/ try { if (PrefsPropsUtil.getBoolean(PropsKeys.XUGGLER_ENABLED, PropsValues.XUGGLER_ENABLED)) { return _audioMimeTypes.contains(mimeType); } } catch (Exception e) { } return false; }
From source file:com.liferay.portlet.documentlibrary.util.AudioProcessorImpl.java
License:Open Source License
private void _generateAudio(FileVersion fileVersion) throws Exception { String tempFileId = DLUtil.getTempFileId(fileVersion.getFileEntryId(), fileVersion.getVersion()); File audioTempFile = _getAudioTempFile(tempFileId, fileVersion.getExtension()); File previewTempFile = getPreviewTempFile(tempFileId); try {/*from w w w .ja va 2 s .com*/ if (!PrefsPropsUtil.getBoolean(PropsKeys.XUGGLER_ENABLED, PropsValues.XUGGLER_ENABLED) || _hasAudio(fileVersion)) { return; } if (_isGeneratePreview(fileVersion)) { File file = null; if (fileVersion instanceof LiferayFileVersion) { try { LiferayFileVersion liferayFileVersion = (LiferayFileVersion) fileVersion; file = liferayFileVersion.getFile(false); } catch (UnsupportedOperationException uoe) { } } if (file == null) { InputStream inputStream = fileVersion.getContentStream(false); FileUtil.write(audioTempFile, inputStream); file = audioTempFile; } try { _generateAudioXuggler(fileVersion, file, previewTempFile); } catch (Exception e) { _log.error(e, e); } } } catch (NoSuchFileEntryException nsfee) { } finally { _fileVersionIds.remove(fileVersion.getFileVersionId()); FileUtil.delete(audioTempFile); FileUtil.delete(previewTempFile); } }
From source file:com.liferay.portlet.documentlibrary.util.VideoProcessorImpl.java
License:Open Source License
public boolean isSupported(String mimeType) { if (Validator.isNull(mimeType)) { return false; }//from w w w. java 2 s . c om try { if (PrefsPropsUtil.getBoolean(PropsKeys.XUGGLER_ENABLED, PropsValues.XUGGLER_ENABLED)) { return _videoMimeTypes.contains(mimeType); } } catch (Exception e) { } return false; }
From source file:com.liferay.portlet.documentlibrary.util.VideoProcessorImpl.java
License:Open Source License
private void _generateVideo(FileVersion fileVersion) throws Exception { String tempFileId = DLUtil.getTempFileId(fileVersion.getFileEntryId(), fileVersion.getVersion()); File videoTempFile = _getVideoTempFile(tempFileId, fileVersion.getExtension()); File[] previewTempFiles = new File[_PREVIEW_TYPES.length]; for (int i = 0; i < _PREVIEW_TYPES.length; i++) { previewTempFiles[i] = getPreviewTempFile(tempFileId, _PREVIEW_TYPES[i]); }// w w w.j ava 2s . com try { if (!PrefsPropsUtil.getBoolean(PropsKeys.XUGGLER_ENABLED, PropsValues.XUGGLER_ENABLED) || _hasVideo(fileVersion)) { return; } File file = null; if (_isGeneratePreview(fileVersion) || _isGenerateThumbnail(fileVersion)) { if (fileVersion instanceof LiferayFileVersion) { try { LiferayFileVersion liferayFileVersion = (LiferayFileVersion) fileVersion; file = liferayFileVersion.getFile(false); } catch (UnsupportedOperationException uoe) { } } if (file == null) { InputStream inputStream = fileVersion.getContentStream(false); FileUtil.write(videoTempFile, inputStream); file = videoTempFile; } } if (_isGeneratePreview(fileVersion)) { try { _generateVideoXuggler(fileVersion, file, previewTempFiles, PropsValues.DL_FILE_ENTRY_PREVIEW_VIDEO_HEIGHT, PropsValues.DL_FILE_ENTRY_PREVIEW_VIDEO_WIDTH); } catch (Exception e) { _log.error(e, e); } } if (_isGenerateThumbnail(fileVersion)) { try { _generateThumbnailXuggler(fileVersion, file, PropsValues.DL_FILE_ENTRY_PREVIEW_VIDEO_HEIGHT, PropsValues.DL_FILE_ENTRY_PREVIEW_VIDEO_WIDTH); } catch (Exception e) { _log.error(e, e); } } } catch (NoSuchFileEntryException nsfee) { } finally { _fileVersionIds.remove(fileVersion.getFileVersionId()); for (int i = 0; i < previewTempFiles.length; i++) { FileUtil.delete(previewTempFiles[i]); } FileUtil.delete(videoTempFile); } }
From source file:com.liferay.server.admin.web.internal.portlet.action.EditServerMVCActionCommand.java
License:Open Source License
protected void updateExternalServices(ActionRequest actionRequest, PortletPreferences portletPreferences) throws Exception { boolean imageMagickEnabled = ParamUtil.getBoolean(actionRequest, "imageMagickEnabled"); String imageMagickPath = ParamUtil.getString(actionRequest, "imageMagickPath"); boolean xugglerEnabled = ParamUtil.getBoolean(actionRequest, "xugglerEnabled"); portletPreferences.setValue(PropsKeys.IMAGEMAGICK_ENABLED, String.valueOf(imageMagickEnabled)); portletPreferences.setValue(PropsKeys.IMAGEMAGICK_GLOBAL_SEARCH_PATH, imageMagickPath); portletPreferences.setValue(PropsKeys.XUGGLER_ENABLED, String.valueOf(xugglerEnabled)); Enumeration<String> enu = actionRequest.getParameterNames(); while (enu.hasMoreElements()) { String name = enu.nextElement(); if (name.startsWith("imageMagickLimit")) { String key = StringUtil.toLowerCase(name.substring(16)); String value = ParamUtil.getString(actionRequest, name); portletPreferences.setValue(PropsKeys.IMAGEMAGICK_RESOURCE_LIMIT + key, value); }/* w ww . j a v a 2s . co m*/ } portletPreferences.store(); GhostscriptUtil.reset(); ImageMagickUtil.reset(); }