edu.cs.ai.kreator
Class KreatorMain

java.lang.Object
  extended by edu.cs.ai.kreator.KreatorMain

public class KreatorMain
extends java.lang.Object

The main class for KReator and entry point for program execution.

Author:
Matthias Thimm, Niklas Wulf

Field Summary
static java.lang.String DEFAULT_CONFIG_NAME
           
static org.apache.log4j.Logger LOG
           
static java.lang.String LOG_OUTPUT_MARGIN
           
static java.lang.String VERSION_NUMBER
           
static java.lang.String WINDOW_TITLE
           
static java.lang.String WINDOW_TITLE_VERSIONFREE
           
 
Constructor Summary
KreatorMain()
           
 
Method Summary
static boolean configIsLocked(java.lang.String configName)
          Checks whether the given configuration file is locked, i.e. whether there is a file "configName"+".lock".
static boolean configSetLock(java.lang.String configName, boolean value)
          Sets the lock of the given file, i.e. creates or removes the corresponding ".lock" file.
static void configureLog4j(java.lang.String fileName)
          Configures log4j with an XML configuration-file.
static FileController getFileController()
           
static GuiController getGuiController()
           
static java.io.File getLastChosenDir()
           
static ModelController getModelController()
           
static ProjectController getProjectController()
           
static java.io.File getPwd()
           
static KreatorModelPlugin getStartPlugin()
          Returns the plugin KReator was instructed to load during startup.
static java.lang.String getSystemProperties()
           
static java.lang.String getSystemProperties(java.lang.String leftMargin)
           
static KreatorUserInterface getUserInterface()
           
static WorkerController getWorkerController()
           
static java.lang.String indentToLogMargin(java.lang.String message)
          Indents a multi-lined string to match the LOG margin.
static boolean isLoggingActive()
           
static boolean isMacOS()
           
static boolean isUnix()
           
static boolean isWindows()
           
static void main(java.lang.String[] args)
           
static void resetPwd()
           
static void setDefaultLoggingLevel(java.lang.String level)
          Sets the logging level of the root logger.
static void setLastChosenDir(java.io.File newdir)
           
static void setLoggingThreshold(java.lang.String level)
          Sets the output level threshold of all loggers.
static void setPwd(java.io.File newdir)
          Sets the current working directory.
static void shutDown()
           
static void shutDown(boolean restartAfterShutdown)
           
static void startWithPlugin(KreatorModelPlugin plugin)
          Starts KReator with the given plugin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.log4j.Logger LOG

LOG_OUTPUT_MARGIN

public static final java.lang.String LOG_OUTPUT_MARGIN
See Also:
Constant Field Values

VERSION_NUMBER

public static final java.lang.String VERSION_NUMBER

WINDOW_TITLE

public static final java.lang.String WINDOW_TITLE

WINDOW_TITLE_VERSIONFREE

public static final java.lang.String WINDOW_TITLE_VERSIONFREE
See Also:
Constant Field Values

DEFAULT_CONFIG_NAME

public static final java.lang.String DEFAULT_CONFIG_NAME
See Also:
Constant Field Values
Constructor Detail

KreatorMain

public KreatorMain()
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args -

setDefaultLoggingLevel

public static void setDefaultLoggingLevel(java.lang.String level)
Sets the logging level of the root logger. This is the default logging level of any other logger, if no explicit logging level for a logger or (more specific) parent-logger has been defined.

Parameters:
level - logging level

setLoggingThreshold

public static void setLoggingThreshold(java.lang.String level)
Sets the output level threshold of all loggers. E.g., if set to "info", all logging messages on a lower level (debug, info) are filtered out (without modifying or influencing the loggers and their levels themselves).

Parameters:
level - logging level

startWithPlugin

public static void startWithPlugin(KreatorModelPlugin plugin)
Starts KReator with the given plugin.

Parameters:
plugin - a plugin that should be loaded during startup.

getStartPlugin

public static KreatorModelPlugin getStartPlugin()
Returns the plugin KReator was instructed to load during startup.

Returns:
the plugin KReator was instructed to load during startup.

getSystemProperties

public static java.lang.String getSystemProperties(java.lang.String leftMargin)

getSystemProperties

public static java.lang.String getSystemProperties()

shutDown

public static void shutDown(boolean restartAfterShutdown)

shutDown

public static void shutDown()

configureLog4j

public static void configureLog4j(java.lang.String fileName)
Configures log4j with an XML configuration-file. This method should be called only one time, otherwise the appenders will be applied multiple time and so the output will be duplicated.

Parameters:
fileName -

getUserInterface

public static KreatorUserInterface getUserInterface()

getFileController

public static FileController getFileController()

getProjectController

public static ProjectController getProjectController()

getModelController

public static ModelController getModelController()

getGuiController

public static GuiController getGuiController()

getWorkerController

public static WorkerController getWorkerController()

isWindows

public static boolean isWindows()

isUnix

public static boolean isUnix()

isMacOS

public static boolean isMacOS()

getLastChosenDir

public static java.io.File getLastChosenDir()

setLastChosenDir

public static void setLastChosenDir(java.io.File newdir)

getPwd

public static java.io.File getPwd()
Returns:
the current working directory

setPwd

public static void setPwd(java.io.File newdir)
Sets the current working directory.

Parameters:
newdir - may not be null an must be a valid directory

resetPwd

public static void resetPwd()

isLoggingActive

public static boolean isLoggingActive()

configIsLocked

public static boolean configIsLocked(java.lang.String configName)
Checks whether the given configuration file is locked, i.e. whether there is a file "configName"+".lock".

Parameters:
configName - the file name of the config file.
Returns:
"true" iff the given file is locked.

configSetLock

public static boolean configSetLock(java.lang.String configName,
                                    boolean value)
Sets the lock of the given file, i.e. creates or removes the corresponding ".lock" file.

Parameters:
configName - the file name of the config file.
value - set to "true" if config should be locked and to "false" if config has to be unlocked.
Returns:
"true" if the action was successful.

indentToLogMargin

public static java.lang.String indentToLogMargin(java.lang.String message)
Indents a multi-lined string to match the LOG margin. This method adds LOG_OUTPUT_MARGIN to the beginning of each new line of a multi-lined string.

Parameters:
message -
Returns:
message indented by LOG_OUTPUT_MARGIN spaces