[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...

Shane Bryzak Shane_Bryzak at symantec.com
Thu Jan 25 11:40:46 EST 2007


  User: sbryzak2
  Date: 07/01/25 11:40:46

  Modified:    src/main/org/jboss/seam/core  Pages.java
  Log:
  moved page security config to pages.xml
  
  Revision  Changes    Path
  1.75      +844 -874  jboss-seam/src/main/org/jboss/seam/core/Pages.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Pages.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Pages.java,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -b -r1.74 -r1.75
  --- Pages.java	23 Jan 2007 23:42:32 -0000	1.74
  +++ Pages.java	25 Jan 2007 16:40:46 -0000	1.75
  @@ -1,8 +1,6 @@
   package org.jboss.seam.core;
  -
   import static org.jboss.seam.InterceptionType.NEVER;
   import static org.jboss.seam.annotations.Install.BUILT_IN;
  -
   import java.io.InputStream;
   import java.util.ArrayList;
   import java.util.Collections;
  @@ -14,10 +12,8 @@
   import java.util.Set;
   import java.util.SortedSet;
   import java.util.TreeSet;
  -
   import javax.faces.application.ViewHandler;
   import javax.faces.context.FacesContext;
  -
   import org.dom4j.DocumentException;
   import org.dom4j.Element;
   import org.jboss.seam.Component;
  @@ -46,7 +42,6 @@
   import org.jboss.seam.util.Parameters;
   import org.jboss.seam.util.Resources;
   import org.jboss.seam.util.XML;
  -
   /**
    * Holds metadata for pages defined in pages.xml, including
    * page actions and page descriptions.
  @@ -59,7 +54,6 @@
   @Install(precedence=BUILT_IN)
   public class Pages
   {
  -   
      private static final LogProvider log = Logging.getLogProvider(Pages.class);
      
      private Map<String, Page> pagesByViewId = Collections.synchronizedMap( new HashMap<String, Page>() );   
  @@ -91,7 +85,6 @@
            parse(stream);
         }
      }
  -
      /**
       * Run any navigation rule defined in pages.xml
       * 
  @@ -120,7 +113,6 @@
         }
         return false;
      }
  -
      /**
       * Get the Page object for the given view id.
       * 
  @@ -146,7 +138,6 @@
            }
         }
      }
  -
      /**
       * Create a new Page object for a JSF view id,
       * by searching for a viewId.page.xml file.
  @@ -168,7 +159,6 @@
            return getCachedPage(viewId);
         }
      }
  -
      private Page getCachedPage(String viewId)
      {
         Page result = pagesByViewId.get(viewId);
  @@ -206,7 +196,6 @@
         }
         return stack;
      }
  -
      /**
       * Create the stack of pages that match a JSF view id
       */
  @@ -253,15 +242,12 @@
         //run the s:link / s:button action after checking the
         //conversation existence!
         result = callAction(facesContext) || result;
  -
         return result;
      }
  -
      public static String toString(Object returnValue)
      {
         return returnValue == null ? null : returnValue.toString();
      }
  -
      /**
       * Call the JSF navigation handler
       */
  @@ -279,7 +265,6 @@
         }
         return (Pages) Component.getInstance(Pages.class, ScopeType.APPLICATION);
      }
  -
      /**
       * Call the action requested by s:link or s:button.
       */
  @@ -407,7 +392,6 @@
         }
         return parameters;
      }
  -
      /**
       * Get the current value of a page parameter, looking in the page context
       * if there is no value binding
  @@ -424,7 +408,6 @@
            return pageParameter.getValueFromModel(facesContext);
         }
      }
  -
      /**
       * Apply any page parameters passed as parameter values to the model.
       */
  @@ -453,7 +436,6 @@
            }
         }
      }
  -
      /**
       * Apply any page parameters passed as view root attributes to the model.
       */
  @@ -476,7 +458,6 @@
            }
         }
      }
  -
      /**
       * The global setting for no-conversation-viewid.
       * 
  @@ -486,7 +467,6 @@
      {
         return noConversationViewId;
      }
  -
      public void setNoConversationViewId(String noConversationViewId)
      {
         this.noConversationViewId = noConversationViewId;
  @@ -504,7 +484,6 @@
         Map<String, Object> parameters = getConvertedParameters(facesContext, viewId);
         return Manager.instance().encodeParameters(url, parameters);
      }
  -
      /**
       * Store the page parameters to the JSF view root
       */
  @@ -516,7 +495,6 @@
            Contexts.getPageContext().set( param.getKey(), param.getValue() );
         }
      }
  -
      /**
       * Search for a defined no-conversation-view-id, beginning with
       * the most specific view id, then wildcarded view ids, and 
  @@ -536,7 +514,6 @@
         }
         return this.noConversationViewId;
      }
  -
      /**
       * Search for a defined conversation timeout, beginning with
       * the most specific view id, then wildcarded view ids, and 
  @@ -556,7 +533,6 @@
         }
         return Manager.instance().getConversationTimeout();
      }
  -
      public static String getSuffix()
      {
         String defaultSuffix = FacesContext.getCurrentInstance().getExternalContext()
  @@ -564,7 +540,6 @@
         return defaultSuffix == null ? ViewHandler.DEFAULT_SUFFIX : defaultSuffix;
      
      }
  -
      /**
       * Parse a pages.xml file
       */
  @@ -581,7 +556,6 @@
            parse( page, page.attributeValue("view-id") );
         } 
      }
  -
      /**
       * Parse a viewId.page.xml file
       */
  @@ -589,7 +563,6 @@
      {
         parse( getDocumentRoot(stream), viewId );
      }
  -
      /**
       * Get the root element of the document
       */
  @@ -604,7 +577,6 @@
            throw new RuntimeException(de);
         }
      }
  -
      /**
       * Parse a page element and add a Page to the map
       */
  @@ -621,10 +593,8 @@
         }
         Page page = new Page(viewId);
         pagesByViewId.put(viewId, page);
  -
         parsePage(page, element, viewId);
         parseConversationControl( element, page.getConversationControl() );
  -
         List<Element> children = element.elements("param");
         for (Element param: children)
         {
  @@ -636,8 +606,16 @@
         {
            parseActionNavigation(page, fromAction);
         }
  -   }
   
  +      Element restrict = element.element("restrict");
  +      if (restrict != null)
  +      {
  +         page.setRestricted(true);
  +         
  +         String expr = restrict.getTextTrim();
  +         if (!"".equals(expr)) page.setRestriction(expr);
  +      }
  +   }
      /**
       * Parse the attributes of page
       */
  @@ -676,7 +654,6 @@
         {
            page.setResourceBundleName(bundle);
         }
  -
         List<Element> moreChildElements = element.elements("in");
         for (Element child: moreChildElements)
         {
  @@ -693,7 +670,6 @@
         
         return page;
      }
  -
      private static Action parseAction(Element element, String actionAtt)
      {
         Action action = new Action();
  @@ -715,7 +691,6 @@
         }
         return action;
      }
  -
      /**
       * Parse end-conversation and begin-conversation
       */
  @@ -747,7 +722,6 @@
            throw new IllegalStateException("cannot use both <begin-conversation/> and <end-conversation/>");
         }
      }
  -
      /**
       * Parse navigation
       */
  @@ -781,7 +755,6 @@
            entry.getNavigations().put(expression, navigation);
         }
      }
  -
      /**
       * Parse param
       */
  @@ -810,7 +783,6 @@
         }
         return param;
      }
  -
      /**
       * Parse rule
       */
  @@ -830,7 +802,6 @@
         
         return rule;
      }
  -
      private static void parseNavigationHandler(Element element, Rule rule)
      {
         Element render = element.element("render");
  @@ -870,5 +841,4 @@
         }
         
      }
  -
   }
  
  
  



More information about the jboss-cvs-commits mailing list