demandType Schema wondering
bkeh12 Feb 27, 2006 11:11 PM
<xsd:complexType name="beanType">
<xsd:annotation>
<xsd:documentation>
[CDATA[
The bean is an instance of a pojo.
e.g.
<bean name="MyName" class="com.acme.POJO">
<classloader .../>
<constructor .../>
<property .../>
<property .../>
<depends .../>
</bean>
]]
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="classloader" type="classloaderType" minOccurs="0"/>
<xsd:element name="constructor" type="constructorType" minOccurs="0"/>
<xsd:element name="property" type="propertyType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="create" type="lifecycleType" minOccurs="0"/>
<xsd:element name="start" type="lifecycleType" minOccurs="0"/>
<xsd:element name="stop" type="lifecycleType" minOccurs="0"/>
<xsd:element name="destroy" type="lifecycleType" minOccurs="0"/>
<xsd:element name="depends" type="dependsType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="demand" type="demandType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="supply" type="supplyType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="install" type="installType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="uninstall" type="installType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="optional"/>
<xsd:attribute name="class" type="xsd:token" use="required"/>
<xsd:attribute name="mode" type="controllerModeType" use="optional"/>
</xsd:complexType>
<xsd:complexType name="demandType">
<xsd:annotation>
<xsd:documentation>
[CDATA[
The demand is used to specify a dependency on a supply
and when the demand is should be deplied
e.g.:
ISupply must be installed before IDemand is constructed
<bean name="IDemand" ...whenRequired="Instantiated">
<,demand >theSupply<,/demand>
</bean>
<bean name="ISupply" ...>
<,supply>theSupply<,/supply>
</bean>
]]
</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="whenRequired" type="controllerStateType" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
is it update as below?
e.g.:
ISupply must be installed before IDemand is constructed
<bean name="IDemand" ...
<,demand whenRequired="Instantiated">>theSupply<,/demand>
</bean>
<bean name="ISupply" ...>
<,supply>theSupply<,/supply>
</bean>
]]
I try to work two samples,resoult as same.
sample1: <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd" xmlns="urn:jboss:bean-deployer:2.0"> <bean name="Integer" class="org.jboss.example.microcontainer.constructor.ConstructorBean" whenRequired="Instantiated"> <constructor> <parameter class="int">4</parameter> </constructor> <demand >HAPPY</demand> </bean> <bean name="StringLong" class="org.jboss.example.microcontainer.constructor.ConstructorBean" > <constructor> <parameter>a string</parameter> <parameter class="long">10</parameter> </constructor> <supply>HAPPY</supply> </bean> </deployment> sample2: <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd" xmlns="urn:jboss:bean-deployer:2.0"> <bean name="Integer" class="org.jboss.example.microcontainer.constructor.ConstructorBean" > <constructor> <parameter class="int">4</parameter> </constructor> <demand whenRequired="Instantiated" >HAPPY</demand> </bean> <bean name="StringLong" class="org.jboss.example.microcontainer.constructor.ConstructorBean" > <constructor> <parameter>a string</parameter> <parameter class="long">10</parameter> </constructor> <supply>HAPPY</supply> </bean> </deployment>
Visit node AbstractDemandMetaData@5e176f{demand=HAPPY whenRequiredDescribed}
Dependencies for Integer: [AbstractDemandMetaData$DemandDependencyItem@c9131c{name=Integer dependsOn=null whenRequired=Described resolved=false demand=HAPPY}]
Still unresolved Described:....
Installing name=StringLong..
.....
StringLong Installed
Dependencies resolved Integer for Described
.....
Integer Installed
.....
Is Visit node AbstractDemandMetaData@5e176f{demand=HAPPY whenRequiredDescribed} correct ?
Or is Visit node AbstractDemandMetaData@5e176f{demand=HAPPY whenRequiredInstantiated}.