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/07/07 01:30:48 UTC

cvs commit: jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/container JetspeedPortletContext.java

taylor      2004/07/06 16:30:48

  Modified:    commons/src/java/org/apache/jetspeed/container
                        JetspeedPortletContext.java
  Log:
  If a portlet is going to make use of a CPS, it must declare it
  Here we validate the CPS upon invocation
  
  completed  JS2-70 -- Support service definitions in Jetspeed portlet descriptor
  this commit completes step 2, validation
  
  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.7       +29 -1     jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/container/JetspeedPortletContext.java
  
  Index: JetspeedPortletContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/container/JetspeedPortletContext.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JetspeedPortletContext.java	6 Jun 2004 01:59:59 -0000	1.6
  +++ JetspeedPortletContext.java	6 Jul 2004 23:30:48 -0000	1.7
  @@ -16,7 +16,9 @@
   package org.apache.jetspeed.container;
   
   import java.io.InputStream;
  +import java.util.Collection;
   import java.util.Enumeration;
  +import java.util.Iterator;
   
   import javax.servlet.ServletContext;
   import javax.servlet.RequestDispatcher;
  @@ -25,6 +27,7 @@
   import javax.portlet.PortletRequestDispatcher;
   
   import org.apache.jetspeed.dispatcher.JetspeedRequestDispatcher;
  +import org.apache.jetspeed.om.common.JetspeedServiceReference;
   import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
   import org.apache.jetspeed.services.JetspeedPortletServices;
   import org.apache.jetspeed.services.PortletServices;
  @@ -111,6 +114,31 @@
           if (name.startsWith("cps:"))
           {
               String serviceName = name.substring("cps:".length());
  +            
  +            // validate service
  +            Collection validServices = application.getJetspeedServices();
  +            if (null == validServices)
  +            {
  +                return null;
  +            }
  +            boolean found = false;
  +            Iterator iterator = validServices.iterator();
  +            while (iterator.hasNext())
  +            {
  +                JetspeedServiceReference validService = (JetspeedServiceReference)iterator.next();
  +                if (validService.getName().equals(serviceName))
  +                {
  +                    found = true;
  +                    break;
  +                }
  +            }
  +            
  +            if (!found)
  +            {
  +                return null;
  +            }
  +            
  +            // return the service
               PortletServices services = JetspeedPortletServices.getSingleton();
               return services.getService(serviceName);
           }
  
  
  

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