List of usage examples for com.liferay.portal.util PropsUtil getProperties
public static Properties getProperties(String prefix, boolean removePrefix)
From source file:com.liferay.mail.util.MailSessionFactoryBean.java
License:Open Source License
@Override protected Session createInstance() throws Exception { Properties properties = PropsUtil.getProperties(_propertyPrefix, true); String jndiName = properties.getProperty("jndi.name"); if (Validator.isNotNull(jndiName)) { try {/* w ww. j a v a 2s. com*/ return (Session) JNDIUtil.lookup(new InitialContext(), jndiName); } catch (Exception e) { _log.error("Unable to lookup " + jndiName, e); } } Session session = Session.getInstance(properties); if (_log.isDebugEnabled()) { session.setDebug(true); SortedProperties sortedProperties = new SortedProperties(session.getProperties()); _log.debug("Properties for prefix " + _propertyPrefix); sortedProperties.list(System.out); } return session; }
From source file:com.liferay.portlet.documentlibrary.util.VideoProcessorImpl.java
License:Open Source License
private void _generateVideoXuggler(FileVersion fileVersion, File srcFile, File destFile, String containerType) throws Exception { if (!_isGeneratePreview(fileVersion, containerType)) { return;/*from w w w . j a v a 2 s.com*/ } StopWatch stopWatch = null; if (_log.isInfoEnabled()) { stopWatch = new StopWatch(); stopWatch.start(); } if (PropsValues.DL_FILE_ENTRY_PREVIEW_FORK_PROCESS_ENABLED) { ProcessCallable<String> processCallable = new LiferayVideoProcessCallable(ServerDetector.getServerId(), PropsUtil.get(PropsKeys.LIFERAY_HOME), Log4JUtil.getCustomLogSettings(), srcFile.getCanonicalPath(), destFile.getCanonicalPath(), FileUtil.createTempFileName(), PropsUtil.getProperties(PropsKeys.DL_FILE_ENTRY_PREVIEW_VIDEO, false), PropsUtil.getProperties(PropsKeys.XUGGLER_FFPRESET, true)); ProcessExecutor.execute(processCallable, ClassPathUtil.getPortalClassPath()); } else { LiferayConverter liferayConverter = new LiferayVideoConverter(srcFile.getCanonicalPath(), destFile.getCanonicalPath(), FileUtil.createTempFileName(), PropsUtil.getProperties(PropsKeys.DL_FILE_ENTRY_PREVIEW_VIDEO, false), PropsUtil.getProperties(PropsKeys.XUGGLER_FFPRESET, true)); liferayConverter.convert(); } addFileToStore(fileVersion.getCompanyId(), PREVIEW_PATH, getPreviewFilePath(fileVersion, containerType), destFile); if (_log.isInfoEnabled()) { _log.info("Xuggler generated a " + containerType + " preview video for " + fileVersion.getTitle() + " in " + stopWatch); } }