You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2004/06/06 03:44:55 UTC

cvs commit: jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF portlet.xml

taylor      2004/06/05 18:44:55

  Modified:    applications/demo/src/java/org/apache/jetspeed/portlet/helloworld
                        HelloWorld.java
               applications/demo project.xml
               applications/pam/src/webapp/WEB-INF portlet.xml
  Added:       applications/pam/src/java/org/apache/jetspeed/portlets/pam
                        PortletApplicationBrowser.java
                        PortletApplicationDetail.java
               applications/pam project.properties maven.xml project.xml
               applications/pam/src/webapp/WEB-INF/view pam-browser.jsp
                        pam-detail.jsp
  Log:
  Moved PAM portlets back into a portlet application
  Uses new PortletServices to access a common portlet service through the Portlet API's PortletContext.getAttribute("cps:...
  see http://nagoya.apache.org/jira/browse/JS2-70
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBrowser.java
  
  Index: PortletApplicationBrowser.java
  ===================================================================
  /*
   * Copyright 2000-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.jetspeed.portlets.pam;
  
  import java.io.IOException;
  import java.util.Enumeration;
  import java.util.Iterator;
  import java.util.List;
  //import java.io.InputStream;
  
  import javax.portlet.ActionRequest;
  import javax.portlet.ActionResponse;
  
  import javax.portlet.PortletConfig;
  import javax.portlet.PortletContext;
  import javax.portlet.PortletException;
  import javax.portlet.RenderRequest;
  import javax.portlet.RenderResponse;
  
  import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
  import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
  import org.apache.jetspeed.portlet.ServletPortlet;
  
  //import org.apache.jetspeed.cps.util.Streams;
  
  /**
   * This portlet is a browser over all the portlet applications in the system.
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @author <a href="mailto:ccardona@gluecode.com">Chris Cardona</a>
   * 
   * @version $Id: PortletApplicationBrowser.java,v 1.1 2004/06/06 01:44:54 taylor Exp $
   */
  public class PortletApplicationBrowser extends ServletPortlet
  {
      private String template;
      
      public void init(PortletConfig config)
      throws PortletException 
      {
          super.init(config);
      }
      
      public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException
      {
          PortletContext context = getPortletContext();
          response.setContentType("text/html");
          
          PortletRegistryComponent registry = (PortletRegistryComponent)
                  context.getAttribute("cps:PortletRegistryComponent");
          if (registry != null)
          {
              List apps = registry.getPortletApplications();
              /*
              Iterator it = apps.iterator();
              while (it.hasNext())
              {
                  MutablePortletApplication pa = (MutablePortletApplication)it.next();
                  System.out.println("PA = " + pa.getName());                
              }
              */
              request.setAttribute("apps", apps);            
          }        
          super.doView(request, response);
          
      }
  
      
  	public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
  	{
  		System.out.println("PorletApplicationBrowser: processAction()");
  	}
  }
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationDetail.java
  
  Index: PortletApplicationDetail.java
  ===================================================================
  /*
 * Copyright 2000-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.jetspeed.portlets.pam;
  
  import java.io.IOException;
//import java.io.InputStream;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletContext;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
import javax.portlet.PortletURL;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.WindowState;
  import org.apache.jetspeed.portlet.ServletPortlet;

  /**
 * This portlet is a browser over all the portlet applications in the system.
 *
 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
 * @author <a href="mailto:ccardona@gluecode.com">Chris Cardona</a>
 * @version $Id: PortletApplicationDetail.java,v 1.1 2004/06/06 01:44:54 taylor Exp $
 */
