[Design of AOP on JBoss (Aspects/JBoss)] - Re: Implementing JAXB style parsing for aop-mc-int
by adrian@jboss.org
Even if you fix it to extends GenericBeanMetaDataFactory2 (or use your own factory),
what you are trying to do isn't going to work at the moment.
1) With the way the MC beans are currently marked up, there is no global
type "property" in the MC schema. i.e. there is no @XmlRootElement
or type name here:
| @XmlType(propOrder={"annotations", "value"})
| public class AbstractPropertyMetaData
|
It should be something like this to conform with the schema document
| @XmlRootElement(name="property")
| @XmlType(name="property" propOrder={"annotations", "value"})
|
This is obviously wrong and needs fixing.
The same is true for a number of other types.
2) But even if we did this, the way the builder is currently working
is that if it finds a class in your class hierarchy, it will add it to your namespace.
One way to fix this would be to mark it up as
| @XmlRootElement(name="property" namespace="urn:jboss:bean-deployer:2.0")
| @XmlType(name="property" namespace="urn:jboss:bean-deployer:2.0")
|
but we don't want to do this, because then the MC couldn't re-use this class across
versions.
I know Alex added a feature where he introduced an xmlns annotation,
but I don't know if it solves this problem. We'd need to ask him.
3) The third point is that you just leave it as it
and have all the mc elements and types in your namespace
which means that users won't have to specify xmlns tags.
| <aspect xmlns:aop="urn:jboss:aop-beans:1.0" class="org.jboss.test.microcontainer.beans.TestAspectWithDependency">
| <property name="dependency"><inject bean="Dependency"/></property>
| </aspect>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132601#4132601
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4132601
16 years, 11 months
[Design the new POJO MicroContainer] - JDK6 compile issue
by scott.stark@jboss.org
I mistakingly was using jdk6 to compile the mc, and ran into this compile time incompatibility in the jmx StandardMBean ctor:
| /home/svn/JBossMC/jbossmc/aop-mc-int/src/main/org/jboss/aop/microcontainer/lazy/JBossAOPLazyInitializer.java:[58,58] [deprecation] getType() in org.jboss.reflect.spi.TypeInfo has been deprecated
|
| /home/svn/JBossMC/jbossmc/aop-mc-int/src/main/org/jboss/aop/microcontainer/integration/AOPConstructorJoinpoint.java:[70,58] [deprecation] getType() in org.jboss.reflect.spi.TypeInfo has been deprecated
|
| /home/svn/JBossMC/jbossmc/aop-mc-int/src/main/org/jboss/aop/microcontainer/aspects/jmx/JMXIntroduction.java:[104,44] cannot find symbol
| symbol : constructor StandardMBean(java.lang.Object,java.lang.Class<capture#773 of ?>)
| location: class javax.management.StandardMBean
|
The problem is that StandardMBean changed from StandardMBean(Object ,Class) to StandardMBean(T , Class). Seems like too strict of behavior by the compiler?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132584#4132584
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4132584
16 years, 11 months
[Design of AOP on JBoss (Aspects/JBoss)] - Re: Implementing JAXB style parsing for aop-mc-int
by kabir.khan@jboss.com
Next stumbling block is trying to deploy things like
| <?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| <bean name="AspectManager" class="org.jboss.aop.AspectManager">
| <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
| </bean>
|
| <aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0" class="org.jboss.test.microcontainer.beans.TestAspectWithDependency">
| <property xmlns="urn:jboss:bean-deployer:2.0" name="dependency"><inject bean="Dependency"/></property>
| </aop:aspect>
|
| ....
| </deployment>
|
I get an error trying to handle the "property" element:
| org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/C:/cygwin/home/Kabir/sourcecontrol/microcontainer/aop-mc-int/target/tests-classes/org/jboss/test/microcontainer/beans/test/AspectWithDependencyJaxbDeploymentTestCaseNotAutomatic1.xml@10,69
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:177)
| at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:139)
| at org.jboss.test.xb.builder.JBossXBTestDelegate.unmarshal(JBossXBTestDelegate.java:122)
| at org.jboss.test.aop.junit.JBossXBDeployer.unmarshal(JBossXBDeployer.java:81)
| at org.jboss.test.aop.junit.JBossXBDeployer.deploy(JBossXBDeployer.java:124)
| at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.deploy(MicrocontainerTestDelegate.java:289)
| at org.jboss.test.kernel.junit.MicrocontainerTest.deploy(MicrocontainerTest.java:233)
| at org.jboss.test.microcontainer.beans.test.AspectWithDependencyTest.testInterceptorWithDependencyCorrectOrder(AspectWithDependencyTest.java:55)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at junit.framework.TestCase.runTest(TestCase.java:154)
| at junit.framework.TestCase.runBare(TestCase.java:127)
| at junit.framework.TestResult$1.protect(TestResult.java:106)
| at junit.framework.TestResult.runProtected(TestResult.java:124)
| at junit.framework.TestResult.run(TestResult.java:109)
| at junit.framework.TestCase.run(TestCase.java:118)
| at junit.framework.TestSuite.runTest(TestSuite.java:208)
| at junit.framework.TestSuite.run(TestSuite.java:203)
| at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
| at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
| at junit.framework.TestResult.runProtected(TestResult.java:124)
| at junit.extensions.TestSetup.run(TestSetup.java:23)
| at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
| at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
| Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:bean-deployer:2.0}property not found as a child of {urn:jboss:aop-beans:1.0}aspect
| at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:396)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:407)
| at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
| at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
| at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
| at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
| at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:173)
| ... 29 more
|
In my original schema, I had the type for aspect extending the beans abstractBeanfactoryType:
| <xsd:complexType name="aopBeanfactoryType">
| <xsd:annotation>
| <xsd:documentation>
| Similar to the beans beanfactoryType, but with an optional class
| </xsd:documentation>
| </xsd:annotation>
| <xsd:complexContent>
| <xsd:extension base="mc:abstractBeanfactoryType">
| <xsd:attribute name="class" type="xsd:token" use="required"/>
| </xsd:extension>
| </xsd:complexContent>
| </xsd:complexType>
|
| <xsd:complexType name="aspectOrInterceptorType">
| <xsd:annotation>
| <xsd:documentation>
| <![CDATA[
| aspects or interceptors
| ]]>
| </xsd:documentation>
| </xsd:annotation>
| <xsd:complexContent>
| <xsd:extension base="aopBeanfactoryType">
| <xsd:attribute name="scope" type="xsd:string" use="optional"/>
| <xsd:attribute name="factory" type="xsd:string" use="optional"/>
| <xsd:attribute name="manager-bean" type="xsd:string" use="optional"/>
| <xsd:attribute name="manager-property" type="xsd:string" use="optional"/>
| </xsd:extension>
| </xsd:complexContent>
| </xsd:complexType>
|
Is there a way to mimic that using the JAXB style parsing?
org.jboss.aop.microcontainer.beans.beanmetadatafactory.AspectBeanMetaDataFactory does not handle the property field in any special way:
| @JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
| @XmlRootElement(name="aspect")
| @XmlType(propOrder={"aliases", "annotations", "classLoader", "constructor", "properties", "create", "start", "depends", "demands", "supplies", "installs", "uninstalls"})
| public class AspectBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory
| implements BeanMetaDataFactory
| {
| ...
| }
|
|
AspectBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory extends GenericBeanFactoryMetaData extends AbstractBeanMetaData
| @JBossXmlSchema(namespace="urn:jboss:bean-deployer:2.0", elementFormDefault=XmlNsForm.QUALIFIED)
| @XmlRootElement(name="bean")
| @XmlType(propOrder={"aliases", "annotations", "classLoader", "constructor", "properties", "create", "start", "stop", "destroy", "depends", "demands", "supplies", "installs", "uninstalls", "installCallbacks", "uninstallCallbacks"})
| public class AbstractBeanMetaData extends AbstractFeatureMetaData
| implements BeanMetaData, BeanMetaDataFactory, MutableLifecycleHolder, Serializable
| {
| private static final long serialVersionUID = 3L;
|
| @XmlElement(name="property", namespace="urn:jboss:bean-deployer:2.0", type=AbstractPropertyMetaData.class)
| public void setProperties(Set<PropertyMetaData> properties)
| {
| this.properties = properties;
| flushJBossObjectCache();
| }
|
|
If I include a setProperties() method in AspectBeanMetaDataFactory to include the namespace it gets a bit further
| @JBossXmlSchema(namespace="urn:jboss:aop-beans:1.0", elementFormDefault=XmlNsForm.QUALIFIED)
| @XmlRootElement(name="aspect")
| @XmlType(propOrder={"aliases", "annotations", "classLoader", "constructor", "properties", "create", "start", "depends", "demands", "supplies", "installs", "uninstalls"})
| public class AspectBeanMetaDataFactory extends AspectManagerAwareBeanMetaDataFactory
| implements BeanMetaDataFactory
| {
| ...
| @XmlElement(name="property", namespace="urn:jboss:bean-deployer:2.0", type=AbstractPropertyMetaData.class)
| public void setProperties(Set<PropertyMetaData> properties)
| {
| this.properties = properties;
| flushJBossObjectCache();
| }
|
it then chokes on the nested "inject" field.
| org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/C:/cygwin/home/Kabir/sourcecontrol/microcontainer/aop-mc-int/target/tests-classes/org/jboss/test/microcontainer/beans/test/AspectWithDependencyJaxbDeploymentTestCaseNotAutomatic1.xml@10,96
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:177)
| at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:139)
| at org.jboss.test.xb.builder.JBossXBTestDelegate.unmarshal(JBossXBTestDelegate.java:122)
| at org.jboss.test.aop.junit.JBossXBDeployer.unmarshal(JBossXBDeployer.java:81)
| at org.jboss.test.aop.junit.JBossXBDeployer.deploy(JBossXBDeployer.java:124)
| at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.deploy(MicrocontainerTestDelegate.java:289)
| at org.jboss.test.kernel.junit.MicrocontainerTest.deploy(MicrocontainerTest.java:233)
| at org.jboss.test.microcontainer.beans.test.AspectWithDependencyTest.testInterceptorWithDependencyCorrectOrder(AspectWithDependencyTest.java:55)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at junit.framework.TestCase.runTest(TestCase.java:154)
| at junit.framework.TestCase.runBare(TestCase.java:127)
| at junit.framework.TestResult$1.protect(TestResult.java:106)
| at junit.framework.TestResult.runProtected(TestResult.java:124)
| at junit.framework.TestResult.run(TestResult.java:109)
| at junit.framework.TestCase.run(TestCase.java:118)
| at junit.framework.TestSuite.runTest(TestSuite.java:208)
| at junit.framework.TestSuite.run(TestSuite.java:203)
| at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
| at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
| at junit.framework.TestResult.runProtected(TestResult.java:124)
| at junit.extensions.TestSetup.run(TestSetup.java:23)
| at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
| at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
| at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
| Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:bean-deployer:2.0}inject not found as a child of {urn:jboss:bean-deployer:2.0}property
| at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:396)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:407)
| at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
| at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
| at org.apache.xerces.xinclude.XIncludeHandler.emptyElement(Unknown Source)
| at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
| at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
| at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:173)
| ... 29 more
|
I could possibly fix that by adding namespaces to things, but it does not feel like the right approach to me? This sounds similar to what I think you meant here, but I am not sure?
"adrian(a)jboss.org" wrote :
| It doesn't actually make much difference, except you'll have to reproduce all the MC schema
| in your schema using your namespace (and maintain it every time it changes ;-)
|
|
I also tried modifying the xml
| <?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| <bean name="AspectManager" class="org.jboss.aop.AspectManager">
| <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
| </bean>
|
| <aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0" class="org.jboss.test.microcontainer.beans.TestAspectWithDependency">
| <property xmlns="urn:jboss:bean-deployer:2.0" name="dependency"><inject xmlns="urn:jboss:bean-deployer:2.0" bean="Dependency"/></property>
| </aop:aspect>
| ...
| </deployment>
|
but that yields the same problem
| org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/C:/cygwin/home/Kabir/sourcecontrol/microcontainer/aop-mc-int/target/tests-classes/org/jboss/test/microcontainer/beans/test/AspectWithDependencyJaxbDeploymentTestCaseNotAutomatic1.xml@10,132
| ...
| Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:bean-deployer:2.0}inject not found as a child of {urn:jboss:bean-deployer:2.0}property
| at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:396)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:407)
| at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
| at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
| at org.apache.xerces.xinclude.XIncludeHandler.emptyElement(Unknown Source)
| at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
| at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
| at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:173)
| ... 29 more
|
|
The test to reproduce this is org.jboss.test.microcontainer.beans.test.AspectWithDependencyJaxbDeploymentTestCase.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132575#4132575
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4132575
16 years, 11 months
[Design of JBossCache] - Re: NPE in InvalidationInterceptor.getNodeVersion()
by bstansberry@jboss.com
I've fixed this by returning null from getNodeVersion() if there is no WorkspaceNode for the Fqn. The effect of this is 'null' will be propagated to other nodes in the cluster as the version being invalidated. Looking at how they handle the invalidate() call, I see no problems with this -- they treat an invalidate() call with a null version as meaning "invalidate this Fqn no matter what version you have, but don't update the version".
Effect of this is, if an Fqn is associated with the optimistic tx, but there is no node w/ that Fqn in the workspace, we tell the cluster to invalidate that Fqn w/o updating the version. In a case where a tx calls cache.removeNode(Fqn.fromString("/locally-non-existent")) that seems to be the desired behavior. I don't see any other reason why an Fqn would be associated with a tx but no node would be in the workspace.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132556#4132556
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4132556
16 years, 11 months