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 2005/07/29 18:43:41 UTC
svn commit: r226395 [2/14] - in /portals/pluto/branches/pluto-1.1: ./
binding/ binding/src/java/org/apache/pluto/binding/
binding/src/java/org/apache/pluto/binding/impl/digester/
binding/src/java/org/apache/pluto/binding/util/ binding/src/resources/org...
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainer.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainer.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainer.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainer.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2003,2004 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;
+
+import java.io.IOException;
+
+import javax.portlet.PortletException;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.pluto.services.PortletContainerServices;
+
+/**
+ * The publicized entry point into Pluto. The base functionality of the portlet
+ * container can be enhanced or even modified by PortletContainerServices.
+ * <p/>
+ * <P> The methods of this class have to be called in the following order:
+ * <TABLE> <TR><TH>Method</TH><TH>Description</TH><TH>Constraints</TH></TR>
+ * <TR><TD>{@link #init(javax.servlet.ServletContext)}</TD> <TD>Initialized the
+ * portlet container.</TD> <TD>Performed only once per container
+ * lifecycle.</TD></TR>
+ * <p/>
+ * <TR><TD>{@link #doAction(org.apache.pluto.PortletWindow,
+ * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}</TD>
+ * <TD>Perform the action for the targeted portlet</TD> <TD>Optionally performed
+ * for a single portlet per request</TD></TR>
+ * <p/>
+ * <TR><TD>{@link #doRender(org.apache.pluto.PortletWindow,
+ * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}</TD>
+ * <TD>Render the portlet</TD> <TD>Performed once for each portlet per
+ * request.</TD></TR>
+ * <p/>
+ * <TR><TD>{@link #destroy()}</TD> <TD>Destroy and remove container from
+ * service.</TD> <TD>Performed only once per container lifecylce</TD></TR>
+ * @version $Id: PortletContainer.java 36010 2004-07-30 14:16:06Z ddewolf $
+ */
+public interface PortletContainer {
+
+ /**
+ * Initializes the portlet container.
+ * @param context the servlet configuration
+ * @throws PortletContainerException if an error occurs while initializing
+ * the container
+ */
+ public void init(ServletContext context) throws PortletContainerException;
+
+ /**
+ * Shuts down the portlet container. After calling this method it is no
+ * longer valid to call any method on the portlet container.
+ * @throws PortletContainerException if an error occurs while shutting down
+ * the container
+ */
+ public void destroy() throws PortletContainerException;
+
+ /**
+ * Calls the render method of the given portlet window.
+ * @param internalPortletWindow the portlet Window
+ * @param request the servlet request
+ * @param response the servlet response
+ * @throws PortletException if one portlet has trouble fulfilling
+ * the request
+ * @throws IOException if the streaming causes an I/O problem
+ * @throws PortletContainerException if the portlet container implementation
+ * has trouble fulfilling the request
+ */
+ public void doRender(PortletWindow internalPortletWindow,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws PortletException, IOException, PortletContainerException;
+
+
+ /**
+ * Indicates that a portlet action occured in the current request and calls
+ * the processAction method of this portlet.
+ * @param internalPortletWindow the portlet Window
+ * @param request the servlet request
+ * @param response the servlet response
+ * @throws PortletException if one portlet has trouble fulfilling
+ * the request
+ * @throws PortletContainerExFrom pluto-scm-return-309-apmail-portals-pluto-scm-archive=portals.apache.org@portals.apache.org Fri Jul 29 16:44:44 2005
Return-Path: <pl...@portals.apache.org>
Delivered-To: apmail-portals-pluto-scm-archive@www.apache.org
Received: (qmail 53436 invoked from network); 29 Jul 2005 16:44:44 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199)
by minotaur.apache.org with SMTP; 29 Jul 2005 16:44:44 -0000
Received: (qmail 13159 invoked by uid 500); 29 Jul 2005 16:44:43 -0000
Delivered-To: apmail-portals-pluto-scm-archive@portals.apache.org
Received: (qmail 13075 invoked by uid 500); 29 Jul 2005 16:44:43 -0000
Mailing-List: contact pluto-scm-help@portals.apache.org; run by ezmlm
Precedence: bulk
list-help: <ma...@portals.apache.org>
list-unsubscribe: <ma...@portals.apache.org>
List-Post: <ma...@portals.apache.org>
List-Id: <pluto-scm.portals.apache.org>
Delivered-To: maiception if the portlet container implementation
+ * has trouble fulfilling the request
+ */
+ public void doAction(PortletWindow internalPortletWindow,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws PortletException, IOException, PortletContainerException;
+
+ /**
+ * Indicates that the portlet must be initialized
+ * @param internalPortletWindow the portlet Window
+ * @param servletRequest the servlet request
+ * @param servletResponse the servlet response
+ * @throws PortletException if one portlet has trouble fulfilling
+ * the request
+ * @throws PortletContainerException if the portlet container implementation
+ * has trouble fulfilling the request
+ */
+ public void doLoad(PortletWindow internalPortletWindow,
+ HttpServletRequest ling list pluto-scm@portals.apache.org
Received: (qmail 13048 invoked by uid 99); 29 Jul 2005 16:44:42 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49)
by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jul 2005 09:44:42 -0700
X-ASF-Spam-Status: No, hits=-9.8 required=10.0
tests=ALL_TRUSTED,NO_REAL_NAME
X-Spam-Check-By: apache.org
Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194)
by apache.org (qpsmtpd/0.29) with SMTP; Fri, 29 Jul 2005 09:44:29 -0700
Received: (qmail 53332 invoked by uid 65534); 29 Jul 2005 16:44:34 -0000
Message-ID: <20...@minotaur.apache.org>
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r226395 [6/14] - in /portals/pluto/branches/pluto-1.1: ./
binding/ binding/src/java/org/apache/pluto/binding/
binding/src/java/org/apache/pluto/binding/impl/digester/
binding/src/java/org/apache/pluto/binding/util/ binding/src/resources/org...
Date: Fri, 29 servletRequest,
+ HttpServletResponse servletResponse)
+ throws PortletException, IOException, PortletContainerException;
+
+ /**
+ * Returns whether the container is already initialized or not.
+ * @return <code>true</code> if the container is initialized
+ */
+ public boolean isInitialized();
+
+ /**
+ * Retrieve the unique container name
+ * @return the container name.
+ */
+ public String getName();
+
+ /**
+ * Retreive the container services associated with this container.
+ * @return the container services associated with this container.
+ */
+ public PortletContainerServices getContainerServices();
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerException.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerException.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerException.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerException.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2003,2004 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;
+
+/**
+ * Thrown when aJul 2005 16:43:41 -0000
To: pluto-scm@portals.apache.org
From: ddewolf@apache.org
X-Mailer: svnmailer-1.0.2
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/AbstractAssembler.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/AbstractAssembler.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/AbstractAssembler.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/AbstractAssembler.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in cn internal portlet container exception occurs within Pluto.
+ * This type of exception indicates an error from which the container is not
+ * able to recover.
+ *
+ * @version 1.0
+ */
+public class PortletContainerException extends Exception {
+ private Throwable cause;
+
+ /**
+ * Constructs a new PortletContainerException.
+ * This exception will have no message and no root cause.
+ */
+ public PortletContainerException() {
+
+ }
+
+ /**
+ * Constructs a new PortletContainerException with the given message.
+ * @param text the message explaining the exception occurance
+ */
+ public PortletContainerException(String text) {
+ super(text);
+ }
+
+ /**
+ * Constructs a new PortletContainerException with the given message and
+ * root cause.
+ * @param text the message explaining the exception occurance
+ * @param cause the root cause of the is exception
+ */
+ public PortletContainerException(String text, Throwable cause) {
+ super(text);
+ this.cause = cause;
+ }
+
+ /**
+ * Constructs a new portlet invoker exception when the portlet needs to
+ * throw an exception. The exception's message is based on the localized
+ * message of the underlying exception.
+ * @param cause the root cause
+ */
+ public PortletContainerException(Throwable cause) {
+ super(cause.getLocalizedMessage());
+ this.cause = cause;
+ }
+
+ /**
+ * Returns the exception that cause this portlet exception.
+ * @return the <CODE>Throwable</CODE> that caused this portlet exception.
+ */
+ public Throwable getRootCause() {
+ return (cause);
+ }
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerFactory.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerFactory.java?rev=226395&view=auto
===========================================================ompliance 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.deploy.impl;
+
+import org.apache.pluto.deploy.Assembler;
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+import org.apache.pluto.descriptors.portlet.PortletDD;
+import org.apache.pluto.descriptors.services.PortletAppDescriptorService;
+import org.apache.pluto.descriptors.services.castor.EntityResolverImpl;
+import org.apache.pluto.descriptors.services.castor.PortletAppDescriptorServiceImpl;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.x===================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerFactory.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerFactory.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2004 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;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.lml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.*;
+
+/**
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Nov 8, 2004
+ */
+public abstract class AbstractAssembler implements Assembler {
+
+ private static final String PORTLET_XML = "WEB-INF/portlet.xml";
+
+ private static final String SERVLET_XML = "WEB-INF/web.xml";
+
+ private static final String[] CLASSES = new String[] { };
+
+ private Properties properties;
+
+ public AbstractAssembler() {
+ properties = new Properties();
+ properties.setProperty(OutputKeys.INDENT, "yes");
+ //properties.setProperty("{http://xml.apache.org/xslogging.LogFactory;
+import org.apache.pluto.core.PortletContainerImpl;
+import org.apache.pluto.services.PortletContainerServices;
+import org.apache.pluto.util.ArgumentUtility;
+
+/**
+ * Factory used to create new PortletContainer instances. The factor constructs
+ * the underlying pluto container implementation by using the the given
+ * container services.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Sep 18, 2004
+ */
+public class PortletContainerFactory {
+
+ /** Internal Logger. */
+ private static final Log LOG =
+ LogFactory.getLog(PortletContainerFactory.class);
+
+
+ /**
+ * Singleton instance of the <code>PortletContainerFactory</code>
+ */
+ private static PortletContainerFactory factory;
+
+ /**
+ * Accessor method for the singleton instance of the
+ * <code>PortletContainerFactory</code>.
+ * @return singleton instance of the PortletContainerFactory
+ */
+ public static PortletContainerFactory getIt}indent-amount", "4");
+ }
+
+ public void assemble() throws IOException {
+ InputStream servletIn = getWebResource(SERVLET_XML);
+ InputStream portletIn = getWebResource(PORTLET_XML);
+
+ Document xml = updateWebXML(servletIn, portletIn);
+ setWebResource(SERVLET_XML, xml);
+
+ InputStream in = null;
+ for(int i = 0;i<CLASSES.length;i++) {
+ in = getClass().getClassLoader().getResourceAsStream(CLASSES[i]);
+ setWebResource("WEB-INF/classes/"+CLASSES[i], in);
+ }
+
+ close();
+ }
+
+ protected abstract InputStream getWebResource(String resource)
+ throws IOException;
+
+ protected abstract void setWebResource(String name, InputStream in)
+ throws IOException;
+
+ protected abstract void setWebResource(String name, Document dom)
+ throws IOException;
+
+ protected abstract void close()
+ throws IOException;
+
+ protected void save(Document doc, OutputStream out)
+ throws IOException {
+ try {
+ TransformerFactory fact = TransformerFactory.newInstance();
+ Transformer trans = fact.newTransformer();
+ trans.setOutputProperties(properties);
+ trans.transform(new DOMSource(doc), new StreamResult(out));
+ } catch (TransformerConfigurationException e) {
+ e.printStackTrace();
+ throw new IOException(e.getMessage());
+ } catch (TransformerException e) {
+ e.printStackTrace();
+ throw new IOException(e.getMessage());
+ } finally {
+ out.flush();
+ out.close();
+ }
+ }
+
+ protected void save(InputStream in, OutputStream out)
+ throws IOException {
+ try {
+ int bytesRead = -1;
+ byte[] buffer = new byte[256];
+ while ((bytesRead = in.read(buffer)) != -1) {
+ out.write(buffer, 0, bytesRead);
+ }
+ }
+ finally {
+ out.flush();
+ out.close();
+ nstance() {
+ if (factory == null) {
+ factory = new PortletContainerFactory();
+ }
+ return factory;
+ }
+
+ /**
+ * Hidden constructor.
+ */
+ private PortletContainerFactory() {
+
+ }
+
+ /**
+ * Create a container with the given containerName, initialized from the given
+ * servlet config, and using the given container services.
+ * @param containerName
+ * @param env
+ * @return newly created PortletContainer
+ * @throws PortletContainerException
+ */
+ public PortletContainer createContainer(String containerName,
+ PortletContainerServices env)
+ throws PortletContainerException {
+
+ ArgumentUtility.validateNotNull("environment", env);
+ ArgumentUtility.validateNotEmpty("containerName", containerName);
+
+ PortletContainer container =
+ new PortletContainerImpl(containerName, env);
+
+ if (LOG.isInfoEnabled()) {
+ LOG.i }
+ }
+
+ /**
+ * @todo currently we rely specifically on the castor implementation.
+ * @param servletIn
+ * @param portletIn
+ * @return
+ * @throws IOException
+ */
+ protected Document updateWebXML(InputStream servletIn, InputStream portletIn)
+ throws IOException {
+ PortletAppDescriptorService portletService =
+ new PortletAppDescriptorServiceImpl();
+
+ Document doc = parse(servletIn);
+
+ Collection servlets = new ArrayList();
+ Collection mappings = new ArrayList();
+
+ PortletAppDD portletAppDD = portletService.read(portletIn);
+ List portlets = portletAppDD.getPortlets();
+ for(int i=0;i<portlets.size();i++) {
+ PortletDD portlet = (PortletDD)portlets.get(i);
+ String name = portlet.getPortletName();
+ Element servlet = doc.createElement("servlet");
+
+ Element servletName = doc.createElement("servlet-name");
+ servletName.appendChild(doc.cnfo("Portlet Container [" + containerName + "] created.");
+ }
+ return container;
+ }
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerRuntimeException.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerRuntimeException.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerRuntimeException.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletContainerRuntimeException.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003,2004 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;
+
+/**
+ * Runtime exception thrown when an unexpected condition is encountered.
+ *
+ * @version 1.0
+ */
+public class PortletContainerRuntimeException extends RuntimeException {
+
+ public PortletContainerRuntimeException() {
+
+ }
+
+ public PortletContainerRuntimeException(String message) {
+ super(message);
+ }
+
+ public PortletContainerRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public PortletContainerRuntimeException(Throwable cause) {
+ super(cause);
+ }
+}
Added: portals/pluto/branches/pluto-1.1/plutreateTextNode(name));
+ servlet.appendChild(servletName);
+
+ Element servletClass = doc.createElement("servlet-class");
+ servletClass.appendChild(doc.createTextNode(DISPATCH_SERVLET_CLASS));
+ servlet.appendChild(servletClass);
+
+ Element initParam = doc.createElement("init-param");
+ Element paramName = doc.createElement("param-name");
+ paramName.appendChild(doc.createTextNode("portlet-name"));
+
+ Element paramValue = doc.createElement("param-value");
+ paramValue.appendChild(doc.createTextNode(name));
+
+ initParam.appendChild(paramName);
+ initParam.appendChild(paramValue);
+ servlet.appendChild(initParam);
+
+ Element load = doc.createElement("load-on-startup");
+ load.appendChild(doc.createTextNode("1"));
+ servlet.appendChild(load);
+
+ Element mapping = doc.createElement("servlet-mapping");
+ servletName = doc.createElement("servlet-name");
+ servletName.appendChild(doc.createTextNode(name));
+ Element uri = doc.createElement("url-pattern");
+ uri.appendChild(doc.createTextNode("/PlutoInvoker/"+name));
+ mapping.appendChild(servletName);
+ mapping.appendChild(uri);
+
+ servlets.add(servlet);
+ mappings.add(mapping);
+ }
+
+
+ Element webAppNode = (Element)doc.getDocumentElement();
+ NodeList nodes = webAppNode.getChildNodes();
+
+ // Find the first node that shouldn't be before the servlet
+ // and start appending. This is kind of ugly, but the hack
+ // works for now!
+ for(int i=0;i<nodes.getLength();i++) {
+ Node node = nodes.item(i);
+ if(node.getNodeType() == Node.ELEMENT_NODE) {
+ if(!BEFORE_SERVLET_DEF.contains(node.getNodeName())) {
+ Iterator it = servlets.iterator();
+ while(it.hasNext()) {
+ o-container/src/main/java/org/apache/pluto/PortletWindow.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletWindow.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletWindow.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/PortletWindow.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004 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;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
+import org.apache.pluto.om.ObjectID;
+
+/**
+ * Thin representation of the portlet window for which the container
+ * request should be processed. The PortletWindow is used internally
+ * to map the request to the configured Portlet Application and Portlet.
+ *
+ * @see org.apache.pluto.core.InternalPortletWindow
+ * @see org.apache.pluto.descriptors.portlet.PortletDD
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Sep 22, 2004
+ */
+public interface PortletWindow {
+
+ /**
+ * Retrieve this windows unique id which will be
+ * used to communicate back to the referencing portal.
+ * @return unique id.
+ */
+ ObjectID getId();
+
+ /**
+ * Retrieve the context path in which the P Node servlet = (Node)it.next();
+ webAppNode.insertBefore(servlet, node);
+ it.remove();
+ }
+ }
+
+ if(!BEFORE_SERVLET_MAPPING_DEF.contains(node.getNodeName())) {
+ Iterator it = mappings.iterator();
+ while(it.hasNext()) {
+ Node mapping = (Node)it.next();
+ webAppNode.insertBefore(mapping, node);
+ it.remove();
+ }
+ }
+ }
+ }
+
+ // Now, in case there are not any nodes after the servlet def!
+ Iterator it = servlets.iterator();
+ while(it.hasNext()) {
+ webAppNode.appendChild((Node)it.next());
+ }
+
+ it = mappings.iterator();
+ while(it.hasNext()) {
+ webAppNode.appendChild((Node)it.next());
+ }
+
+ return doc;
+ }
+
+ private static final Collection BEFORE_SERVLET_DEF = new ArrayList();
+
+ private static final Collection BEFORE_SERVLET_MAPPING_DEF = new ArrayList();
+
+ static {
+ BEFORE_SERVLET_DEF.add("icon");
+ BEFORE_SERVLET_DEF.add("display-name");
+ BEFORE_SERVLET_DEF.add("description");
+ BEFORE_SERVLET_DEF.add("distributable");
+ BEFORE_SERVLET_DEF.add("context-param");
+ BEFORE_SERVLET_DEF.add("filter");
+ BEFORE_SERVLET_DEF.add("filter-mapping");
+ BEFORE_SERVLET_DEF.add("listener");
+
+ BEFORE_SERVLET_MAPPING_DEF.addAll(BEFORE_SERVLET_DEF);
+ BEFORE_SERVLET_MAPPING_DEF.add("servlet");
+ }
+
+ private Document parse(InputStream in)
+ throws IOException {
+ Document doc = null;
+ try {
+ DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = fact.newDocumentBuilder();
+ builder.setEntityResolver(new EntityResolverImpl());
+ doc = builder.parse(in);
+ } catch (ParserConfiguortlet resides.
+ * @return context path
+ */
+ String getContextPath();
+
+ /**
+ * Retrieve the name of the portlet as configured in the
+ * <code>portlet.xml</code>.
+ * @return the name of the portlet.
+ */
+ String getPortletName();
+
+ /**
+ * Retrieve the current window state for this window.
+ * @return the current window state.
+ */
+ WindowState getWindowState();
+
+ /**
+ * Retrieve the current portlet mode for this window.
+ * @return the current portlet mode.
+ */
+ PortletMode getPortletMode();
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/Configuration.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/Configuration.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/Configuration.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/Configuration.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2003,2004 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ResourceBundle;
+import java.util.PropertyResourceBundle;
+
+/**
+ *rationException e) {
+ throw new IOException(e.getMessage());
+ } catch (SAXException e) {
+ throw new IOException(e.getMessage());
+ }
+ return doc;
+ }
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ArchivedFileAssembler.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ArchivedFileAssembler.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ArchivedFileAssembler.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ArchivedFileAssembler.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2004 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.deploy.impl;
+
+import org.w3c.dom.Document;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+
+/**
+ * Used to assemble a web application into a portlet application.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Oct 15, 2 Central location for Configuration info.
+ *
+ * @author ddewolf@apache.org
+ * @since Jul 2, 2005
+ */
+class Configuration {
+
+ private static final Log LOG =
+ LogFactory.getLog(Configuration.class);
+
+ public static final ResourceBundle BUNDLE =
+ PropertyResourceBundle.getBundle("org.apache.pluto.core.pluto-configuration");
+
+ private static final String DESCRIPTOR_SERVICE =
+ "org.apache.pluto.descriptors.services.PortletAppDescriptorService";
+
+
+ public static String getPortletAppDescriptorServiceImpl() {
+ String impl = BUNDLE.getString(DESCRIPTOR_SERVICE);
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("Using Descriptor Service Impl: "+impl);
+ }
+ return impl;
+ }
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalActionResponse.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalActionResponse.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalActionResponse.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalActionResponse.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2003,2004 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
+ * limitatio004
+ */
+public class ArchivedFileAssembler extends AbstractAssembler {
+
+ private JarFile war;
+ private File destination;
+
+ private Map entries = new java.util.HashMap();
+
+ public ArchivedFileAssembler(JarFile war, File destination) {
+ this.war = war;
+ this.destination = destination;
+ }
+
+
+ protected InputStream getWebResource(String name)
+ throws IOException {
+ JarEntry entry = war.getJarEntry(name);
+ if(entry!=null) {
+ return war.getInputStream(entry);
+ }
+ return null;
+ }
+
+ protected void setWebResource(String name, InputStream in)
+ throws IOException {
+
+ }
+
+ protected void setWebResource(String name, Document doc)
+ throws IOException {
+
+ }
+
+
+ protected void close() throws IOException {
+ File file = new File(destination+".tmp");
+ FileOutputStream fout = new FileOutputStream(file);
+ JarOutputStream out = new JarOutputStream(fout);
+
+ Enumeration enumeration = war.entries();
+ while(enumeration.hasMoreElements()) {
+ JarEntry entry = (JarEntry)enumeration.nextElement();
+ entry = new JarEntry(entry.getName());
+ InputStream is = null;
+ if(!entries.containsKey(entry.getName())) {
+ is = war.getInputStream(entry);
+ out.putNextEntry(new JarEntry(entry));
+ save(is, out);
+ }
+ }
+
+ Iterator it = entries.keySet().iterator();
+ while(it.hasNext()) {
+ String name = it.next().toString();
+ InputStream in = (InputStream)entries.get(name);
+ out.putNextEntry(new JarEntry(name));
+ save(in, out);
+ }
+ out.flush();
+ out.close();
+
+ destination.delete();
+ file.renameTo(destination);
+ file.delete();
+ }
+}
+
+
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ExplodedFileAssembler.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ExplodedFileAssembler.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ExplodedFileAssembler.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/ExplodedFileAssembler.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2004 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, ens under the License.
+ */
+/*
+
+ */
+
+package org.apache.pluto.core;
+
+import java.util.Map;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
+/**
+ * ActionResponse implemntation.
+ *
+ */
+public interface InternalActionResponse extends InternalPortletResponse {
+
+ /**
+ * Retrieve the render parameters associated with
+ * this response.
+ *
+ * @return map of all render parameters associated with this request.
+ */
+ public Map getRenderParameters();
+
+ /**
+ * Retrieve the portlet mode.
+ * @return the changed portlet mode.
+ */
+ public PortletMode getChangedPortletMode();
+
+ /**
+ * Retrieve the window state.
+ * @return the changed window state.
+ */
+ public WindowState getChangedWindowState();
+
+ /**
+ * Retreive the location for which the action should
+ * be redirected.
+ * @return the redirect location.
+ */
+ public String getRedirectLocation();
+}
+
+
Added: portals/pluto/branchither express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.deploy.impl;
+
+import org.w3c.dom.Document;
+
+import java.io.*;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Used to assemble a web application into a portlet application.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Oct 15, 2004
+ */
+public class ExplodedFileAssembler extends AbstractAssembler {
+
+
+ private File source;
+ private File destination;
+
+ private Map documents = new java.util.HashMap();
+ private Map streams = new java.util.HashMap();
+
+ public ExplodedFileAssembler(File webapp) {
+ this(webapp, webapp);
+ }
+
+ public ExplodedFileAssembler(File webapp, File destination) {
+ this.source = webapp;
+ this.destination = destination;
+ destination.mkdirs();
+ }
+
+
+ protected InputStream getWebResource(String resoes/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletConfig.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletConfig.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletConfig.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletConfig.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2003,2004 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 javax.portlet.PortletConfig;
+import javax.servlet.ServletConfig;
+
+import org.apache.pluto.descriptors.portlet.PortletDD;
+
+public interface InternalPortletConfig extends PortletConfig {
+
+ public ServletConfig getServletConfig();
+
+ public PortletDD getPortletDefinition();
+}
+
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletContext.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletContext.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/orgurce) throws IOException {
+ File file = new File(source, resource);
+ return new FileInputStream(file);
+ }
+
+ protected void setWebResource(String name, InputStream in)
+ throws IOException {
+ streams.put(name, in);
+ }
+
+ protected void setWebResource(String name, Document dom)
+ throws IOException {
+ documents.put(name, dom);
+ }
+
+ protected void close() throws IOException {
+ if(!source.equals(destination)) {
+ copyRecursive(source, destination);
+ }
+
+ Iterator it = documents.keySet().iterator();
+ while(it.hasNext()) {
+ String name = it.next().toString();
+ Document doc = (Document)documents.get(name);
+ File file = new File(destination, name);
+ file.getParentFile().mkdirs();
+ OutputStream out = new FileOutputStream(file);
+ save(doc, out);
+ }
+
+ it = streams.keySet().iterator();
+ while(it.hasNext()) {
+ /apache/pluto/core/InternalPortletContext.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletContext.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2003,2004 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 javax.portlet.PortletContext;
+import javax.servlet.ServletContext;
+
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+
+public interface InternalPortletContext extends PortletContext {
+
+ public ServletContext getServletContext();
+
+ public PortletAppDD getPortletApplicationDefinition();
+}
+
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletRequest.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletRequest.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletRequest.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletRequest.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except String name = it.next().toString();
+ InputStream in = (InputStream) streams.get(name);
+ File file = new File(destination, name);
+ file.getParentFile().mkdirs();
+ OutputStream out = new FileOutputStream(file);
+ save(in, out);
+ }
+ }
+
+ private void copyRecursive(File source, File dest) throws IOException {
+ File[] files = source.listFiles();
+ for(int i=0;i<files.length;i++) {
+ File destFile = new File(dest, files[i].getName());
+ if(files[i].isDirectory()) {
+ copyRecursive(files[i], destFile);
+ }
+ else {
+ FileInputStream in = new FileInputStream(files[i]);
+ FileOutputStream out = new FileOutputStream(destFile);
+ save(in, out);
+ }
+ }
+ }
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/FileSystemDeployer.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/FileSystemDeployer.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/FileSystemDeployer.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/FileSystemDeployer.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004 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 impin 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 javax.portlet.PortletRequest;
+import javax.portlet.PortletContext;
+
+public interface InternalPortletRequest extends PortletRequest {
+
+
+ void setPortletContext(PortletContext context);
+
+ InternalPortletWindow getInternalPortletWindow();
+
+ void setIncluded(boolean included);
+
+ boolean isIncluded();
+}
+
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletResponse.java
URL: http://svn.apache.org/viewcvs/portals/plutolied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.deploy.impl;
+
+import org.apache.pluto.deploy.Deployer;
+import org.apache.pluto.deploy.DeploymentConfig;
+import org.apache.pluto.deploy.DeploymentException;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Oct 15, 2004
+ */
+public abstract class FileSystemDeployer implements Deployer {
+
+ public FileSystemDeployer() {
+
+ }
+
+ public void deploy(DeploymentConfig config, InputStream webapp)
+ throws IOException, DeploymentException {
+
+ File dir = getWebApplicationDirectory(config);
+ File file = new File(dir, config.getDeploymentName()+".war");
+
+ FileOutputStream out = new FileOutputStream(file);
+
+ int read = -1;
+ byte[] bits = new byte[256];
+ /branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletResponse.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletResponse.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletResponse.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2003,2004 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;
+
+
+public interface InternalPortletResponse {
+
+ public void lateInit(
+ javax.servlet.http.HttpServletRequest webModuleServletRequest,
+ javax.servlet.http.HttpServletResponse webModuleServletResponse);
+
+ public InternalPortletWindow getInternalPortletWindow();
+
+ public void setIncluded(boolean included);
+
+ public boolean isIncluded();
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletWindow.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletWindow.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletWindow.java (added)
+++ port while( (read = webapp.read(bits)) != -1) {
+ out.write(bits, 0, read);
+ }
+
+ out.flush();
+ out.close();
+
+ configure(config);
+
+ }
+
+
+ /**
+ * Retrieve the directory to which the webapp
+ * should be deployed.
+ * @return
+ */
+ protected abstract File getWebApplicationDirectory(DeploymentConfig config)
+ throws DeploymentException;
+
+ /**
+ * Configure the deployment.
+ * @param config
+ */
+ protected abstract void configure(DeploymentConfig config)
+ throws DeploymentException, IOException;
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/Tomcat4FileSystemDeployer.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/Tomcat4FileSystemDeployer.java?rev=226395&view=auto
==============================================================================
--- portals/plutoals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/InternalPortletWindow.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2003,2004 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 javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+import javax.servlet.ServletContext;
+
+import org.apache.pluto.PortletWindow;
+import org.apache.pluto.PortletCont/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/Tomcat4FileSystemDeployer.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/Tomcat4FileSystemDeployer.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2004 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.deploy.impl;
+
+import org.apache.pluto.deploy.DeploymentConfig;
+import org.apache.pluainerRuntimeException;
+import org.apache.pluto.util.StringManager;
+import org.apache.pluto.om.ObjectID;
+
+
+/**
+ * <P> The <CODE>InternalPortletWindow</CODE> interface represents a single
+ * window of a portlet instance as it can be shown only once on a single page.
+ * There is a one-to-one relation between portlet windows and portlet entities.
+ * Adding the same portlet e.g. twice on a page results in two different
+ * windows. </P> <P> This interface defines the model as known from the MVC
+ * pattern. Its purpose is to provide read access to the data stored in the
+ * model. </P>
+ */
+public class InternalPortletWindow implements PortletWindow {
+
+ private static final StringManager EXCEPTIONS =
+ StringManager.getManager(InternalPortletWindow.class.getPackage().getName());
+
+ private PortletWindow window;
+ private ServletContext context;
+
+ private ObjectID id;
+ private PortletEntity entity;
+
+ /**
+ * @param ctx the ServletContext from which this window ito.deploy.DeploymentException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Oct 28, 2004
+ */
+public class Tomcat4FileSystemDeployer extends FileSystemDeployer {
+
+ private File tomcatHome = null;
+
+ public Tomcat4FileSystemDeployer() {
+
+ }
+
+ protected File getWebApplicationDirectory(DeploymentConfig config)
+ throws DeploymentException {
+ File dir = new File(getTomcatHome(config), "webapps");
+ dir.mkdirs();
+ return dir;
+ }
+
+ protected void configure(DeploymentConfig config)
+ throws DeploymentException, IOException {
+ File conf = new File(getConfigDir(config), config.getDeploymentName()+".xml");
+ PrintWriter out = new PrintWriter(new FileWriter(conf));
+ out.print("<Context path=\"/");
+ out.print(config.getDeploymentName());
+ out.print("\" docBase=\"s being
+ * invoked.
+ * @param window the underlying window instance.
+ */
+ public InternalPortletWindow(ServletContext ctx, PortletWindow window) {
+ this.context = ctx.getContext(window.getContextPath());
+ if(context == null) {
+ throw new PortletContainerRuntimeException(
+ EXCEPTIONS.getString(
+ "error.config.context.null",
+ window.getPortletName(),
+ window.getContextPath()
+ )
+ );
+ }
+ this.window = window;
+ }
+
+ /**
+ * Standard Getter.
+ * @return the context path.
+ */
+ public String getContextPath() {
+ return window.getContextPath();
+ }
+
+ /**
+ * Standard getter.
+ * @return the portlet name as defined in the deployment descriptor.
+ */
+ public String getPortletName() {
+ return window.getPortletName();
+ }
+
+ /**
+ * Standard getter.
+ * @return the w");
+ out.print(config.getDeploymentName()+".war");
+ out.println("\" crossContext=\"true\">");
+ out.println("</Context>");
+
+ out.flush();
+ out.close();
+ }
+
+ protected File getTomcatHome(DeploymentConfig config) throws DeploymentException {
+ if(tomcatHome == null) {
+ String file = config.getDeploymentProperty("tomcat.home");
+ if(file == null) {
+ throw new DeploymentException("tomcat.home not defined");
+ }
+ tomcatHome = new File(file);
+ tomcatHome.mkdirs();
+ }
+ return tomcatHome;
+ }
+
+ protected File getConfigDir(DeploymentConfig config)
+ throws DeploymentException {
+ File dir = new File(getTomcatHome(config), "conf");
+ return dir;
+ }
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/Tomcat5FileSystemDeployer.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.indow state.
+ */
+ public WindowState getWindowState() {
+ return window.getWindowState();
+ }
+
+ /**
+ * Standard getter.
+ * @return the portlet mode the portlet mode
+ */
+ public PortletMode getPortletMode() {
+ return window.getPortletMode();
+ }
+
+
+ /**
+ * Returns the identifier of this portlet instance window as object id. The
+ * return value cannot be NULL.
+ * @return the object identifier
+ */
+ public ObjectID getId() {
+ return window.getId();
+ }
+
+ /**
+ * The Context from which this window can be serviced.
+ * @return the associated servlet context.
+ */
+ public ServletContext getServletContext() {
+ return context;
+ }
+
+ /**
+ * Returns the portlet entity. The return value cannot be NULL.
+ * @return the portlet entity
+ */
+ public PortletEntity getPortletEntity() {
+ if (entity == null) {
+ entity = new PortletEntity(context, this);
+ }1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/Tomcat5FileSystemDeployer.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/Tomcat5FileSystemDeployer.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/impl/Tomcat5FileSystemDeployer.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2004 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
+ return entity;
+ }
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,273 @@
+/*
+ * Copyright 2004 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 for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.deploy.impl;
+
+import org.apache.pluto.deploy.DeploymentConfig;
+import org.apache.pluto.deploy.DeploymentException;
+
+import java.io.File;
+
+/**
+ * Deployer used to deploy portlet applications to a Tomcat 5
+ * installation via the file system. This deployer performs
+ * a simple copy of the assembled application into the webapps
+ * directory and creates a context configuration file under
+ * the ${tomcat.home}/conf/${tomcat.service}/${tomcat.host}
+ * directory.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Oct 28, 2004
+ */
+public class Tomcat5FileSystemDeployer extends Tomcat4FileSystemDeployer {
+
+ /**
+ * Retrieve the configuration directory for the deployment.
+ *
+ * @param config
+ * @return
+ * @throws DeploymentException
+ */
+ protected File getConfigDir(DeploymentConfig config) throws DeploymentEagreed 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 java.io.IOException;
+import java.util.Map;
+
+import javax.portlet.PortletException;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.pluto.PortletContainer;
+import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.PortletWindow;
+import org.apache.pluto.core.impl.ActionRequestImpl;
+import org.apache.pluto.core.impl.ActionResponseImpl;
+import org.apache.pluto.core.impl.RenderRequestImpl;
+import org.apache.pluto.core.impl.RenderResponseImpl;
+import org.apache.pluto.servicxception {
+ File dir = super.getConfigDir(config);
+ String serv = config.getDeploymentProperty("tomcat.service");
+ if(serv == null) {
+ throw new DeploymentException("tomcat.service is not defined");
+ }
+ dir = new File(dir, serv);
+ String host = config.getDeploymentProperty("tomcat.host");
+ if(host == null) {
+ throw new DeploymentException("tomcat.host is not defined");
+ }
+ dir = new File(dir, host);
+ dir.mkdirs();
+ return dir;
+ }
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/MavenDeploymentConfig.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/MavenDeploymentConfig.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/mavees.PortletContainerServices;
+import org.apache.pluto.services.PortletURLProvider;
+
+/**
+ * Default Pluto Container implementation.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Sep 18, 2004
+ */
+public class PortletContainerImpl implements PortletContainer {
+
+ /** Internal logger. */
+ private static final Log LOG =
+ LogFactory.getLog(PortletContainerImpl.class);
+
+ /** The portlet container name. */
+ private String name;
+
+ /** The PortletContainerServices associated with this container. */
+ private PortletContainerServices containerServices;
+
+ /** The ServletContext associated with this container. */
+ private ServletContext context;
+
+ /** Flag indicating whether or not we've been initialized. */
+ private boolean initialized;
+
+ /** Default Constructor. Create a container implementation
+ * whith the given name and given services.
+ *
+ * @param name the name of the container.
+ * @paramn/MavenDeploymentConfig.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/MavenDeploymentConfig.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2004 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.deploy.maven;
+
+import org.apache.commons.jelly.JellyContext;
+import org.apache.pluto.deploy.DeploymentConfig;
+
+/**
+ * Deployment Configuration used for Maven goal services the container services implementation.
+ */
+ public PortletContainerImpl(String name,
+ PortletContainerServices services) {
+ this.name = name;
+ this.containerServices = services;
+ }
+
+ /**
+ * Initialize the container for use within the given configuration scope.
+ * @param context
+ */
+ public void init(ServletContext context) {
+ this.context = context;
+ initialized = true;
+ if (LOG.isInfoEnabled()) {
+ LOG.debug("Portlet Container [" + name +
+ "] successfully initialized.");
+ }
+ }
+
+ /**
+ * Determine whether this container has been initialized or not.
+ * @return true if the container has been initialized.
+ */
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ /**
+ * Destroy this container.
+ */
+ public void destroy() {
+ this.context = null;
+ initialized = false;
+ }
+
+
+s.
+ * Exposes the JellyContext underwhich Maven is executing
+ * so that the Variables can be used as deployment properties.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Oct 28, 2004
+ *
+ */
+class MavenDeploymentConfig extends DeploymentConfig {
+
+ private JellyContext context;
+
+ MavenDeploymentConfig(String name, JellyContext context) {
+ super(name);
+ this.context = context;
+ }
+
+ public String getDeploymentProperty(String key) {
+ String val = System.getProperty(key);
+ if(val == null) {
+ val = System.getProperty("maven."+key);
+ }
+
+ if(val == null) {
+ val = (String)context.getVariable(key);
+ }
+
+ if(val == null) {
+ val = (String)context.getVariable("maven."+key);
+ }
+ return val==null?null:val.toString();
+ }
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoAssemblerTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoAssemblerTag.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoAssemblerTag.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoAssemblerTag.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2004 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 AN /**
+ * Render the portlet associated with the specified window.
+ * @param pWindow
+ * @param request
+ * @param response
+ * @throws PortletException
+ * @throws IOException
+ * @throws PortletContainerException
+ */
+ public void doRender(PortletWindow pWindow,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws PortletException, IOException, PortletContainerException {
+
+ InternalPortletWindow window = new InternalPortletWindow(context, pWindow);
+
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Portlet Container [" + name +
+ "]: Render request recieved.");
+ }
+
+ RenderRequestImpl req =
+ new RenderRequestImpl(this, window, request);
+
+ RenderResponseImpl res =
+ new RenderResponseImpl(this, window, request, response);
+
+ PortletInvoker invoker = new PortletInvoker(window);
+
+ if (LOG.isDeY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.deploy.maven;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.jelly.TagSupport;
+import org.apache.commons.jelly.XMLOutput;
+import org.apache.commons.jelly.MissingAttributeException;
+import org.apache.commons.jelly.JellyTagException;
+import org.apache.pluto.deploy.Assembler;
+import org.apache.pluto.deploy.AssemblerFactory;
+
+/**
+ * Tag which is used to assemble portlet applications.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Oct 27, 2004
+ */
+public class PlutoAssemblerTag extends TagSupport {
+
+ private Assembler assembler;
+
+ public PlutoAssemblerTag() {
+ }
+
+ public void doTag(XMLOutput xmlOutput) throws MissingAttributeException,
+ JellyTagException {
+
+ String src = (StringbugEnabled()) {
+ LOG.debug("Portlet Container [" + name + "]: Invoker Created.");
+ }
+
+ invoker.render(req, res);
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Portlet Container [" + name + "]: Portlet rendered.");
+ }
+ }
+
+ /**
+ * Process the action for the portlet associated with the given action.
+ * @param pWindow
+ * @param request
+ * @param response
+ * @throws PortletException
+ * @throws IOException
+ * @throws PortletContainerException
+ */
+ public void doAction(PortletWindow pWindow,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws PortletException, IOException, PortletContainerException {
+
+ InternalPortletWindow window =
+ new InternalPortletWindow(context, pWindow);
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Portlet Container [" + name + "] Action request recieved");
+ }
+
+ )context.getVariable("maven.pluto.src.webapp");
+ File source = new File(src);
+
+ try {
+ // BIG HACK! Why doesn't Maven like Transformers?
+ // I think it probably does a System.setProperties(Props)
+ // and overrides the dflt prop.
+ // xalan comes with jdk1.4.0x so we're kinda safe to do this
+ if(System.getProperty("javax.xml.transform.TransformerFactory")==null) {
+ System.setProperty(
+ "javax.xml.transform.TransformerFactory",
+ "org.apache.xalan.processor.TransformerFactoryImpl"
+ );
+ }
+ assembler = AssemblerFactory.getFactory().
+ createAssembler(source, source);
+ assembler.assemble();
+ }
+ catch(IOException io) {
+ io.printStackTrace();
+ throw new JellyTagException(io);
+ }
+ catch(RuntimeException re) {
+ re.printStackTrace();
+ throw re;
ActionRequestImpl req =
+ new ActionRequestImpl(this, window, request);
+
+ ActionResponseImpl res =
+ new ActionResponseImpl(this, window, request, response);
+
+ PortletInvoker invoker = new PortletInvoker(window);
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Portlet Container [" + name + "]: Invoker Created.");
+ }
+ invoker.action(req, res);
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(
+ "Portlet Container [" + name + "]: Portlet Action performed.");
+ }
+
+ String location = res.getRedirectLocation();
+
+ if (location == null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(
+ "Portlet Container [" + name +
+ "]: No redirect location specified.");
+ }
+
+ PortletURLProvider redirectURL =
+ containerServices.getDynamicInformationProvider(request)
+ .getPortletURLProvider(+ }
+ catch(Error error) {
+ error.printStackTrace();
+ throw error;
+ }
+ }
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoDeployTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoDeployTag.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoDeployTag.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoDeployTag.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004 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
+ *
+ * hwindow);
+
+ if (res.getChangedPortletMode() != null) {
+ redirectURL.setPortletMode(res.getChangedPortletMode());
+ }
+
+ if (res.getChangedWindowState() != null) {
+ redirectURL.setWindowState(res.getChangedWindowState());
+ }
+
+ Map renderParameters = res.getRenderParameters();
+ redirectURL.clearParameters();
+ redirectURL.setParameters(renderParameters);
+ redirectURL.setAction(false);
+
+ if (req.isSecure()) {
+ redirectURL.setSecure();
+ }
+ location = res.encodeRedirectURL(redirectURL.toString());
+ }
+
+ // Here we intentionally use the original response
+ // instead of the wrapped internal response.
+ response.sendRedirect(location);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Portlet Container [" + name + "]: Redirect sent.");
+ }
+
+ }
+
+ /**
+ * Load the portlet associatttp://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.deploy.maven;
+
+import java.io.IOException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Map;
+
+import org.apache.commons.jelly.TagSupport;
+import org.apache.commons.jelly.XMLOutput;
+import org.apache.commons.jelly.MissingAttributeException;
+import org.apache.commons.jelly.JellyTagException;
+import org.apache.pluto.deploy.Deployer;
+import org.apache.pluto.deploy.DeploymentConfig;
+import org.apache.pluto.deploy.DeploymentException;
+
+/**
+ * Tag which is used to assemble portlet applications.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @ed with the specified window.
+ * @param pWindow
+ * @param request
+ * @param response
+ * @throws PortletException
+ * @throws PortletContainerException
+ */
+ public void doLoad(PortletWindow pWindow,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws PortletException, IOException, PortletContainerException {
+
+ InternalPortletWindow window = new InternalPortletWindow(context, pWindow);
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Portlet Container [" + name + "]: Load request recieved.");
+ }
+
+ RenderRequestImpl req =
+ new RenderRequestImpl(this, window, request);
+
+ RenderResponseImpl res =
+ new RenderResponseImpl(this, window, request, response);
+
+ PortletInvoker invoker = new PortletInvoker(window);
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Portlet Container [" + name + "]: Invoker Created.");
+ }since Oct 27, 2004
+ */
+public class PlutoDeployTag extends TagSupport {
+
+ public PlutoDeployTag() {
+ }
+
+ public void doTag(XMLOutput xmlOutput) throws MissingAttributeException,
+ JellyTagException {
+ try {
+ String deployerName =
+ (String)context.getVariable("org.apache.pluto.deploy.Deployer");
+
+ String dir = (String)context.getVariable("maven.build.dir");
+ String name = (String)context.getVariable("maven.pluto.final.name");
+
+ File file = new File(dir, name+".war");
+ FileInputStream in = new FileInputStream(file);
+ DeploymentConfig config = new MavenDeploymentConfig(name, context);
+
+ Class cl = Class.forName(deployerName);
+ Deployer deployer = (Deployer)cl.newInstance();
+ deployer.deploy(config, in);
+ }
+ catch(IOException io) {
+ throw new JellyTagException(io);
+ } catch (Illeg
+
+ invoker.load(req, res);
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Portlet Container [" + name + "]: Portlet loaded.");
+ }
+
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public PortletContainerServices getContainerServices() {
+ return containerServices;
+ }
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletContextManager.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004 The ApaalAccessException e) {
+ e.printStackTrace();
+ throw new JellyTagException("Error retrieving Deployer", e);
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ throw new JellyTagException("Error Instantiating Deployer", e);
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ throw new JellyTagException("Error Finding Deployer", e);
+ } catch (DeploymentException e) {
+ e.printStackTrace();
+ throw new JellyTagException("Error deploying application", e);
+ } catch(RuntimeException t) {
+ t.printStackTrace();
+ throw t;
+ }
+ }
+
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoTagLibrary.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoTagLibrary.java?rev=226395&view=auto
========================che 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 java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+import javax.portlet.PortletContext;
+import javax.servlet.ServletContext;
+
+import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.util.StringManager;
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+import org.apache.pluto.descriptors.services.PortletAppDescriptorServic======================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoTagLibrary.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/main/java/org/apache/pluto/deploy/maven/PlutoTagLibrary.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2004 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.deploy.maven;
+
+import org.apache;
+import org.apache.pluto.core.impl.PortletContextImpl;
+
+/**
+ * Manager used to cache the portlet configurations which have
+ * been previously parsed.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Sep 20, 2004
+ */
+public class PortletContextManager {
+
+ /** Singleton instance. */
+ private static PortletContextManager manager;
+
+ /**
+ * Singleton accessor method.
+ * @return the PortletContextManager implementation.
+ */
+ public static PortletContextManager getManager() {
+ if (manager == null) {
+ manager = new PortletContextManager();
+ }
+ return manager;
+ }
+
+ /** The PortletContext cache. */
+ private Map contexts;
+
+ /** Singleton Constructor. */
+ private PortletContextManager() {
+ contexts = new java.util.HashMap();
+ }
+
+
+
+ /**
+ * Retrieve the PortletContext associated with the given ServletContext.
+ * If one does not exist, it is created.
+ e.commons.jelly.TagLibrary;
+
+/**
+ * Maven Tag Library for Pluto Tasks.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Oct 27, 2004
+ */
+public class PlutoTagLibrary extends TagLibrary {
+
+ public PlutoTagLibrary() {
+ registerTag("assemble", PlutoAssemblerTag.class);
+ registerTag("deploy", PlutoDeployTag.class);
+ }
+
+
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/mojo/plugin.jelly
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/mojo/plugin.jelly?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/mojo/plugin.jelly (added)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/mojo/plugin.jelly Fri Jul 29 09:40:51 2005
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+
+<!--
+ =============================================================================
+ Pluto Maven Plugin: Provides Asse *
+ * @param context the servlet context
+ * @return the portlet context existing within the ServletContext.
+ * @throws PortletContainerException
+ */
+ public InternalPortletContext getContext(ServletContext context)
+ throws PortletContainerException {
+ if (!contexts.containsKey(context)) {
+ PortletAppDD def = PortletDescriptorRegistry.getRegistry().getPortletAppDD(context);
+ PortletContext pc = new PortletContextImpl(context, def);
+ contexts.put(context, pc);
+ }
+ return (InternalPortletContext) contexts.get(context);
+ }
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletDescriptorRegistry.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletDescriptorRegistry.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/brancmbly and Deployment support for
+ portlet applications which are to be deployed into
+ the pluto portlet container.
+ =============================================================================
+-->
+
+<project
+ xmlns:j="jelly:core"
+ xmlns:ant="jelly:ant"
+ xmlns:define="jelly:define"
+ xmlns:x="jelly:xml"
+ xmlns:maven="jelly:maven"
+ xmlns:pluto="jelly:org.apache.pluto.deploy.maven.PlutoTagLibrary">
+
+ <!--
+ Default Pluto Goal. Invokes the pluto:deploy goal.
+ -->
+ <goal name="pluto">
+ <attaingGoal name="pluto:deploy"/>
+
+ </goal>
+
+ <goal name="pluto:init">
+ <maven:get var="webappBuildDir" plugin="maven-war-plugin" property="maven.war.webapp.dir"/>
+ <maven:property var="maven.pluto.src.webapp"
+ name="maven.pluto.src.webapp"
+ defaultValue="${webappBuildDir}"/>
+ </goal>
+
+<!-- ===== ============== ===== -->
+<!-- ===== Assembly Goals ===== -->
+<!-- ===== ============== ===== hes/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletDescriptorRegistry.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletDescriptorRegistry.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2004 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.PlutoConfigurationException;
+import org.apache.pluto.PortletContai-->
+ <goal name="pluto:assemble" prereqs="pluto:init">
+ <attainGoal name="war:webapp"/>
+ <pluto:assemble/>
+ <ant:fixcrlf srcDir="${maven.pluto.srcs.webapp}" eol="lf" includes="**/*.xml"/>
+ </goal>
+
+ <goal name="pluto:war" prereqs="pluto:assemble">
+ <ant:jar destfile="${maven.build.dir}/${maven.pluto.final.name}.war"
+ basedir="${maven.pluto.src.webapp}"/>
+ </goal>
+
+<!-- ===== ============== ===== -->
+<!-- ===== Deploy Goals ===== -->
+<!-- ===== ============== ===== -->
+ <goal name="pluto:deploy" prereqs="pluto:init">
+ <attainGoal name="pluto:war"/>
+ <pluto:deploy/>
+ </goal>
+
+</project>
+
Added: portals/pluto/branches/pluto-1.1/pluto-deploy/src/mojo/plugin.properties
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-deploy/src/mojo/plugin.properties?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-deploy/src/mojo/plugin.properties (addednerException;
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+import org.apache.pluto.descriptors.services.PortletAppDescriptorService;
+import org.apache.pluto.util.StringManager;
+
+import javax.servlet.ServletContext;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+/**
+ * Simple caching mechanism used to manage
+ * portlet descriptors. This mechanism takes
+ * special considerations to make sure that the
+ * cache is invalidated for any ServletContext that
+ * is destroyed, thus allowing for a the context
+ * to be redeployed.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Nov 3, 2004
+ */
+class PortletDescriptorRegistry {
+ /** Portlet deployment descriptor location. */
+ private static final String PORTLET_XML = "/WEB-INF/portlet.xml";
+
+ /** Exception Messages. */
+ private static final StringManager EXCEPTIONS =
+ StringManager.getManager(
+ PortletDescriptorRegistry.class.get)
+++ portals/pluto/branches/pluto-1.1/pluto-deploy/src/mojo/plugin.properties Fri Jul 29 09:40:51 2005
@@ -0,0 +1,34 @@
+####################################################
+## Maven Pluto Deploy Plugin - Default Properties ##
+##
+
+####################################################
+## The location of the webapplication which will ##
+## be assembled. ##
+## defualt: ${maven.war.src.webapp} ##
+####################################################
+## maven.pluto.src.webapp=${maven.build.dir}/${pom.artifactId}
+
+####################################################
+## The name of the artifact war which is to be ##
+## created and deployed. ##
+####################################################
+maven.pluto.final.name=${pom.artifactId}
+
+####################################################
+## The directory in which the app will be ##
+## assembled ##
+##############################Package().getName()
+ );
+
+ private PortletAppDescriptorService portletDDService;
+
+ public static PortletDescriptorRegistry instance;
+
+ public static PortletDescriptorRegistry getRegistry() {
+ if(instance == null) {
+ instance = new PortletDescriptorRegistry();
+ }
+ return instance;
+ }
+
+ /**
+ * We must modify the context class loader in order for
+ * the Configuration utility to find the properties file.
+ */
+ private PortletDescriptorRegistry() {
+ String className = Configuration.getPortletAppDescriptorServiceImpl();
+ try {
+ Class cl = Class.forName(className);
+ Object instance = cl.newInstance();
+ portletDDService = (PortletAppDescriptorService)instance;
+ } catch (ClassNotFoundException e) {
+ throw new PlutoConfigurationException("ClassLoader configuration error: Unable to load class "+className, e);
+ } catch (InstantiationException e) {
+ ######################
+maven.pluto.build.dir=${maven.build.dir}
+
+####################################################
+## Deployment Properties ##
+## 1) The deployer implementation to be used. ##
+## (org.apache.pluto.deploy.Deployer) ##
+## 2) The default tomcat service (tomcat.service) ##
+## 3) The default tomcat host (tomcat.host) ##
+####################################################
+org.apache.pluto.deploy.Deployer=org.apache.pluto.deploy.impl.Tomcat5FileSystemDeployer
+tomcat.service=Catalina
+tomcat.host=localhost
+
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/pom.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/pom.xml?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/pom.xml (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/pom.xml Fri Jul 29 09:40:51 2005
@@ -0,0 throw new PlutoConfigurationException("Configuration Error: Unable to instantiate class "+className, e);
+ } catch (IllegalAccessException e) {
+ throw new PlutoConfigurationException("Security Error: Unable to access class "+className, e);
+ }
+ }
+
+ /**
+ * Cache of descriptors. WeakHashMap is used so that
+ * once the context is destroyed (kinda), the cache is eliminated.
+ * Ideally we'd use a ServletContextListener, but at this
+ * point I'm wondering if we really want to add another
+ * config requirement in the servlet xml? Hmm. . .
+ */
+ private Map cache = new java.util.WeakHashMap();
+
+ /**
+ * Retrieve the Portlet Application Deployment Descriptor
+ * for the given servlet context. Create it if it does
+ * not allready exist.
+ *
+ * @param context
+ * @return
+ * @throws PortletContainerException
+ */
+ public PortletAppDD getPortletAppDD(ServletContext context)
+ throws PortletContainerExcept+1,33 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto-descriptor-api</artifactId>
+ <packaging>jar</packaging>
+ <version>1.1-SNAPSHOT</version>
+ <name>Pluto Descriptor Service API</name>
+ <url>http://portals.apache.org/pluto</url>
+ <parent>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptor>src/assemble/bin.xml</descriptor>
+ <finalName>portals-pluto-1.0-SNAPSHOT</finalName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/ion {
+ PortletAppDD dd = (PortletAppDD)cache.get(context);
+ if(dd == null) {
+ dd = createDefinition(context);
+ cache.put(context, dd);
+ }
+ return dd;
+ }
+ /**
+ * Create the portlet.xml deployment descriptor representation.
+ *
+ * @param ctx the servlet context for which the DD is requested.
+ * @return the Portlet Application Deployment Descriptor info.
+ * @throws org.apache.pluto.PortletContainerException
+ */
+ private PortletAppDD createDefinition(ServletContext ctx)
+ throws PortletContainerException {
+ PortletAppDD app = null;
+ try {
+ InputStream in = ctx.getResourceAsStream(PORTLET_XML);
+ app = this.portletDDService.read(in);
+ } catch (IOException io) {
+ throw new PortletContainerException(
+ EXCEPTIONS.getString(
+ "error.context.descriptor.load",
+ new String[] {ctx.getServletContextName()}
+ src/assemble/bin.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/assemble/bin.xml?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/assemble/bin.xml (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/assemble/bin.xml Fri Jul 29 09:40:51 2005
@@ -0,0 +1,28 @@
+<assembly>
+ <id>bin</id>
+ <formats>
+ <format>tar.gz</format>
+ <format>tar.bz2</format>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <includes>
+ <include>README*</include>
+ <include>LICENSE*</include>
+ <include>NOTICE*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+
+ </dependencySets>
+</assembly>
+ ),
+ io);
+ }
+ return app;
+ }
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletEntity.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletEntity.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletEntity.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletEntity.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2003,2004 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 requir
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/IconDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/IconDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/IconDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/IconDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2005 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 writied 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.PortletWindow;
+import org.apache.pluto.core.impl.PortletPreferenceImpl;
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+import org.apache.pluto.descriptors.portlet.PortletDD;
+import org.apache.pluto.descriptors.portlet.PortletPreferenceDD;
+import org.apache.pluto.descriptors.portlet.PortletPreferencesDD;
+import org.apache.pluto.descriptors.servlet.ServletDD;
+
+import javax.servlet.ServletContext;
+import java.util.Iterator;
+
+/**
+ * The PortletEntity encapsulates all data peng, 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.descriptors.common;
+
+/**
+ * Resource Icon configuration.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version $Id: IconDD.java 157038 2005-03-11 03:44:40Z ddewolf $
+ * @since Feb 28, 2005
+ */
+public class IconDD{
+
+ /** The large icon uri. */
+ private String largeIcon;
+
+ /** The small icon uri. */
+ private String smallIcon;
+
+ /**
+ * Default Constructor.
+ */
+ public IconDD() {
+
+ }
+
+ /**
+ * Retrieve the large icon uri.
+ * @return the uri to the large icon (relative to the context path).
+ */
+ public String getLargeIcon() {
+ return largeIcon;
+ }
+
+ /**
+ * Set the large icon uri.
+ * @param largeIcon thrtaining to a single portlet
+ * instance. This instance may appear zero or more times per user. The
+ * PortletEntity consists of two primary peices of information, the Portlet
+ * Definition as defined by the {@link PortletDD} and the Wrapping Servlet
+ * information as defined by the{@link ServletDD}
+ */
+public class PortletEntity {
+ private static final Log LOG =
+ LogFactory.getLog(PortletEntity.class);
+
+ private static final String PREFIX = "/PlutoInvoker/";
+
+ private ServletContext ctx;
+ private PortletWindow window;
+
+ // Looked up and Cached
+ private PortletDD dd;
+ private PortletPreference[] prefs;
+
+ PortletEntity(ServletContext ctx, PortletWindow window) {
+ this.ctx = ctx;
+ this.window = window;
+ }
+
+ /**
+ * Returns all preferences of this portlet The return value cannot be NULL.
+ * @return the preference set
+ */
+ public PortletPreference[] getDefaultPreferences() {
+ if(prefs == null) {
+ Pore relative path to the icon resource.
+ */
+ public void setLargeIcon(String largeIcon) {
+ this.largeIcon = largeIcon;
+ }
+
+ /**
+ * Retrieve the small icon uri.
+ * @return the uri to the small icon (relative to the context path).
+ */
+ public String getSmallIcon() {
+ return smallIcon;
+ }
+
+ /**
+ * Set the small Icon uri.
+ * @param smallIcon the relative path to the icon resource.
+ */
+ public void setSmallIcon(String smallIcon) {
+ this.smallIcon = smallIcon;
+ }
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/InitParamDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/InitParamDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apatletDD dd = getPortletDefinition();
+ PortletPreferencesDD ppdd = dd.getPortletPreferences();
+ PortletPreference[] prefs = new PortletPreference[ppdd.getPortletPreferences().size()];
+ Iterator pds = ppdd.getPortletPreferences().iterator();
+ for(int i=0;pds.hasNext();i++) {
+ PortletPreferenceDD pd = (PortletPreferenceDD)pds.next();
+ prefs[i] = new PortletPreferenceImpl(
+ pd.getName(), new String[] { pd.getValue()}
+ );
+ }
+ }
+ return prefs;
+ }
+
+ /**
+ * Returns the portlet description The return value cannot be NULL.
+ * @return the portlet description
+ */
+ public PortletDD getPortletDefinition() {
+ if (dd == null) {
+ load();
+ }
+ return dd;
+
+ }
+
+ private void load() {
+ String context = window.getContextPath();
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("Loading PortletAppDD forche/pluto/descriptors/common/InitParamDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/InitParamDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2005 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.descriptors.common;
+
+/**
+ * Initialization Parameter configuration.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @versio context: "+context);
+ }
+ ServletContext ctx = this.ctx.getContext(context);
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("Retrieved context: "+ctx);
+ }
+ try {
+ PortletAppDD appDD = PortletDescriptorRegistry.getRegistry().getPortletAppDD(ctx);
+ Iterator dds = appDD.getPortlets().iterator();
+ while(dds.hasNext()) {
+ PortletDD pd = (PortletDD)dds.next();
+ if (pd.getPortletName().equals(window.getPortletName())) {
+ dd = pd;
+ }
+ }
+ } catch (PortletContainerException io) {
+ throw new NullPointerException("Unable to load the Portlet Application Deployment Descriptor: "+io.getMessage());
+ }
+ }
+
+ public String getControllerServletUri() {
+ return PREFIX + window.getPortletName();
+ }
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletInvoker.java
URL: http://n $Id: InitParamDD.java 157038 2005-03-11 03:44:40Z ddewolf $
+ * @since Feb 28, 2005
+ */
+public class InitParamDD {
+
+ /** The name of the parameter. */
+ private String paramName;
+
+ /** The value of the parameter. */
+ private String paramValue;
+
+ /** The description of the parameter. */
+ private String description;
+
+ /**
+ * Default Constructor.
+ */
+ public InitParamDD() {
+
+ }
+
+ /**
+ * Retrieve the name of the parameter.
+ * @return
+ */
+ public String getParamName() {
+ return paramName;
+ }
+
+ /**
+ * Set the name of the parameter.
+ * @param paramName
+ */
+ public void setParamName(String paramName) {
+ this.paramName = paramName;
+ }
+
+ /**
+ * Get the name of the parameter.
+ * @return
+ */
+ public String getParamValue() {
+ return paramValue;
+ }
+
+ /**
+ * Set the value of the parameter.
+ * @param paramValue
+ */
+ public void setParamValue(svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletInvoker.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletInvoker.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletInvoker.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2003,2004 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.
String paramValue) {
+ this.paramValue = paramValue;
+ }
+
+ /**
+ * Retrieve the description.
+ * @return
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Set the description of the parameter.
+ * @param description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/SecurityRoleRefDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/SecurityRoleRefDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/SecurityRoleRefDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.core;
+
+import java.io.IOException;
+
+import javax.portlet.PortletException;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.pluto.core.impl.ActionRequestImpl;
+import org.apache.pluto.core.impl.ActionResponseImpl;
+import org.apache.pluto.core.impl.PortletRequestImpl;
+import org.apache.pluto.core.impl.PortletResponseImpl;
+import org.apache.pluto.core.impl.RenderRequestImpl;
+import org.apache.pluto.core.impl.RenderResponseImpl;
+import org.apache.pluto.util.StringManager;
+import org.apache.pluto.PortletContainerException;
+
+/**
+ * Used internally to invoke/dispatch requests from the container to
+ * the portlet application.
+ *
+ * @version $Id$
+ *
+ */
+class PortletInvoker {
+
+ /** Internal Logger. */
+ private static /apache/pluto/descriptors/common/SecurityRoleRefDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2005 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.descriptors.common;
+
+/**
+ * Security Role Reference Configuration.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version $Id: SecurityRoleRefDD.java 157038 2005-03-11 03:44:40Z ddewolf $
+ * @since Feb 28, 2005
+ */
+public class SecurityRoleRfinal Log LOG = LogFactory.getLog(PortletInvoker.class);
+
+ /** Exception Messages. */
+ private static final StringManager EXCEPTIONS =
+ StringManager.getManager(PortletInvoker.class.getPackage().getName());
+
+ /**
+ * Portlet Window for which we are invoking
+ * the portlet.
+ */
+ private InternalPortletWindow window;
+
+ /**
+ * Default Constructor. Create a new invoker which
+ * is initialized for the given <code>InternalPortletWindow</code>.
+ *
+ * @param window portlet window.
+ */
+ public PortletInvoker(InternalPortletWindow window) {
+ this.window = window;
+ }
+
+ /**
+ * Invoke the portlet with an action request.
+ *
+ * @param request action request used for the invocation.
+ * @param response action response used for the invocation.
+ * @throws PortletException if a error occurs within the portlet.
+ * @throws IOException if an IO error occurs writing the response.
+ *
+ * @see PortletServlefDD {
+
+ /** The name of the role reference. */
+ private String roleName;
+
+ /** The role to which the reference is linked. */
+ private String roleLink;
+
+ /** The description of what the role is utilized for. */
+ private String description;
+
+ /**
+ * Default Constructor.
+ */
+ public SecurityRoleRefDD() {
+
+ }
+
+ /**
+ * Retrieve the name of the role reference.
+ * @return
+ */
+ public String getRoleName() {
+ return roleName;
+ }
+
+ /**
+ * Set the name of the role reference.
+ * @param roleName
+ */
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ /**
+ * Retrieve then role to which the reference is linked.
+ * @return
+ */
+ public String getRoleLink() {
+ return roleLink;
+ }
+
+ /**
+ * Set the role to which the reference is linked.
+ * @param roleLink
+ */
+ public void setRoleLink(String roleLink) {
+ this.roleLinket
+ * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
+ */
+ public void action(ActionRequestImpl request, ActionResponseImpl response)
+ throws PortletException, IOException {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Performing Action Invocation");
+ }
+ invoke(request, response, org.apache.pluto.Constants.METHOD_ACTION);
+ }
+
+ /**
+ * Invoke the portlet with a render request.
+ *
+ * @param request action request used for the invocation.
+ * @param response action response used for the invocation.
+ * @throws PortletException if a error occurs within the portlet.
+ * @throws IOException if an IO error occurs writing the response.
+ *
+ * @see PortletServlet
+ * @see javax.portlet.Portlet#render(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
+ */
+ public void render(RenderRequestImpl request, RenderResponseImpl response)
+ throws Portl = roleLink;
+ }
+
+ /**
+ * Retrieve the description of the role reference.
+ * @return
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Set the description of the role reference.
+ * @param description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/package.html
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/package.html?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/package.html (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/common/package.html Fri JuetException, IOException {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Performing Render Invocation");
+ }
+ invoke(request, response, org.apache.pluto.Constants.METHOD_RENDER);
+ }
+
+ /**
+ * Invoke the portlet with a load request.
+ *
+ * @param request action request used for the invocation.
+ * @param response action response used for the invocation.
+ * @throws PortletException if a error occurs within the portlet.
+ *
+ * @see PortletServlet
+ */
+ public void load(PortletRequestImpl request, PortletResponseImpl response)
+ throws PortletException, IOException {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Performing Load Invocation");
+ }
+ invoke(request, response, org.apache.pluto.Constants.METHOD_NOOP);
+ }
+
+ /**
+ * Perform the invocation.
+ *
+ * @param request portlet request
+ * @param response portlet response
+ * @param methodID method identifier
+ * @thl 29 09:40:51 2005
@@ -0,0 +1,5 @@
+<HTML>
+<BODY>
+Common deployment descriptor elements used in many descriptors.
+</BODY>
+</HTML>
\ No newline at end of file
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/package.html
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/package.html?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/package.html (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/package.html Fri Jul 29 09:40:51 2005
@@ -0,0 +1,6 @@
+<HTML>
+<BODY>
+Object Model and Read/Write Services for deployment descriptors.
+Specifically used to represent web.xml and portlet.xml files.
+</BODY>
+</HTML>
\ No newline at end of file
Added: portals/pluto/branches/rows PortletException if a portlet exception occurs.
+ * @throws IOException if an error occurs writing to the response.
+ */
+ private void invoke(PortletRequestImpl request,
+ PortletResponseImpl response,
+ Integer methodID)
+ throws PortletException, IOException {
+
+ String uri = window.getPortletEntity().getControllerServletUri();
+ ServletContext servletContext = window.getServletContext();
+ RequestDispatcher dispatcher = servletContext.getRequestDispatcher(uri);
+
+ if (dispatcher != null) {
+ try {
+ request.setAttribute(org.apache.pluto.Constants.METHOD_ID,
+ methodID);
+ request.setAttribute(
+ org.apache.pluto.Constants.PORTLET_REQUEST, request);
+ request.setAttribute(
+ org.apache.pluto.Constants.PORTLET_RESPONSE, response);
+ dispatcher.include(request, responspluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletAppDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletAppDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletAppDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletAppDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2005 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, e);
+ } catch (javax.servlet.UnavailableException e) {
+ int seconds = e.isPermanent()?-1:e.getUnavailableSeconds();
+ String message = EXCEPTIONS.getString(
+ "error.portlet.unavailable",
+ new String[] {String.valueOf(seconds)}
+ );
+ if(LOG.isErrorEnabled()) {
+ LOG.error(message, e);
+ }
+ throw new javax.portlet.UnavailableException(
+ message, seconds
+ );
+ } catch (javax.servlet.ServletException e) {
+ String message = EXCEPTIONS.getString("error.portlet.invoke");
+ if(LOG.isErrorEnabled()) {
+ LOG.error(message);
+ }
+
+ if (e.getRootCause() != null &&
+ e.getRootCause() instanceof PortletException) {
+ throw (PortletException) e.getRootCause();
+ }
+ 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.descriptors.portlet;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Portlet Application Configuration.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version $Id: PortletAppDD.java 157475 2005-03-14 22:13:18Z ddewolf $
+ * @since Mar 6, 2005
+ */
+public class PortletAppDD {
+
+ /** The defined portlets within the system. */
+ private List portlets = new ArrayList();
+
+ /**
+ * Default Constructor.
+ */
+ public PortletAppDD() {
+ }
+
+ /**
+ * Retrieve the portlets which exist within this application.
+ * @return
+ */
+ public List getPortlets() {
+ return portlets;
+ }
+
+ /**
+ * Set the portlets that exist within this else if(e.getRootCause() != null) {
+ throw new PortletException(e.getRootCause());
+ }
+ else {
+ throw new PortletException(e);
+ }
+ } finally {
+ request.removeAttribute(org.apache.pluto.Constants.METHOD_ID);
+ request.removeAttribute(org.apache.pluto.Constants.PORTLET_REQUEST);
+ request.removeAttribute(org.apache.pluto.Constants.PORTLET_RESPONSE);
+ }
+ } else {
+ String msg = EXCEPTIONS.getString(
+ "error.portlet.invoker.dispatcher",
+ new String[] {servletContext.getServletContextName(), uri}
+ );
+ if(LOG.isErrorEnabled()) {
+ LOG.error(msg);
+ }
+ throw new PortletException(msg);
+ }
+ }
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletPreference.java
URL: http://svn.apache.org application.
+ * @param portlets
+ */
+ public void setPortlets(List portlets) {
+ this.portlets = portlets;
+ }
+
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2005 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.
+ */viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletPreference.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletPreference.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletPreference.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2003,2004 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 t 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.descriptors.portlet;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Bare bones implementation of the Portlet descriptor.
+ * Eventually this should be flushed out :), but for the sake
+ * of timing I'll be lazy for now.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version $Id: PortletDD.java 157475 2005-03-14 22:13:18Z ddewolf $
+ * @since Mar 6, 2005
+ */
+public class PortletDD {
+
+ /** The unique name of the portlet. */
+ private String portletName;
+
+ /** The class which implements the portlet interfache License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.core;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public interface PortletPreference {
+
+ String getName();
+
+ String[] getValues();
+
+ void setValues(String[] values);
+
+ boolean isReadOnly();
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/PortletServlet.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2003,2004 The. */
+ private String portletClass;
+
+ private String resourceBundle;
+
+ private PortletInfoDD portletInfo;
+
+ private PortletPreferencesDD portletPreferences;
+
+ private List initParams = new ArrayList();
+
+ private List supports = new ArrayList();
+
+ /** All security role references. */
+ private List securityRoleRefs = new ArrayList();
+
+
+ /**
+ * Default Constructor.
+ */
+ public PortletDD() {
+
+ }
+
+ /**
+ * Retrieve the unique name of the portlet.
+ * @return
+ */
+ public String getPortletName() {
+ return portletName;
+ }
+
+ /**
+ * Set the unique name of the portlet.
+ * @param portletName
+ */
+ public void setPortletName(String portletName) {
+ this.portletName = portletName;
+ }
+
+ /**
+ * Retrieve the name of the portlet class.
+ * @return the fully qualified portlet class name.
+ */
+ public String getPortletClass() {
+ return portletClass;
+ }
+
+ /**
+ e 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.Constants;
+import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.core.impl.*;
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+import org.apache.pluto.descriptors.portlet.PortletDD;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletException;
+import javax.servlet.ServletContext;
+import javax.s * Set the name of the portlet class.
+ * @param portletClass
+ */
+ public void setPortletClass(String portletClass) {
+ this.portletClass = portletClass;
+ }
+
+ public String getResourceBundle() {
+ return resourceBundle;
+ }
+
+ public void setResourceBundle(String resourceBundle) {
+ this.resourceBundle = resourceBundle;
+ }
+
+ public PortletInfoDD getPortletInfo() {
+ return portletInfo;
+ }
+
+ public void setPortletInfo(PortletInfoDD portletInfo) {
+ this.portletInfo = portletInfo;
+ }
+
+ public List getSupports() {
+ return supports;
+ }
+
+ public void setSupports(List supports) {
+ this.supports = supports;
+ }
+
+ public List getInitParams() {
+ return initParams;
+ }
+
+ public void setInitParams(List initParams) {
+ this.initParams = initParams;
+ }
+
+ public PortletPreferencesDD getPortletPreferences() {
+ return portletPreferences;
+ }
+
+ public voiervlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Portlet Invocation Servlet. This servlet recieves cross context requests from
+ * the the container and services the portlet request for the specified method.
+ * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.1
+ * @since 09/22/2004
+ */
+public class PortletServlet extends HttpServlet {
+
+ private String portletName;
+
+ private Portlet portlet;
+ private InternalPortletContext portletContext;
+ private InternalPortletConfig portletConfig;
+
+ public String getServletInfo() {
+ return "Pluto PortletServlet [" + portletName + "]";
+ }
+
+ public void init() throws ServletException {
+
+ portletName = getInitParameter("portlet-name");
+
+ ServletContext context = getServletContext();
+
+ try {
+ pod setPortletPreferences(PortletPreferencesDD portletPreferences) {
+ this.portletPreferences = portletPreferences;
+ }
+
+ /**
+ * Retrieve the security role references for this portlet.
+ * @return
+ */
+ public List getSecurityRoleRefs() {
+ return securityRoleRefs;
+ }
+
+ /**
+ * Set the security role references for this portlet.
+ * @param securityRoleRefs
+ */
+ public void setSecurityRoleRefs(List securityRoleRefs) {
+ this.securityRoleRefs = securityRoleRefs;
+ }
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletInfoDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletInfoDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/plurtletContext =
+ PortletContextManager.getManager().getContext(context);
+ } catch (PortletContainerException pce) {
+ throw new ServletException(pce);
+ }
+
+ PortletAppDD appDD = portletContext.getPortletApplicationDefinition();
+ List dds = appDD.getPortlets();
+
+ PortletDD dd = null;
+ for (int i = 0; i < dds.size(); i++) {
+ PortletDD pd = (PortletDD)dds.get(i);
+ if (pd.getPortletName().equals(portletName)) {
+ dd = pd;
+ break;
+ }
+ }
+
+ if (dd == null) {
+ throw new ServletException(
+ "Unable to resolve portlet '" + portletName + "'");
+ }
+
+ portletConfig = new PortletConfigImpl(getServletConfig(),
+ portletContext, dd);
+
+ try {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Class pClass = loader.loadClass((dd.getPortto/descriptors/portlet/PortletInfoDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletInfoDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2003,2004 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.descriptors.portlet;
+
+/**
+ * Implementation of the Portlet Info descriptor element.
+ * @author <a href="ddewolf@apache.org">David H. DeWolletClass()));
+ portlet = (Portlet) pClass.newInstance();
+ portlet.init(portletConfig);
+ } catch (ClassNotFoundException cne) {
+ cne.printStackTrace();
+ throw new ServletException(cne);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ throw new ServletException(e);
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ throw new ServletException(e);
+ } catch (PortletException pe) {
+ pe.printStackTrace();
+ throw new ServletException(pe);
+ }
+ }
+
+ protected void doGet(HttpServletRequest req,
+ HttpServletResponse resp)
+ throws ServletException, IOException {
+ dispatch(req, resp);
+ }
+
+ protected void doPost(HttpServletRequest req,
+ HttpServletResponse resp)
+ throws ServletException, IOException {
+ dispatch(req, resp);
+ }
+
+ protectedf</a>
+ * @since 1.1.0-SNAPSHOT
+ */
+public class PortletInfoDD {
+ private String title;
+ private String shortTitle;
+ private String keywords;
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getKeywords() {
+ return keywords;
+ }
+
+ public void setKeywords(String keywords) {
+ this.keywords = keywords;
+ }
+
+ public String getShortTitle() {
+ return shortTitle;
+ }
+
+ public void setShortTitle(String shortTitle) {
+ this.shortTitle = shortTitle;
+ }
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletPreferenceDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletPreferenceDD.java?rev=226395&view=auto
=========================================================== void doPut(HttpServletRequest req,
+ HttpServletResponse resp)
+ throws ServletException, IOException {
+ dispatch(req, resp);
+ }
+
+ public void destroy() {
+ if (portlet != null) {
+ portlet.destroy();
+ }
+ super.destroy();
+ }
+
+ private void dispatch(HttpServletRequest request,
+ HttpServletResponse response)
+ throws ServletException, IOException {
+ try {
+ request.setAttribute(org.apache.pluto.Constants.PORTLET_CONFIG,
+ portletConfig);
+
+ Integer method_id =
+ (Integer) request.getAttribute(
+ org.apache.pluto.Constants.METHOD_ID);
+
+ InternalPortletRequest pRequest = (InternalPortletRequest)
+ request.getAttribute(Constants.PORTLET_REQUEST);
+
+ InternalPortletResponse pResponse = (InternalPortletResponse)
+ request.getAttribute(Constants===================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletPreferenceDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletPreferenceDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003,2004 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.descriptors.portlet;
+
+.PORTLET_RESPONSE);
+
+ pRequest.setPortletContext(portletContext);
+
+
+ if (method_id == org.apache.pluto.Constants.METHOD_RENDER) {
+ RenderRequestImpl renderRequest =
+ (RenderRequestImpl) pRequest;
+
+ RenderResponseImpl renderResponse =
+ (RenderResponseImpl) pResponse;
+
+ portlet.render(renderRequest, renderResponse);
+ } else if (method_id == org.apache.pluto.Constants.METHOD_ACTION) {
+ ActionRequestImpl actionRequest =
+ (ActionRequestImpl) pRequest;
+
+ ActionResponseImpl actionResponse =
+ (ActionResponseImpl) pResponse;
+
+ portlet.processAction(actionRequest, actionResponse);
+ } else if (method_id == org.apache.pluto.Constants.METHOD_NOOP) {
+ //nothing to do
+ }
+
+ } catch (javax.portlet.UnavailableException e) {
+ e.printStackTrace();
+ /**
+ * <B>TODO:</B> Document
+ *
+ * @author ddewolf@apache.org
+ * @since Jun 29, 2005
+ */
+public class PortletPreferenceDD {
+
+ private String name;
+ private String value;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletPreferencesDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletPreferencesDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletPreferencesDD.java (added)
+++ po /*
+ if (e.isPermanent()) {
+ throw new UnavailableException(e.getMessage());
+ } else {
+ throw new UnavailableException(e.getMessage(), e.getUnavailableSeconds());
+ }*/
+
+ // destroy isn't called by Tomcat, so we have to fix it
+ try {
+ portlet.destroy();
+ } catch (Throwable t) {
+ // don't care for Exception
+ }
+
+ // handle everything as permanently for now
+ throw new javax.servlet.UnavailableException(e.getMessage());
+ } catch (PortletException e) {
+ e.printStackTrace();
+ throw new ServletException(e);
+ } finally {
+ request.removeAttribute(org.apache.pluto.Constants.PORTLET_CONFIG);
+ }
+ }
+}
Added: portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/ActionRequestImpl.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/plutortals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletPreferencesDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2003,2004 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.descriptors.portlet;
+
+import java.util.List;
+
+/**
+ * <B>TODO:</B> Document
+ *
+ * @author ddewolf@apache.org
+ * @since Jun 29, 2005
+ */
+public class PortletPreferencesDD {
+
+ pri-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/ActionRequestImpl.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/ActionRequestImpl.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-container/src/main/java/org/apache/pluto/core/impl/ActionRequestImpl.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2003,2004 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 vate List portletPreferences;
+ private String preferencesValidator;
+
+ public List getPortletPreferences() {
+ return portletPreferences;
+ }
+
+ public void setPortletPreferences(List portletPreferences) {
+ this.portletPreferences = portletPreferences;
+ }
+
+ public String getPreferencesValidator() {
+ return preferencesValidator;
+ }
+
+ public void setPreferencesValidator(String preferencesValidator) {
+ this.preferencesValidator = preferencesValidator;
+ }
+}
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/SupportsDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/SupportsDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/Supspecific language governing permissions and
+ * limitations under the License.
+ */
+/*
+
+ */
+
+package org.apache.pluto.core.impl;
+
+import java.io.InputStream;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.PortletPreferences;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.pluto.Constants;
+import org.apache.pluto.PortletContainer;
+import org.apache.pluto.core.InternalPortletWindow;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+/**
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates. To enable and disable the creation of type
+ * comments go to Window>Preferences>Java>Code Generation.
+ */
+public class ActionRequestImpl
+ extends PortletRequestImpl implements ActionRequest {
+
+ private static final Log LOG = LogFactory.getLog(ActionRequestImpl.class);
+ /**
+ * Holds the portlet preferences
+ */
+ private PortletPreferences portletPreferenportsDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/SupportsDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003,2004 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.descriptors.portlet;
+
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: David
+ * Date: Jun 29, 2005
+ * Time: 9:07:38 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class SupportsDD {
+
+ private String mimeType;
+ private List portletModes;
+
+ public String getMimeType() {
+ return mimeType;
+ }
+
+ public void setMimeType(String mimeType) {
+ this.mimeType = mimeType;
+ }
+
+ public List getPortletModes() {
+ return portletModes;
+ }
+
+ public void setPortletModes(List portletModes) {
+ this.portletModes = portletModes;
+ }
+}
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/services/Constants.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/services/Constants.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/services/Constants.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/services/Constants.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2005 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.descriptors.services;
+
+/**
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version $Id: Constants.java 156636 2005-03-09 12:16:31Z cziegeler $
+ * @since Mar 7, 2005
+ */
+public class Constants {
+
+ public static final String WEB_XML_PUBLIC_ID = "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN";
+ public static final String WEB_XML_DTD = "http://java.sun.com/dtd/web-app_2_3.dtd";
+
+ public static final String PORLTET_XML_PUBLIC_ID = "-//Sun Microsystems, Inc.//DTD PortletApplication 1.0//EN";
+ public static final String PORTLET_XML_DTD = "http://java.sun.com/dtd/portlet-app_1_0.dtd";
+
+ private Constants() {
+
+ }
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/services/PortletAppDescriptorService.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/services/PortletAppDescriptorService.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/services/PortletAppDescriptorService.java (addeces;
+
+ public ActionRequestImpl(PortletContainer container,
+ InternalPortletWindow internalPortletWindow,
+ HttpServletRequest servletRequest) {
+ super(container, internalPortletWindow, servletRequest);
+ LOG.debug("Created action request for: "+internalPortletWindow);
+
+ }
+
+ // javax.portlet.ActionRequest implementation -------------------------------------------------
+ /* (non-Javadoc)
+ * @see org.apache.pluto.core.InternalActionResponse#getPortletInputStream()
+ */
+ public InputStream getPortletInputStream() throws java.io.IOException {
+ javax.servlet.http.HttpServletRequest servletRequest = (javax.servlet.http.HttpServletRequest) super.getRequest();
+
+ if (servletRequest.getMethod().equals("POST")) {
+ String contentType = servletRequest.getContentType();
+ if (contentType == null ||
+ contentType.equals("application/x-www-form-urlencoded")) {
+ d)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/services/PortletAppDescriptorService.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2005 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.descriptors.services;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.InputStream;
+
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+
+/* throw new java.lang.IllegalStateException(
+ "User request HTTP POST data is of type application/x-www-form-urlencoded. This data has been already processed by the portal/portlet-container and is available as request parameters.");
+ }
+ }
+ return servletRequest.getInputStream();
+ }
+
+ // --------------------------------------------------------------------------------------------
+ // PortletRequestImpl implementation ----------------------------------------------------------
+ public PortletPreferences getPreferences() {
+ if (this.portletPreferences == null) {
+ InternalPortletWindow window = getWindow();
+ portletPreferences = new PortletPreferencesImpl(getContainer(),
+ getWindow(), this,
+ Constants.METHOD_ACTION);
+ }
+ return this.portletPreferences;
+ }
+ // ------------*
+ * Read/Write services for Portlet Application configuration
+ * This service reads the portlet.xml and converts it to a
+ * standard bean model.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version $Id: PortletAppDescriptorService.java 157038 2005-03-11 03:44:40Z ddewolf $
+ * @since Mar 6, 2005
+ */
+public interface PortletAppDescriptorService {
+
+ /**
+ * Retrieve the PortletApp deployment descriptor
+ * (portlet.xml).
+ * @return Object representation of the descriptor.
+ * @throws IOException if an IO error occurs.
+ */
+ PortletAppDD read(InputStream in) throws IOException;
+
+ /**
+ * Write the PortletApp deployment descriptor
+ * (portlet.xml).
+ * @param portletDescriptor
+ * @param out
+ * @throws IOException if an IO error occurs.
+ */
+ void write(PortletAppDD portletDescriptor, OutputStream out) throws IOException;
+}
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/de--------------------------------------------------------------------------------
+}
scriptors/services/WebAppDescriptorService.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/services/WebAppDescriptorService.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/services/WebAppDescriptorService.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/services/WebAppDescriptorService.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2005 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.descriptors.services;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.pluto.descriptors.servlet.WebAppDD;
+
+/**
+ * WebApplication configuration as contained
+ * within the web.xml Deployment Descriptor.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version $Id: WebAppDescriptorService.java 157038 2005-03-11 03:44:40Z ddewolf $
+ * @since Feb 28, 2005
+ */
+public interface WebAppDescriptorService {
+
+ /**
+ * Retrieve the WebApp deployment descriptor
+ * (web.xml).
+ * @return Object representation of the descriptor.
+ * @throws IOException if an IO error occurs.
+ */
+ WebAppDD read(InputStream in) throws IOException;
+
+ /**
+ * Write the WebApp deployment descriptor
+ * (web.xml).
+ * @param dd
+ * @param out output stream to which the descriptor should be written
+ * @throws IOException if an IO error occurs.
+ */
+ void write(WebAppDD dd, OutputStream out) throws IOException;
+}
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/AuthConstraintDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/AuthConstraintDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/AuthConstraintDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/AuthConstraintDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2005 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.descriptors.servlet;
+
+/**
+ * <B>TODO</B>: Document
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version $Id: AuthConstraintDD.java 156636 2005-03-09 12:16:31Z cziegeler $
+ * @since Feb 28, 2005
+ */
+public class AuthConstraintDD {
+
+ private String description;
+ private String roleName;
+
+ public AuthConstraintDD() {
+
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getRoleName() {
+ return roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/EjbRefDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/EjbRefDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/EjbRefDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/EjbRefDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2005 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.descriptors.servlet;
+
+/**
+ * <B>TODO</B>: Document
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version $Id: EjbRefDD.java 156636 2005-03-09 12:16:31Z cziegeler $
+ * @since Feb 28, 2005
+ */
+public class EjbRefDD {
+
+ private String description;
+ private String ejbRefName;
+ private String ejbRefType;
+ private String home;
+ private String remote;
+ private String ejbLink;
+ private String runAs;
+
+ public EjbRefDD() {
+
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getEjbRefName() {
+ return ejbRefName;
+ }
+
+ public void setEjbRefName(String ejbRefName) {
+ this.ejbRefName = ejbRefName;
+ }
+
+ public String getEjbRefType() {
+ return ejbRefType;
+ }
+
+ public void setEjbRefType(String ejbRefType) {
+ this.ejbRefType = ejbRefType;
+ }
+
+ public String getHome() {
+ return home;
+ }
+
+ public void setHome(String home) {
+ this.home = home;
+ }
+
+ public String getRemote() {
+ return remote;
+ }
+
+ public void setRemote(String remote) {
+ this.remote = remote;
+ }
+
+ public String getEjbLink() {
+ return ejbLink;
+ }
+
+ public void setEjbLink(String ejbLink) {
+ this.ejbLink = ejbLink;
+ }
+
+ public String getRunAs() {
+ return runAs;
+ }
+
+ public void setRunAs(String runAs) {
+ this.runAs = runAs;
+ }
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/EnvEntryDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/EnvEntryDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/EnvEntryDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/EnvEntryDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2005 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.descriptors.servlet;
+
+/**
+ * <B>TODO</B>: Document
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version $Id: EnvEntryDD.java 156636 2005-03-09 12:16:31Z cziegeler $
+ * @since Feb 28, 2005
+ */
+public class EnvEntryDD {
+
+ private String description;
+ private String envEntryName;
+ private String envEntryValue;
+ private String envEntryType;
+
+ public EnvEntryDD() {
+
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getEnvEntryName() {
+ return envEntryName;
+ }
+
+ public void setEnvEntryName(String envEntryName) {
+ this.envEntryName = envEntryName;
+ }
+
+ public String getEnvEntryValue() {
+ return envEntryValue;
+ }
+
+ public void setEnvEntryValue(String envEntryValue) {
+ this.envEntryValue = envEntryValue;
+ }
+
+ public String getEnvEntryType() {
+ return envEntryType;
+ }
+
+ public void setEnvEntryType(String envEntryType) {
+ this.envEntryType = envEntryType;
+ }
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/ErrorPageDD.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/ErrorPageDD.java?rev=226395&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/ErrorPageDD.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/servlet/ErrorPageDD.java Fri Jul 29 09:40:51 2005
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2005 The Apache Software FoundationType
+ *
+ * Licensed under the Apache License, VersionType 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 permissionTypes and
+ * limitationTypes under the License.
+ */
+package org.apache.pluto.descriptors.servlet;
+
+/**
+ * <B>TODO</B>: Document
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version $Id: ErrorPageDD.java 156636 2005-03-09 12:16:31Z cziegeler $
+ * @since Mar 4, 2005
+ */
+public class ErrorPageDD {
+
+ private String errorCode;
+ private String exceptionType;
+ private String location;
+
+ public ErrorPageDD() {
+
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getExceptionType() {
+ return exceptionType;
+ }
+
+ public void setExceptionType(String exceptionType) {
+ this.exceptionType = exceptionType;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+}
+