public class PortletApplicationDetail extends ServletPortlet
{
    public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException
      {
          PortletContext context = getPortletContext();
          response.setContentType("text/html");        
          PortletURL url = response.createRenderURL();
          PortletURL actionUrl = response.createActionURL();
          url.setWindowState(WindowState.MAXIMIZED);
          actionUrl.setPortletMode(PortletMode.EDIT);
          // url.addParameter("test", "value");
          response.getWriter().println("<br/><b>Init Param 'Template' = " + this.getInitParameter("template") +  "</b>");
        response.getWriter().println("<br/><b>Render URL = <a href='" + url +  "'>" + url + "</a></b>");
        response.getWriter().println("<br/><b>Action URL = <a href='" + actionUrl +  "'>" + actionUrl + "</a></b>");
        response.getWriter().println("<br/><b>Request dispatching now</b>");        
          super.doView(request, response);
       }
  	public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
	{
		System.out.println("PorletApplicationDetail: processAction()");
	}
  }
  
  
  1.4       +14 -3     jakarta-jetspeed-2/applications/pam/project.properties
  
  
  
  
  1.5       +5 -0      jakarta-jetspeed-2/applications/pam/maven.xml
  
  
  
  
  1.4       +51 -16    jakarta-jetspeed-2/applications/pam/project.xml
  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/view/pam-browser.jsp
  
  Index: pam-browser.jsp
  ===================================================================
  <%--
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.
--%>
<%@ page language="java" import="javax.portlet.*, java.util.List, java.util.Iterator, org.apache.jetspeed.om.common.portlet.MutablePortletApplication" session="true" %>
<%@ taglib uri='/WEB-INF/portlet.tld' prefix='portlet'%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<portlet:defineObjects/>

  <p>This page was invoked from a LOCAL portlet app</P>
<a href='/snipet.html'>somelink</a>
<p>renderURL</p>
<p>
<portlet:renderURL windowState="normal" portletMode="view"  var="myView">
	 <portlet:param name="invokeMsg" value="No action just render" />
</portlet:renderURL>
<a href="<c:out value="${myView}" />">View!</a>
</p>
<p>"<c:out value="${myView}" />"</p>
<p>
<a href="<portlet:actionURL windowState="normal" portletMode="view" />">My Action!!!</a>
<a href="<portlet:actionURL windowState="normal" portletMode="view" />">Invoke My Action!!!</a>
</p>

  <br>

  <table>
<%
 List apps = (List) renderRequest.getAttribute("apps");
 for (Iterator i = apps.iterator(); i.hasNext();)
 {
   MutablePortletApplication pa = (MutablePortletApplication) i.next();
   out.println("<tr><td>" + pa.getName() + "</td>");
   out.println("<td>" + pa.getDescription() + "</td></tr>"); 
 }
