taylor 2003/12/05 18:06:11
Modified: portal/src/java/org/apache/jetspeed/aggregator
BasicAggregator.java
portal/src/sql/hsql populate-db-default.sql
portal/src/webapp/WEB-INF web.xml
portal/src/webapp/WEB-INF/db/hsql Registry.script
portal/src/webapp/WEB-INF/pages default-page.psml
Added: portal/src/java/org/apache/jetspeed/portlets/layout
GenericLayoutPortlet.java LayoutPortlet.java
Log:
* Added internal Portlet Application 'jetspeed' to house internal portlets and
layouts
This portlet application exists inside the Jetspeed webapp.
The invoker is not cross-context
* Added entries to the database scripts for the default webapp, portletapp, and a
very simple layout portlet
* Skeleton GenericLayoutPortlet created
we are going to need PortletTools now to aggregate portlet content via layouts
Revision Changes Path
1.6 +35 -22
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/BasicAggregator.java
Index: BasicAggregator.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/BasicAggregator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BasicAggregator.java 4 Dec 2003 04:50:18 -0000 1.5
+++ BasicAggregator.java 6 Dec 2003 02:06:11 -0000 1.6
@@ -173,6 +173,8 @@
}
Fragment root = page.getRootFragment();
+ render(container, root, request);
+
for (Iterator fit = root.getFragments().iterator(); fit.hasNext();)
{
Fragment fragment = (Fragment)fit.next();
@@ -180,9 +182,27 @@
if (fragment.getType().equals(Fragment.LAYOUT))
{
// skip layouts for now
- continue;
+ // continue;
}
+ render(container, fragment, request);
+ }
+ }
+ /**
+ * Render a portlet by calling the container's renderPortlet.
+ *
+ * @param container
+ * @param fragment
+ * @param request
+ */
+ private void render(PortletContainer container, Fragment fragment,
RequestContext request)
+ {
+
+ //
+ // create the portlet window and render the portlet
+ //
+ try
+ {
//
// Load Portlet from registry
//
@@ -192,29 +212,22 @@
{
throw new JetspeedException("Failed to load: " + fragment.getName()
+ " from registry");
}
+
+ PortletWindow portletWindow =
PortletWindowFactory.getWindow(portletDefinition, fragment.getName());
- //
- // create the portlet window and render the portlet
- //
- try
- {
- PortletWindow portletWindow =
PortletWindowFactory.getWindow(portletDefinition, fragment.getName());
-
- HttpServletRequest servletRequest =
request.getRequestForWindow(portletWindow);
- HttpServletResponse servletResponse =
request.getResponseForWindow(portletWindow);
+ HttpServletRequest servletRequest =
request.getRequestForWindow(portletWindow);
+ HttpServletResponse servletResponse =
request.getResponseForWindow(portletWindow);
- PortalControlParameter control = new
PortalControlParameter(request.getRequestedPortalURL());
- WindowState windowState = control.getState(portletWindow);
+ PortalControlParameter control = new
PortalControlParameter(request.getRequestedPortalURL());
+ WindowState windowState = control.getState(portletWindow);
- container.renderPortlet(portletWindow, servletRequest,
servletResponse);
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- log.error("Failed to service portlet, portlet exception: " + t);
- break;
- }
+ container.renderPortlet(portletWindow, servletRequest, servletResponse);
}
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ log.error("Failed to service portlet, portlet exception: " + t);
+ }
+
}
-
}
1.1
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/portlets/layout/GenericLayoutPortlet.java
Index: GenericLayoutPortlet.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.portlets.layout;
import java.io.IOException;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletContext;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletURL;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
/**
* AbstractLayoutPortlet
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: GenericLayoutPortlet.java,v 1.1 2003/12/06 02:06:11 taylor Exp $
*/
public class GenericLayoutPortlet
extends GenericPortlet
implements LayoutPortlet
{
public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException
{
PortletContext context = getPortletContext();
response.setContentType("text/html");
// PortletURL url = response.createRenderURL();
// url.addParameter("test", "value");
// OK, so this is square one as they say. We're going to need some portlet
tools next
response.getWriter().println("<br/><b>Layout Portlet</b>");
// PortletRequestDispatcher rd =
context.getRequestDispatcher("/WEB-INF/hello.jsp");
// rd.include(request, response);
}
}
1.1
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/portlets/layout/LayoutPortlet.java
Index: LayoutPortlet.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.portlets.layout;
import javax.portlet.Portlet;
/**
* LayoutPortlet
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: LayoutPortlet.java,v 1.1 2003/12/06 02:06:11 taylor Exp $
*/
public interface LayoutPortlet extends Portlet
{
}
1.5 +8 -0 jakarta-jetspeed-2/portal/src/sql/hsql/populate-db-default.sql
Index: populate-db-default.sql
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/sql/hsql/populate-db-default.sql,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- populate-db-default.sql 5 Dec 2003 21:09:22 -0000 1.4
+++ populate-db-default.sql 6 Dec 2003 02:06:11 -0000 1.5
@@ -1,4 +1,12 @@
------------------------------------------
+-- The Jetspeed Internal Portlet App
+------------------------------------------
+INSERT INTO WEB_APPLICATION VALUES(1,'/jetspeed');
+INSERT INTO PORTLET_APPLICATION VALUES (1, 'jetspeed', 'jetspeed', '1.0', NULL, 1);
+INSERT INTO PORTLET_DEFINITION VALUES(1, 'Layout',
+ 'org.apache.jetspeed.portlets.layout.GenericLayoutPortlet',1,'Layout','-1',NULL);
+
+------------------------------------------
-- Add seed data for Capability
------------------------------------------
INSERT INTO CAPABILITY (CAPABILITY_ID, CAPABILITY) VALUES(0,'HTML_3_2');
1.3 +16 -0 jakarta-jetspeed-2/portal/src/webapp/WEB-INF/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/web.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- web.xml 10 Aug 2003 11:25:45 -0000 1.2
+++ web.xml 6 Dec 2003 02:06:11 -0000 1.3
@@ -23,6 +23,12 @@
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
+ <servlet>
+ <servlet-name>JetspeedContainer</servlet-name>
+ <display-name>Jetspeed Container</display-name>
+ <description>MVC Servlet for Jetspeed Portlet Applications</description>
+
<servlet-class>org.apache.jetspeed.container.JetspeedContainerServlet</servlet-class>
+ </servlet>
<servlet-mapping>
<servlet-name>
@@ -40,6 +46,16 @@
/jetspeed/*
</url-pattern>
</servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>JetspeedContainer</servlet-name>
+ <url-pattern>/container/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>JetspeedContainer</servlet-name>
+ <url-pattern>/container/*</url-pattern>
+ </servlet-mapping>
<!-- The Usual Welcome File List -->
<welcome-file-list>
1.12 +4 -1
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/db/hsql/Registry.script
Index: Registry.script
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/db/hsql/Registry.script,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Registry.script 5 Dec 2003 21:09:22 -0000 1.11
+++ Registry.script 6 Dec 2003 02:06:11 -0000 1.12
@@ -50,8 +50,8 @@
CREATE UNIQUE INDEX IX_PROFILE_DESKTOP_1 ON
PROFILE_DESKTOP_ASSOC(LOCATOR_HASH,DESKTOP_ID)
CREATE TABLE PROFILE_PAGE_ASSOC(LOCATOR_HASH VARCHAR(40) NOT NULL,PAGE_ID
VARCHAR(80) NOT NULL)
CREATE UNIQUE INDEX IX_PROFILE_PAGE_1 ON PROFILE_PAGE_ASSOC(LOCATOR_HASH,PAGE_ID)
-GRANT ALL ON CLASS "org.hsqldb.Library" TO PUBLIC
GRANT ALL ON CLASS "java.lang.Math" TO PUBLIC
+GRANT ALL ON CLASS "org.hsqldb.Library" TO PUBLIC
CREATE USER SA PASSWORD "" ADMIN
CREATE ALIAS DAYNAME FOR "org.hsqldb.Library.dayname"
CREATE ALIAS SPACE FOR "org.hsqldb.Library.space"
@@ -121,6 +121,9 @@
CREATE ALIAS LENGTH FOR "org.hsqldb.Library.length"
CREATE ALIAS ROUND FOR "org.hsqldb.Library.round"
CREATE ALIAS REPLACE FOR "org.hsqldb.Library.replace"
+INSERT INTO PORTLET_APPLICATION VALUES(1,'jetspeed','jetspeed','1.0',NULL,1)
+INSERT INTO WEB_APPLICATION VALUES(1,'/jetspeed')
+INSERT INTO PORTLET_DEFINITION
VALUES(1,'Layout','org.apache.jetspeed.portlet.layout.GenericLayoutPortlet',1,'Layout','-1',NULL)
INSERT INTO MEDIA_TYPE VALUES(0,'html','UTF-8','HTML','Rich HTML for HTML 4.0
compliants browsers')
INSERT INTO MEDIA_TYPE VALUES(1,'wml','UTF-8','WML','Format for mobile phones and
PDAs compatible with WML 1.1')
INSERT INTO MEDIA_TYPE VALUES(2,'vxml','UTF-8','VoiceXML','Format suitable for use
with an audio VoiceXML server')
1.2 +1 -1
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/pages/default-page.psml
Index: default-page.psml
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/pages/default-page.psml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- default-page.psml 4 Dec 2003 04:52:10 -0000 1.1
+++ default-page.psml 6 Dec 2003 02:06:11 -0000 1.2
@@ -6,7 +6,7 @@
portlet-decorator="box-titled"
/>
<title>My First PSML Page</title>
- <fragment id="f001" type="layout" name="TwoColumns">
+ <fragment id="f001" type="layout" name="Layout">
<fragment id="pe001" type="portlet" name="HelloPortlet">
<property layout="TwoColumns" name="row" value="0" />
<property layout="TwoColumns" name="column" value="0" />
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]