001: /*
002: * The Apache Software License, Version 1.1
003: *
004: * Copyright (c) 1999 The Apache Software Foundation. All rights
005: * reserved.
006: *
007: * Redistribution and use in source and binary forms, with or without
008: * modification, are permitted provided that the following conditions
009: * are met:
010: *
011: * 1. Redistributions of source code must retain the above copyright
012: * notice, this list of conditions and the following disclaimer.
013: *
014: * 2. Redistributions in binary form must reproduce the above copyright
015: * notice, this list of conditions and the following disclaimer in
016: * the documentation and/or other materials provided with the
017: * distribution.
018: *
019: * 3. The end-user documentation included with the redistribution, if
020: * any, must include the following acknowlegement:
021: * "This product includes software developed by the
022: * Apache Software Foundation (http://www.apache.org/)."
023: * Alternately, this acknowlegement may appear in the software itself,
024: * if and wherever such third-party acknowlegements normally appear.
025: *
026: * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
027: * Foundation" must not be used to endorse or promote products derived
028: * from this software without prior written permission. For written
029: * permission, please contact apache@apache.org.
030: *
031: * 5. Products derived from this software may not be called "Apache"
032: * nor may "Apache" appear in their names without prior written
033: * permission of the Apache Group.
034: *
035: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
036: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
037: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
038: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
039: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
040: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
041: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
042: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
043: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
044: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
045: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
046: * SUCH DAMAGE.
047: * ====================================================================
048: *
049: * This software consists of voluntary contributions made by many
050: * individuals on behalf of the Apache Software Foundation. For more
051: * information on the Apache Software Foundation, please see
052: * <http://www.apache.org/>.
053: *
054: */
055:
056: package com.sun.portal.providers.jsp.jasper3.jasper;
057:
058: import com.sun.portal.providers.jsp.jasper3.jasper.compiler.JspReader;
059: import com.sun.portal.providers.jsp.jasper3.jasper.compiler.ServletWriter; //import com.sun.portal.providers.jsp.jasper3.jasper.runtime.JspLoader;
060: import com.sun.portal.providers.jsp.jasper3.jasper.compiler.TagLibraries;
061: import java.io.IOException;
062: import com.sun.portal.providers.jsp.jasper3.jasper.compiler.Compiler;
063:
064: /**
065: * A place holder for various things that are used through out the JSP
066: * engine. This is a per-request/per-context data structure. Some of
067: * the instance variables are set at different points.
068: *
069: * JspLoader creates this object and passes this off to the "compiler"
070: * subsystem, which then initializes the rest of the variables.
071: *
072: * @author Anil K. Vijendran
073: * @author Harish Prabandham
074: */
075: public interface JspCompilationContext {
076:
077: /**
078: * The classpath that is passed off to the Java compiler.
079: */
080: public String getClassPath();
081:
082: /**
083: * Get the input reader for the JSP text.
084: */
085: public JspReader getReader();
086:
087: /**
088: * Where is the servlet being generated?
089: */
090: public ServletWriter getWriter();
091:
092: /**
093: * What class loader to use for loading classes while compiling
094: * this JSP? I don't think this is used right now -- akv.
095: */
096: public ClassLoader getClassLoader();
097:
098: /** Add a jar to the classpath used by the loader
099: */
100: public void addJar(String jar) throws IOException;
101:
102: /**
103: * Are we processing something that has been declared as an
104: * errorpage?
105: */
106: public boolean isErrorPage();
107:
108: /**
109: * What is the scratch directory we are generating code into?
110: * FIXME: In some places this is called scratchDir and in some
111: * other places it is called outputDir.
112: */
113: public String getOutputDir();
114:
115: /**
116: * Path of the JSP URI. Note that this is not a file name. This is
117: * the context rooted URI of the JSP file.
118: */
119: public String getJspFile();
120:
121: /**
122: * Just the class name (does not include package name) of the
123: * generated class.
124: */
125: public String getServletClassName();
126:
127: /**
128: * The package name into which the servlet class is generated.
129: */
130: public String getServletPackageName();
131:
132: /**
133: * Utility method to get the full class name from the package and
134: * class name.
135: */
136: public String getFullClassName();
137:
138: /**
139: * Full path name of the Java file into which the servlet is being
140: * generated.
141: */
142: public String getServletJavaFileName();
143:
144: /**
145: * Are we keeping generated code around?
146: */
147: public boolean keepGenerated();
148:
149: /**
150: * What's the content type of this JSP? Content type includes
151: * content type and encoding.
152: */
153: public String getContentType();
154:
155: /**
156: * Get hold of the Options object for this context.
157: */
158: public Options getOptions();
159:
160: public void setContentType(String contentType);
161:
162: public void setReader(JspReader reader);
163:
164: public void setWriter(ServletWriter writer);
165:
166: public void setServletClassName(String servletClassName);
167:
168: public void setServletPackageName(String servletPackageName);
169:
170: public void setServletJavaFileName(String servletJavaFileName);
171:
172: public void setErrorPage(boolean isErrPage);
173:
174: /**
175: * Create a "Compiler" object based on some init param data. This
176: * is not done yet. Right now we're just hardcoding the actual
177: * compilers that are created.
178: */
179: public Compiler createCompiler() throws JasperException;
180:
181: /**
182: * Get the full value of a URI relative to this compilations context
183: */
184: public String resolveRelativeUri(String uri);
185:
186: /**
187: * Gets a resource as a stream, relative to the meanings of this
188: * context's implementation.
189: *@returns a null if the resource cannot be found or represented
190: * as an InputStream.
191: */
192: public java.io.InputStream getResourceAsStream(String res);
193:
194: /**
195: * Gets the actual path of a URI relative to the context of
196: * the compilation.
197: */
198: public String getRealPath(String path);
199:
200: }
|