submarine.pages
Class WSPCompilerLoader

java.lang.Object
  |
  +--submarine.pages.WSPCompilerLoader

public class WSPCompilerLoader
extends java.lang.Object

class that will pilot the compilation and load of the auto build class


Inner Class Summary
private  class WSPCompilerLoader.ErrorListener
          This internal class handles errors for the XSL transformation
private  class WSPCompilerLoader.LocalUriResolver
           
 
Field Summary
protected  java.io.ByteArrayOutputStream baos_messages
           
 int counter
           
 SimpleClassLoader instantClassLoader
           
private  java.lang.String javaEncoding
           
 java.lang.String javaFileName
           
protected  java.io.PrintStream out
           
 java.lang.String page
           
 java.lang.String pagesPath
           
static boolean reloadXSL
           
private  javax.xml.transform.Templates templatePageToJava
          The internal template for xsl compilation.
 java.lang.Class theClass
           
 java.lang.String workPath
           
 java.lang.String wsp_id
           
 java.lang.String xslPageToJava
           
 
Constructor Summary
WSPCompilerLoader(java.lang.String path, java.lang.String page)
           
WSPCompilerLoader(java.lang.String workPath, java.lang.String wspId, java.lang.String xslCompiler, java.lang.String path, java.lang.String page)
           
 
Method Summary
private  boolean compileJava()
          compile the generated file to class file
private  boolean compileXSL()
          compile the page using XSL styleSheet Then compile the java file to class
 java.lang.String getErrorMessages()
           
private  int getLastExistingCounter()
          returns the last index used by the java files generated
private  boolean hasLoadedClass()
          Test whether we need to load the class file in the classLoader
private  boolean loadClass()
          replace the class loader by a new one in order to free the previously loaded class
private  javax.xml.transform.Templates loadXSL()
          Load the StyleSheet from the classes resources
private  boolean shouldCompile()
          returns true if the files say it should be rebuild
 boolean update()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

workPath

public java.lang.String workPath

wsp_id

public java.lang.String wsp_id

xslPageToJava

public java.lang.String xslPageToJava

reloadXSL

public static final boolean reloadXSL

pagesPath

public java.lang.String pagesPath

page

public java.lang.String page

javaFileName

public java.lang.String javaFileName

theClass

public java.lang.Class theClass

instantClassLoader

public SimpleClassLoader instantClassLoader

counter

public int counter

javaEncoding

private java.lang.String javaEncoding

baos_messages

protected java.io.ByteArrayOutputStream baos_messages

out

protected java.io.PrintStream out

templatePageToJava

private javax.xml.transform.Templates templatePageToJava
The internal template for xsl compilation. Keeped in a variable in order to not reload it at each compilation
Constructor Detail

WSPCompilerLoader

public WSPCompilerLoader(java.lang.String workPath,
                         java.lang.String wspId,
                         java.lang.String xslCompiler,
                         java.lang.String path,
                         java.lang.String page)

WSPCompilerLoader

public WSPCompilerLoader(java.lang.String path,
                         java.lang.String page)
Method Detail

getErrorMessages

public java.lang.String getErrorMessages()

getLastExistingCounter

private int getLastExistingCounter()
returns the last index used by the java files generated

shouldCompile

private boolean shouldCompile()
                       throws java.io.FileNotFoundException
returns true if the files say it should be rebuild

loadXSL

private javax.xml.transform.Templates loadXSL()
                                       throws java.lang.Exception
Load the StyleSheet from the classes resources

compileXSL

private boolean compileXSL()
                    throws java.lang.Exception
compile the page using XSL styleSheet Then compile the java file to class

compileJava

private boolean compileJava()
                     throws java.lang.Exception
compile the generated file to class file

hasLoadedClass

private boolean hasLoadedClass()
Test whether we need to load the class file in the classLoader

loadClass

private boolean loadClass()
                   throws java.lang.Exception
replace the class loader by a new one in order to free the previously loaded class

update

public boolean update()
               throws java.lang.Exception

Submarine project. free distribution of this software must include the opensource licence.
Guénolé de Cadoudal.