You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christian Schneider <ch...@die-schneider.net> on 2013/04/17 11:28:57 UTC

Add class to jaxb context in wsdl first case

Hi all,

I am generating my java classes for a service using wsdl first.
In the implementation I want to extend a generated class and make it 
known to the jaxb context.

I have found:
<jaxws:properties>
     <entry key="jaxb.additionalContextClasses">
                  <bean class="...ClassArrayFactoryBean">
                      <property name="classNames">
                          <list>
                              <value>...MyClass</value>
                          </list>
                      </property>
                  </bean>
   </entry>
</jaxws:properties>

but I am using Blueprint and the ClassArrayFactoryBean from the systests 
is spring specific. Any idea how to do this in blueprint?


Christian

-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


RE: Add class to jaxb context in wsdl first case

Posted by Andrei Shakirin <as...@talend.com>.
Thanks for tip, Dan!
Will look into it.

Andrei.

> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Donnerstag, 25. April 2013 18:23
> To: users@cxf.apache.org
> Subject: Re: Add class to jaxb context in wsdl first case
> 
> 
> We should make this easier....
> 
> In
> rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.ja
> va  it currently checks if the return is a single Class file.   We likely should
> update that check to allow for standard "Collection<Class>" things and
> maybe even String and Collection<String> and grab the context class loader
> and do Class.forName(...) things for each of them.  That would remove the
> need for the custom spring thing and greatly simplify this to allow use of the
> standard spring or blueprint arrays/list things.    Feel free to log and issue and
> fix it.   :-)
> 
> Dan
> 
> 
> 
> On Apr 24, 2013, at 12:16 PM, Andrei Shakirin <as...@talend.com>
> wrote:
> 
> > Hi Glen,
> >
> >> I don't know what you mean by ClassArrayFactoryBean being
> >> Spring-specific; are you referring to it being Spring DM
> >> configuration and just want to know the Blueprint equivalent, or that
> >> it's using Spring libraries that you don't care to import into your OSGi app?
> >
> > ClassArrayFactoryBean internally uses Spring libraries ():
> >
> > import org.springframework.beans.factory.FactoryBean;
> >
> > public class ClassArrayFactoryBean implements FactoryBean<Object> { }
> >
> > Christian has found following solution for blueprint:
> >
> >        <jaxws:properties>
> >            <entry key="jaxb.additionalContextClasses">
> >            	<bean class="java.lang.Object" factory-ref="additionalClasses"
> factory-method="create"/>
> >            </entry>
> >        </jaxws:properties>
> >
> >       <bean id="additionalClasses"
> > class="xxx.yyy.AdditionalClassesFactory"/>
> >
> > public class AdditionalClassesFactory {
> >    public Class<?>[] create() {
> >        return new Class[]{ExtensionClass.class};
> >    }
> > }
> >
> > It work fine.
> >
> > Regards,
> > Andrei.
> >
> >> -----Original Message-----
> >> From: Glen Mazza [mailto:glen.mazza@gmail.com]
> >> Sent: Mittwoch, 24. April 2013 15:41
> >> To: users@cxf.apache.org
> >> Subject: Re: Add class to jaxb context in wsdl first case
> >>
> >> Can't you use the same syntax for Blueprint?
> >> https://github.com/Talend/tesb-rt-se/blob/master/examples/cxf/jaxws-
> >> cxf-sts/client/src/main/resources/OSGI-INF/blueprint/client.xml
> >>
> >> I don't know what you mean by ClassArrayFactoryBean being
> >> Spring-specific; are you referring to it being Spring DM
> >> configuration and just want to know the Blueprint equivalent, or that
> >> it's using Spring libraries that you don't care to import into your OSGi app?
> >>
> >> Glen
> >>
> >> On 04/17/2013 05:28 AM, Christian Schneider wrote:
> >>> Hi all,
> >>>
> >>> I am generating my java classes for a service using wsdl first.
> >>> In the implementation I want to extend a generated class and make it
> >>> known to the jaxb context.
> >>>
> >>> I have found:
> >>> <jaxws:properties>
> >>>    <entry key="jaxb.additionalContextClasses">
> >>>                 <bean class="...ClassArrayFactoryBean">
> >>>                     <property name="classNames">
> >>>                         <list>
> >>>                             <value>...MyClass</value>
> >>>                         </list>
> >>>                     </property>
> >>>                 </bean>
> >>>  </entry>
> >>> </jaxws:properties>
> >>>
> >>> but I am using Blueprint and the ClassArrayFactoryBean from the
> >>> systests is spring specific. Any idea how to do this in blueprint?
> >>>
> >>>
> >>> Christian
> >>>
> >
> 
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog Talend Community Coder -
> http://coders.talend.com