%>
</table>

  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/view/pam-detail.jsp
  
  Index: pam-detail.jsp
  ===================================================================
  <%--
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.
--%>
<%@ page language="java" import="javax.portlet.*, java.util.List" session="true" %>
<%@ taglib uri='/WEB-INF/portlet.tld' prefix='portlet'%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<portlet:defineObjects/>
<br>
<p>TODO: write me</p>
  
  
  1.6       +2 -1      jakarta-jetspeed-2/applications/demo/src/java/org/apache/jetspeed/portlet/helloworld/HelloWorld.java
  
  Index: HelloWorld.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/demo/src/java/org/apache/jetspeed/portlet/helloworld/HelloWorld.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HelloWorld.java	2 Jun 2004 05:05:39 -0000	1.5
  +++ HelloWorld.java	6 Jun 2004 01:44:55 -0000	1.6
  @@ -26,6 +26,7 @@
   import javax.portlet.RenderRequest;
   import javax.portlet.RenderResponse;
   
  +
   /**
    *  This example portlet will display text <pre>This is a test from hello.jsp</pre>
    *
  @@ -60,7 +61,7 @@
       throws PortletException 
       {
           System.out.println("HelloWorldPortlet: initializing portlet, config = " + config.getPortletName());
  -        super.init(config);
  +        super.init(config);        
       }
       
       /*
  
  
  
  1.13      +2 -2      jakarta-jetspeed-2/applications/demo/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/demo/project.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- project.xml	7 Apr 2004 13:38:32 -0000	1.12
  +++ project.xml	6 Jun 2004 01:44:55 -0000	1.13
  @@ -14,7 +14,7 @@
       <url>http://cvs.apache.org/viewcvs/jakarta-jetspeed-2/applications/demo/</url>
     </repository>
   
  -  <dependencies>
  +  <dependencies>      
         <dependency>
         <id>portlet-api</id>
         <groupId>portlet-api</groupId>
  
  
  
  1.5       +48 -18    jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/portlet.xml
  
  Index: portlet.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/portlet.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- portlet.xml	5 Jun 2004 00:52:12 -0000	1.4
  +++ portlet.xml	6 Jun 2004 01:44:55 -0000	1.5
  @@ -15,24 +15,54 @@
   limitations under the License.
   -->
   <portlet-app id="security" version="1.0">
  -	<portlet id="LoginPortlet">
  -    	<init-param>
  -      		<name>ViewPage</name>
  -      		<value>/WEB-INF/security/login/login.jsp</value>
  -		</init-param>
  -    	<portlet-name>LoginPortlet</portlet-name>
  -    	<display-name>Login Portlet</display-name>
  -    	<portlet-class>org.apache.jetspeed.portlet.ServletPortlet</portlet-class>
  -	    <expiration-cache>-1</expiration-cache>
  -    	<supports>
  -	      <mime-type>text/html</mime-type>
  -    	  <portlet-mode>VIEW</portlet-mode>
  -    	</supports>
  -		<portlet-info>
  -			<title>Login Portlet</title>
  -			<short-title>Login Portlet</short-title>
  -    	</portlet-info>
  -  	</portlet>
  +
  +<portlet id="PortletApplicationBrowser">
  +    <init-param>
  +    	<description>This parameter sets the template used in view mode.</description>
  +		<name>ViewPage</name>
  +			<value>/WEB-INF/view/pam-browser.jsp</value>
  +     </init-param>   
  +    <portlet-name>PortletApplicationBrowser</portlet-name>
  +    <display-name>Portlet Application Browser</display-name>
  +    <description>The PAM (Portlet Application Manager) Portlet Application Browser displays a list of portlet applications deployed to this portal. From here you can add, edit, and delete portlet applications.</description>
  +    <portlet-class>org.apache.jetspeed.portlets.pam.PortletApplicationBrowser</portlet-class>
  +    <expiration-cache>-1</expiration-cache>
  +    <supports>
  +      <mime-type>text/html</mime-type>
  +      <portlet-mode>EDIT</portlet-mode>
  +      <portlet-mode>VIEW</portlet-mode>
  +      <portlet-mode>HELP</portlet-mode>
  +    </supports>
  +    <portlet-info>
  +      <title>Portlet Application Browser</title>
  +      <short-title>Apps</short-title>
  +      <keywords>applications,apps,PAM</keywords>
  +    </portlet-info>
  +</portlet>
  +
  +<portlet id="PortletApplicationDetail">
  +    <init-param>
  +      <description>This parameter sets the template used in view mode.</description>
  +      <name>ViewPage</name>
  +      <value>//WEB-INF/view/pam-detail.jsp</value>
  +    </init-param>   
  +    <portlet-name>PortletApplicationDetail</portlet-name>
  +    <display-name>Portlet Application Detail</display-name>
  +    <description>The PAM (Portlet Application Manager) Portlet Application Detail displays a specific portlet application deployed to this portal. From here you can add, edit, and delete this portlet application.</description>
  +    <portlet-class>org.apache.jetspeed.portlets.pam.PortletApplicationDetail</portlet-class>
  +    <expiration-cache>-1</expiration-cache>
  +    <supports>
  +      <mime-type>text/html</mime-type>
  +      <portlet-mode>EDIT</portlet-mode>
  +      <portlet-mode>VIEW</portlet-mode>
  +      <portlet-mode>HELP</portlet-mode>
  +    </supports>
  +    <portlet-info>
  +      <title>Portlet Application Detail</title>
  +      <short-title>PAD</short-title>
  +      <keywords>applications,apps,PAM</keywords>
  +    </portlet-info>
  +  </portlet>
   
   </portlet-app>
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org