[jboss-user] [Microcontainer] - Using bean injection tags in a custom XML schema
david.lloyd@jboss.com
do-not-reply at jboss.com
Wed May 7 17:22:40 EDT 2008
I'd like to set things up so that the user can do something like this:
| <io:deployment xmlns:io="urn:jboss:io:1.0" xmlns:bean="urn:jboss:bean-deployer:2.0">
| <io:server>
| <io:handler-factory-bean>
| <bean:inject bean="MyHandlerFactory"/>
| </io:handler-factory-bean>
| <io:bind-address>0.0.0.0:12345</io:bind-address>
| <io:bind-address>0.0.0.0:12346</io:bind-address>
| <io:bind-address>0.0.0.0:12347</io:bind-address>
| </io:server>
| <io:connection name="TheConnection">
| <io:handler-bean>
| <bean:inject bean="MyHandler"/>
| </io:handler-bean>
| <io:client>
| <io:connector/>
| <io:connect-address>irc.freenode.net:6667</io:connect-address>
| <io:connect-address>irc.us.freenode.net:6667</io:connect-address>
| <io:connect-address>irc.au.freenode.net:6667</io:connect-address>
| </io:client>
| </io:connection>
| </io:deployment>
|
The "io" tags are my custom schema; the "bean" tags are the regular bean-deployer tags. Is there any way this is possible to do? I've been looking over various docs and code and I'm not seeing any obvious ways to do this.
Specifically I'm trying to make it so that I can let the user use any tag that they'd normally use within a <bean:property> or similar tag, in order to inject beans into those properties.
Am I overthinking this? Maybe I should just accept a bean name instead...
The schema for the "io" tags is:
| <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
| xmlns="urn:jboss:io:1.0"
| targetNamespace="urn:jboss:io:1.0"
| xmlns:bean="urn:jboss:bean-deployer:2.0"
| elementFormDefault="qualified"
| attributeFormDefault="unqualified"
| >
|
| <xs:complexType name="deployment">
| <xs:sequence minOccurs="0" maxOccurs="unbounded">
| <xs:choice minOccurs="0" maxOccurs="unbounded">
| <xs:element name="server" type="server"/>
| <xs:element name="connector" type="connector"/>
| <xs:element name="client" type="client"/>
| <xs:element name="connection" type="connection"/>
| </xs:choice>
| </xs:sequence>
| </xs:complexType>
|
| <xs:complexType name="server">
| <xs:sequence minOccurs="1" maxOccurs="1">
| <xs:element name="handler-factory-bean" type="bean" minOccurs="1" maxOccurs="1"/>
| <xs:sequence minOccurs="1" maxOccurs="unbounded">
| <xs:element name="bind-address" type="xs:string"/>
| </xs:sequence>
| </xs:sequence>
| <xs:attribute name="reuse-address" use="optional" type="xs:boolean"/>
| <xs:attribute name="receive-buffer-size" use="optional" type="xs:int"/>
| <xs:attribute name="backlog" use="optional" type="xs:int"/>
| <xs:attribute name="socket-timeout" use="optional" type="xs:int"/>
| <xs:attribute name="name" type="xs:string"/>
| </xs:complexType>
|
| <xs:complexType name="connector">
| <xs:sequence minOccurs="1" maxOccurs="1">
| <xs:element name="executor-bean" type="bean" minOccurs="0" maxOccurs="1"/>
| </xs:sequence>
| <xs:attribute name="keep-alive" use="optional" type="xs:boolean"/>
| <xs:attribute name="oob-inline" use="optional" type="xs:boolean"/>
| <xs:attribute name="receive-buffer-size" use="optional" type="xs:int"/>
| <xs:attribute name="reuse-address" use="optional" type="xs:boolean"/>
| <xs:attribute name="send-buffer-size" use="optional" type="xs:int"/>
| <xs:attribute name="linger" use="optional" type="xs:boolean"/>
| <xs:attribute name="linger-time" use="optional" type="xs:int"/>
| <xs:attribute name="timeout" use="optional" type="xs:int"/>
| <xs:attribute name="tcp-no-delay" use="optional" type="xs:boolean"/>
| <xs:attribute name="connect-timeout" use="optional" type="xs:int"/>
| <xs:attribute name="name" type="xs:string"/>
| </xs:complexType>
|
| <xs:complexType name="client">
| <xs:sequence minOccurs="1" maxOccurs="1">
| <xs:choice minOccurs="1" maxOccurs="1">
| <xs:element name="connector" minOccurs="1" maxOccurs="1" type="connector"/>
| <xs:element name="connector-bean" minOccurs="1" maxOccurs="1" type="bean"/>
| </xs:choice>
| <xs:sequence minOccurs="1" maxOccurs="unbounded">
| <xs:element name="connect-address" type="xs:string"/>
| </xs:sequence>
| </xs:sequence>
| <xs:attribute name="name" type="xs:string"/>
| </xs:complexType>
|
| <xs:complexType name="connection">
| <xs:sequence minOccurs="1" maxOccurs="1">
| <xs:element name="handler-bean" minOccurs="1" maxOccurs="1" type="bean"/>
| <xs:choice minOccurs="1" maxOccurs="1">
| <xs:element name="client" minOccurs="1" maxOccurs="1" type="client"/>
| <xs:element name="client-bean" minOccurs="1" maxOccurs="1" type="bean"/>
| </xs:choice>
| <xs:element name="scheduled-executor-bean" minOccurs="0" maxOccurs="1" type="bean"/>
| </xs:sequence>
| <xs:attribute name="name" type="xs:string"/>
| </xs:complexType>
|
| <xs:complexType name="bean">
| ???? what goes here ????
| </xs:complexType>
|
| <xs:element name="deployment" type="deployment"/>
| </xs:schema>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4149234#4149234
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4149234
More information about the jboss-user
mailing list