package net.sf.etl.core.internal; import java.io.IOException; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import net.sf.etl.parsers.internal.term_parser.cache.LocatorCacheFacet; import net.sf.etl.parsers.internal.term_parser.cache.LocatorCacheManager; /** * This is a cache manager that tracks resource dependencies in Eclipse cache. * The resources from plugins are never invalidated. The resources in * the workspace are invalidated when a new version of the grammar is saved. * * Note that information from this cache manager is saved to persistent storage * and restored after startup. Builders need this information to invalidate * ETL sources correctly. * * @author const */ public class EclipseCacheManager implements LocatorCacheManager, EntityResolver { /** * Map from public ids to system ids to which it was last resolved. * This information is saved to persisten storage. */ Map<String,String> publicId2SystemId = new HashMap<String,String>(); /** * Map from system ids to set of publicIds. * This information is saved to persisten storage. */ Map<String,String> systemId2PublicIds = new HashMap<String,String>(); /** * Map from dependent system ids to primary system id. * This information is saved to persisten storage. */ Map<String,String> dependencies2SystemIds = new HashMap<String, String>(); public void cacheManagerInstalled(LocatorCacheFacet locator) { // TODO Auto-generated method stub } public void cacheManagerUninstalled(LocatorCacheFacet locator) { // TODO Auto-generated method stub } public void peerAdded(String systemId, Collection<String> allDependencies) { // TODO Auto-generated method stub } public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { // TODO Auto-generated method stub return null; } // FIXME the locator also depends on publicid. If publicid resolves to systemid, during parsing process. We need to track this dependency. On other hand it happen only in our resolver class, so possibly this could be tracked conservatively. PublicId -> sysid mapping invalidates everyone who depend on old value of sysid. }