Re: Add class to jaxb context in wsdl first case

Posted by Daniel Kulp <dk...@apache.org>.
We should make this easier….

In rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java  it currently checks if the return is a single Class file.   We likely should update that check to allow for standard "Collection<Class>" things and maybe even String and Collection<String> and grab the context class loader and do Class.forName(…) things for each of them.  That would remove the need for the custom spring thing and greatly simplify this to allow use of the standard spring or blueprint arrays/list things.    Feel free to log and issue and fix it.   :-)

Dan



On Apr 24, 2013, at 12:16 PM, Andrei Shakirin <as...@talend.com> wrote:

> Hi Glen,
> 
>> I don't know what you mean by ClassArrayFactoryBean being Spring-specific;
>> are you referring to it being Spring DM configuration and just want to know
>> the Blueprint equivalent, or that it's using Spring libraries that you don't care
>> to import into your OSGi app?
> 
> ClassArrayFactoryBean internally uses Spring libraries ():
> 
> import org.springframework.beans.factory.FactoryBean;
> 
> public class ClassArrayFactoryBean implements FactoryBean<Object> {
> }
> 
> Christian has found following solution for blueprint:
> 
>        <jaxws:properties>
>            <entry key="jaxb.additionalContextClasses">
>            	<bean class="java.lang.Object" factory-ref="additionalClasses" factory-method="create"/>
>            </entry>
>        </jaxws:properties>
> 
>       <bean id="additionalClasses" class="xxx.yyy.AdditionalClassesFactory"/>
> 
> public class AdditionalClassesFactory {
>    public Class<?>[] create() {
>        return new Class[]{ExtensionClass.class};
>    }
> }
> 
> It work fine.
> 
> Regards,
> Andrei.
> 
>> -----Original Message-----
>> From: Glen Mazza [mailto:glen.mazza@gmail.com]
>> Sent: Mittwoch, 24. April 2013 15:41
>> To: users@cxf.apache.org
>> Subject: Re: Add class to jaxb context in wsdl first case
>> 
>> Can't you use the same syntax for Blueprint?
>> https://github.com/Talend/tesb-rt-se/blob/master/examples/cxf/jaxws-
>> cxf-sts/client/src/main/resources/OSGI-INF/blueprint/client.xml
>> 
>> I don't know what you mean by ClassArrayFactoryBean being Spring-specific;
>> are you referring to it being Spring DM configuration and just want to know
>> the Blueprint equivalent, or that it's using Spring libraries that you don't care
>> to import into your OSGi app?
>> 
>> Glen
>> 
>> On 04/17/2013 05:28 AM, Christian Schneider wrote:
>>> Hi all,
>>> 
>>> I am generating my java classes for a service using wsdl first.
>>> In the implementation I want to extend a generated class and make it
>>> known to the jaxb context.
>>> 
>>> I have found:
>>> <jaxws:properties>
>>>    <entry key="jaxb.additionalContextClasses">
>>>                 <bean class="...ClassArrayFactoryBean">
>>>                     <property name="classNames">
>>>                         <list>
>>>                             <value>...MyClass</value>
>>>                         </list>
>>>                     </property>
>>>                 </bean>
>>>  </entry>
>>> </jaxws:properties>
>>> 
>>> but I am using Blueprint and the ClassArrayFactoryBean from the
>>> systests is spring specific. Any idea how to do this in blueprint?
>>> 
>>> 
>>> Christian
>>> 
> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


