cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Diephouse" <...@envoisolutions.com>
Subject Re: Proposing minor change to AbstractBeanDefinitionParser.getJaxbPackage()
Date Tue, 03 Apr 2007 23:58:40 GMT
I suppose thats fine.

You might also want to consider returning multiple packages:

protected String getJaxbPackage() {
 return "foo.bar1:foo.bar2:another,package";
}

Reagrds,
- Dan

On 4/3/07, Bhole, Ulhas <ulhas.bhole@iona.com> wrote:
>
> Hi,
>
> I have a configurartion usecase where I need to decide the package name
> based on the element that is getting parsed in
> org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser.mapElem
> entToJaxbProperty() method.
>
> Currently it calls on to getJaxbPackage() which doesn't provided
> flexibility of returning different pacakge names based on the item being
> processed.
>
> I have a scenario where my configuration schema imports some other
> schema for the types and wires it's own configuration type which contain
> elemements of some local type plus elements of some types from imported
> schema.
>
> If we can modify the getJaxbPackage() method to pass in namespace URI of
> the item being processed it will allow the me to decide what package
> name to return.
>
> Original code looks like:
>
> protected void mapElementToJaxbProperty(Element parent,
> BeanDefinitionBuilder bean, QName name,
>                                             String string, Class<?> c) {
>         Node data = null;
>      ...
>         if (data == null) {
>             return;
>         }
>
>         JAXBContext context = null;
>         Object obj = null;
>         try {
>             context = JAXBContext.newInstance(getJaxbPackage(),
> getClass().getClassLoader());
>             Unmarshaller u = context.createUnmarshaller();
>         ...
>     }
>
>     protected String getJaxbPackage() {
>         return "";
>     }
>
> Proposed change is:
>
> protected void mapElementToJaxbProperty(Element parent,
> BeanDefinitionBuilder bean, QName name,
>                                             String string, Class<?> c) {
>         Node data = null;
>      ...
>         if (data == null) {
>             return;
>         }
>
>         JAXBContext context = null;
>         Object obj = null;
>         try {
>             context =
> JAXBContext.newInstance(getJaxbPackage(data.getNamespaceURI()),
> getClass().getClassLoader());
>             Unmarshaller u = context.createUnmarshaller();
>         ...
>     }
>
>     protected String getJaxbPackage(String uri) {
>         return "";
>     }
>
>
> There are 4 classes currently which extends this class (2 in http config
> and 2 in JMS config) which will need the change along with the change I
> mentioned but it will allow a flexibility in other usecases where the
> configuration is composed of elements from multiple schemas and multiple
> namespaces.
>
> Any objections?
>
> Regards,
>
> Ulhas Bhole
>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

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