[Design the new POJO MicroContainer] - Getting content of XML element
by kabir.khan@jboss.com
Can somebody please tell me how to get the contents of the annotation? i.e. I want: @org.jboss.test.microcontainer.beans2.Annotation1. It does not appear to be accessible from any of the things passed in to the methods of AnnotationOverrideHandler?
Also, for a similar schenario I will need to construct a org.w3c.dom.Element from the nested contents of a element. Is that possible?
Schema:
| <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
| targetNamespace="urn:jboss:aop-beans:1.0"
| xmlns="urn:jboss:aop-beans:1.0"
| xmlns:mc="urn:jboss:bean-deployer:2.0"
| elementFormDefault="qualified"
| attributeFormDefault="unqualified"
| version="1.0"
| >
| ...
|
| <xsd:element name="annotation" type="annotationType">
| <xsd:annotation>
| <xsd:documentation>
| <![CDATA[
| A annotation override
| ]]>
| </xsd:documentation>
| </xsd:annotation>
| </xsd:element>
|
| <xsd:complexType name="annotationType">
| <xsd:annotation>
| <xsd:documentation>
| <![CDATA[
| A annotation override
| ]]>
| </xsd:documentation>
| </xsd:annotation>
| <xsd:complexContent>
| <xsd:attribute name="expr" type="xsd:string" use="required"/>
| <xsd:attribute name="invisible" type="xsd:string" use="required"/>
| </xsd:complexContent>
| </xsd:complexType>
|
| </xsd:schema>
|
|
XML:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
| ...
| <annotation xmlns="urn:jboss:aop-beans:1.0" expr="class(org.jboss.test.microcontainer.beans2.POJO)" invisible="false">
| @org.jboss.test.microcontainer.beans2.Annotation1
| </annotation>
| ...
| </deployment>
|
|
SchemaBindingIntitializer:
| public class AOPBeansSchemaInitializer implements SchemaBindingInitializer
| {
| ...
|
| private static final QName annotationTypeQName = new QName(AOP_BEANS_NS, "annotationType");
|
| TypeBinding type = schema.getType(annotationTypeQName);
| type.setHandler(AnnotationOverrideHandler.HANDLER);
| //type.pushInterceptor(annotationQName, AnnotationContentInterceptor.INTERCEPTOR);
| ....
|
|
| private static class AnnotationOverrideHandler extends DefaultElementHandler
| {
| public static final AnnotationOverrideHandler HANDLER = new AnnotationOverrideHandler();
|
| @Override
| public Object startElement(Object parent, QName name, ElementBinding element)
| {
| return new AbstractBeanMetaData(AnnotationOverride.class.getName());
| }
|
| @Override
| public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
| {
| AspectBeanMetaDataUtil util = new AspectBeanMetaDataUtil();
| AbstractBeanMetaData pointcut = (AbstractBeanMetaData)o;
|
| for (int i = 0; i < attrs.getLength(); ++i)
| {
| ....
| }
| }
|
| @Override
| public Object endElement(Object o, QName name, ElementBinding element)
| {
| return super.endElement(o, name, element);
| }
|
|
| }
|
| private static class AnnotationContentInterceptor extends DefaultElementInterceptor
| {
| public static final AnnotationContentInterceptor INTERCEPTOR = new AnnotationContentInterceptor();
|
| @Override
| public void add (Object parent, Object child, QName name)
| {
| System.out.println("-----------> " + child);
| }
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106519#4106519
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106519
18 years, 4 months
[Design of JBoss jBPM] - Re: Improvig timer
by tom.baeyens@jboss.com
cool feature proposal. i would propose to add an attribute duedatetime with the following syntax:
where
duedatetime:= [day] space time
day:= (relativeday | absoluteday)
|
| relativeday:= today (+|-) [0..9]* [business] day(s)
|
| absoluteday:= dd/mm/yyyy
|
| time:= HH:mm[:ss]
|
|
(the date formats should be configurable in the businesscalendar.properties)
i proposed a separate attribute to ease the distinction between the currently supported delay-based format and the new format parsing
does that make sense ?
no not yet. just realized that we need to separate between relative dates and times and absolute dates and times. so my proposal above is not good enough, but it shows the direction in which i want to think.
if you want please, propose something more complete and clean.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106447#4106447
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106447
18 years, 4 months