Ken Webb 2010-02-21T14:39:29Z
Spring is a popular dependency injection (DI) framework for Java development.
Any Xholon application can write out its structure as a Spring-compatible XML file. For example, the following is part of a file written by an executing Xholon application. This file can be read by Spring 2.x to inject dependencies (DI) between instances of Java classes.
As an additional optional feature, a Xholon application can configure itself by starting the Spring framework and having it read this XML file. Xholon can then invoke Spring to get access to the configured application, and run it as a normal Xholon application.
<?xml version="1.0" encoding="UTF-8"?> <!-- Automatically generated by Xholon version 0.8, using org.primordion.xholon.service.spring.Xholon2Spring.java Fri Sep 11 17:17:30 EDT 2009 1252703850332 model: Coop PSystem 2002 ex32 www.primordion.com/Xholon --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <import resource="XholonInternalServices.xml"/> <!-- Xholon instance beans --> <bean id="superCell_0" class="org.primordion.memcomp.app.XhCoopSys02ex32_1"> <property name="id" value="0"/> <property name="xhc" ref="SuperCell"/> <property name="firstChild" ref="completionDetector_1"/> <property name="nextSibling" ref="xholonInternalServices_0"/> </bean> <bean id="completionDetector_1" class="org.primordion.memcomp.app.XhCoopSys02ex32_1"> <property name="id" value="1"/> <property name="xhc" ref="CompletionDetector"/> <property name="parentNode" ref="superCell_0"/> <property name="nextSibling" ref="environment_2"/> <property name="port"> <list> <ref bean="membrane_12"/> </list> </property> </bean> <bean id="environment_2" class="org.primordion.memcomp.app.XhCoopSys02ex32_1"> <property name="id" value="2"/> <property name="xhc" ref="Environment"/> <property name="parentNode" ref="superCell_0"/> <property name="firstChild" ref="objects_3"/> <property name="nextSibling" ref="membrane_4"/> </bean> <bean id="objects_3" class="org.primordion.memcomp.app.XhCoopSys02ex32_1"> <property name="id" value="3"/> <property name="xhc" ref="Objects"/> <property name="parentNode" ref="environment_2"/> <property name="firstChild" ref="a_46"/> </bean> <bean id="a_46" class="org.primordion.memcomp.app.XhCoopSys02ex32_1"> <property name="id" value="46"/> <property name="xhc" ref="a"/> <property name="parentNode" ref="objects_3"/> <property name="nextSibling" ref="a_47"/> </bean> <bean id="a_47" class="org.primordion.memcomp.app.XhCoopSys02ex32_1"> <property name="id" value="47"/> <property name="xhc" ref="a"/> <property name="parentNode" ref="objects_3"/> </bean> <bean id="membrane_4" class="org.primordion.memcomp.app.XhCoopSys02ex32_1"> <property name="id" value="4"/> <property name="xhc" ref="Membrane"/> <property name="roleName" value="1"/> <property name="parentNode" ref="superCell_0"/> <property name="firstChild" ref="region_5"/> </bean> ... <bean id="ruleSet_9" class="org.primordion.memcomp.app.XhCoopSys02ex32_1"> <property name="id" value="9"/> <property name="xhc" ref="RuleSet"/> <property name="roleName" value="R1"/> <property name="parentNode" ref="region_5"/> <property name="firstChild" ref="r1r2_11"/> <property name="port"> <list> <ref bean="objects_6"/> <ref bean="objects_3"/> <ref bean="objects_14"/> </list> </property> </bean> ... <bean id="ruleSet_15" class="org.primordion.memcomp.app.XhCoopSys02ex32_1"> <property name="id" value="15"/> <property name="xhc" ref="RuleSet"/> <property name="roleName" value="R2"/> <property name="parentNode" ref="region_13"/> <property name="port"> <list> <ref bean="objects_14"/> <ref bean="objects_3"/> </list> </property> </bean> <!-- XholonClass instance beans --> <bean id="XholonClass" class="org.primordion.xholon.base.XholonClass"> <property name="id" value="0"/> <property name="name" value="XholonClass"/> <property name="implName" value="org.primordion.memcomp.app.XhCoopSys02ex32_1"/> <property name="firstChild" ref="CompletionDetector"/> <property name="app" ref="Application"/> </bean> <bean id="CompletionDetector" class="org.primordion.xholon.base.XholonClass"> <property name="id" value="16"/> <property name="name" value="CompletionDetector"/> <property name="implName" value="org.primordion.memcomp.app.XhCoopSys02ex32_1"/> <property name="parentNode" ref="XholonClass"/> <property name="nextSibling" ref="Environment"/> <property name="app" ref="Application"/> </bean> ... <!-- Application instance bean --> <bean id="Application" class="org.primordion.xholon.app.ExternallyInitializedApplication"> <property name="modelName" value="Coop PSystem 2002 ex32"/> <property name="maxProcessLoops" value="20"/> <property name="timeStepInterval" value="10"/> <property name="IQueueImplName" value="org.primordion.xholon.base.Queue"/> <property name="sizeMessageQueue" value="20"/> <property name="maxPorts" value="6"/> <property name="useInteractions" value="true"/> <property name="interactionParams" value="4,false,localhost,60001"/> <property name="root" ref="superCell_0"/> <property name="xhcRoot" ref="XholonClass"/> <property name="srvRoot" ref="xholonInternalServices_0"/> </bean> <!-- Spring framework beans --> </beans>