| java.lang.Object org.mandarax.xkb.framework.AbstractXMLAdapter org.mandarax.xkb.framework.CachedXMLAdapter
All known Subclasses: org.mandarax.xkb.framework.XMLAdapter4SQLPredicates, org.mandarax.xkb.framework.XMLAdapter4DataSources, org.mandarax.xkb.framework.XMLAdapter4Objects,
CachedXMLAdapter | abstract public class CachedXMLAdapter extends AbstractXMLAdapter (Code) | | Abstract adapter class supporting caching. I.e., elements get an ID attribute with
a unique object id value. When two elements with the same id are imported, the same
object is returned. We have some utility methods here to support this behaviour.
Warning: We use a map for caching. Implementations such as HashMap
identify keys using equal() , but there might be alternative implementations
using == (like the Smalltalk class IdentityDictionary). Therefore the effects of using
a cache depend on the implementation of map choosen!
See Also: java.util.Map author: Jens Dietrich version: 3.4 <7 March 05> since: 1.6 |
Field Summary | |
final public static String | ID |
Method Summary | |
abstract protected Element | _exportObject(Object obj, GenericDriver driver, Map cache) Export the object. | abstract protected Object | _importObject(Element e, GenericDriver driver, Map cache, LogicFactory lfactory) Build an object from an XML element. | public Element | exportObject(Object obj, GenericDriver driver, Map cache) Export the object, check first whether an element is aleady in the cache. | public Object | importObject(Element e, GenericDriver driver, Map cache, LogicFactory lfactory) Build an object from an XML element. | protected String | nextId() Get the next object id. |
_exportObject | abstract protected Element _exportObject(Object obj, GenericDriver driver, Map cache) throws XKBException(Code) | | Export the object. Subclasses must implement this method and must not care about caching.
Parameters: obj - an object Parameters: driver - the generic driver Parameters: cache - a cache used in order to associate the sameid with various occurences of the same object exception: an - XKBException is thrown if export fails |
_importObject | abstract protected Object _importObject(Element e, GenericDriver driver, Map cache, LogicFactory lfactory) throws XKBException(Code) | | Build an object from an XML element. Subclasses must implement this method and must not care about caching.
Parameters: e - an element Parameters: driver - the generic driver Parameters: cache - a cache used to identify objects that have the same id Parameters: lfactory - the logic factory used to create objects exception: an - XKBException is thrown if export fails |
exportObject | public Element exportObject(Object obj, GenericDriver driver, Map cache) throws XKBException(Code) | | Export the object, check first whether an element is aleady in the cache.
Parameters: obj - an object Parameters: driver - the generic driver Parameters: cache - a cache used in order to associate the sameid with various occurences of the same object exception: an - XKBException is thrown if export fails |
importObject | public Object importObject(Element e, GenericDriver driver, Map cache, LogicFactory lfactory) throws XKBException(Code) | | Build an object from an XML element. First we check whether an object for the respective id
is already in the cache.
Parameters: e - an element Parameters: driver - the generic driver Parameters: cache - a cache used to identify objects that have the same id Parameters: lfactory - the logic factory used to create objects exception: an - XKBException is thrown if export fails |
nextId | protected String nextId()(Code) | | Get the next object id.
a unique id |
Methods inherited from org.mandarax.xkb.framework.AbstractXMLAdapter | protected void addProperties(Element e, ClauseSet cs)(Code)(Java Doc) protected void addProperties(Element e, Query q)(Code)(Java Doc) protected void check(Object obj, Class clazz) throws XKBException(Code)(Java Doc) protected void exportChildren(Object[] objs, Element parent, String kindOfObject, GenericDriver driver, Map cache) throws XKBException(Code)(Java Doc) protected void exportChildren(Collection objs, Element parent, String kindOfObject, GenericDriver driver, Map cache) throws XKBException(Code)(Java Doc) protected Element exportObject(Object obj, String kindOfObject, GenericDriver driver, Map cache) throws XKBException(Code)(Java Doc) protected String getFunctionType(Function f)(Code)(Java Doc) protected String getPredicateType(Predicate p)(Code)(Java Doc) protected String getTermType(Term t)(Code)(Java Doc) protected Object importChild(Element parent, String name, GenericDriver driver, Map cache, LogicFactory lfactory) throws XKBException(Code)(Java Doc) protected Object importChildren(Element parent, String name, GenericDriver driver, Map cache, LogicFactory lfactory, Class targetType) throws XKBException(Code)(Java Doc) protected void loadProperties(Element e, ClauseSet cs)(Code)(Java Doc) protected void loadProperties(Element e, Query q)(Code)(Java Doc)
|
|
|