Closed ithena closed 10 years ago
Currently Schema Includes are also not cached, only Schema imports.
I just looked over the modifications. Looks pretty good! Good coding practises and style. There are lot of modifications so we need some time for the pull.
Thomas, I assume the Include construct should also cause the Schema to be added to the cache. Could you confirm this?
@ithena Dear Ruben, would you send us a new pull request with the latest changes? Thanks
We refactored the AbstractParserContext and the cache for imported Schema's so that it becomes possible to reuse the Schema cache when parsing multiple WSDL definitions.
I tried to avoid any changes in the parsing behavior for the standard scenario. The client code needs to explicitly reuse the ParserImportedSchemaCache when parsing multiple WSDL definitions. Otherwise the parser behavior should not be different as before.
One minor difference might be that ParserImportedSchemaCache does not cache Schema's without a targetNamespace. Before, when a map was used for caching, Schema's without a targetNamespace would be cached with an empty String as key.
The refactoring makes the ParserContext responsible for choosing an appropriate cache key, and adding and retrieving Schema's from the cache. This allows for custom cache key strategies, e.g. baseDir + targetNamespace, by subclassing one of the parser context implementations.
To reuse the parsed Schema's for different WSDLs the client needs to explicitly reuse the ParserImportedSchemaCache as shown in the snippet below. When the client does this, only one instance of each Schema will be in memory.