weaver 2005/01/04 08:11:20 Modified: portal/src/java/org/apache/jetspeed/container/invoker ServletPortletInvoker.java PortletInvokerFactoryImpl.java Removed: portal/src/java/org/apache/jetspeed/container/invoker AbstractPortletInvokerFactory.java ServletPortletInvokerFactory.java LocalPortletInvokerFactory.java Log: PortletInvoker factories has been removed and are now assembled in Spring. Revision Changes Path 1.17 +5 -5 jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvoker.java Index: ServletPortletInvoker.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvoker.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- ServletPortletInvoker.java 24 Aug 2004 14:18:40 -0000 1.16 +++ ServletPortletInvoker.java 4 Jan 2005 16:11:20 -0000 1.17 @@ -73,6 +73,8 @@ protected boolean activated = false; protected String servletMappingName; + + /* (non-Javadoc) * @see org.apache.jetspeed.container.invoker.JetspeedPortletInvoker#passivate() */ @@ -109,9 +111,7 @@ activate(portletDefinition, servletConfig); } - public ServletPortletInvoker() - { - } + /** * @@ -198,7 +198,7 @@ try { - PortletContext portletContext = PortletContextFactory.createPortletContext(appContext, app); + PortletContext portletContext = PortletContextFactory.createPortletContext(appContext, app); PortletConfig portletConfig = new PortletConfigImpl(this.jetspeedConfig, portletContext, portletDefinition); servletRequest.setAttribute(ContainerConstants.METHOD_ID, methodID); 1.11 +35 -50 jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/PortletInvokerFactoryImpl.java Index: PortletInvokerFactoryImpl.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/PortletInvokerFactoryImpl.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- PortletInvokerFactoryImpl.java 8 Mar 2004 00:23:31 -0000 1.10 +++ PortletInvokerFactoryImpl.java 4 Jan 2005 16:11:20 -0000 1.11 @@ -59,16 +59,20 @@ public class PortletInvokerFactoryImpl implements PortletInvokerFactory { + + public final static String INVOKER_SERVLET_MAPPING_NAME = "factory.invoker.servlet.mapping.name"; + public final static String DEFAULT_MAPPING_NAME = "/container"; + private final static Log log = LogFactory.getLog(PortletInvokerFactoryImpl.class); /** The servlet configuration for the Jetspeed portal */ private ServletConfig servletConfig; + + private Map props; + + private PortalContext portalContext; - /** factory for creating servlet-based portlet invokers */ - private ServletPortletInvokerFactory servletInvokerFactory; - - /** factory for creating local portlet invokers */ - private LocalPortletInvokerFactory localInvokerFactory; + /* (non-Javadoc) * @see org.apache.pluto.factory.Factory#init(javax.servlet.ServletConfig, java.util.Map) @@ -77,9 +81,8 @@ throws Exception { servletConfig = config; - PortalContext pc = Jetspeed.getContext(); - servletInvokerFactory = new ServletPortletInvokerFactory(pc); - localInvokerFactory = new LocalPortletInvokerFactory(pc); + portalContext = Jetspeed.getContext(); + props = properties; } /* (non-Javadoc) @@ -105,37 +108,18 @@ if (app.getApplicationType() == MutablePortletApplication.LOCAL) { - // create a local portlet invoker - try - { - invoker = localInvokerFactory.getPortletInvoker(); + invoker = (JetspeedPortletInvoker) props.get("LocalPortletInvoker"); invoker.activate(portletDefinition, servletConfig); - return invoker; - } - catch (Throwable t) - { - log.error("failed to create LOCAL invoker, using default", t); - // try default - invoker = new LocalPortletInvoker(); - invoker.activate(portletDefinition, servletConfig); - return invoker; - } - } - - // create a servlet-based portlet invoker - try - { - invoker = servletInvokerFactory.getPortletInvoker(); - invoker.activate(portletDefinition, servletConfig, servletInvokerFactory.getServletMappingName()); - return invoker; + return invoker; } - catch (Throwable t) + else { - log.error("failed to create SERVLET invoker, using default", t); - invoker = new ServletPortletInvoker(); - invoker.activate(portletDefinition, servletConfig, servletInvokerFactory.getServletMappingName()); + invoker = (JetspeedPortletInvoker) props.get("ServletPortletInvoker"); + String servletMappingName = portalContext.getConfigurationProperty(INVOKER_SERVLET_MAPPING_NAME, DEFAULT_MAPPING_NAME); + invoker.activate(portletDefinition, servletConfig, servletMappingName); return invoker; } + } /* (non-Javadoc) @@ -143,21 +127,22 @@ */ public void releasePortletInvoker(PortletInvoker invoker) { - try - { - if (invoker instanceof ServletPortletInvoker) - { - servletInvokerFactory.releaseObject(invoker); - } - else - { - localInvokerFactory.releaseObject(invoker); - } - } - catch (Exception e) - { - log.error(e); - } + // this is now taken care off by Spring's CommonsPoolingTargetSource +// try +// { +// if (invoker instanceof ServletPortletInvoker) +// { +// servletInvokerFactory.releaseObject(invoker); +// } +// else +// { +// localInvokerFactory.releaseObject(invoker); +// } +// } +// catch (Exception e) +// { +// log.error(e); +// } } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]