Map undefined collections from interface to defined collections in XSD /  Set 
min/maxOccurs from an external XSD
----------------------------------------------------------------------------------------------------------------

                 Key: XFIRE-970
                 URL: http://jira.codehaus.org/browse/XFIRE-970
             Project: XFire
          Issue Type: New Feature
          Components: Aegis Module, Core, Spring
    Affects Versions: 1.2.5
         Environment: Tested on:
OS : XP, Linux
Container: Jetty 5,JBoss 4.0.5, Weblogic 8.1 SP4
            Reporter: Maxime ORAIN
            Assignee: Dan Diephouse
         Attachments: XFire - Test Collection MinOcc MaxOcc.zip, XFire modified 
src.zip

To provide those new features  there is little steps to do. (Sample is included 
in archive)
1)       Define an XSD with your schema. (src/META-INF/schema/test.xsd
     Here the name are strictly the same as in java source
     In this XSD we see that the collection is typed
     In this XSD we see that for count minOccurs and maxOccurs are set to 1


2)       Add the schema to 
HashMap  properties = new HashMap();
schemas.add("test.xsd");
properties.put(ObjectServiceFactory.EXT_SCHEMAS, schemas);

or in services.xml:
<beans xmlns="http://xfire.codehaus.org/config/1.0";>
        <service>
                <name>TestService</name>
                <namespace>http://test</namespace>
                <serviceClass>test.IMyService</serviceClass>
                <implementationClass>test.MyService</implementationClass>
                <ext_schemas>
                        <schema>META-INF/schema/test.xsd</schema>
                </ext_schemas>
        </service>
</beans>

To provide a list of XSD a new properties is set in ServiceBean.
Once the service is bringing up the methods will read the different types in 
the schema and load them into hashtable (AbstractWSDL & ObjectServiceFactory)
The configuration is made that the XSD will only be read once and before a WSDL 
generation.

When a collection is found dynamically the method createType is invoked 
(AbstractTypeCreator). At this time a query to the hashtable is made to map the 
collection type to the real one in the XSD otherwise the normal exception is 
thrown.

When a type is found dynamically the method WriteTypeReference is invoked in 
(from BeanType). At this time a query to the hashtable is made to know if 
min/maxOccurs is set if yes those ones are set


To test the 2 features a eclipse workspace is included just change the deploy 
dir in the ant-build.xml.

Index of modifications:

AbstractTypeCreator:
            L381 : Method CreateType
                                    Map the collection to a referent in the XSD

BeanType
            L633: Method WriteTypeReference
                                    Handle Min/MaxOccurs 

ObjectServiceFactory
            L88: Add symbol ext_schemas
            L443 : Define an XSD at the beginning

AbstractWSDL
            L81 : isXSDAlreadyLoaded
            L92 getElementbyNSandType
            L97: getRealtype
            L127 fillNameSpace
            L137 saveOwnTypes
            L171 AddSchemas
            L230 Load XSD
            L476 Modify method : AddSchemas
            L525 remove getSchema() : If schema is already put why put all 
types?

SchemaBean
            Add the properties : ext_schemas for services.xml


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to