'Hello World' ExampleBlackBadger ships with a very simple 'hello world' type example file that should help you familiarize yourself with the BlackBadger concepts. System XMLThe system xml (below) is fairly simple in that it only consists of 1 agent with 1 component for that agent to run. There are various properties defined - one for each scope that variables may exist in.<?xml version="1.0" encoding="UTF-8"?> <system name="Simple Hello World example"> <property name="sysvar" value="This is a system variable"/> <agent id="agent1"> <property name="agentvar" value="This is the value of agent variable"/> <group id="group1"> <property name="groupvar" value="This is the value of group variable"/> <comp base="echo" id="echo component"> <property name="compvar" value="This is the value of component variable"/> </comp> </group> </agent> </system> Component XMLThe component described in this example doesn't deploy or run any software as per the general usage of the component descriptor. It merely outputs messages to the standard output using the <echo> Ant task. <?xml version="1.0" encoding="UTF-8"?> <project name="Echo Component" default="clean" basedir="."> <description>Echo Example Component - each target simply echoes a message</description> <target name="clean" description="Called at the start to ensure the environment is clean for deployment"> <echo message="Clean target executing on agent ${agent.this.ipaddress}"/> </target> <target name="deploy" description="Called when the system is starting up and needing to install and startup the necessary software"> <echo message="Deploy target executing"/> <echo message="The value of the variables set in the calling script are as follows:"/> <echo message=" system.sysvar: ${system.sysvar}"/> <echo message=" agent.this.agentvar: ${agent.this.agentvar}"/> <echo message=" group.this.groupvar: ${group.this.groupvar}"/> <echo message=" component.this.compvar: ${component.this.compvar}"/> </target> <target name="run" description="Called when the system is ready run up the component"> <echo message="Run target executing"/> </target> <target name="test" description="Called when the system is ready to start testing"> <echo message="Test target executing"/> </target> <target name="terminate" description="Called when either an exception/error has occurred or the system is to stop."> <echo message="Terminate target executing"/> </target> </project> Expected outputBy running the example you will see the flow of execution together with a nice demonstration of the variable system. Upon running the example you should get output similar to the following: Sep 28 17:15.51: WB_18.6002: clean started Sep 28 17:15.57: WB_18.6002: Component.echo component executing state: clean Sep 28 17:16.05: WB_18.6002: Component.echo component.[ANT] Clean target executing on agent 192.168.1.18 Sep 28 17:16.05: WB_18.6002: Component.echo component completed state: clean Sep 28 17:16.05: WB_18.6002: clean completed time=14437ms Sep 28 17:16.05: WB_18.6002: deploy started Sep 28 17:16.05: WB_18.6002: Component.echo component executing state: deploy Sep 28 17:16.05: WB_18.6002: Component.echo component.[ANT] Deploy target executing Sep 28 17:16.05: WB_18.6002: Component.echo component.[ANT] The value of the variables set in the calling script are as follows: Sep 28 17:16.05: WB_18.6002: Component.echo component.[ANT] system.sysvar: This is a system variable Sep 28 17:16.05: WB_18.6002: Component.echo component.[ANT] agent.this.agentvar: This is the value of agent variable Sep 28 17:16.05: WB_18.6002: Component.echo component.[ANT] group.this.groupvar: This is the value of group variable Sep 28 17:16.05: WB_18.6002: Component.echo component.[ANT] component.this.compvar: This is the value of component variable Sep 28 17:16.05: WB_18.6002: deploy completed time=63ms Sep 28 17:16.05: WB_18.6002: run started Sep 28 17:16.05: WB_18.6002: Component.echo component completed state: deploy Sep 28 17:16.05: WB_18.6002: Component.echo component executing state: run Sep 28 17:16.05: WB_18.6002: Component.echo component.[ANT] Run target executing Sep 28 17:16.05: WB_18.6002: Component.echo component completed state: run Sep 28 17:16.05: WB_18.6002: run completed time=31ms Sep 28 17:16.05: WB_18.6002: test started Sep 28 17:16.05: WB_18.6002: Component.echo component executing state: test Sep 28 17:16.05: WB_18.6002: Component.echo component.[ANT] Test target executing Sep 28 17:16.05: WB_18.6002: Component.echo component completed state: test Sep 28 17:16.05: WB_18.6002: test completed time=31ms Sep 28 17:16.06: WB_18.6002: terminate started Sep 28 17:16.06: WB_18.6002: Component.echo component executing state: terminate Sep 28 17:16.06: WB_18.6002: Component.echo component.[ANT] Terminate target executing Sep 28 17:16.06: WB_18.6002: Component.echo component completed state: terminate Sep 28 17:16.06: WB_18.6002: terminate completed time=15ms The helloworld_multiple.xml extends the example further by demonstrating the effect of an additional agent in the system. The files in this example can be found in the following locations:
|