Class CollectingCacheManager
java.lang.Object
com.e1c.langtool.internal.collector.CollectingCacheManager
- All Implemented Interfaces:
IManagedService,ICollectingCacheManager
The default implementation of
ICollectingCacheManager with storing to MapDB store by each project.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()voidAdds the cache change listener.Iterator<org.eclipse.core.runtime.IPath>allInvalidated(org.eclipse.core.resources.IProject project) All invalidated file paths of the project that may have cache data.Iterator<org.eclipse.core.runtime.IPath>allResources(org.eclipse.core.resources.IProject project) All project file paths that may have cache.voidclear(org.eclipse.core.resources.IProject project) Clear cache of the project if exist.voidcloseAndDisableTrackChanges(org.eclipse.core.resources.IProject project) Close cache resources by the project and disable track changes of files of the project.voidvoidenableTrackChanges(org.eclipse.core.resources.IProject project) Enable track file changes for the project.getInterface(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path) Gets the interface cache data.getModel(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path) Gets the model cache data.getModelComputed(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path) Gets the model computed cache data.booleaninvalidate(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path) Invalidate cache for the file path of the project.booleaninvalidateAll(org.eclipse.core.resources.IProject project) Invalidate all existing cache for files for the project.booleanisInvalidated(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path) Checks if the file path of the project is already invalidated (marked as changed and the cache may exist but not valid).voidputInterface(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, Collection<FeatureValue> values) Put interface cache data.voidputModel(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, Collection<FeatureValue> values) Put model cache data.voidputModelComputed(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, Collection<FeatureValue> values) Put model computed cache data.voidRemoves the cache change listener.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.e1c.langtool.collector.ICollectingCacheManager
computeIfAbsent, computeIfAbsent, computeIfAbsentInterface, computeIfAbsentInterface, computeIfAbsentModel, computeIfAbsentModel, computeIfAbsentModelComputed, computeIfAbsentModelComputed, getInterface, getModel, getModelComputed, invalidate, putInterface, putModel, putModelComputed
-
Constructor Details
-
CollectingCacheManager
-
-
Method Details
-
activate
public void activate()- Specified by:
activatein interfaceIManagedService
-
deactivate
public void deactivate()- Specified by:
deactivatein interfaceIManagedService
-
addChangeListener
Description copied from interface:ICollectingCacheManagerAdds the cache change listener. Has no effect if an identical listener is already registered for change events.- Specified by:
addChangeListenerin interfaceICollectingCacheManager- Parameters:
listener- the listener, cannot benull.
-
removeChangeListener
Description copied from interface:ICollectingCacheManagerRemoves the cache change listener. Has no effect if the listener was already removed from registration.- Specified by:
removeChangeListenerin interfaceICollectingCacheManager- Parameters:
listener- the listener, cannot benull.
-
clear
public void clear(org.eclipse.core.resources.IProject project) Description copied from interface:ICollectingCacheManagerClear cache of the project if exist. This method allows to clear any cache data including closed and disabled to track changes projects. Call firstICollectingCacheManager.closeAndDisableTrackChanges(IProject)method before this method to prevent from reopening new cache after clear if needed.- Specified by:
clearin interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.
-
enableTrackChanges
public void enableTrackChanges(org.eclipse.core.resources.IProject project) Description copied from interface:ICollectingCacheManagerEnable track file changes for the project. Cache will not be initialized immediately, but lazy opens with first call of any method.- Specified by:
enableTrackChangesin interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.
-
closeAndDisableTrackChanges
public void closeAndDisableTrackChanges(org.eclipse.core.resources.IProject project) Description copied from interface:ICollectingCacheManagerClose cache resources by the project and disable track changes of files of the project. This method stop cache forever until callICollectingCacheManager.enableTrackChanges(IProject)or restart application. All file changes in workspace will be lost if disabled.- Specified by:
closeAndDisableTrackChangesin interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.
-
invalidate
public boolean invalidate(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path) Description copied from interface:ICollectingCacheManagerInvalidate cache for the file path of the project. This method usually calls when file changed in workspace. Clients do not need to call this to track changes manually because this manager responsible for this.- Specified by:
invalidatein interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.path- the project-relative file path, cannot benull.- Returns:
- true, if cache existed for the file path of the project
-
isInvalidated
public boolean isInvalidated(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path) Description copied from interface:ICollectingCacheManagerChecks if the file path of the project is already invalidated (marked as changed and the cache may exist but not valid).- Specified by:
isInvalidatedin interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.path- the project-relative file path, cannot benull.- Returns:
- true, if the file path is already invalidated
-
invalidateAll
public boolean invalidateAll(org.eclipse.core.resources.IProject project) Description copied from interface:ICollectingCacheManagerInvalidate all existing cache for files for the project.- Specified by:
invalidateAllin interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.- Returns:
- true, if cache exited and was invalidated successfully.
-
allInvalidated
public Iterator<org.eclipse.core.runtime.IPath> allInvalidated(org.eclipse.core.resources.IProject project) Description copied from interface:ICollectingCacheManagerAll invalidated file paths of the project that may have cache data.- Specified by:
allInvalidatedin interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.- Returns:
- the iterator of invalidated paths, cannot return
null.
-
allResources
public Iterator<org.eclipse.core.runtime.IPath> allResources(org.eclipse.core.resources.IProject project) Description copied from interface:ICollectingCacheManagerAll project file paths that may have cache. Note! That this iterator does not return all project files or may return removed files.- Specified by:
allResourcesin interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.- Returns:
- the iterator, cannot return
null.
-
getInterface
public Collection<FeatureValue> getInterface(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path) Description copied from interface:ICollectingCacheManagerGets the interface cache data.- Specified by:
getInterfacein interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.path- the path, cannot benull.- Returns:
- the interface cache, may return
nullif cache not exist.
-
putInterface
public void putInterface(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, Collection<FeatureValue> values) Description copied from interface:ICollectingCacheManagerPut interface cache data.- Specified by:
putInterfacein interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.path- the path, cannot benull.values- the keys, can benullthis mean to invalidate resource and remove this cache data.
-
getModel
public Collection<FeatureValue> getModel(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path) Description copied from interface:ICollectingCacheManagerGets the model cache data.- Specified by:
getModelin interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.path- the path, cannot benull.- Returns:
- the model cache, may return
nullif cache not exist.
-
putModel
public void putModel(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, Collection<FeatureValue> values) Description copied from interface:ICollectingCacheManagerPut model cache data.- Specified by:
putModelin interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.path- the path, cannot benull.values- the keys, can benullthis mean to invalidate resource and remove this cache data.
-
getModelComputed
public Collection<FeatureValue> getModelComputed(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path) Description copied from interface:ICollectingCacheManagerGets the model computed cache data.- Specified by:
getModelComputedin interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.path- the path, cannot benull.- Returns:
- the model computed cache, may return
nullif cache not exist.
-
putModelComputed
public void putModelComputed(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, Collection<FeatureValue> values) Description copied from interface:ICollectingCacheManagerPut model computed cache data.- Specified by:
putModelComputedin interfaceICollectingCacheManager- Parameters:
project- the project, cannot benull.path- the path, cannot benull.values- the keys, can benullthis mean to invalidate resource and remove this cache data.
-