Thank you for telling me :-)
So do this:
| TypeBinding beanType = schemaBinding.getType(beanTypeQName);
|
| /*
| ClassMetaData classMetaData = new ClassMetaData();
| classMetaData.setImpl(AbstractBeanMetaData.class.getName());
| beanType.setClassMetaData(classMetaData);
|
| QName CLASS = new QName("class");
| AttributeBinding attribute = beanType.getAttribute(CLASS);
| PropertyMetaData propertyMetaData = new PropertyMetaData();
| propertyMetaData.setName("bean");
| attribute.setPropertyMetaData(propertyMetaData);
|
| QName MODE = new QName("mode");
| attribute = beanType.getAttribute(MODE);
| ValueAdapter modeAdapter = new ValueAdapter()
| {
| public Object cast(Object o, Class c)
| {
| String string = (String) o;
| return new ControllerMode(string);
| }
| };
| attribute.setValueAdapter(modeAdapter);
| */
| beanType.setHandler(new DefaultElementHandler()
| {
|
| public Object startElement(Object parent, QName name,
ElementBinding element)
| {
| return new AbstractBeanMetaData();
| }
|
| public void attributes(Object o, QName elementName, ElementBinding
element, Attributes attrs, NamespaceContext nsCtx)
| {
| AbstractBeanMetaData bean = (AbstractBeanMetaData) o;
| for (int i = 0; i < attrs.getLength(); ++i)
| {
| String localName = attrs.getLocalName(i);
| if ("name".equals(localName))
| bean.setName(attrs.getValue(i));
| else if ("class".equals(localName))
| bean.setBean(attrs.getValue(i));
| else if ("mode".equals(localName))
| bean.setMode(new ControllerMode(attrs.getValue(i)));
| else if ("whenRequired".equals(localName))
| bean.set........
| }
| }
| });
|
| <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:attribute name="WhenRequired" type="controllerStateType"
use="optional"/>
| </xsd:complexType>
|
Or do this
| public void attributes(Object o, QName elementName, ElementBinding
element, Attributes attrs, NamespaceContext nsCtx)
| {
| AbstractDemandMetaData demand = (AbstractDemandMetaData) o;
| for (int i = 0; i < attrs.getLength(); ++i)
| {
| String localName = attrs.getLocalName(i);
| if ("whenRequired".equals(localName))
| demand.setWhenRequired(new
ControllerState(attrs.getValue(i)));
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3927456#3927456
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3927456
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user