orc
Class Config

java.lang.Object
  extended by orc.Config

public class Config
extends java.lang.Object

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)
           
 java.lang.Boolean debugMode()
           
 java.lang.Boolean getDumpOil()
           
 java.lang.String getFilename()
           
 java.util.List<java.lang.String> getIncludes()
           
 java.io.Reader getInstream()
           
 int getMaxPubs()
           
 java.lang.Boolean getNoPrelude()
           
 java.lang.Integer getNumKilimThreads()
           
 java.lang.Integer getNumSiteThreads()
           
 int getStackSize()
           
 java.io.PrintStream getStderr()
           
 java.io.PrintStream getStdout()
           
 TokenPool getTokenPool()
           
 Tracer getTracer()
           
 java.lang.Boolean hasCapability(java.lang.String name)
          Current capabilities include: send mail import java
 java.io.Reader openInclude(java.lang.String name)
          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 setDebug(boolean debug)
           
 void setDumpOil(boolean dumpOil)
           
 void setFullTraceFile(java.io.File file)
           
 void setIncludePath(java.lang.String includePath)
           
 void setInputFile(java.io.File file)
           
 void setMaxPubs(int maxPubs)
           
 void setMinimalTraceFile(java.io.File file)
           
 void setNoPrelude(boolean noPrelude)
           
 void setStackSize(int stackSize)
           
 void setStderr(java.io.PrintStream stderr)
           
 void setStdout(java.io.PrintStream stdout)
           
 void setTokenPoolSize(int tokenPoolSize)
           
 void setTracer(Tracer tracer)
          Set a custom tracer.
 void setTypeChecking(boolean typecheck)
           
 boolean typeCheckingMode()
           
 
Methods inherited from class java.lang.Object
clone, 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.


printUsage

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

setDebug

public void setDebug(boolean debug)

setTypeChecking

public void setTypeChecking(boolean typecheck)

setNoPrelude

public void setNoPrelude(boolean noPrelude)

setMinimalTraceFile

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

setFullTraceFile

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

setDumpOil

public void setDumpOil(boolean dumpOil)

addInclude

public void addInclude(java.lang.String include)

setIncludePath

public void setIncludePath(java.lang.String includePath)

setMaxPubs

public void setMaxPubs(int maxPubs)

setInputFile

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

setTracer

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


debugMode

public java.lang.Boolean debugMode()

getDumpOil

public java.lang.Boolean getDumpOil()

getNoPrelude

public java.lang.Boolean getNoPrelude()

getMaxPubs

public int getMaxPubs()

getInstream

public java.io.Reader getInstream()

getTracer

public Tracer getTracer()

getIncludes

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

getNumKilimThreads

public java.lang.Integer getNumKilimThreads()

getNumSiteThreads

public java.lang.Integer getNumSiteThreads()

typeCheckingMode

public boolean typeCheckingMode()

getFilename

public java.lang.String getFilename()

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)

openInclude

public final java.io.Reader openInclude(java.lang.String name)
                                 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).

TODO: should we support include paths relative to the current file?

Parameters:
name - of the include file relative to some directory of include path or package orc.inc
Returns:
Reader to read the file.
Throws:
java.io.FileNotFoundException - if the resource is not found.