001
014
015 package com.liferay.portlet.journal.lar;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.PortalClassLoaderUtil;
020 import com.liferay.portal.util.PropsValues;
021
022
025 public class JournalCreationStrategyFactory {
026
027 public static JournalCreationStrategy getInstance() {
028 if (_journalCreationStrategy == null) {
029 if (_log.isDebugEnabled()) {
030 _log.debug(
031 "Instantiate " + PropsValues.JOURNAL_LAR_CREATION_STRATEGY);
032 }
033
034 ClassLoader classLoader = PortalClassLoaderUtil.getClassLoader();
035
036 try {
037 _journalCreationStrategy =
038 (JournalCreationStrategy)classLoader.loadClass(
039 PropsValues.JOURNAL_LAR_CREATION_STRATEGY).
040 newInstance();
041 }
042 catch (Exception e) {
043 _log.error(e, e);
044 }
045 }
046
047 if (_log.isDebugEnabled()) {
048 _log.debug(
049 "Return " + _journalCreationStrategy.getClass().getName());
050 }
051
052 return _journalCreationStrategy;
053 }
054
055 public static void setInstance(
056 JournalCreationStrategy journalCreationStrategy) {
057
058 if (_log.isDebugEnabled()) {
059 _log.debug("Set " + journalCreationStrategy.getClass().getName());
060 }
061
062 _journalCreationStrategy = journalCreationStrategy;
063 }
064
065 private static Log _log = LogFactoryUtil.getLog(
066 JournalCreationStrategyFactory.class);
067
068 private static JournalCreationStrategy _journalCreationStrategy;
069
070 }