You are here: Foswiki>Service Web>ConditionTool (20 Sep 2017, ErwinWagner)Edit Attach

Condition Tools

The condition tools consist of several tools to generate, manage and import conditions easily.

Each particular tool has its own purpose to handle conditions. You can find closer information about these tools below.
  • conditions legacy importer
  • conditions loader
  • conditions generator
  • others

Conditions legacy importer


Conditions Loader

  • java -jar conditions-loader.jar -help
get: create xml representations of facilites and their corresponding conditions:
usage: get [-all] -facilities <arg> [-path <arg>]
-all load all facilities if option is used
-facilities <arg> specify the facilities to load by name (separated by
-path <arg> the directory where generated facility xml-files are
generated in

insert: import a new facility based on a given xml file
usage: insert -file <arg>
-file <arg> path to xml file

update: update an existing facility based on a given xml file
usage: update -file <arg>
-file <arg> path to xml file

delete: delete a given facilty from the database. TODO: Since this option can cause build failures in modules which depent on condition compiler generated source code or libraries, this option should be used cautiously or removed in a productive environment
usage: delete [-all] [-facilities <arg>]
-all load all facilities if option is used
-facilities <arg> file option description

list: list all facilities stored in the conditions db
usage: list [-sortbyname]
-sortbyname sort by facility name instead of facility id.

Conditions generator

This tool generates conditions for several languages like Java, C/C++ and Python. For more information concerning all features of this tool, use the --help parameter.
  • for Java: java –jar conditions-generator.jar create –J path=./your/Path

After executing you´ll get a jar file you can include in your project to make use of condition messages.
Code example:
import java.util.*;


public class example {

public static void main(String[] args) {

List<String> liste = new ArrayList <String>();

int conditionNumber = 268349434;


for(int i=0; i < liste.size() ;i++ )
System.out.println("param"+i+": "+liste.get(i) );

System.out.println("\nCondition text before: ");
System.out.println("Txt: "+ ConditionTexts.getMessageText(conditionNumber));

System.out.println("\nCondition text after:");
String request = ConditionTexts.getFormattedMessageText(conditionNumber, liste);
System.out.println("Result in DE: " + request);

param0: Sonne
param1: Mond
param2: Sterne

Condition text before:
Txt: Laterne,{0},{1} und {2}...

Condition text after:
Result in DE: Laterne,Sonne,Mond und Sterne...

  • for C/C++: java –jar conditions-generator.jar create –SO path=./your/Path

your generated file is and you can use it as described below
#include <stdio.h>
#include <stdlib.h>
#include <condintf.h>

int main() {
char* stringArray[3];
stringArray[0]= "sonne";
stringArray[1]= "mond";
stringArray[2]= "sterne";

int conditionNumber = 268349434;
char result[4096];

int success = getFormattedMsg(result, conditionNumber, stringArray, 3 );

return 0;
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/your/shared/Object

gcc -I/path_to_your_workspace_of_condition_generator/conditions-generator/src/main/resources/de/gsi/cs/co/sv/conditions/tools/generator yourMain.c -o yourProgramName -m32

  • for Python: java –jar conditions-generator.jar create –P path=./your/Path
After executing the command above you can find a bunch of .py files in your path you set before.
Include the into your project to make use of formatted messages.
The following example shows up how to include and use the Python files in your Python project.
import texthelper


print texthelper.getFormattedMsg(268349434,myList)


-- ErwinWagner - 17 Aug 2017
Topic revision: r5 - 20 Sep 2017, ErwinWagner
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback