orc
Class Config

java.lang.Object
  extended by orc.Config
All Implemented Interfaces:
java.lang.Cloneable

public class Config
extends java.lang.Object
implements java.lang.Cloneable

Class for processing configuration options. Such options could be provided via command line arguments or obtained though environment variables, and could also be read from other sources or hard-coded.

This class uses annotations to map command-line arguments to calls to setter methods. See processArgs(String[]).

Author:
dkitchin, quark

Constructor Summary
Config()
           
 
Method Summary
 void addInclude(java.lang.String include)
           
 Config clone()
           
 java.lang.String composeCmdLine()
           
 java.lang.String getClassPath()
           
 int getDebugLevel()
           
 boolean getExceptionsOn()
           
 java.lang.String getIncludePath()
           
 java.util.List<java.lang.String> getIncludes()
           
 java.lang.String getInputFilename()
           
 java.io.InputStream getInputStream()
           
 int getMaxPubs()
           
 CompileMessageRecorder getMessageRecorder()
           
 java.lang.Boolean getNoPrelude()
           
 int getNumKilimThreads()
           
 int getNumSiteThreads()
           
 java.io.File getOilOutputFile()
           
 java.io.Reader getOilReader()
           
 java.io.Writer getOilWriter()
           
 ProgressListener getProgressListener()
           
 boolean getQuietChecking()
           
 java.io.Reader getReader()
           
 boolean getShortErrors()
           
 int getStackSize()
           
 java.io.PrintStream getStderr()
           
 java.io.PrintStream getStdout()
           
 TokenPool getTokenPool()
           
 java.io.File getTraceOutputFile()
           
 Tracer getTracer()
           
 boolean getTypeChecking()
           
 java.lang.Boolean hasCapability(java.lang.String name)
          Current capabilities include: send mail import java
 boolean hasInputFile()
           
 boolean hasOilInputFile()
           
 boolean hasOilOutputFile()
           
 boolean hasTraceOutputFile()
           
 void inputFromString(java.lang.String source)
           
 java.lang.Class loadClass(java.lang.String name)
           
 boolean noExecute()
           
 java.io.Reader openInclude(java.lang.String name, java.lang.String relativeTo)
          Open an include file.
 void printUsage(boolean _)
           
 void processArgs(java.lang.String[] args)
          Set properties based on command-line arguments.
 void setCapability(java.lang.String name, java.lang.Boolean value)
           
 void setClassPath(java.lang.String classPath)
           
 void setDebug(boolean debug)
           
 void setDebugLevel(int debugLevel)
           
 void setExceptionsOn(boolean exceptionsOn)
           
 void setIncludePath(java.lang.String includePath)
           
 void setInputFile(java.io.File file)
           
 void setMaxPubs(int maxPubs)
           
 void setMessageRecorder(CompileMessageRecorder messageRecorder)
           
 void setNoExecute(boolean noExecute)
           
 void setNoPrelude(boolean noPrelude)
           
 void setNumSiteThreads(java.lang.Integer v)
           
 void setOilOutputFile(java.io.File oilOut)
           
 void setProgressListener(ProgressListener progressListener)
           
 void setQuietChecking(boolean b)
          If the typechecker runs, suppress all its output.
 void setShortErrors(boolean b)
          The default is long errors.
 void setStackSize(int stackSize)
           
 void setStderr(java.io.PrintStream stderr)
           
 void setStdout(java.io.PrintStream stdout)
           
 void setTokenPoolSize(int tokenPoolSize)
           
 void setTraceOutputFile(java.io.File file)
           
 void setTracer(Tracer tracer)
          Set a custom tracer.
 void setTypeChecking(boolean typecheck)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Config

public Config()
Method Detail

processArgs

public void processArgs(java.lang.String[] args)
Set properties based on command-line arguments.


composeCmdLine

public java.lang.String composeCmdLine()

printUsage

public void printUsage(boolean _)
                throws org.kohsuke.args4j.CmdLineException
Throws:
org.kohsuke.args4j.CmdLineException

setDebug

public void setDebug(boolean debug)

setDebugLevel

public void setDebugLevel(int debugLevel)

setTypeChecking

public void setTypeChecking(boolean typecheck)

setNoPrelude

public void setNoPrelude(boolean noPrelude)

setNoExecute

public void setNoExecute(boolean noExecute)

setTraceOutputFile

public void setTraceOutputFile(java.io.File file)
                        throws org.kohsuke.args4j.CmdLineException
