| java.lang.Object net.sourceforge.squirrel_sql.fw.xml.XMLObjectCache
XMLObjectCache | public class XMLObjectCache implements IObjectCache<E>(Code) | | This class is a cache of objects that can be read from/written to an XML
document. All objects stored must implement IHasIdentifier .
It is implemented using ObjectCache .
author: Colin Bell |
XMLObjectCache | public XMLObjectCache()(Code) | | Default ctor.
|
addChangesListener | public void addChangesListener(IObjectCacheChangeListener lis, Class<E> objClass)(Code) | | Adds a listener for changes to the cache entry for the passed class.
Parameters: lis - an IObjectCacheChangeListener that will be notifiedwhen objects are added and removed from this cacheentry. Parameters: objClass - The class of objects whose cache we want to listento. |
get | public IHasIdentifier get(Class<E> objClass, IIdentifier id)(Code) | | Retrieve a stored object.
Parameters: objClass - The class of the object to be retrieved. Parameters: id - The IIdentifier that identifiesthe object to be retrieved. The IHasIdentifier retrieved or null if no object exists for id . |
getAllClasses | public Class<E>[] getAllClasses()(Code) | | Return an array of Class |
getAllForClass | public Iterator<E> getAllForClass(Class<E> objClass)(Code) | | Return an Iterator of all objects stored for the
passed class.
Parameters: objClass - Class to return objects for. Iterator over all objects. |
load | public void load(Reader rdr) throws XMLException, DuplicateObjectException(Code) | | Load from a reader over an XML document. Use the system classloader and
don't ignore duplicate objects.
Parameters: rdr - Reader over the XML document. exception: XMLException - Thrown if an XML error occurs. exception: DuplicateObjectException - Thrown if two objects of the same classand with the same identifier are added to the cache. |
load | public void load(Reader rdr, ClassLoader cl, boolean ignoreDuplicates) throws XMLException, DuplicateObjectException(Code) | | Load from a reader over an XML document.
Parameters: rdr - Reader over the XML document. Parameters: cl - Class loader to use for object creation. Passnull to use the system classloader. Parameters: ignoreDuplicates - If true don't throw aDuplicateObjectException but ratherignore the attempt to add a duplicate, inthis case there will be only one object added tothe cache. exception: XMLException - Thrown if an XML error occurs. exception: DuplicateObjectException - Thrown if two objects of the same classand with the same identifier are added to the cache. |
remove | public void remove(Class<E> objClass, IIdentifier id)(Code) | | Remove an object.
Parameters: objClass - Class of object to be removed. Parameters: id - Identifier for object to be removed. |
removeChangesListener | public void removeChangesListener(IObjectCacheChangeListener lis, Class<E> objClass)(Code) | | Removes a listener for changes to the cache entry for the passed class.
Parameters: lis - an IObjectCacheChangeListener that will be notifiedwhen objects are added and removed from this cacheentry. Parameters: objClass - The class of objects whose cache we want to listento. |
save | public synchronized void save(String xmlFilename) throws IOException, XMLException(Code) | | Save all objects in this cache to an XML document.
Parameters: xmlFileName - Name of XML file to save to. exception: IOException - Thrown if an IO error occurs. exception: XMLException - Thrown if an XML error occurs. |
saveAllForClass | public synchronized void saveAllForClass(String xmlFilename, Class<E> forClass) throws IOException, XMLException(Code) | | Save all objects of type objClass to an XML document.
Parameters: xmlFileName - Name of XML file to save to. Parameters: forClass - Class of objects to be saved. exception: IOException - Thrown if an IO error occurs. exception: XMLException - Thrown if an XML error occurs. |
|
|