You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2007/02/04 21:17:33 UTC
svn commit: r503472 - in /portals/pluto/trunk:
pluto-container/src/main/java/org/apache/pluto/
pluto-container/src/main/java/org/apache/pluto/core/
pluto-container/src/main/java/org/apache/pluto/internal/
pluto-container/src/main/java/org/apache/pluto/...
Author: ddewolf
Date: Sun Feb 4 12:17:32 2007
New Revision: 503472
URL: http://svn.apache.org/viewvc?view=rev&rev=503472
Log:
Implementing administrative services; Adding PortletDD description; PLUTO-301
Added:
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java (with props)
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalPortletWindowImpl.java
- copied, changed from r503447, portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletWindowImpl.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/AdministrativeRequestListener.java (with props)
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java (with props)
Removed:
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletWindowImpl.java
Modified:
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/Constants.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/OptionalContainerServices.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletContainer.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletWindow.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortletInvokerService.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/Configuration.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortletInvokerService.java
portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java
portals/pluto/trunk/pluto-descriptor-impl/src/main/resources/org/apache/pluto/descriptors/services/castor/castor-portlet-xml-mapping.xml
portals/pluto/trunk/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java
portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/ContainerServicesImpl.java
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/Constants.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/Constants.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/Constants.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/Constants.java Sun Feb 4 12:17:32 2007
@@ -61,6 +61,7 @@
*/
public final static String METHOD_ID = "org.apache.pluto.core.method";
+
/**
* The unique method identifier for render requests. Render requests are
* requested through a call to the {@link PortletContainer#doRender(org.apache.pluto.PortletWindow,
@@ -78,7 +79,7 @@
public final static Integer METHOD_ACTION = new Integer(3);
/**
- * The unique method identifier for render requests. Render requests are
+ * The unique method identifier for noop (load) requests. Load requests are
* requested through a call to the {@link PortletContainer#doLoad(org.apache.pluto.PortletWindow,
* javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
* method.
@@ -86,4 +87,10 @@
public final static Integer METHOD_NOOP = new Integer(5);
+ /**
+ * The unique method identifier for admin requests. Admin requests
+ * are requested through a call to the {@link PortletContainer#doAdmin(PortletWindow, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}
+ * method.
+ */
+ public final static Integer METHOD_ADMIN = new Integer(7);
}
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/OptionalContainerServices.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/OptionalContainerServices.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/OptionalContainerServices.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/OptionalContainerServices.java Sun Feb 4 12:17:32 2007
@@ -20,6 +20,7 @@
import org.apache.pluto.spi.optional.PortletInvokerService;
import org.apache.pluto.spi.optional.PortletRegistryService;
import org.apache.pluto.spi.optional.PortletInfoService;
+import org.apache.pluto.spi.optional.PortalAdministrationService;
/**
* Defines the services necessary for integration between the Pluto Container
@@ -69,5 +70,13 @@
* @return portlet info service implementation.
*/
PortletInfoService getPortletInfoService();
+
+ /**
+ * Returns the admin service implementation used by
+ * the container.
+ *
+ * @return portal admin service
+ */
+ PortalAdministrationService getPortalAdministrationService();
}
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletContainer.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletContainer.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletContainer.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletContainer.java Sun Feb 4 12:17:32 2007
@@ -71,7 +71,7 @@
/**
* Calls the render method of the given portlet window.
- * @param internalPortletWindow the portlet Window
+ * @param portletWindow the portlet Window
* @param request the servlet request
* @param response the servlet response
* @throws PortletException if one portlet has trouble fulfilling
@@ -80,7 +80,7 @@
* @throws PortletContainerException if the portlet container implementation
* has trouble fulfilling the request
*/
- public void doRender(PortletWindow internalPortletWindow,
+ public void doRender(PortletWindow portletWindow,
HttpServletRequest request,
HttpServletResponse response)
throws PortletException, IOException, PortletContainerException;
@@ -89,7 +89,7 @@
/**
* Indicates that a portlet action occured in the current request and calls
* the processAction method of this portlet.
- * @param internalPortletWindow the portlet Window
+ * @param portletWindow the portlet Window
* @param request the servlet request
* @param response the servlet response
* @throws PortletException if one portlet has trouble fulfilling
@@ -97,14 +97,14 @@
* @throws PortletContainerException if the portlet container implementation
* has trouble fulfilling the request
*/
- public void doAction(PortletWindow internalPortletWindow,
+ public void doAction(PortletWindow portletWindow,
HttpServletRequest request,
HttpServletResponse response)
throws PortletException, IOException, PortletContainerException;
/**
* Indicates that the portlet must be initialized
- * @param internalPortletWindow the portlet Window
+ * @param portletWindow the portlet Window
* @param servletRequest the servlet request
* @param servletResponse the servlet response
* @throws PortletException if one portlet has trouble fulfilling
@@ -112,10 +112,25 @@
* @throws PortletContainerException if the portlet container implementation
* has trouble fulfilling the request
*/
- public void doLoad(PortletWindow internalPortletWindow,
+ public void doLoad(PortletWindow portletWindow,
HttpServletRequest servletRequest,
HttpServletResponse servletResponse)
throws PortletException, IOException, PortletContainerException;
+
+ /**
+ * Indicates that the portal needs to perform administrative
+ * actions upon the portlet and/or portlet application. An
+ * administrative request will be spawned and any registered
+ * handlers invoked.
+ * @param portletWindow the portlet window
+ * @param servletRequest the servlet request
+ * @param servletResponse the servlet response
+ * @throws PortletContainerException if the request can not be fullfilled.
+ */
+ public void doAdmin(PortletWindow portletWindow,
+ HttpServletRequest servletRequest,
+ HttpServletResponse servletResponse)
+ throws PortletException, IOException, PortletContainerException;
/**
* Returns whether the container is already initialized or not.
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletWindow.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletWindow.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletWindow.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletWindow.java Sun Feb 4 12:17:32 2007
@@ -23,7 +23,7 @@
* request should be processed. The PortletWindow is used internally
* to map the request to the configured Portlet Application and Portlet.
*
- * @see org.apache.pluto.internal.impl.PortletWindowImpl
+ * @see org.apache.pluto.internal.impl.InternalPortletWindowImpl
* @see org.apache.pluto.descriptors.portlet.PortletDD
*
* @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java Sun Feb 4 12:17:32 2007
@@ -21,6 +21,7 @@
import org.apache.pluto.spi.optional.PortletInvokerService;
import org.apache.pluto.spi.optional.PortletRegistryService;
import org.apache.pluto.spi.optional.PortletInfoService;
+import org.apache.pluto.spi.optional.PortalAdministrationService;
/**
* Default Optional Container Services implementation.
@@ -37,7 +38,8 @@
private PortletInvokerService portletInvokerService;
private PortletEnvironmentService portletEnvironmentService;
private PortletInfoService portletInfoService;
-
+ private PortalAdministrationService portalAdministrationService;
+
/**
* Constructs an instance using the default portlet preferences service
@@ -48,7 +50,8 @@
portletRegistryService = PortletContextManager.getManager();
portletInvokerService = new DefaultPortletInvokerService();
portletEnvironmentService = new DefaultPortletEnvironmentService();
- portletInfoService = null;
+ portletInfoService = new DefaultPortletInfoService();
+ portalAdministrationService = new DefaultPortalAdministrationService();
}
/**
@@ -74,6 +77,19 @@
if(root.getPortletInvokerService() != null) {
portletInvokerService = root.getPortletInvokerService();
}
+
+ if(root.getPortletEnvironmentService() != null) {
+ portletEnvironmentService = root.getPortletEnvironmentService();
+ }
+
+ if(root.getPortletInfoService() != null) {
+ portletInfoService = root.getPortletInfoService();
+ }
+
+ if(root.getPortalAdministrationService() != null) {
+ portalAdministrationService = root.getPortalAdministrationService();
+ }
+
}
@@ -98,6 +114,10 @@
public PortletInfoService getPortletInfoService() {
return portletInfoService;
+ }
+
+ public PortalAdministrationService getPortalAdministrationService() {
+ return portalAdministrationService;
}
}
Added: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java?view=auto&rev=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java (added)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java Sun Feb 4 12:17:32 2007
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2007 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.core;
+
+import org.apache.pluto.spi.optional.PortalAdministrationService;
+
+import java.util.List;
+import java.util.ArrayList;
+
+public class DefaultPortalAdministrationService implements PortalAdministrationService {
+
+ private List administrativeRequestListeners =
+ new ArrayList();
+
+ public List getAdministrativeRequestListeners() {
+ return administrativeRequestListeners;
+ }
+}
Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java
------------------------------------------------------------------------------
svn:keywords = Id Author Date Rev
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortletInvokerService.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortletInvokerService.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortletInvokerService.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortletInvokerService.java Sun Feb 4 12:17:32 2007
@@ -115,9 +115,18 @@
public void load(PortletRequest request, PortletResponse response, InternalPortletWindow window)
throws IOException, PortletException {
if (LOG.isDebugEnabled()) {
- LOG.debug("Performing Load Invocation");
+ LOG.debug("Performing Load Invocation.");
}
invoke(request, response, window, Constants.METHOD_NOOP);
+ }
+
+ public void admin(PortletRequest request, PortletResponse response, InternalPortletWindow window)
+ throws IOException, PortletException {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("Performing Admin Invocation.");
+ }
+
+ invoke(request, response, window, Constants.METHOD_ADMIN);
}
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java Sun Feb 4 12:17:32 2007
@@ -19,6 +19,7 @@
import java.util.Map;
import javax.portlet.PortletException;
+import javax.portlet.PortletPreferences;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -33,7 +34,11 @@
import org.apache.pluto.internal.InternalRenderRequest;
import org.apache.pluto.internal.InternalRenderResponse;
import org.apache.pluto.internal.InternalActionRequest;
-import org.apache.pluto.internal.impl.PortletWindowImpl;
+import org.apache.pluto.internal.InternalPortletRequest;
+import org.apache.pluto.internal.InternalPortletResponse;
+import org.apache.pluto.internal.impl.InternalPortletWindowImpl;
+import org.apache.pluto.internal.impl.PortletRequestImpl;
+import org.apache.pluto.internal.impl.PortletResponseImpl;
import org.apache.pluto.spi.PortletURLProvider;
import org.apache.pluto.spi.optional.PortletInvokerService;
import org.apache.pluto.OptionalContainerServices;
@@ -41,6 +46,8 @@
import org.apache.pluto.PortletContainerException;
import org.apache.pluto.PortletWindow;
import org.apache.pluto.RequiredContainerServices;
+import org.apache.pluto.PortletContainerRuntimeException;
+import org.apache.pluto.util.StringManager;
/**
* Default Pluto Container implementation.
@@ -55,9 +62,10 @@
/** Internal logger. */
private static final Log LOG = LogFactory.getLog(PortletContainerImpl.class);
-
-
- // Private Member Variables ------------------------------------------------
+
+ private static final StringManager EXCEPTIONS = StringManager.getManager(
+ PortletContainerImpl.class.getPackage().getName());
+
/** The portlet container name. */
private String name = null;
@@ -149,7 +157,10 @@
ensureInitialized();
InternalPortletWindow internalPortletWindow =
- new PortletWindowImpl(servletContext, portletWindow);
+ new InternalPortletWindowImpl(
+ PortletContextManager.getPortletContext(servletContext,
+ portletWindow.getContextPath()),
+ portletWindow);
debugWithName("Render request received for portlet: "
+ portletWindow.getPortletName());
@@ -192,8 +203,11 @@
ensureInitialized();
InternalPortletWindow internalPortletWindow =
- new PortletWindowImpl(servletContext, portletWindow);
- debugWithName("Action request received for portlet: "
+ new InternalPortletWindowImpl(
+ PortletContextManager.getPortletContext(servletContext,
+ portletWindow.getContextPath()), portletWindow);
+
+ debugWithName("Action request received for portlet: "
+ portletWindow.getPortletName());
InternalActionRequest actionRequest = getOptionalContainerServices().getPortletEnvironmentService()
@@ -278,13 +292,18 @@
ensureInitialized();
InternalPortletWindow internalPortletWindow =
- new PortletWindowImpl(servletContext, portletWindow);
+ new InternalPortletWindowImpl(
+ PortletContextManager.getPortletContext(servletContext,
+ portletWindow.getContextPath()),
+ portletWindow);
+
debugWithName("Load request received for portlet: "
+ portletWindow.getPortletName());
InternalRenderRequest renderRequest =
getOptionalContainerServices().getPortletEnvironmentService()
.createRenderRequest(this, request, response, internalPortletWindow);
+
InternalRenderResponse renderResponse =
getOptionalContainerServices().getPortletEnvironmentService()
.createRenderResponse(this, request, response, internalPortletWindow);
@@ -301,6 +320,40 @@
debugWithName("Portlet loaded for: " + portletWindow.getPortletName());
}
+
+ public void doAdmin(PortletWindow portletWindow,
+ HttpServletRequest servletRequest,
+ HttpServletResponse servletResponse)
+ throws PortletException, IOException, PortletContainerException {
+ ensureInitialized();
+
+ InternalPortletWindow internalPortletWindow =
+ new InternalPortletWindowImpl(
+ PortletContextManager.getPortletContext(servletContext,
+ portletWindow.getContextPath()), portletWindow);
+
+ debugWithName("Admin request received for portlet: "
+ +portletWindow.getPortletName());
+
+ InternalPortletRequest internalRequest =
+ new AdminRequest(this, internalPortletWindow, servletRequest) { };
+
+ InternalPortletResponse internalResponse =
+ new AdminResponse(this, internalPortletWindow, servletRequest, servletResponse);
+
+ PortletInvokerService invoker =
+ optionalContainerServices.getPortletInvokerService();
+
+ try {
+ ContainerInvocation.setInvocation(this, internalPortletWindow);
+ invoker.admin(internalRequest, internalResponse, internalPortletWindow);
+ } finally {
+ ContainerInvocation.clearInvocation();
+ }
+
+ debugWithName("Admin request complete.");
+ }
+
public String getName() {
return name;
}
@@ -334,7 +387,7 @@
}
// obtain the context of the portlet
- ServletContext portletCtx = servletContext.getContext(context);
+ ServletContext portletCtx = PortletContextManager.getPortletContext(servletContext, context);
if (portletCtx == null) {
final String msg = "Unable to obtain the servlet context for " +
"portlet context [" + context + "]. Ensure the portlet has " +
@@ -359,8 +412,7 @@
return portletAppDD;
}
-
-
+
// Private Methods ---------------------------------------------------------
/**
@@ -405,5 +457,27 @@
}
+ class AdminRequest extends PortletRequestImpl {
+
+ public AdminRequest(PortletContainer container,
+ InternalPortletWindow internalPortletWindow,
+ HttpServletRequest servletRequest) {
+ super(container, internalPortletWindow, servletRequest);
+ }
+
+ public PortletPreferences getPreferences() {
+ throw new IllegalStateException("Can not access preferences during admin request.");
+ }
+ }
+
+ class AdminResponse extends PortletResponseImpl {
+
+ public AdminResponse(PortletContainer container,
+ InternalPortletWindow internalPortletWindow,
+ HttpServletRequest servletRequest,
+ HttpServletResponse servletResponse) {
+ super(container, internalPortletWindow, servletRequest, servletResponse);
+ }
+ }
}
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java Sun Feb 4 12:17:32 2007
@@ -21,6 +21,7 @@
import org.apache.pluto.descriptors.portlet.PortletAppDD;
import org.apache.pluto.internal.InternalPortletContext;
import org.apache.pluto.internal.PortletDescriptorRegistry;
+import org.apache.pluto.internal.Configuration;
import org.apache.pluto.internal.impl.PortletContextImpl;
import org.apache.pluto.spi.optional.PortletRegistryEvent;
import org.apache.pluto.spi.optional.PortletRegistryListener;
@@ -180,6 +181,16 @@
//
// Utility
+ public static ServletContext getPortletContext(ServletContext portalContext, String portletContextPath) {
+ if(Configuration.preventUnecessaryCrossContext()) {
+ String portalPath = getContextPath(portalContext);
+ if(portalPath.equals(portletContextPath)) {
+ return portalContext;
+ }
+ }
+ return portalContext.getContext(portletContextPath);
+ }
+
/**
* Servlet 2.5 ServletContext.getContextPath() method.
*/
@@ -194,7 +205,7 @@
}
}
- protected String getContextPath(ServletContext context) {
+ protected static String getContextPath(ServletContext context) {
String contextPath = null;
if (contextPathGetter != null) {
try {
@@ -212,8 +223,7 @@
}
private static final String WEB_XML = "/WEB-INF/web.xml";
-
- protected String computeContextPath(ServletContext context) {
+ protected static String computeContextPath(ServletContext context) {
try {
URL webXmlUrl = context.getResource(WEB_XML);
String path = webXmlUrl.toExternalForm();
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java Sun Feb 4 12:17:32 2007
@@ -223,6 +223,10 @@
portlet.processAction(actionRequest, actionResponse);
}
+ else if (methodId == Constants.METHOD_ADMIN) {
+
+ }
+
// The requested method is NOOP: do nothing.
else if (methodId == Constants.METHOD_NOOP) {
// Do nothing.
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/Configuration.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/Configuration.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/Configuration.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/Configuration.java Sun Feb 4 12:17:32 2007
@@ -18,9 +18,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.util.ResourceBundle;
-import java.util.PropertyResourceBundle;
import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
/**
* Central location for Configuration info.
@@ -29,9 +29,9 @@
* @since Jul 2, 2005
*/
public class Configuration {
-
- private static final Log LOG =
- LogFactory.getLog(Configuration.class);
+
+ private static final Log LOG =
+ LogFactory.getLog(Configuration.class);
public static final ResourceBundle BUNDLE =
PropertyResourceBundle.getBundle("org.apache.pluto.core.pluto-configuration");
@@ -39,28 +39,52 @@
private static final String DESCRIPTOR_SERVICE =
"org.apache.pluto.descriptors.services.PortletAppDescriptorService";
+
/**
* org.apache.pluto.ALLOW_BUFFER
*/
private static final String BUFFER_SUPPORT =
"org.apache.pluto.ALLOW_BUFFER";
-
+
+ /**
+ * org.apache.pluto.PREVENT_UNECESSARY_CROSS_CONTEXT
+ */
+ private static final String PREVENT_UNECESSARY_CROSS_CONTEXT =
+ "org.apache.pluto.PREVENT_UNECESSARY_CROSS_CONTEXT";
+
public static String getPortletAppDescriptorServiceImpl() {
- String impl = BUNDLE.getString(DESCRIPTOR_SERVICE);
- if(LOG.isDebugEnabled()) {
- LOG.debug("Using Descriptor Service Impl: "+impl);
+ String impl = BUNDLE.getString(DESCRIPTOR_SERVICE);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Using Descriptor Service Impl: " + impl);
}
return impl;
}
+ private static Boolean buffering;
public static boolean isBufferingSupported() {
- try {
- String buffer = BUNDLE.getString(BUFFER_SUPPORT);
- return Boolean.TRUE.toString().equalsIgnoreCase(buffer);
- } catch(MissingResourceException mre) {
- return false;
+ if (buffering == null) {
+ try {
+ String buffer = BUNDLE.getString(BUFFER_SUPPORT);
+ buffering = new Boolean(buffer);
+ } catch (MissingResourceException mre) {
+ buffering = Boolean.FALSE;
+ }
}
+ return buffering.booleanValue();
+ }
+
+ private static Boolean prevent;
+ public static boolean preventUnecessaryCrossContext() {
+ if (prevent == null) {
+ try {
+ String test = BUNDLE.getString(PREVENT_UNECESSARY_CROSS_CONTEXT);
+ prevent = new Boolean(test);
+ } catch (MissingResourceException mre) {
+ prevent = Boolean.FALSE;
+ }
+ }
+ return prevent.booleanValue();
}
}
Copied: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalPortletWindowImpl.java (from r503447, portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletWindowImpl.java)
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalPortletWindowImpl.java?view=diff&rev=503472&p1=portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletWindowImpl.java&r1=503447&p2=portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalPortletWindowImpl.java&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletWindowImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/InternalPortletWindowImpl.java Sun Feb 4 12:17:32 2007
@@ -32,14 +32,8 @@
* @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
* @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
*/
-public class PortletWindowImpl implements InternalPortletWindow {
+public class InternalPortletWindowImpl implements InternalPortletWindow {
- private static final StringManager EXCEPTIONS = StringManager.getManager(
- PortletWindowImpl.class.getPackage().getName());
-
-
- // Private Member Variables ------------------------------------------------
-
/** The underlying portlet window instance. */
private PortletWindow portletWindow = null;
@@ -62,16 +56,9 @@
* being invoked.
* @param portletWindow the underlying portlet window instance.
*/
- public PortletWindowImpl(ServletContext context,
+ public InternalPortletWindowImpl(ServletContext context,
PortletWindow portletWindow) {
- this.servletContext = context.getContext(
- portletWindow.getContextPath());
- if (servletContext == null) {
- throw new PortletContainerRuntimeException(EXCEPTIONS.getString(
- "error.config.context.null",
- portletWindow.getPortletName(),
- portletWindow.getContextPath()));
- }
+ this.servletContext = context;
this.portletWindow = portletWindow;
}
@@ -107,7 +94,7 @@
public PortletEntity getPortletEntity() {
if (entity == null) {
- entity = new PortletEntityImpl(servletContext, this);
+ entity = new PortletEntityImpl(servletContext, getPortletName());
}
return entity;
}
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java Sun Feb 4 12:17:32 2007
@@ -62,7 +62,7 @@
private ServletContext servletContext = null;
/** The portlet window. */
- private PortletWindow portletWindow = null;
+ private String portletName = null;
/** The cached PortletDD retrieved from the portlet descriptor registry. */
private PortletDD portletDefinition = null;
@@ -73,9 +73,9 @@
// Constructor -------------------------------------------------------------
- PortletEntityImpl(ServletContext servletContext, PortletWindow portletWindow) {
+ PortletEntityImpl(ServletContext servletContext, String portletName) {
this.servletContext = servletContext;
- this.portletWindow = portletWindow;
+ this.portletName = portletName;
}
@@ -86,7 +86,7 @@
* @return the URI to the controller servlet that wraps this portlet.
*/
public String getControllerServletUri() {
- return PREFIX + portletWindow.getPortletName();
+ return PREFIX + portletName;
}
/**
@@ -170,11 +170,7 @@
private void load() {
// Retrieve the cross servlet context for the portlet.
- String contextPath = portletWindow.getContextPath();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Loading portlet definition for context: " + contextPath);
- }
- ServletContext crossContext = servletContext.getContext(contextPath);
+ ServletContext crossContext = servletContext;
if (LOG.isDebugEnabled()) {
LOG.debug("Retrieved cross context: " + crossContext);
}
@@ -185,8 +181,7 @@
.getPortletAppDD(crossContext);
for (Iterator it = appDD.getPortlets().iterator(); it.hasNext(); ) {
PortletDD portletDD = (PortletDD) it.next();
- if (portletDD.getPortletName().equals(
- portletWindow.getPortletName())) {
+ if (portletDD.getPortletName().equals(portletName)) {
portletDefinition = portletDD;
break;
}
Added: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/AdministrativeRequestListener.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/AdministrativeRequestListener.java?view=auto&rev=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/AdministrativeRequestListener.java (added)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/AdministrativeRequestListener.java Sun Feb 4 12:17:32 2007
@@ -0,0 +1,24 @@
+package org.apache.pluto.spi.optional;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+
+/*
+ * Copyright 2007 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public interface AdministrativeRequestListener {
+
+ void administer(PortletRequest request, PortletResponse response);
+}
Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/AdministrativeRequestListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/AdministrativeRequestListener.java
------------------------------------------------------------------------------
svn:keywords = Id Author Date Rev
Added: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java?view=auto&rev=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java (added)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java Sun Feb 4 12:17:32 2007
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2007 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.spi.optional;
+
+import java.util.List;
+
+/**
+ * Provides callback for executing portal administration
+ * tasks within the portlet environment. This is key for
+ * when the portal needs to accessing items such as the
+ * session.
+ *
+ * Example Use Cases:
+ * <ul>
+ * <li>PortletException
+ * <p>The portal wants to ensure that portlets never
+ * become stuck in an unusable state. To make sure
+ * this happens, they want the ability to clear the
+ * session if they repetedly catch exception from
+ * container invocations
+ * </p>
+ * <p>By implementing this services and registering
+ * and administrative request handler, the portal
+ * can invoke the doAdmin method of the container
+ * and then receive the request through the handler
+ * executing within the portlet environment (as
+ * opposed to the portal environment)
+ * </p>
+ * </li>
+ * </ul>
+ */
+public interface PortalAdministrationService {
+
+ List getAdministrativeRequestListeners();
+
+}
Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java
------------------------------------------------------------------------------
svn:keywords = Id Author Date Rev
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortletInvokerService.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortletInvokerService.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortletInvokerService.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortletInvokerService.java Sun Feb 4 12:17:32 2007
@@ -40,5 +40,7 @@
public void load(PortletRequest req, PortletResponse res, InternalPortletWindow window)
throws IOException, PortletException;
-
+
+ public void admin(PortletRequest req, PortletResponse res, InternalPortletWindow window)
+ throws IOException, PortletException;
}
Modified: portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java (original)
+++ portals/pluto/trunk/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java Sun Feb 4 12:17:32 2007
@@ -40,6 +40,9 @@
/** The display name of the portlet. */
private List displayNames = new ArrayList();
+ /** The descriptions of the portlet. */
+ private List descriptions = new ArrayList();
+
private int expirationCache = 0;
/** The class which implements the portlet interface. */
@@ -101,6 +104,14 @@
public void setDisplayNames(List displayNames) {
this.displayNames = displayNames;
+ }
+
+ public List getDescriptions() {
+ return descriptions;
+ }
+
+ public void setDescriptions(List descriptions) {
+ this.descriptions = descriptions;
}
public int getExpirationCache() {
Modified: portals/pluto/trunk/pluto-descriptor-impl/src/main/resources/org/apache/pluto/descriptors/services/castor/castor-portlet-xml-mapping.xml
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-descriptor-impl/src/main/resources/org/apache/pluto/descriptors/services/castor/castor-portlet-xml-mapping.xml?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-descriptor-impl/src/main/resources/org/apache/pluto/descriptors/services/castor/castor-portlet-xml-mapping.xml (original)
+++ portals/pluto/trunk/pluto-descriptor-impl/src/main/resources/org/apache/pluto/descriptors/services/castor/castor-portlet-xml-mapping.xml Sun Feb 4 12:17:32 2007
@@ -65,8 +65,13 @@
</field>
<field name="DisplayNames" type="org.apache.pluto.descriptors.common.DisplayNameDD"
- collection="arraylist">
+ collection="arraylist">
<bind-xml name="display-name" node="element"/>
+ </field>
+
+ <field name="Descriptions" type="org.apache.pluto.descriptors.common.DescriptionDD"
+ collection="arraylist">
+ <bind-xml name="description" node="element"/>
</field>
<field name="ExpirationCache">
Modified: portals/pluto/trunk/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java (original)
+++ portals/pluto/trunk/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java Sun Feb 4 12:17:32 2007
@@ -51,6 +51,7 @@
PortletDD pd = (PortletDD)dd.getPortlets().get(0);
assertEquals(2, pd.getDisplayNames().size());
+ assertEquals(1, pd.getDescriptions().size());
assertEquals("About Portlet", ((DisplayNameDD)pd.getDisplayNames().get(0)).getDisplayName());
assertEquals("en", ((DisplayNameDD)pd.getDisplayNames().get(0)).getLang());
assertEquals("fr", ((DisplayNameDD)pd.getDisplayNames().get(1)).getLang());
Modified: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/ContainerServicesImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/ContainerServicesImpl.java?view=diff&rev=503472&r1=503471&r2=503472
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/ContainerServicesImpl.java (original)
+++ portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/ContainerServicesImpl.java Sun Feb 4 12:17:32 2007
@@ -25,6 +25,7 @@
import org.apache.pluto.spi.optional.PortletInvokerService;
import org.apache.pluto.spi.optional.PortletRegistryService;
import org.apache.pluto.spi.optional.PortletInfoService;
+import org.apache.pluto.spi.optional.PortalAdministrationService;
import javax.portlet.PortalContext;
@@ -97,6 +98,10 @@
}
public PortletInfoService getPortletInfoService() {
+ return null;
+ }
+
+ public PortalAdministrationService getPortalAdministrationService() {
return null;
}
}