Throws:
org.kohsuke.args4j.CmdLineException

setOilOutputFile

public void setOilOutputFile(java.io.File oilOut)

setIncludePath

public void setIncludePath(java.lang.String includePath)

setClassPath

public void setClassPath(java.lang.String classPath)

setMaxPubs

public void setMaxPubs(int maxPubs)

setNumSiteThreads

public void setNumSiteThreads(java.lang.Integer v)

setInputFile

public void setInputFile(java.io.File file)
                  throws org.kohsuke.args4j.CmdLineException
Throws:
org.kohsuke.args4j.CmdLineException

inputFromString

public void inputFromString(java.lang.String source)

setExceptionsOn

public void setExceptionsOn(boolean exceptionsOn)

addInclude

public void addInclude(java.lang.String include)

hasInputFile

public boolean hasInputFile()

setShortErrors

public void setShortErrors(boolean b)
The default is long errors. Short errors are currently used only for regression testing.


getShortErrors

public boolean getShortErrors()

setQuietChecking

public void setQuietChecking(boolean b)
If the typechecker runs, suppress all its output. Quiet checking is currently used only for regression testing.

Parameters:
b -

getQuietChecking

public boolean getQuietChecking()

setTracer

public void setTracer(Tracer tracer)
Set a custom tracer.


getDebugLevel

public int getDebugLevel()

getMessageRecorder

public CompileMessageRecorder getMessageRecorder()

setMessageRecorder

public void setMessageRecorder(CompileMessageRecorder messageRecorder)

getProgressListener

public ProgressListener getProgressListener()

setProgressListener

public void setProgressListener(ProgressListener progressListener)

getTraceOutputFile

public java.io.File getTraceOutputFile()

hasTraceOutputFile

public boolean hasTraceOutputFile()

getOilOutputFile

public java.io.File getOilOutputFile()

hasOilOutputFile

public boolean hasOilOutputFile()

hasOilInputFile

public boolean hasOilInputFile()

getOilReader

public java.io.Reader getOilReader()
                            throws java.io.IOException
Throws:
java.io.IOException

getOilWriter

public java.io.Writer getOilWriter()
                            throws java.io.IOException
Throws:
java.io.IOException

getNoPrelude

public java.lang.Boolean getNoPrelude()

getMaxPubs

public int getMaxPubs()

getReader

public java.io.Reader getReader()

getInputStream

public java.io.InputStream getInputStream()

getTracer

public Tracer getTracer()

getIncludes

public java.util.List<java.lang.String> getIncludes()

getNumKilimThreads

public int getNumKilimThreads()

getNumSiteThreads

public int getNumSiteThreads()

getTypeChecking

public boolean getTypeChecking()

getInputFilename

public java.lang.String getInputFilename()

hasCapability

public java.lang.Boolean hasCapability(java.lang.String name)
Current capabilities include: send mail import java


setCapability

public void setCapability(java.lang.String name,
                          java.lang.Boolean value)

getStdout

public java.io.PrintStream getStdout()

setStdout

public void setStdout(java.io.PrintStream stdout)

getStderr

public java.io.PrintStream getStderr()

setStderr

public void setStderr(java.io.PrintStream stderr)

getTokenPool

public TokenPool getTokenPool()

setTokenPoolSize

public void setTokenPoolSize(int tokenPoolSize)

getStackSize

public int getStackSize()

setStackSize

public void setStackSize(int stackSize)

getIncludePath

public java.lang.String getIncludePath()

getClassPath

public java.lang.String getClassPath()

getExceptionsOn

public boolean getExceptionsOn()

openInclude

public final java.io.Reader openInclude(java.lang.String name,
                                        java.lang.String relativeTo)
                                 throws java.io.FileNotFoundException
Open an include file. Searches first the include path defined by setIncludePath(String) and then the package orc.inc. This means you can store include files as either files or class resources (which will continue to work when Orc is deployed as a servlet or JAR).

Parameters:
name - of the include file relative to some directory of include path or package orc.inc relativeTo The path that should be considered the "current directory" if any include path is relative; typically this is the directory containing the program file which declared the include. If null, ignore all relative include paths.
Returns:
Reader to read the file.
Throws:
java.io.FileNotFoundException - if the resource is not found.

loadClass

public final java.lang.Class loadClass(java.lang.String name)
                                throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

clone

public Config clone()
Overrides:
clone in class java.lang.Object

noExecute

public boolean noExecute()
Returns:
true is noExecute flag set