geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: SchemaConversions (was Re: [Fwd: Re: rid of all ns prefixes])
Date Thu, 13 Oct 2005 15:45:46 GMT

On Oct 13, 2005, at 6:28 AM, Sachin Patel wrote:

> David,
>
> So an validation exception is being thrown on my call to  
> SchemaConversionUtil.fixGeronimoSchema(...) and can't seem to figure  
> out why... Perhaps you can shed some light?

> WebAppDocument webDoc = (WebAppDocument)  
> plan.changeType(WebAppDocument.type);

This claims that your document is a spec dd
> WebAppType web = (WebAppType)  
> SchemaConversionUtils.fixGeronimoSchema(webDoc, "web-app",  
> WebAppDocument.type);

This attempts to convert the web-app element into a spec dd document.   
This is why the errors are even stranger than they might be :-)

I think you want  only one line,

GerWebAppType webApp = (GerWebAppType)  
SchemaConversionUtils.fixGeronimoSchema(plan, "web-app",  
GerWebAppType.type);

Hope I'm close to right :-)

david jencks


>
> I start with the following hand written plan...
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.0"  
> configId="test/test">
>  <context-root>/test</context-root>
>  <context-priority-classloader>false</context-priority-classloader>
>  <resource-env-ref>
>    <ref-name>blah</ref-name>
>    <message-destination-link>blah</message-destination-link>
>  </resource-env-ref>
> </web-app>
>
>
> I then call the following snippet of code...
>
>
> XmlObject plan =  
> XmlBeansUtil.parse(dpFile.getLocation().toFile().toURL());
> WebAppDocument webDoc = (WebAppDocument)  
> plan.changeType(WebAppDocument.type);
> WebAppType web = (WebAppType)  
> SchemaConversionUtils.fixGeronimoSchema(webDoc, "web-app",  
> WebAppDocument.type);
>
>
> The following exception is thrown although the converted plan in the  
> exception seems to be correct...
>
> org.apache.xmlbeans.XmlException: Invalid deployment descriptor:  
> [error: cvc-complex-type.3.2.1: Attribute not allowed (no wildcards  
> allowed): configId, error: cvc-complex-type.2.4a: Expected element  
> 'web-app@http://java.sun.com/xml/ns/j2ee' instead of  
> 'context-root@http://geronimo.apache.org/xml/ns/j2ee/web-1.0' here,  
> error: cvc-complex-type.2.4a: Expected element  
> 'web-app@http://java.sun.com/xml/ns/j2ee' instead of  
> 'context-priority-classloader@http://geronimo.apache.org/xml/ns/j2ee/ 
> web-1.0' here, error: cvc-complex-type.2.4a: Expected element  
> 'web-app@http://java.sun.com/xml/ns/j2ee' instead of  
> 'resource-env-ref@http://geronimo.apache.org/xml/ns/naming-1.0' here,  
> error: cvc-complex-type.2.4c: Expected element  
> 'web-app@http://java.sun.com/xml/ns/j2ee' before the end of the  
> content]
>
> Descriptor: <xml-fragment configId="test/test"  
> xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-1.0"  
> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.0">
>  <web:context-root>/test</web:context-root>
>   
> <web:context-priority-classloader>false</web:context-priority- 
> classloader>
>  <nam:resource-env-ref>
>    <nam:ref-name>blah</nam:ref-name>
>    <nam:message-destination-link>blah</nam:message-destination-link>
>  </nam:resource-env-ref>
> </xml-fragment>
>   at  
> org.apache.geronimo.schema.SchemaConversionUtils.validateDD(SchemaConve 
> rsionUtils.java:594)
>    at  
> org.apache.geronimo.schema.SchemaConversionUtils.fixGeronimoSchema(Sche 
> maConversionUtils.java:360)
>
> Any ideas as to what is wrong?
>
> Thanks,
>
> Sachin
>
> David Jencks wrote:
>>
>> On Oct 11, 2005, at 6:04 PM, Sachin Patel wrote:
>>
>>>
>>> David Jencks wrote:
>>>>
>>>>
>>>> I'd have the issue say that the eclipse stuff should pre-convert  
>>>> the plans using SchemaConversionUtils.  We'll find out soon enough  
>>>> what needs to change :-)  Is there an easy to find point in the  
>>>> eclipse stuff where you know what kind of plan it is and want to  
>>>> convert it?
>>> Well when importing a J2EE app or module into WTP a new  
>>> "project/component" is always created for every module in that  
>>> application and so I'll know every module type and thus should  
>>> automatically know the j2ee plan type during the import.  This  
>>> import operation is extendable and I'll be able to do this  
>>> conversion then for every module.  (With nested plans, it may be a  
>>> little tricker, will have to put some thought into that...)
>>
>> An ear plan always has namespaces for the plans for the modules.   
>> They could be the old unversioned namespaces (missing -1.0 at the  
>> end) but they are sufficient to identify what you should end up with.  
>>  The web plans are a little trickier, since after figuring out which  
>> builder we will use the generic geronimo-web docs are converted to  
>> container-specific docs.  Are you planning to generate generic web  
>> plans or container specific web plans or give the user a choice?
>>
>> An ear plan will still need some namespace conversion to get the  
>> dependencies and gbeans.
>>
>> thanks
>> david jencks
>>
>>
>


Mime
View raw message