Class CollectingCacheManager

java.lang.Object
com.e1c.langtool.internal.collector.CollectingCacheManager
All Implemented Interfaces:
IManagedService, ICollectingCacheManager

public final class CollectingCacheManager extends Object implements ICollectingCacheManager
The default implementation of ICollectingCacheManager with storing to MapDB store by each project.
  • Constructor Details

  • Method Details

    • activate

      public void activate()
      Specified by:
      activate in interface IManagedService
    • deactivate

      public void deactivate()
      Specified by:
      deactivate in interface IManagedService
    • addChangeListener

      public void addChangeListener(ICollectingCacheChangeListener listener)
      Description copied from interface: ICollectingCacheManager
      Adds the cache change listener. Has no effect if an identical listener is already registered for change events.
      Specified by:
      addChangeListener in interface ICollectingCacheManager
      Parameters:
      listener - the listener, cannot be null.
    • removeChangeListener

      public void removeChangeListener(ICollectingCacheChangeListener listener)
      Description copied from interface: ICollectingCacheManager
      Removes the cache change listener. Has no effect if the listener was already removed from registration.
      Specified by:
      removeChangeListener in interface ICollectingCacheManager
      Parameters:
      listener - the listener, cannot be null.
    • clear

      public void clear(org.eclipse.core.resources.IProject project)
      Description copied from interface: ICollectingCacheManager
      Clear cache of the project if exist. This method allows to clear any cache data including closed and disabled to track changes projects. Call first ICollectingCacheManager.closeAndDisableTrackChanges(IProject) method before this method to prevent from reopening new cache after clear if needed.
      Specified by:
      clear in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
    • enableTrackChanges

      public void enableTrackChanges(org.eclipse.core.resources.IProject project)
      Description copied from interface: ICollectingCacheManager
      Enable track file changes for the project. Cache will not be initialized immediately, but lazy opens with first call of any method.
      Specified by:
      enableTrackChanges in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
    • closeAndDisableTrackChanges

      public void closeAndDisableTrackChanges(org.eclipse.core.resources.IProject project)
      Description copied from interface: ICollectingCacheManager
      Close cache resources by the project and disable track changes of files of the project. This method stop cache forever until call ICollectingCacheManager.enableTrackChanges(IProject) or restart application. All file changes in workspace will be lost if disabled.
      Specified by:
      closeAndDisableTrackChanges in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
    • invalidate

      public boolean invalidate(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path)
      Description copied from interface: ICollectingCacheManager
      Invalidate 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:
      invalidate in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
      path - the project-relative file path, cannot be null.
      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: ICollectingCacheManager
      Checks if the file path of the project is already invalidated (marked as changed and the cache may exist but not valid).
      Specified by:
      isInvalidated in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
      path - the project-relative file path, cannot be null.
      Returns:
      true, if the file path is already invalidated
    • invalidateAll

      public boolean invalidateAll(org.eclipse.core.resources.IProject project)
      Description copied from interface: ICollectingCacheManager
      Invalidate all existing cache for files for the project.
      Specified by:
      invalidateAll in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
      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: ICollectingCacheManager
      All invalidated file paths of the project that may have cache data.
      Specified by:
      allInvalidated in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
      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: ICollectingCacheManager
      All project file paths that may have cache. Note! That this iterator does not return all project files or may return removed files.
      Specified by:
      allResources in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
      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: ICollectingCacheManager
      Gets the interface cache data.
      Specified by:
      getInterface in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      Returns:
      the interface cache, may return null if 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: ICollectingCacheManager
      Put interface cache data.
      Specified by:
      putInterface in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      values - the keys, can be null this 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: ICollectingCacheManager
      Gets the model cache data.
      Specified by:
      getModel in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      Returns:
      the model cache, may return null if 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: ICollectingCacheManager
      Put model cache data.
      Specified by:
      putModel in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      values - the keys, can be null this 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: ICollectingCacheManager
      Gets the model computed cache data.
      Specified by:
      getModelComputed in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      Returns:
      the model computed cache, may return null if 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: ICollectingCacheManager
      Put model computed cache data.
      Specified by:
      putModelComputed in interface ICollectingCacheManager
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      values - the keys, can be null this mean to invalidate resource and remove this cache data.