[ 
https://issues.apache.org/jira/browse/TUSCANY-2640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723201#action_12723201
 ] 

Scott Kurz commented on TUSCANY-2640:
-------------------------------------

Picking this up again:

How about adjusting the algorithm to say:

1. build a list of classes
2. build a list of pkgs containing those classes...
3. for each of those pkgs, look for an ObjectFactory.class (I'm assuming 
there's an obvious classloader to use)
4. do newInstance(...list of classes..)   

Sound good? 

> Should use package(s) when possible in creating JAXBContext, not set of 
> Classes
> -------------------------------------------------------------------------------
>
>                 Key: TUSCANY-2640
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2640
>             Project: Tuscany
>          Issue Type: Bug
>            Reporter: Scott Kurz
>             Fix For: Java-SCA-Next
>
>
> The JAXBContextHelper method:
>    createJAXBContext(TransformationContext tContext, boolean source)
> ends up calling
>   JAXBContextCache.getJAXBContext(Set<Class<?>> classes)  
> This latter method, though, will only use the pkg-style 
> JAXBContext.newInstance() if there is only a single Class in the set... 
> otherwise it will use class-style JAXBContext.newInstance().
> It is only the pkg-style, however, which causes the @XmlRegistry (typically 
> 'ObjectFactory') to be registered in the JAXBContext (since it's not like we 
> go add the registry to the list of classes passed into newInstance()).  The 
> end result is that the @XmlElemDecl's in the registry are not registered, and 
> there are a list of global elems with the context doesn't know about, though 
> it could if we changed the context creation.
> My motive for caring here is in looking to support JAXB unmarshalling by 
> global-element....  I'm not sure if I could produce an error with the current 
> code doing unmarshalling by declaredType, so for now I'm arguing for changing 
> this for consistency's sake.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to