001
014
015 package com.liferay.portal.kernel.util;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019
020
023 public abstract class BasePortalLifecycle implements PortalLifecycle {
024
025 public void portalDestroy() {
026 if (!_calledPortalDestroy) {
027 PortalLifecycleUtil.removeDestroy(this);
028
029 try {
030 doPortalDestroy();
031 }
032 catch (Exception e) {
033 _log.error(e, e);
034 }
035
036 _calledPortalDestroy = true;
037 }
038 }
039
040 public void portalInit() {
041 try {
042 doPortalInit();
043 }
044 catch (Exception e) {
045 _log.error(e, e);
046 }
047 }
048
049 public void registerPortalLifecycle() {
050 PortalLifecycleUtil.register(this);
051 }
052
053 protected abstract void doPortalDestroy() throws Exception;
054
055 protected abstract void doPortalInit() throws Exception;
056
057 private static Log _log = LogFactoryUtil.getLog(BasePortalLifecycle.class);
058
059 private boolean _calledPortalDestroy;
060
061 }