luehe       2002/07/25 12:02:16

  Modified:    jasper2/src/share/org/apache/jasper/compiler
                        JspDocumentParser.java Parser.java
                        TagLibraryInfoImpl.java
  Log:
  Integrated TagFileProcessor into TagLibraryInfo constructor
  
  Revision  Changes    Path
  1.9       +5 -5      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java
  
  Index: JspDocumentParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JspDocumentParser.java    24 Jul 2002 19:58:57 -0000      1.8
  +++ JspDocumentParser.java    25 Jul 2002 19:02:16 -0000      1.9
  @@ -483,8 +483,8 @@
                       // get the location
                       String[] location = ctxt.getTldLocation(uri);
                   
  -                    tl = new TagLibraryInfoImpl(ctxt, prefix, uri, location,
  -                                             err);
  +                    tl = new TagLibraryInfoImpl(ctxt, parserController, prefix,
  +                                             uri, location, err);
                   }
                taglibs.put(prefix, tl);
            }
  
  
  
  1.12      +6 -5      
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java
  
  Index: Parser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Parser.java       22 Jul 2002 20:35:27 -0000      1.11
  +++ Parser.java       25 Jul 2002 19:02:16 -0000      1.12
  @@ -371,8 +371,9 @@
        if (uri != null && prefix != null) {
            // Errors to be checked in Validator
            String[] location = ctxt.getTldLocation(uri);
  -         TagLibraryInfo tl = new TagLibraryInfoImpl(ctxt, prefix, uri,
  -                                                location, err);
  +         TagLibraryInfo tl = new TagLibraryInfoImpl(ctxt, parserController,
  +                                                    prefix, uri, location,
  +                                                    err);
            taglibs.put(prefix, tl);
        }
   
  
  
  
  1.5       +51 -13    
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java
  
  Index: TagLibraryInfoImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TagLibraryInfoImpl.java   22 Jul 2002 23:02:55 -0000      1.4
  +++ TagLibraryInfoImpl.java   25 Jul 2002 19:02:16 -0000      1.5
  @@ -81,13 +81,14 @@
    * @author Kin-man Chung
    */
   public class TagLibraryInfoImpl extends TagLibraryInfo {
  -    static private final String TAGLIB_TLD = "META-INF/taglib.tld";
  -    static private final String WEB_XML = "/WEB-INF/web.xml";
   
  -    Hashtable jarEntries;
  +    private static final String TAGLIB_TLD = "META-INF/taglib.tld";
  +    private static final String WEB_XML = "/WEB-INF/web.xml";
   
  -    JspCompilationContext ctxt;
  -    ErrorDispatcher err;
  +    private Hashtable jarEntries;
  +    private JspCompilationContext ctxt;
  +    private ErrorDispatcher err;
  +    private ParserController parserController;
   
       private final void print(String name, String value, PrintWriter w) {
           if (value != null) {
  @@ -141,14 +142,19 @@
          
       }
   
  -    public TagLibraryInfoImpl(JspCompilationContext ctxt, String prefix, 
  -                           String uriIn, String[] location,
  -                           ErrorDispatcher err) 
  -                throws JasperException {
  -
  +    /**
  +     * Constructor.
  +     */
  +    public TagLibraryInfoImpl(JspCompilationContext ctxt,
  +                           ParserController pc,
  +                           String prefix, 
  +                           String uriIn,
  +                           String[] location,
  +                           ErrorDispatcher err) throws JasperException {
           super(prefix, uriIn);
   
        this.ctxt = ctxt;
  +     this.parserController = pc;
        this.err = err;
           ZipInputStream zin;
           InputStream in = null;
  @@ -275,6 +281,8 @@
                   this.tagLibraryValidator = createValidator(element);
               else if ("tag".equals(tname))
                   tagVector.addElement(createTagInfo(element));
  +            else if ("tag-file".equals(tname))
  +                tagVector.addElement(createTagInfoFromTagFile(element));
               else if ("function".equals(tname))          // JSP2.0
                   functionVector.addElement(createFunctionInfo(element));
               else if ("display-name".equals(tname) ||    // Ignored elements
  @@ -415,6 +423,36 @@
                                         fragmentAttributes,
                                         dynamicAttributes);
           return taginfo;
  +    }
  +
  +    /*
  +     * Parses the tag file directives of the given TagFile and turns them into
  +     * a TagInfo.
  +     *
  +     * @return TagInfo correspoding to tag file directives
  +     */
  +    private TagInfo createTagInfoFromTagFile(TreeNode elem)
  +             throws JasperException {
  +
  +     TagInfo tagInfo = null;
  +
  +        Iterator list = elem.findChildren();
  +        while (list.hasNext()) {
  +            TreeNode child = (TreeNode) list.next();
  +            String tname = child.getName();
  +            if ("path".equals(tname)) {
  +             String tagFilePath = child.getBody();
  +             try {
  +                 tagInfo = TagFileProcessor.parseTagFile(parserController,
  +                                                         tagFilePath);
  +             } catch (FileNotFoundException e) {
  +                 err.jspError("jsp.error.file.not.found", tagFilePath);
  +             }
  +             break;
  +         }
  +     }
  +
  +     return tagInfo;
       }
   
       TagAttributeInfo createAttribute(TreeNode elem) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to