Interaction between enclosing SchemaBinding and SchemaBindin
starksm64 Mar 13, 2006 11:52 AMI have the xmbean 2 parsing past the point of being able to create the objects correctly, but there is a disconnect between the out xmbean schema and the custom schema. A document like this:
<mbean xmlns="urn:jboss-test:xmbean:2.0" code="org.jboss.naming.JNDIBindingService" name="jboss.tests:service=JNDIBindingService"> <descriptors> <interceptors> <custom1:javabean xmlns:custom1="urn:jboss:simplejavabean:1.0" class="org.jboss.test.xml.mbeanserver.interceptors.SomeBeanInterceptor" flag="true" anInt="1234" aLong="123456789" aString="string1" someStrings="string1,string2,string3" address="127.0.0.1" homePage="http://www.jboss.org/" aClass="java.lang.Integer" someProperties="prop1=value1\nprop2=value2\nprop3=value3" /> <interceptor code="org.jboss.mx.interceptor.PersistenceInterceptor2" /> <interceptor code="org.jboss.mx.interceptor.ModelMBeanInterceptor" /> <interceptor code="org.jboss.mx.interceptor.ObjectReferenceInterceptor" /> </interceptors> </descriptors> </mbean> does have interceptors from the two schemas created. However, the interceptor from the custom schema is not being added to its parent. The xmbean schema does define an add method for both the integrated interceptor, and the any wildcard:
<xs:complexType name="interceptorsType"> <xs:annotation> <xs:documentation> <![CDATA[ The interceptors element specifies a customized stack of interceptors that will be used in place of the default stack. Currently this is only used when specified at the mbean level, but it could define a custom attribute or operation level interceptor stack in the future. Any stack should include the following interceptors as the last interceptors: <interceptors> <interceptor code="org.jboss.test.jmx.interceptors.JNDISecurity" securityDomain="java:/jaas/secure-jndi"/> <interceptor code="org.jboss.naming.interceptors.ProxyFactoryInterceptor" proxyName="jboss:service=proxyFactory,type=jrmp,target=Naming"/> <interceptor code="org.jboss.mx.interceptor.PersistenceInterceptor2" /> <interceptor code="org.jboss.mx.interceptor.ModelMBeanInterceptor" /> <interceptor code="org.jboss.mx.interceptor.ObjectReferenceInterceptor" /> </interceptors> ]]> </xs:documentation> <xs:appinfo> <jbxb:class impl="org.jboss.mx.metadata.xb.InterceptorsHolder"/> </xs:appinfo> </xs:annotation> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="interceptor" type="xmbean:interceptorType" /> <xs:any namespace="##other" processContents="lax"> <xs:annotation> <xs:appinfo> <jbxb:addMethod name="addInterceptor" valueType="org.jboss.mx.interceptor.Interceptor"/> </xs:appinfo> </xs:annotation> </xs:any> </xs:choice> </xs:complexType> <xs:complexType name="interceptorType"> <xs:annotation> <xs:documentation> The interceptor element specifies a custom interceptor instance. Each interceptor must implement the org.jboss.mx.interceptor.Interceptor interface, and must have either a no-arg constructor, or a constructor that accepts a javax.management.modelmbean.ModelMBeanInfo. </xs:documentation> <xs:appinfo> <jbxb:class impl="org.jboss.mx.metadata.xb.InterceptorHolder"/> <jbxb:addMethod name="addInterceptor" valueType="org.jboss.mx.interceptor.Interceptor"/> </xs:appinfo> </xs:annotation> <xs:attribute name="code" /> <xs:anyAttribute /> </xs:complexType>
However, the add of the any object binding is not being done. Presumably I would have to create the AddMethodMetaData to the interceptor element in the org.jboss.test.xml.mbeanserver.JavaBeanSchemaInitializer, but this is not practical as the result of the urn:jboss:simplejavabean:1.0 binding should be reusable in any enclosing schema.
It seems like there should be a check on the enclosing schema for an addMethod binding if the SchemaBindingInitializer result does not provide this information.