Interface ICollectingCacheManager

All Superinterfaces:
IManagedService
All Known Implementing Classes:
CollectingCacheManager

public interface ICollectingCacheManager extends IManagedService
The manager service of collecting data cache for file resources. This manager allows to manually stop and start track file changes for the project in case some external project life-cycle. This cache is used by default in IFeatureValueCollectingService when collect by resources.
See Also:
  • Method Details

    • addChangeListener

      void addChangeListener(ICollectingCacheChangeListener listener)
      Adds the cache change listener. Has no effect if an identical listener is already registered for change events.
      Parameters:
      listener - the listener, cannot be null.
    • removeChangeListener

      void removeChangeListener(ICollectingCacheChangeListener listener)
      Removes the cache change listener. Has no effect if the listener was already removed from registration.
      Parameters:
      listener - the listener, cannot be null.
    • clear

      void clear(org.eclipse.core.resources.IProject project)
      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 closeAndDisableTrackChanges(IProject) method before this method to prevent from reopening new cache after clear if needed.
      Parameters:
      project - the project, cannot be null.
    • enableTrackChanges

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

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

      default boolean invalidate(org.eclipse.core.resources.IFile file)
      Invalidate cache for the file. 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.
      Parameters:
      file - the file, cannot be null.
      Returns:
      true, if cache existed for the file
    • invalidate

      boolean invalidate(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path)
      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.
      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

      boolean isInvalidated(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).
      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

      boolean invalidateAll(org.eclipse.core.resources.IProject project)
      Invalidate all existing cache for files for the project.
      Parameters:
      project - the project, cannot be null.
      Returns:
      true, if cache exited and was invalidated successfully.
    • allInvalidated

      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.
      Parameters:
      project - the project, cannot be null.
      Returns:
      the iterator of invalidated paths, cannot return null.
    • allResources

      Iterator<org.eclipse.core.runtime.IPath> allResources(org.eclipse.core.resources.IProject project)
      All project file paths that may have cache. Note! That this iterator does not return all project files or may return removed files.
      Parameters:
      project - the project, cannot be null.
      Returns:
      the iterator, cannot return null.
    • getInterface

      default Collection<FeatureValue> getInterface(org.eclipse.core.resources.IFile file)
      Gets the interface cache for the file.
      Parameters:
      file - the file, cannot be null.
      Returns:
      the interface cache, may return null if cache not exist.
    • getInterface

      Collection<FeatureValue> getInterface(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path)
      Gets the interface cache data.
      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

      default void putInterface(org.eclipse.core.resources.IFile file, Collection<FeatureValue> keys)
      Put interface cache data.
      Parameters:
      file - the file, cannot be null.
      keys - the keys, can be null this mean to invalidate resource and remove this cache data.
    • putInterface

      void putInterface(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, Collection<FeatureValue> keys)
      Put interface cache data.
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      keys - the keys, can be null this mean to invalidate resource and remove this cache data.
    • getModel

      default Collection<FeatureValue> getModel(org.eclipse.core.resources.IFile file)
      Gets the model cache data.
      Parameters:
      file - the file, cannot be null.
      Returns:
      the model cache, may return null if cache not exist.
    • getModel

      Collection<FeatureValue> getModel(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path)
      Gets the model cache data.
      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

      default void putModel(org.eclipse.core.resources.IFile file, Collection<FeatureValue> keys)
      Put model cache data.
      Parameters:
      file - the file, cannot be null.
      keys - the keys, can be null this mean to invalidate resource and remove this cache data.
    • putModel

      void putModel(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, Collection<FeatureValue> keys)
      Put model cache data.
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      keys - the keys, can be null this mean to invalidate resource and remove this cache data.
    • getModelComputed

      default Collection<FeatureValue> getModelComputed(org.eclipse.core.resources.IFile file)
      Gets the model computed cache data.
      Parameters:
      file - the file, cannot be null.
      Returns:
      the model computed cache, may return null if cache not exist.
    • getModelComputed

      Collection<FeatureValue> getModelComputed(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path)
      Gets the model computed cache data.
      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

      default void putModelComputed(org.eclipse.core.resources.IFile file, Collection<FeatureValue> keys)
      Put model computed cache data.
      Parameters:
      file - the file, cannot be null.
      keys - the keys, can be null this mean to invalidate resource and remove this cache data.
    • putModelComputed

      void putModelComputed(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, Collection<FeatureValue> keys)
      Put model computed cache data.
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      keys - the keys, can be null this mean to invalidate resource and remove this cache data.
    • computeIfAbsent

      default Collection<FeatureValue> computeIfAbsent(org.eclipse.core.resources.IFile file, Function<org.eclipse.core.resources.IFile,Collection<FeatureValue>> mappingFunction)
      Compute full cache if it absent for the file.
      Parameters:
      file - the file, cannot be null.
      mappingFunction - the mapping function, cannot be null. This function should provide full collecting data for the file. Function should not return null value and should return empty collection instead, however null returned value doesn't take any effect.
      Returns:
      the collection of cached data or cache computed if not exist, never returns null.
    • computeIfAbsent

      default Collection<FeatureValue> computeIfAbsent(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, BiFunction<org.eclipse.core.resources.IProject,org.eclipse.core.runtime.IPath,Collection<FeatureValue>> mappingFunction)
      Compute full cache if it absent for the file.
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      mappingFunction - the mapping function, cannot be null. This function should provide full collecting data for the file. Function should not return null value and should return empty collection instead, however null returned value doesn't take any effect.
      Returns:
      the collection of cached data or cache computed if not exist, never returns null.
    • computeIfAbsentInterface

      default Collection<FeatureValue> computeIfAbsentInterface(org.eclipse.core.resources.IFile file, Function<org.eclipse.core.resources.IFile,Collection<FeatureValue>> mappingFunction)
      Compute interface cache if it absent for the file.
      Parameters:
      file - the file, cannot be null.
      mappingFunction - the mapping function, cannot be null. This function should provide only interface collecting data for the file. Function should not return null value and should return empty collection instead, however null returned value doesn't take any effect.
      Returns:
      the collection of cached data or cache computed if not exist, never returns null.
    • computeIfAbsentInterface

      default Collection<FeatureValue> computeIfAbsentInterface(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, BiFunction<org.eclipse.core.resources.IProject,org.eclipse.core.runtime.IPath,Collection<FeatureValue>> mappingFunction)
      Compute interface cache if it absent for the file.
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      mappingFunction - the mapping function, cannot be null. This function should provide only interface collecting data for the file. Function should not return null value and should return empty collection instead, however null returned value doesn't take any effect.
      Returns:
      the collection of cached data or cache computed if not exist, never returns null.
    • computeIfAbsentModel

      default Collection<FeatureValue> computeIfAbsentModel(org.eclipse.core.resources.IFile file, Function<org.eclipse.core.resources.IFile,Collection<FeatureValue>> mappingFunction)
      Compute model cache if it absent for the file.
      Parameters:
      file - the file, cannot be null.
      mappingFunction - the mapping function, cannot be null. This function should provide only model collecting data for the file. Function should not return null value and should return empty collection instead, however null returned value doesn't take any effect.
      Returns:
      the collection of cached data or cache computed if not exist, never returns null.
    • computeIfAbsentModel

      default Collection<FeatureValue> computeIfAbsentModel(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, BiFunction<org.eclipse.core.resources.IProject,org.eclipse.core.runtime.IPath,Collection<FeatureValue>> mappingFunction)
      Compute model cache if it absent for the file.
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      mappingFunction - the mapping function, cannot be null. This function should provide only model collecting data for the file. Function should not return null value and should return empty collection instead, however null returned value doesn't take any effect.
      Returns:
      the collection of cached data or cache computed if not exist, never returns null.
    • computeIfAbsentModelComputed

      default Collection<FeatureValue> computeIfAbsentModelComputed(org.eclipse.core.resources.IFile file, Function<org.eclipse.core.resources.IFile,Collection<FeatureValue>> mappingFunction)
      Compute model computed cache if it absent for the file.
      Parameters:
      file - the file, cannot be null.
      mappingFunction - the mapping function, cannot be null. This function should provide model computed collecting data for the file. Function should not return null value and should return empty collection instead, however null returned value doesn't take any effect.
      Returns:
      the collection of cached data or cache computed if not exist, never returns null.
    • computeIfAbsentModelComputed

      default Collection<FeatureValue> computeIfAbsentModelComputed(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IPath path, BiFunction<org.eclipse.core.resources.IProject,org.eclipse.core.runtime.IPath,Collection<FeatureValue>> mappingFunction)
      Compute model computed cache if it absent for the file.
      Parameters:
      project - the project, cannot be null.
      path - the path, cannot be null.
      mappingFunction - the mapping function, cannot be null. This function should provide model computed collecting data for the file. Function should not return null value and should return empty collection instead, however null returned value doesn't take any effect.
      Returns:
      the collection of cached data or cache computed if not exist, never returns null.