FileDocCategorySizeDatePackage
CachedXPathAPIHolder.javaAPI DocJava SE 6 API1999Tue Jun 10 00:23:04 BST 2008com.sun.org.apache.xml.internal.security.utils

CachedXPathAPIHolder

public class CachedXPathAPIHolder extends Object
author
Raul Benito

Fields Summary
static Logger
log
static ThreadLocal
local
static ThreadLocal
localDoc
Constructors Summary
Methods Summary
public static com.sun.org.apache.xpath.internal.CachedXPathAPIgetCachedXPathAPI()

return
the cachexpathapi for this thread

        
        CachedXPathAPI cx=(CachedXPathAPI)local.get();        
        if (cx==null) {
            cx=new CachedXPathAPI();
            local.set(cx);
            localDoc.set(null);            
        }
    	return cx;
    
public static voidsetDoc(org.w3c.dom.Document doc)
Sets the doc for the xpath transformation. Resets the cache if needed

param
doc

  
	              	 
	                         
       if (localDoc.get()!=doc) {
            CachedXPathAPI cx=(CachedXPathAPI)local.get();
            if (cx==null) {
               cx=new CachedXPathAPI();
               local.set(cx);
               localDoc.set(doc);
               return;
            }
            //Different docs reset.
            cx.getXPathContext().reset();
            localDoc.set(doc);                     
        }