001
014
015 package com.liferay.portal.deploy.hot;
016
017 import com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener;
018 import com.liferay.portal.kernel.deploy.hot.HotDeployEvent;
019 import com.liferay.portal.kernel.deploy.hot.HotDeployException;
020 import com.liferay.portal.kernel.servlet.SecurePluginContextListener;
021
022 import java.lang.reflect.Method;
023
024 import javax.servlet.ServletContext;
025
026
029 public class ServletContextListenerHotDeployListener
030 extends BaseHotDeployListener {
031
032 public void invokeDeploy(HotDeployEvent hotDeployEvent)
033 throws HotDeployException {
034
035 try {
036 doInvokeDeploy(hotDeployEvent);
037 }
038 catch (Throwable t) {
039 throwHotDeployException(
040 hotDeployEvent,
041 "Error registering servlet context listeners for ", t);
042 }
043 }
044
045 public void invokeUndeploy(HotDeployEvent hotDeployEvent)
046 throws HotDeployException {
047
048 try {
049 doInvokeUndeploy(hotDeployEvent);
050 }
051 catch (Throwable t) {
052 throwHotDeployException(
053 hotDeployEvent,
054 "Error unregistering servlet context listeners for ", t);
055 }
056 }
057
058 protected void doInvokeDeploy(HotDeployEvent hotDeployEvent)
059 throws Exception {
060
061 ServletContext servletContext = hotDeployEvent.getServletContext();
062
063 Object securePluginContextListener = servletContext.getAttribute(
064 SecurePluginContextListener.class.getName());
065
066 if (securePluginContextListener != null) {
067 Class<?> clazz = securePluginContextListener.getClass();
068
069 Method method = clazz.getMethod("instantiatingListeners");
070
071 method.invoke(securePluginContextListener);
072 }
073 }
074
075 protected void doInvokeUndeploy(HotDeployEvent hotDeployEvent)
076 throws Exception {
077 }
078
079 }