xml.parser
Class CachedGrammarPool

java.lang.Object
  extended by xml.parser.CachedGrammarPool
All Implemented Interfaces:
org.apache.xerces.xni.grammars.XMLGrammarPool

public class CachedGrammarPool
extends java.lang.Object
implements org.apache.xerces.xni.grammars.XMLGrammarPool

FIXME: thread safety


Constructor Summary
CachedGrammarPool(org.gjt.sp.jedit.Buffer requestingBuffer)
           
 
Method Summary
 void cacheGrammars(java.lang.String grammarType, org.apache.xerces.xni.grammars.Grammar[] grammars)
          return the final set of grammars that the validator ended up with.
 void clear()
          Removes all grammars from the pool.
 void lockPool()
          Causes the XMLGrammarPool not to store any grammars when the cacheGrammars(String, Grammar[[]) method is called.
 org.apache.xerces.xni.grammars.Grammar retrieveGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)
           This method requests that the application retrieve a grammar corresponding to the given GrammarIdentifier from its cache.
 org.apache.xerces.xni.grammars.Grammar[] retrieveInitialGrammarSet(java.lang.String grammarType)
           retrieve the initial known set of grammars.
 void unlockPool()
          Allows the XMLGrammarPool to store grammars when its cacheGrammars(String, Grammar[]) method is called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedGrammarPool

public CachedGrammarPool(org.gjt.sp.jedit.Buffer requestingBuffer)
Method Detail

retrieveInitialGrammarSet

public org.apache.xerces.xni.grammars.Grammar[] retrieveInitialGrammarSet(java.lang.String grammarType)

retrieve the initial known set of grammars. this method is called by a validator before the validation starts. the application can provide an initial set of grammars available to the current validation attempt.

Specified by:
retrieveInitialGrammarSet in interface org.apache.xerces.xni.grammars.XMLGrammarPool
Parameters:
grammarType - the type of the grammar, from the org.apache.xerces.xni.grammars.Grammar interface.
Returns:
the set of grammars the validator may put in its "bucket"

cacheGrammars

public void cacheGrammars(java.lang.String grammarType,
                          org.apache.xerces.xni.grammars.Grammar[] grammars)

return the final set of grammars that the validator ended up with. This method is called after the validation finishes. The application may then choose to cache some of the returned grammars.

Specified by:
cacheGrammars in interface org.apache.xerces.xni.grammars.XMLGrammarPool
Parameters:
grammarType - the type of the grammars being returned;
grammars - an array containing the set of grammars being returned; order is not significant.

retrieveGrammar

public org.apache.xerces.xni.grammars.Grammar retrieveGrammar(org.apache.xerces.xni.grammars.XMLGrammarDescription desc)

This method requests that the application retrieve a grammar corresponding to the given GrammarIdentifier from its cache. If it cannot do so it must return null; the parser will then call the EntityResolver. An application must not call its EntityResolver itself from this method; this may result in infinite recursions.

Specified by:
retrieveGrammar in interface org.apache.xerces.xni.grammars.XMLGrammarPool
Parameters:
desc - The description of the Grammar being requested.
Returns:
the Grammar corresponding to this description or null if no such Grammar is known.

lockPool

public void lockPool()
Causes the XMLGrammarPool not to store any grammars when the cacheGrammars(String, Grammar[[]) method is called.

Specified by:
lockPool in interface org.apache.xerces.xni.grammars.XMLGrammarPool

unlockPool

public void unlockPool()
Allows the XMLGrammarPool to store grammars when its cacheGrammars(String, Grammar[]) method is called. This is the default state of the object.

Specified by:
unlockPool in interface org.apache.xerces.xni.grammars.XMLGrammarPool

clear

public void clear()
Removes all grammars from the pool.

Specified by:
clear in interface org.apache.xerces.xni.grammars.XMLGrammarPool