Author: chris.laprun(a)jboss.com
Date: 2011-07-29 12:50:35 -0400 (Fri, 29 Jul 2011)
New Revision: 6952
Added:
portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java
Modified:
portal/branches/api/examples/portlets/api/pom.xml
portal/branches/api/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml
Log:
- Added sample portlet to show how the API can be used to navigation portal information.
Modified: portal/branches/api/examples/portlets/api/pom.xml
===================================================================
--- portal/branches/api/examples/portlets/api/pom.xml 2011-07-29 16:46:44 UTC (rev 6951)
+++ portal/branches/api/examples/portlets/api/pom.xml 2011-07-29 16:50:35 UTC (rev 6952)
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--
@@ -35,5 +36,10 @@
<artifactId>portlet-api</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.gatein.api</groupId>
+ <artifactId>gatein-java-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Added:
portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java
===================================================================
---
portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java
(rev 0)
+++
portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java 2011-07-29
16:50:35 UTC (rev 6952)
@@ -0,0 +1,58 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.gatein.portal.samples.api;
+
+import org.gatein.api.GateIn;
+import org.gatein.api.portal.Portal;
+import org.gatein.api.util.IterableIdentifiableCollection;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
+public class NavigationPortlet extends GenericPortlet
+{
+ private GateIn gateIn;
+
+ @Override
+ public void init(PortletConfig config) throws PortletException
+ {
+ super.init(config);
+ gateIn = (GateIn)config.getPortletContext().getAttribute(GateIn.GATEIN_API);
+ }
+
+ @Override
+ protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
+
+ IterableIdentifiableCollection<Portal> portals = gateIn.getPortals();
+ for (Portal portal : portals)
+ {
+ response.getWriter().println(portal.getNavigation());
+ }
+ }
+}
Modified: portal/branches/api/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml
===================================================================
---
portal/branches/api/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml 2011-07-29
16:46:44 UTC (rev 6951)
+++
portal/branches/api/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml 2011-07-29
16:50:35 UTC (rev 6952)
@@ -26,62 +26,81 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1...
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
-->
- <portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="1.0">
+<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="1.0">
<portlet>
- <description xml:lang="EN">Public Render Parameter API
Portlet</description>
- <portlet-name>PRPAPIPortlet</portlet-name>
- <display-name xml:lang="EN">Public Render Parameter API
Portlet</display-name>
- <portlet-class>org.gatein.portal.samples.api.PRPPortlet</portlet-class>
+ <description xml:lang="EN">Public Render Parameter API
Portlet</description>
+ <portlet-name>PRPAPIPortlet</portlet-name>
+ <display-name xml:lang="EN">Public Render Parameter API
Portlet</display-name>
+
<portlet-class>org.gatein.portal.samples.api.PRPPortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- </supports>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
- <portlet-info>
- <title>PRP Portlet</title>
- <short-title>PRP Portlet</short-title>
- <keywords>Sample</keywords>
- </portlet-info>
+ <portlet-info>
+ <title>PRP Portlet</title>
+ <short-title>PRP Portlet</short-title>
+ <keywords>Sample</keywords>
+ </portlet-info>
-
<supported-public-render-parameter>navigation_uri</supported-public-render-parameter>
-
<supported-public-render-parameter>page_name</supported-public-render-parameter>
-
<supported-public-render-parameter>site_type</supported-public-render-parameter>
-
<supported-public-render-parameter>site_name</supported-public-render-parameter>
-
<supported-public-render-parameter>window_width</supported-public-render-parameter>
-
<supported-public-render-parameter>window_height</supported-public-render-parameter>
-
<supported-public-render-parameter>window_show_info_bar</supported-public-render-parameter>
+
<supported-public-render-parameter>navigation_uri</supported-public-render-parameter>
+
<supported-public-render-parameter>page_name</supported-public-render-parameter>
+
<supported-public-render-parameter>site_type</supported-public-render-parameter>
+
<supported-public-render-parameter>site_name</supported-public-render-parameter>
+
<supported-public-render-parameter>window_width</supported-public-render-parameter>
+
<supported-public-render-parameter>window_height</supported-public-render-parameter>
+
<supported-public-render-parameter>window_show_info_bar</supported-public-render-parameter>
- </portlet>
+ </portlet>
- <public-render-parameter>
- <identifier>navigation_uri</identifier>
- <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:navigatio...
- </public-render-parameter>
- <public-render-parameter>
- <identifier>page_name</identifier>
- <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:page_name...
- </public-render-parameter>
- <public-render-parameter>
- <identifier>site_type</identifier>
- <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:site_type...
- </public-render-parameter>
- <public-render-parameter>
- <identifier>site_name</identifier>
- <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:site_name...
- </public-render-parameter>
- <public-render-parameter>
- <identifier>window_width</identifier>
- <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_wi...
- </public-render-parameter>
- <public-render-parameter>
- <identifier>window_height</identifier>
- <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_he...
- </public-render-parameter>
- <public-render-parameter>
- <identifier>window_show_info_bar</identifier>
- <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_sh...
- </public-render-parameter>
+ <portlet>
+ <description xml:lang="EN">Navigation Portlet Example using
GateIn's public API</description>
+ <portlet-name>NavigationAPIPortlet</portlet-name>
+ <display-name xml:lang="EN">API Navigation
Portlet</display-name>
+
<portlet-class>org.gatein.portal.samples.api.NavigationPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+
+ <portlet-info>
+ <title>API Navigation Portlet</title>
+ <short-title>Navigation Portlet</short-title>
+ <keywords>Sample</keywords>
+ </portlet-info>
+ </portlet>
+
+ <public-render-parameter>
+ <identifier>navigation_uri</identifier>
+ <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:navigatio...
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>page_name</identifier>
+ <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:page_name...
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>site_type</identifier>
+ <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:site_type...
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>site_name</identifier>
+ <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:site_name...
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>window_width</identifier>
+ <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_wi...
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>window_height</identifier>
+ <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_he...
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>window_show_info_bar</identifier>
+ <qname
xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_sh...
+ </public-render-parameter>
+
</portlet-app>