org.apache.ws.commons.schema
Class SchemaBuilder

java.lang.Object
  extended by org.apache.ws.commons.schema.SchemaBuilder

public class SchemaBuilder
extends Object

Object used to build a schema from a schema document. This object includes a cache of previously resolved schema documents. This cache might be useful when an application has multiple webservices that each have WSDL documents that import the same schema, for example. On app startup, we may wish to cache XmlSchema objects so we don't build up the schema graph multiple times. key - use a combination of thread id and all three parameters passed to resolveXmlSchema to give minimal thread safety value - XmlSchema object wrapped in a SoftReference to encourage GC in low memory situations. CAUTION: XmlSchema objects are not likely to be thread-safe. This cache should only be used, then cleared, by callers aware of its existence. It is VERY important that users of this cache call clearCache() after they are done. Usage of the cache is controlled by calling initCache() which will initialize resolvedSchemas to non-null. Clearing of cache is done by calling clearCache() which will clear and nullify resolvedSchemas


Method Summary
static void clearCache()
          Remove any entries from the cache for the current thread.
 ExtensionRegistry getExtReg()
           
static void initCache()
          Setup the cache to be used by the current thread of execution.
 void setExtReg(ExtensionRegistry extReg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

clearCache

public static void clearCache()
Remove any entries from the cache for the current thread. Entries for other threads are not altered.


initCache

public static void initCache()
Setup the cache to be used by the current thread of execution. Multiple threads can use the cache, and each one must call this method at some point prior to attempting to resolve the first schema, or the cache will not be used on that thread. IMPORTANT: The thread MUST call clearCache() when it is done with the schemas or a large amount of memory may remain in-use.


getExtReg

public ExtensionRegistry getExtReg()

setExtReg

public void setExtReg(ExtensionRegistry extReg)


Copyright © 2004-2015 The Apache Software Foundation. All Rights Reserved.