costin      01/06/16 13:38:42

  Modified:    jasper34/generator/org/apache/jasper34/core
                        ContainerLiaison.java
  Log:
  Few more comments.
  
  Few signature changes to allow "singleton" per webapp ( one ContainerLiaiason
  instance per contextin instead of page - a lot of savings, plus we can cache things 
in
  it)
  
  Start to convert the last static methods to instance ( messages ). Also the
  pattern for logging no longer require expensive object allocations.
  
  logKey method is a replacement for log( containerL.getString( key ), new Object[] 
)...
  ( right now is doing exactly the same thing - but later on we can optimize it in
  one place )
  
  Revision  Changes    Path
  1.5       +48 -14    
jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/core/ContainerLiaison.java
  
  Index: ContainerLiaison.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper34/generator/org/apache/jasper34/core/ContainerLiaison.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ContainerLiaison.java     2001/06/12 15:04:12     1.4
  +++ ContainerLiaison.java     2001/06/16 20:38:41     1.5
  @@ -78,31 +78,32 @@
    * @author Costin Manolache
    */
   public abstract class ContainerLiaison {
  -
  -    static ContainerLiaison liaison;
  -
  -    public static ContainerLiaison getContainerLiaison() {
  -     return liaison;
  -    }
  -
  -    public static void setContainerLiaison( ContainerLiaison l ) {
  -     liaison=l;
  +    protected Options options;
  +    
  +    protected ContainerLiaison() {
       }
  +    
   
       // -------------------- Options --------------------
       /**
        * Get hold of the Options object for this context. 
        */
  -    public abstract Options getOptions();
  -
  +    public Options getOptions() {
  +     return options;
  +    }
   
  +    public void setOptions( Options opt ) {
  +     options=opt;
  +    }
   
       // --------------------  resource access --------------------
       
       /** 
  -     * Get the full value of a URI relative to this compilations context
  +     * Get the full value of a URI relative to a compiled page.
  +     * Used only by taglib code to find the taglib descriptor relative
  +     * to the JSP file.
        */
  -    public abstract String resolveRelativeUri(String uri);
  +    public abstract String resolveRelativeUri(String uri, String jspBase);
   
       /**
        * Gets a resource as a stream, relative to the meanings of this
  @@ -115,6 +116,8 @@
       /** 
        * Gets the actual path of a URI relative to the context of
        * the compilation.
  +     * Used to get a real file relative to the base context.
  +     * Used in JspReader, CommandLineContext, TagLibReader, JspServlet
        */
       public abstract String getRealPath(String path);
   
  @@ -133,7 +136,7 @@
        implementation ( TagLibReader ).
       */
       public abstract void readTLD( TagLibraries libs, TagLibraryInfoImpl tl,
  -                      String prefix, String uri )
  +                               String prefix, String uri, String jspBase )
        throws IOException, JasperException;
   
   
  @@ -159,7 +162,25 @@
        */
       public abstract String getOutputDir();
   
  +    // -------------------- New messages --------------------
  +
  +    public void log( String msg ) {
  +     log( msg, null );
  +    }
  +
  +    public void log( String msg, Throwable t ) {
  +     System.out.println("ContainerLiaison: " + msg );
  +     if( t!=null )
  +         t.printStackTrace();
  +    }
   
  +    public void logKey( String key, String param1 ) {
  +     // XXX optimize
  +     String msg= getString( key, new Object[] { param1 });
  +     log( msg );
  +    }
  +    
  +//     public abstract void log( String msg, Throwable t );
       
       // -------------------- messages --------------------
       // XXX TODO
  @@ -230,6 +251,19 @@
        StringManager.getManager("org.apache.jasper34.runtime.res");
   
       private static Log jasperLog = null;    
  +
  +    // -------------------- Default liaison --------------------
  +    
  +    static ContainerLiaison liaison;
  +
  +    public static ContainerLiaison getContainerLiaison() {
  +     return liaison;
  +    }
  +
  +    public static void setContainerLiaison( ContainerLiaison l ) {
  +     liaison=l;
  +    }
  +
   
   
   }
  
  
  

Reply via email to