org.enhydra.shark.utilities
Class Compiler

java.lang.Object
  extended by org.enhydra.shark.utilities.Compiler

public class Compiler
extends java.lang.Object

Author:
Svjetlana Milidrag

Constructor Summary
Compiler()
          Compiler Constructor without parameters loadProperties - load property parameters from default property file
Compiler(com.lutris.util.Config config)
          Compiler Constructor for given Config object for loading properties loadProperties - load property parameters from default property file
Compiler(java.io.File propertyFile)
          Compiler Constructor for given property file for loading properties loadProperties - load property parameters from default property file
Compiler(java.io.InputStream propertyIs)
          Compiler Constructor for given Input stream for loading properties loadProperties - load property parameters from default property file
Compiler(java.util.Properties properties)
          Compiler Constructor for given Properties object for loading properties loadProperties - load property parameters from default property file
Compiler(java.lang.String propertyFileName)
          Compiler Constructor for given property file name for loading properties loadProperties - load property parameters from default property file
 
Method Summary
 void autoCompile(boolean force)
          Method : autoCompile() Method for auto compile - it first creates auto compile parameters fom property file - depend of parameter format (which is defined in property file) it calls compileSingle(fullParameterString) or compileArray(fullParameterArray) function
 void autoCompile(java.lang.String sourceDir, java.lang.String outDir, boolean force)
          Method : autoCompile(String sourceDir,String outputDir,boolean force) Method for auto compile - it first creates auto compile parameters fom property file - depend of parameter format (which is defined in property file) it calls compileSingle(fullParameterString) or compileArray(fullParameterArray) function
 void clearHistory()
          Clear timestamp cache
 void compile(java.lang.String fileName, boolean force)
          Method : Compile(String fileName)) compile single java file as parameter accepts full path to java file compiler class, output dir, and compiler parameters gets from properties
 void compile(java.lang.String fileName, java.lang.String outDir, boolean force)
          Method : Compile(String fileName, String outDir)) compile single java file as parameter accepts full path to java file and output directory compiler class and compiler parameters gets from properties
 void compile(java.lang.String fileName, java.lang.String outDir, java.lang.String[] parameters, boolean force)
          Method : Compile(String fileName, String outDir, String[] parameters)) compile single java file as parameter accepts full path to java file,output directory and array of other parameters for compiler compiler class gets from properties
 com.lutris.logging.LogChannel getLogChannel()
           
 java.lang.String getProperty(java.lang.String key)
          Function for getting property as String
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultVal)
          Function for getting property as String with default value
 java.lang.String[] getPropertyArray(java.lang.String key)
          Function for getting property as String[]
 java.lang.String[] getPropertyArray(java.lang.String key, java.lang.String[] defaultVal)
          Function for getting property as String[] with default value
 boolean isCompiledOnce()
           
 void putInClassHash(java.lang.String key, java.lang.Long value)
          Put java files timestamps in HashTable javaFilesTimestamps
 void runThread(int time)
          start thread
 boolean saveProperties()
          Save property file
 void setLogChannel(com.lutris.logging.LogChannel logChannel)
          Function for set logChannel
 void setProperty(java.lang.String key, java.lang.String newVal)
           
 void setPropertyArray(java.lang.String key, java.lang.String[] newValues)
          Set property as String[] , and remove old values
 void stopThread(int time)
          stop thread
 void updateCache()
          Update timestamp cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Compiler

public Compiler()
         throws java.lang.SecurityException,
                java.lang.NoSuchMethodException,
                java.lang.ClassNotFoundException
Compiler Constructor without parameters loadProperties - load property parameters from default property file

Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException

Compiler

public Compiler(java.lang.String propertyFileName)
         throws java.lang.SecurityException,
                java.lang.NoSuchMethodException,
                java.lang.ClassNotFoundException
Compiler Constructor for given property file name for loading properties loadProperties - load property parameters from default property file

Parameters:
propertyFileName - - filename for properties file
Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException

Compiler

public Compiler(java.io.File propertyFile)
         throws java.lang.SecurityException,
                java.lang.NoSuchMethodException,
                java.lang.ClassNotFoundException
Compiler Constructor for given property file for loading properties loadProperties - load property parameters from default property file

Parameters:
propertyFile - - properties file
Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException

Compiler

public Compiler(java.io.InputStream propertyIs)
         throws java.lang.SecurityException,
                java.lang.NoSuchMethodException,
                java.lang.ClassNotFoundException
Compiler Constructor for given Input stream for loading properties loadProperties - load property parameters from default property file

Parameters:
propertyIs - - InpuStream for properties file
Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException

Compiler

public Compiler(java.util.Properties properties)
         throws java.lang.SecurityException,
                java.lang.NoSuchMethodException,
                java.lang.ClassNotFoundException
Compiler Constructor for given Properties object for loading properties loadProperties - load property parameters from default property file

Parameters:
properties - - properties object
Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException

Compiler

public Compiler(com.lutris.util.Config config)
         throws java.lang.Exception
Compiler Constructor for given Config object for loading properties loadProperties - load property parameters from default property file

Parameters:
config - -Config object
Throws:
java.lang.Exception
Method Detail

isCompiledOnce

public boolean isCompiledOnce()

compile

public void compile(java.lang.String fileName,
                    boolean force)
             throws java.lang.Exception
Method : Compile(String fileName)) compile single java file as parameter accepts full path to java file compiler class, output dir, and compiler parameters gets from properties

