org.apache.tuscany.sca.databinding.jaxb
Class JAXBContextCache

java.lang.Object
  extended by org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache

public class JAXBContextCache
extends java.lang.Object


Field Summary
protected static java.util.Set<java.lang.Class<?>> BUILTIN_CLASSES_SET
           
protected  LRUCache<java.lang.Object,javax.xml.bind.JAXBContext> cache
           
protected  javax.xml.bind.JAXBContext defaultContext
           
protected static java.lang.Class<?>[] JAXB_BUILTIN_CLASSES
           
protected  org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.Pool<javax.xml.bind.JAXBContext,javax.xml.bind.Marshaller> mpool
           
protected  org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.Pool<javax.xml.bind.JAXBContext,javax.xml.bind.Unmarshaller> upool
           
 
Constructor Summary
JAXBContextCache()
           
JAXBContextCache(int contextSize, int marshallerSize, int unmarshallerSize)
           
 
Method Summary
static boolean checkPackage(java.lang.String p, java.lang.ClassLoader cl)
           
 void clear()
           
 LRUCache<java.lang.Object,javax.xml.bind.JAXBContext> getCache()
           
static javax.xml.bind.JAXBContext getDefaultJAXBContext()
           
 javax.xml.bind.JAXBContext getJAXBContext(java.lang.Class<?> cls)
           
 javax.xml.bind.JAXBContext getJAXBContext(java.lang.Class<?>[] classes)
           
 javax.xml.bind.JAXBContext getJAXBContext(java.util.Set<java.lang.Class<?>> classes)
           
 javax.xml.bind.Marshaller getMarshaller(javax.xml.bind.JAXBContext context)
           
static java.lang.Class<?> getPrimitiveClass(java.lang.String text)
           
 javax.xml.bind.Unmarshaller getUnmarshaller(javax.xml.bind.JAXBContext context)
           
 void releaseJAXBMarshaller(javax.xml.bind.JAXBContext context, javax.xml.bind.Marshaller marshaller)
           
 void releaseJAXBUnmarshaller(javax.xml.bind.JAXBContext context, javax.xml.bind.Unmarshaller unmarshaller)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAXB_BUILTIN_CLASSES

protected static java.lang.Class<?>[] JAXB_BUILTIN_CLASSES

BUILTIN_CLASSES_SET

protected static final java.util.Set<java.lang.Class<?>> BUILTIN_CLASSES_SET

cache

protected LRUCache<java.lang.Object,javax.xml.bind.JAXBContext> cache

mpool

protected org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.Pool<javax.xml.bind.JAXBContext,javax.xml.bind.Marshaller> mpool

upool

protected org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.Pool<javax.xml.bind.JAXBContext,javax.xml.bind.Unmarshaller> upool

defaultContext

protected javax.xml.bind.JAXBContext defaultContext
Constructor Detail

JAXBContextCache

public JAXBContextCache()

JAXBContextCache

public JAXBContextCache(int contextSize,
                        int marshallerSize,
                        int unmarshallerSize)
Method Detail

getDefaultJAXBContext

public static javax.xml.bind.JAXBContext getDefaultJAXBContext()

getPrimitiveClass

public static java.lang.Class<?> getPrimitiveClass(java.lang.String text)
Parameters:
name - of primitive type
Returns:
primitive Class or null

checkPackage

public static boolean checkPackage(java.lang.String p,
                                   java.lang.ClassLoader cl)
Parameters:
p - Package
cl -
Returns:
true if each package has a ObjectFactory class or package-info

getMarshaller

public javax.xml.bind.Marshaller getMarshaller(javax.xml.bind.JAXBContext context)
                                        throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

releaseJAXBMarshaller

public void releaseJAXBMarshaller(javax.xml.bind.JAXBContext context,
                                  javax.xml.bind.Marshaller marshaller)

getUnmarshaller

public javax.xml.bind.Unmarshaller getUnmarshaller(javax.xml.bind.JAXBContext context)
                                            throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

releaseJAXBUnmarshaller

public void releaseJAXBUnmarshaller(javax.xml.bind.JAXBContext context,
                                    javax.xml.bind.Unmarshaller unmarshaller)

getCache

public LRUCache<java.lang.Object,javax.xml.bind.JAXBContext> getCache()

getJAXBContext

public javax.xml.bind.JAXBContext getJAXBContext(java.lang.Class<?> cls)
                                          throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

getJAXBContext

public javax.xml.bind.JAXBContext getJAXBContext(java.lang.Class<?>[] classes)
                                          throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

getJAXBContext

public javax.xml.bind.JAXBContext getJAXBContext(java.util.Set<java.lang.Class<?>> classes)
                                          throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

clear

public void clear()