activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Posta <christian.po...@gmail.com>
Subject Re: How to create a bean that implements its own custom XML?
Date Thu, 04 Apr 2013 23:50:28 GMT
Take a look at this blog post to understand a little more about how the
namespaces integrate with spring...
http://www.christianposta.com/blog/?p=111




On Thu, Apr 4, 2013 at 4:38 PM, Paul Gale <paul.n.gale@gmail.com> wrote:

> Hi,
>
> (I have searched this mailing list's archive looking for Xbean guidance but
> none of the other cases match mine.)
>
> I have written a bean extension to ActiveMQ that I can instantiate using
> regular bean syntax and everything works just fine.
> Therefore there are no classpath issues with ActiveMQ finding my bean's jar
> file.
>
> However, I want to take it to the next level and have my bean implement its
> own custom XML via Xbean but getting this to work is proving elusive.
>
> ActiveMQ vomits at startup claiming schema validation errors etc that my
> bean cannot appear at said location.  Like a lot of elements the schema
> definition contained in activemq-core.xsd of the element inside which I
> wish to instantiate my bean contains the obligatory last entry:
>
> <xs:any namespace='##other' />
>
> This _should_ allow me to extend the element's definition using my custom
> XML (putting the X into XML).
>
> However, according to the definition of xs:any
> http://www.w3schools.com/schema/el_any.asp it states that "the default
> processing of the contents of the element is strict - the XML processor
> must obtain the required namespaces and validate the elements".
>
> How should I instruct ActiveMQ's XML processor to find my schema
> definition? My bean's XSD file sits at the top level of its jar. Xbean has
> generated all the relevant artifacts under
> /META-INF/services/org/apache/xbean/spring/... etc.
>
> The beans tag in my activemq.xml file looks as follows:
>
> <beans
>     xmlns="http://www.springframework.org/schema/beans"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:m="http://example.com/activemq/schema"
>     xsi:schemaLocation="http://www.springframework.org/schema/beans
>
> http://www.springframework.org/schema/beans/spring-beans.xsd
>                         http://activemq.apache.org/schema/core
>
> http://activemq.apache.org/schema/core/activemq-core.xsd
>                         http://example.com/activemq/schema
>                         http://example.com/activemq/schema/example.xsd">
>
> Where the example.com domain contains my bean.
>
> What am I missing? Do I need to create a Spring bean factory for this? I am
> a bit a neophyte when it comes to Spring etc so be kind. :)
>
> I have noticed, through experimentation, that if I change the beans tag to
> read as follows then my bean IS created, however, the creation of other
> ActiveMQ beans subsequently fail:
>
> <beans
>     xmlns="http://www.springframework.org/schema/beans"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:m="http://example.com/activemq/schema"
>     xsi:schemaLocation="http://www.springframework.org/schema/beans
>
> http://www.springframework.org/schema/beans/spring-beans.xsd
>                         http://activemq.apache.org/schema/core
>
> http://activemq.apache.org/schema/core/activemq-core.xsd
>                         http://example.com/activemq/schema
>                         example.xsd">
>
>
> Just as aside, I don't understand how the activemq-core.xsd is loaded when
> the activemq-all.jar only contains a schema called activemq.xsd (not
> activemq-core.xsd) located at the top-level of the jar (like mine is) and
> yet is referenced as
> http://activemq.apache.org/schema/core/activemq-core.xsd even though
> 'core'
> in said path is a file not a folder as found under
> /META-INF/services/org/apache/xbean/spring/... Can someone explain that to
> me?
>
>
> Thanks,
> Paul
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message