You are viewing a plain text version of this content. The canonical link for it is here.
Posted to servletapi-dev@jakarta.apache.org by ed...@locus.apache.org on 2000/10/25 21:11:25 UTC

cvs commit: jakarta-servletapi/src/share/javax/servlet/jsp/tagext TagLibraryValidator.java

eduardop    00/10/25 12:11:23

  Modified:    src/share/javax/servlet/jsp/tagext Tag: SERVLET_23_JSP_12
                        TagLibraryValidator.java
  Log:
  Renamed PageInfo to PageData for consistency with TagData.
  
  Changed protocol so it does not depend on TagLibraryInfo but instead relies
  on <init-param> information.  Clarified the lifecycle and invocation protocol
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +42 -15    jakarta-servletapi/src/share/javax/servlet/jsp/tagext/Attic/TagLibraryValidator.java
  
  Index: TagLibraryValidator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-servletapi/src/share/javax/servlet/jsp/tagext/Attic/TagLibraryValidator.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- TagLibraryValidator.java	2000/08/24 21:05:31	1.1.2.1
  +++ TagLibraryValidator.java	2000/10/25 19:11:21	1.1.2.2
  @@ -55,15 +55,30 @@
   
   package javax.servlet.jsp.tagext;
   
  +import java.util.Map;
  +
   /**
    * Translation-time validator class for a JSP page. 
    * A validator operates on the XML document associated with the JSP page.
    *
  + * <p>
  + * The TLD file associates a TagLibraryValidator class and some init
  + * arguments with a tag library.
  + *
  + * <p>
  + * The JSP container is reponsible for locating an approriate
  + * instance of the appropriate subclass by
  + *
  + * <ul>
  + * <li> new a fresh instance, or reuse an available one
  + * <li> invoke the setInitParams(Map) method on the instance
  + * </ul>
  + *
  + * once initialized, the validate(String, String, PageData) method will
  + * be invoked, where the first two arguments are the prefix
  + * and uri arguments used in the taglib directive.
  + *
    * <p>
  - * Validator classes are associated with a tag library via the TLD.
  - * A TagLibraryValidator instance is associated with a given TLD
  - * and the JSP translator will invoke the setTagLibraryInfo method
  - * on an instance before invoking the validate method.
    * A TagLibraryValidator instance
    * may create auxiliary objects internally to perform
    * the validation (e.g. an XSchema validator) and may reuse it for all
  @@ -73,37 +88,49 @@
   abstract public class TagLibraryValidator {
   
       /**
  -     * Set the TagLibraryInfo data for this validator.
  +     * Set the init data in the TLD for this validator.
  +     * Parameter names are keys, and parameter values are the values.
        *
  -     * @param tld The TagLibraryInfo instance
  +     * @param initMap A Map describing the init parameters
        */
  -    public void setTagLibraryInfo(TagLibraryInfo tld) {
  -	theTLD = tld;
  +    public void setInitParameters(Map map) {
  +	initParameters = map;
       }
   
   
       /**
  -     * Get the TagLibraryInfo associated with with Validator.
  +     * Get the init parameters data as an immutable Map.
  +     * Parameter names are keys, and parameter values are the values.
        *
  -     * @return The TagLibraryInfo instance
  +     * @return The init parameters as an immutable map.
        */
  -    public TagLibraryInfo getTagLibraryInfo() {
  -	return theTLD;
  +    public Map getInitParameters() {
  +	return initParameters;
       }
   
       /**
        * Validate a JSP page.
  +     * This will get invoked once per directive in the JSP page.
        * This method will return a null String if the page passed through
        * is valid; otherwise an error message.
        *
  -     * @param thePage the JSP page object
  +     * @param prefix the value of the prefix argument in the directive
  +     * @param uri the value of the uri argument in the directive
  +     * @param thePage the JspData page object
        * @return A string indicating whether the page is valid or not.
        */
  -    public String validate(PageInfo thePage) {
  +    public String validate(String prefix, String uri, PageData page) {
   	return null;
       }
   
  +    /**
  +     * Release any data kept by this instance for validation purposes
  +     */
  +    public void release() {
  +	initParameters = null;
  +    };
  +
       // Private data
  -    private TagLibraryInfo theTLD;
  +    private Map initParameters;
   
   }