Parameters:
fileName - - full path to java file for compile
Throws:
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.Exception

compile

public void compile(java.lang.String fileName,
                    java.lang.String outDir,
                    boolean force)
             throws java.lang.IllegalArgumentException,
                    java.lang.reflect.InvocationTargetException,
                    java.lang.SecurityException,
                    java.lang.NoSuchMethodException,
                    java.lang.ClassNotFoundException,
                    java.lang.IllegalAccessException
Method : Compile(String fileName, String outDir)) compile single java file as parameter accepts full path to java file and output directory compiler class and compiler parameters gets from properties

Parameters:
fileName - - full path to java file for compile
outDir - - full path to dir where will be stored class files
Throws:
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException

compile

public void compile(java.lang.String fileName,
                    java.lang.String outDir,
                    java.lang.String[] parameters,
                    boolean force)
             throws java.lang.IllegalArgumentException,
                    java.lang.reflect.InvocationTargetException,
                    java.lang.SecurityException,
                    java.lang.NoSuchMethodException,
                    java.lang.ClassNotFoundException,
                    java.lang.IllegalAccessException
Method : Compile(String fileName, String outDir, String[] parameters)) compile single java file as parameter accepts full path to java file,output directory and array of other parameters for compiler compiler class gets from properties

Parameters:
fileName - - full path to java file for compile
outDir - - full path to dir where will be stored class files
parameters - - prameters for compilation as String[]
Throws:
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException

autoCompile

public void autoCompile(boolean force)
                 throws java.lang.IllegalArgumentException,
                        java.lang.reflect.InvocationTargetException,
                        java.lang.SecurityException,
                        java.lang.NoSuchMethodException,
                        java.lang.ClassNotFoundException,
                        java.lang.IllegalAccessException
Method : autoCompile() Method for auto compile - it first creates auto compile parameters fom property file - depend of parameter format (which is defined in property file) it calls compileSingle(fullParameterString) or compileArray(fullParameterArray) function

Parameters:
force - - false(compile only if it's a new java src file), true (compile anyway)
Throws:
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException

autoCompile

public void autoCompile(java.lang.String sourceDir,
                        java.lang.String outDir,
                        boolean force)
                 throws java.lang.IllegalArgumentException,
                        java.lang.reflect.InvocationTargetException,
                        java.lang.SecurityException,
                        java.lang.NoSuchMethodException,
                        java.lang.ClassNotFoundException,
                        java.lang.IllegalAccessException
Method : autoCompile(String sourceDir,String outputDir,boolean force) Method for auto compile - it first creates auto compile parameters fom property file - depend of parameter format (which is defined in property file) it calls compileSingle(fullParameterString) or compileArray(fullParameterArray) function

Parameters:
sourceDir - - dir with src java files
outputDir - - dir for compiled java classes
force - - false(compile only if it's a new java src file), true (compile anyway)
Throws:
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException

putInClassHash

public void putInClassHash(java.lang.String key,
                           java.lang.Long value)
Put java files timestamps in HashTable javaFilesTimestamps

Parameters:
key - - full java src file path
value - - timestamp value

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultVal)
Function for getting property as String with default value

Parameters:
key - - key for property value in property file
defaultVal - - String default value if value for given key doesn't exist
Returns:
- property as String if there is no value for given key, return value is default value

getProperty

public java.lang.String getProperty(java.lang.String key)
Function for getting property as String

Parameters:
key - - key for property value in property file
Returns:
- property as String if there is no value for given key, return null (no default value)

getPropertyArray

public java.lang.String[] getPropertyArray(java.lang.String key,
                                           java.lang.String[] defaultVal)
Function for getting property as String[] with default value

Parameters:
key - - key for property value in property file
defaultVal - - String[] default value if value for given key doesn't exist
Returns:
- property as String[] if there is no value for given key, return value is default value

getPropertyArray

public java.lang.String[] getPropertyArray(java.lang.String key)
Function for getting property as String[]

Parameters:
key - - key for property value in property file
Returns:
- property as String[] if there is no value for given key, return null (no default value)

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String newVal)
                 throws java.lang.SecurityException,
                        java.lang.NoSuchMethodException,
                        java.lang.ClassNotFoundException
Parameters:
key - - key for property value in property file
newVal - - String value that will be positioned in property object
Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException

setPropertyArray

public void setPropertyArray(java.lang.String key,
                             java.lang.String[] newValues)
                      throws java.lang.SecurityException,
                             java.lang.NoSuchMethodException,
                             java.lang.ClassNotFoundException
Set property as String[] , and remove old values

Parameters:
key - - key for property value in property file
newValues - - String[] value that will be positioned in property object
Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException

saveProperties

public boolean saveProperties()
Save property file

Returns:
boolean value as true if property file is saved well, or false in counterpart

clearHistory

public void clearHistory()
Clear timestamp cache


updateCache

public void updateCache()
Update timestamp cache


runThread

public void runThread(int time)
start thread

Parameters:
time - - timeout for thread

stopThread

public void stopThread(int time)
stop thread

Parameters:
time - - timeout for thread

getLogChannel

public com.lutris.logging.LogChannel getLogChannel()
Returns:
logChanal

setLogChannel

public void setLogChannel(com.lutris.logging.LogChannel logChannel)
Function for set logChannel

Parameters:
newLogChannel -