The Java Backend

This page explains how to generate Java code from ABS sources and how to execute the generated Java code.

Generating Java Code

Java code can be generated by running the following command:

java -cp absfrontend.jar abs.backend.java.JavaBackend <options> <ABS files>

For example to compile the files A.abs and B.abs one would write:

java -cp absfrontend.jar abs.backend.java.JavaBackend A.abs B.abs

This will generate the java files in a folder named "gen". This folder can be changed using the "-d" parameter. The destination folder has to be created manually.

Parameters

The following parameters can be used, when generating Java code:

-version
print version
-v
verbose output
-product=PID
build given product by applying deltas (PID is the qualified product ID)
-notypecheck
disable typechecking
-nostdlib
do not include the standard lib
-loctypes
enable location type checking
-locdefault=loctype
sets the default location type to loctype where loctype in [Far, Near, Somewhere, Infer]
-locscope=scope
sets the location aliasing scope to scope where scope in [BASIC, METHOD_LOCAL_FAR, CLASS_LOCAL_FAR, COMPILATION_UNIT_LOCAL_FAR, MODULE_LOCAL_FAR, GLOBAL_FAR]
-dump
dump AST to standard output
-solve
solve constraint satisfaction problem (CSP) for the feature model
-solveall
get ALL solutions for the CSP
-nsol
count the number of solutions
-noattr
ignore the attributes
-check=PID
check satisfiability of a product with qualified name PID
-h
print this help message
-d dir
generate files to dir
-debug
print stacktrace on exception
-sourceonly
do not generate class files
-loctypestats
???
-sat
???

Executing Generated Java Code

To execute the generated Java Code use:

java -cp gen:absfrontend.jar <ModuleName>.Main [options]

On windows systems you have to use a semicolon instead of a colon as classpath seperator.

The module name must refer to an ABS module with a main block. If the module does not exist or does not have a main block you will see a NoClassDefFoundError exception.

Parameters

The following parameters can be used, when executing generated Java code:

-help
shows help information
-net
enables the use of ABS-NET
-debug
enables debugging
-gdebug
starts the graphical debugger
-terminateOnException
terminates the system when an exception occurs
-systemobserver=classlist
comma-separated list of system observer classes. Implementations of SystemObserver:
  • abs.backend.java.debugging.GraphicalDebugger
  • abs.backend.java.RuntimeUsageTest
  • abs.backend.java.visualization.SequenceDiagramVisualization
  • abs.backend.java.visualization.CoCoME
  • abs.backend.java.visualization.UMLSequenceChart
  • abs.backend.java.visualization.TaskStateHistoryObserver
  • abs.backend.java.TestSystemObserver
  • abs.backend.java.observing.EmptyCompleteObserver
  • abs.backend.java.observing.ConsoleObserver
-totalscheduler=class
sets a total scheduler class. Implementations of TotalSchedulingStrategy:
  • abs.backend.java.scheduling.InteractiveScheduler
  • abs.backend.java.scheduling.RandomOptionPnl
  • abs.backend.java.scheduling.RandomSchedulingStrategy
  • abs.backend.java.scheduling.ReplayOptionPnl
  • abs.backend.java.RuntimeUsageTest.TestScheduler
-globalscheduler=class
sets a global scheduler class. Can use the same classes as the totalscheduler option.
-taskschedulerstrategy=class
sets a task scheduler strategy class
  • abs.backend.java.scheduling.RecordingSchedulerStrategy
  • abs.backend.java.scheduling.InteractiveScheduler
  • abs.backend.java.scheduling.RandomOptionPnl
  • abs.backend.java.scheduling.RandomSchedulingStrategy
  • abs.backend.java.scheduling.ReplayOptionPnl
  • abs.backend.java.RuntimeUsageTest.TestScheduler
-taskscheduler=string
sets the task scheduler to be used. Either "default" or "simple".
-recordtaskscheduler
enables recording of task scheduling
-randomseed=long
set the random seed used by schedulers
-useRandomScheduler
sets the random scheduler as the total scheduler
-printrandomseed
prints that used random seed to stdout
-loglevel=string
sets the logging level
-loggedClasses=classlist
comma-separated list of classes to be logged
-scheduableTasksFilter=class
sets a filter class for scheduable tasks. Possible options are:
  • abs.backend.java.scheduling.ScheduableTasksFilterDefault (default)
  • abs.backend.java.scheduling.ScheduableTasksFilterFifo (guarantees message ordering between two COGs)