portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager PortletDescriptorUtilities.java
Date Tue, 11 May 2004 15:23:57 GMT
taylor      2004/05/11 08:23:57

  Modified:    portal/src/java/org/apache/jetspeed/tools/pamanager
                        PortletDescriptorUtilities.java
  Log:
  patch from Ate Douma, continuing his work on Portlet and Servlet deployment validation
  
  PR:
  Obtained from:
  Submitted by:	
  Reviewed by:	
  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.10      +36 -31    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletDescriptorUtilities.java
  
  Index: PortletDescriptorUtilities.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletDescriptorUtilities.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PortletDescriptorUtilities.java	10 May 2004 17:43:07 -0000	1.9
  +++ PortletDescriptorUtilities.java	11 May 2004 15:23:57 -0000	1.10
  @@ -242,8 +242,8 @@
   
       /**
        * Validate a PortletApplicationDefinition tree AFTER its
  -     * WebApplicationDefinition has been loaded. Currently, only the security role
  -     * references of the portlet definitions are validated:
  +     * WebApplicationDefinition has been loaded. Currently, only the security
  +     * role references of the portlet definitions are validated:
        * <ul>
        * <li>A security role reference should reference a security role through a
        * roleLink. A warning message is logged if a direct reference is used.
  @@ -256,32 +256,37 @@
        *            The PortletApplicationDefinition to validate
        * @throws PortletApplicationException
        */
  -     public static void validate(MutablePortletApplication app) throws PortletApplicationException

  -     {
  -         SecurityRoleSet roles = app.getWebApplicationDefinition().getSecurityRoles();
  -         Collection portlets = app.getPortletDefinitions();
  -         Iterator portletIterator = portlets.iterator();
  -         while ( portletIterator.hasNext() ) 
  -         {
  -             PortletDefinition portlet = (PortletDefinition)portletIterator.next();
  -             SecurityRoleRefSet securityRoleRefs = portlet.getInitSecurityRoleRefSet();
  -             Iterator roleRefsIterator = securityRoleRefs.iterator();
  -             while ( roleRefsIterator.hasNext() ) 
  -             {
  -                 SecurityRoleRef roleRef = (SecurityRoleRef)roleRefsIterator.next();
  -                 String roleName = roleRef.getRoleLink();
  -                 if ( roleName == null ) 
  -                 {
  -                     log.warn("No role link specified for portlet " +portlet.getName()+"
security role reference "+ roleRef.getRoleName());
  -                     roleName = roleRef.getRoleName();
  -                 }
  -                 if ( roles.get(roleName) == null ) 
  -                 {
  -                     String errorMsg = "Undefined security role " +roleName+ " referenced
from portlet " + portlet.getName();                    
  -                     log.error(errorMsg);
  -                     throw new PortletApplicationException(errorMsg);
  -                 }
  -             }
  -         }           
  -     }    
  +    public static void validate(MutablePortletApplication app)
  +            throws PortletApplicationException
  +    {
  +        SecurityRoleSet roles = app.getWebApplicationDefinition()
  +                .getSecurityRoles();
  +        Collection portlets = app.getPortletDefinitions();
  +        Iterator portletIterator = portlets.iterator();
  +        while (portletIterator.hasNext())
  +        {
  +            PortletDefinition portlet = (PortletDefinition) portletIterator
  +                    .next();
  +            SecurityRoleRefSet securityRoleRefs = portlet
  +                    .getInitSecurityRoleRefSet();
  +            Iterator roleRefsIterator = securityRoleRefs.iterator();
  +            while (roleRefsIterator.hasNext())
  +            {
  +                SecurityRoleRef roleRef = (SecurityRoleRef) roleRefsIterator
  +                        .next();
  +                String roleName = roleRef.getRoleLink();
  +                if (roleName == null || roleName.length() == 0)
  +                {
  +                    roleName = roleRef.getRoleName();
  +                }
  +                if (roles.get(roleName) == null)
  +                {
  +                    String errorMsg = "Undefined security role " + roleName
  +                            + " referenced from portlet " + portlet.getName();
  +                    log.error(errorMsg);
  +                    throw new PortletApplicationException(errorMsg);
  +                }
  +            }
  +        }
  +    }
   }
  
  
  

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


Mime
View raw message