AgE 2.7 : Sample XML configuration

The configuration below is taken form the Hello World example. It is split into a general base.xml file which configures the platform itself and a specific age.xml which defines a specific computation.

age.xml
<?xml version="1.0" encoding="UTF-8" ?>
<configuration xmlns="http://age.iisg.agh.edu.pl/schema/age"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://age.iisg.agh.edu.pl/schema/age http://age.iisg.agh.edu.pl/schema/age/age.xsd">
	<include file="classpath:examples/base.xml">
		<block name="workplaces">
			<agent name="workplace" class="org.jage.workplace.IsolatedSimpleWorkplace">
				<component class="org.jage.address.agent.DefaultAgentAddressSupplier" >
					<constructor-arg name="nameTemplate" value="TheXFiles"/>
				</component>
				<property name="agents">
					<list>
						<agent name="scully" class="org.jage.examples.helloworld.HelloWorldSimpleAgent">
							<component class="org.jage.address.agent.DefaultAgentAddressSupplier" >
								<constructor-arg name="nameTemplate" value="Scully"/>
							</component>
						</agent>
						<agent name="mulder" class="org.jage.examples.helloworld.HelloWorldSimpleAgent">
							<component class="org.jage.address.agent.DefaultAgentAddressSupplier" >
								<constructor-arg name="nameTemplate" value="Mulder"/>
							</component>
						</agent>
					</list>
				</property>
			</agent>
		</block>
		<block name="stopCondition" >
			<component name="stopCondition" class="org.jage.workplace.FixedStepCountStopCondition">
				<constructor-arg type="Long" value="100" />
			</component>
		</block>
	</include>
</configuration>

As you can see, the above file includes a generic base.xml configuration file (line 5) and overrides the workplaces block (line 6) with a specific workplace definition (lines 7-25). The workplace is configured with a specific address supplier (line 9) and two chidlren agents (lines 11-24). This configuration also overrides the stopCondition block to provide an application-specific stopping condition.

The base.xml is related to a specific deployment scenario and can be usually reused in different simulations and computations. Mos users don't have to care about its details and can use the following one:

base.xml
<?xml version="1.0" encoding="UTF-8" ?>
<configuration xmlns="http://age.iisg.agh.edu.pl/schema/age"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://age.iisg.agh.edu.pl/schema/age http://age.iisg.agh.edu.pl/schema/age/age.xsd">
	<component class="org.jage.address.node.DefaultNodeAddressSupplier" />
	<component class="org.jage.communication.LoopbackCommunicationService" />
	<component name="configurationService" class="org.jage.lifecycle.DefaultConfigurationService" />
	<component name="workplaceManager" class="org.jage.workplace.manager.DefaultWorkplaceManager">
		<block name="workplaceManagerComponents" >
			<component name="defaultAgentAddressSupplier" class="org.jage.address.agent.DefaultAgentAddressSupplier" />
			<component name="comparator" class="org.jage.action.ordering.DefaultActionComparator" isSingleton="false"/>
		</block>
		<block name="workplaceComponents" >
			<component name="aggregateActionService" class="org.jage.agent.AggregateActionService" isSingleton="false"/>
			<component name="aggregateQueryService" class="org.jage.agent.AggregateQueryService" isSingleton="false"/>
			<component name="aggregateMessagingService" class="org.jage.agent.AggregateMessagingService" isSingleton="false"/>
		</block>

		<property name="workplaces">
			<list>
				<block name="workplaces" />
			</list>
		</property>
		<block name="stopCondition" />		
		<block name="propertygatherer" />
		<block name="persistence" />
	</component>
</configuration>