RE: Add class to jaxb context in wsdl first case

Posted by Andrei Shakirin <as...@talend.com>.
Hi Glen,

> I don't know what you mean by ClassArrayFactoryBean being Spring-specific;
> are you referring to it being Spring DM configuration and just want to know
> the Blueprint equivalent, or that it's using Spring libraries that you don't care
> to import into your OSGi app?

ClassArrayFactoryBean internally uses Spring libraries ():

import org.springframework.beans.factory.FactoryBean;

public class ClassArrayFactoryBean implements FactoryBean<Object> {
}

Christian has found following solution for blueprint:

        <jaxws:properties>
            <entry key="jaxb.additionalContextClasses">
            	<bean class="java.lang.Object" factory-ref="additionalClasses" factory-method="create"/>
            </entry>
        </jaxws:properties>

       <bean id="additionalClasses" class="xxx.yyy.AdditionalClassesFactory"/>

public class AdditionalClassesFactory {
    public Class<?>[] create() {
        return new Class[]{ExtensionClass.class};
    }
}

It work fine.

Regards,
Andrei.

> -----Original Message-----
> From: Glen Mazza [mailto:glen.mazza@gmail.com]
> Sent: Mittwoch, 24. April 2013 15:41
> To: users@cxf.apache.org
> Subject: Re: Add class to jaxb context in wsdl first case
> 
> Can't you use the same syntax for Blueprint?
> https://github.com/Talend/tesb-rt-se/blob/master/examples/cxf/jaxws-
> cxf-sts/client/src/main/resources/OSGI-INF/blueprint/client.xml
> 
> I don't know what you mean by ClassArrayFactoryBean being Spring-specific;
> are you referring to it being Spring DM configuration and just want to know
> the Blueprint equivalent, or that it's using Spring libraries that you don't care
> to import into your OSGi app?
> 
> Glen
> 
> On 04/17/2013 05:28 AM, Christian Schneider wrote:
> > Hi all,
> >
> > I am generating my java classes for a service using wsdl first.
> > In the implementation I want to extend a generated class and make it
> > known to the jaxb context.
> >
> > I have found:
> > <jaxws:properties>
> >     <entry key="jaxb.additionalContextClasses">
> >                  <bean class="...ClassArrayFactoryBean">
> >                      <property name="classNames">
> >                          <list>
> >                              <value>...MyClass</value>
> >                          </list>
> >                      </property>
> >                  </bean>
> >   </entry>
> > </jaxws:properties>
> >
> > but I am using Blueprint and the ClassArrayFactoryBean from the
> > systests is spring specific. Any idea how to do this in blueprint?
> >
> >
> > Christian
> >


Re: Add class to jaxb context in wsdl first case

Posted by Glen Mazza <gl...@gmail.com>.
Can't you use the same syntax for Blueprint? 
https://github.com/Talend/tesb-rt-se/blob/master/examples/cxf/jaxws-cxf-sts/client/src/main/resources/OSGI-INF/blueprint/client.xml

I don't know what you mean by ClassArrayFactoryBean being 
Spring-specific; are you referring to it being Spring DM configuration 
and just want to know the Blueprint equivalent, or that it's using 
Spring libraries that you don't care to import into your OSGi app?

Glen

On 04/17/2013 05:28 AM, Christian Schneider wrote:
> Hi all,
>
> I am generating my java classes for a service using wsdl first.
> In the implementation I want to extend a generated class and make it 
> known to the jaxb context.
>
> I have found:
> <jaxws:properties>
>     <entry key="jaxb.additionalContextClasses">
>                  <bean class="...ClassArrayFactoryBean">
>                      <property name="classNames">
>                          <list>
>                              <value>...MyClass</value>
>                          </list>
>                      </property>
>                  </bean>
>   </entry>
> </jaxws:properties>
>
> but I am using Blueprint and the ClassArrayFactoryBean from the 
> systests is spring specific. Any idea how to do this in blueprint?
>
>
> Christian
>