Class ProjectConverterStorage

java.lang.Object
com.e1c.langtool.internal.converter.db.ProjectConverterStorage

public class ProjectConverterStorage extends Object
Represents a storage mechanism for managing converted data associated with language projects.

The ProjectConverterStorage class provides methods for managing converted values, target keys, and resource indexes associated with a specific IProject.

Usage example:


 // Create an instance of ProjectConverterStorage for a specific IProject
 IProject project = ...; // Specify the language project
 ProjectConverterStorage converterStorage = new ProjectConverterStorage(project);

 // Check if the storage is empty
 boolean isEmpty = converterStorage.isEmpty();

 // Check if converted values exist for a specific IPath
 IPath path = ...; // Specify the resource path
 boolean valuesExist = converterStorage.valuesExists(path);

 // Get converted values for a specific IPath
 ConvertedValues values = converterStorage.getValues(path);

 // Put converted values for a specific IPath
 ConvertedValues newValues = ...; // Specify the new converted values
 converterStorage.putValues(path, newValues);

 // Remove converted values for a specific IPath
 converterStorage.removeValues(path);

 // Get the target key for a specific IPath
 String targetKey = converterStorage.getTargetKey(path);

 // Put the target key for a specific IPath
 String newTargetKey = ...; // Specify the new target key
 converterStorage.putTargetKey(path, newTargetKey);

 // Remove the target key for a specific IPath
 converterStorage.removeTargetKey(path);

Note: The ProjectConverterStorage assumes that all provided IPaths, converted values, and target keys are non-null.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ProjectConverterStorage(org.eclipse.core.resources.IProject project)
    Creates a new instance of ProjectConverterStorage for the specified IProject.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the store.
    collectValues(org.eclipse.core.runtime.IPath path, ConvertedValues values)
    Collects the converted values for a specific resource path.
    boolean
    Deletes the storage and associated files for the language project.
    getTargetKey(org.eclipse.core.runtime.IPath path)
    Gets the target key for a specific resource path.
    getValues(org.eclipse.core.runtime.IPath path)
    Gets the converted values for a specific resource path.
    boolean
    Checks whether the storage is empty.
    void
    Opens the storage.
    putTargetKey(org.eclipse.core.runtime.IPath path, String targetKey)
    Puts the target key for a specific resource path.
    putValues(org.eclipse.core.runtime.IPath path)
    Puts the converted values for a specific resource path.
    removeTargetKey(org.eclipse.core.runtime.IPath path)
    Removes the target key for a specific resource path.
    removeValues(org.eclipse.core.runtime.IPath path)
    Removes the converted values for a specific resource path.
    boolean
    valuesExists(org.eclipse.core.runtime.IPath path)
    Checks if converted values exist for a specific resource path.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProjectConverterStorage

      public ProjectConverterStorage(org.eclipse.core.resources.IProject project)
      Creates a new instance of ProjectConverterStorage for the specified IProject.
      Parameters:
      project - the language project to associate with the storage, cannot be null.
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Checks whether the storage is empty.
      Returns:
      true if the storage is empty, false otherwise.
    • valuesExists

      public boolean valuesExists(org.eclipse.core.runtime.IPath path)
      Checks if converted values exist for a specific resource path.
      Parameters:
      path - the resource path to check, cannot be null.
      Returns:
      true if converted values exist, false otherwise.
    • getValues

      public ConvertedValues getValues(org.eclipse.core.runtime.IPath path)
      Gets the converted values for a specific resource path.
      Parameters:
      path - the resource path to retrieve converted values for, cannot be null.
      Returns:
      the converted values for the specified path, or an empty set if none exist.
    • putValues

      public ConvertedValues putValues(org.eclipse.core.runtime.IPath path)
      Puts the converted values for a specific resource path.
      Parameters:
      path - the resource path to store converted values for, cannot be null.
      Returns:
      the previous converted values for the specified path, or an empty set if none existed.
    • collectValues

      public ConvertedValues collectValues(org.eclipse.core.runtime.IPath path, ConvertedValues values)
      Collects the converted values for a specific resource path.
      Parameters:
      path - the resource path to store converted values for, cannot be null.
      values - the converted values to store, cannot be null.
      Returns:
      the previous converted values for the specified path, or an empty set if none existed.
    • removeValues

      public ConvertedValues removeValues(org.eclipse.core.runtime.IPath path)
      Removes the converted values for a specific resource path.
      Parameters:
      path - the resource path to remove converted values for, cannot be null.
      Returns:
      the removed converted values for the specified path, or an empty set if none existed.
    • getTargetKey

      public String getTargetKey(org.eclipse.core.runtime.IPath path)
      Gets the target key for a specific resource path.
      Parameters:
      path - the resource path to retrieve the target key for, cannot be null.
      Returns:
      the target key for the specified path, or an empty string if none exists.
    • putTargetKey

      public String putTargetKey(org.eclipse.core.runtime.IPath path, String targetKey)
      Puts the target key for a specific resource path.
      Parameters:
      path - the resource path to store the target key for, cannot be null.
      targetKey - the target key to store, cannot be null.
      Returns:
      the previous target key for the specified path, or an empty string if none existed.
    • removeTargetKey

      public String removeTargetKey(org.eclipse.core.runtime.IPath path)
      Removes the target key for a specific resource path.
      Parameters:
      path - the resource path to remove the target key for, cannot be null.
      Returns:
      the removed target key for the specified path, or an empty string if none existed.
    • open

      public void open()
      Opens the storage.
    • close

      public void close()
      Closes the store.
    • delete

      public boolean delete()
      Deletes the storage and associated files for the language project.

      The delete method removes the storage, resource index, and associated MapDB files for the language project, ensuring a clean state. It returns true to indicate a successful deletion.

      Note: The delete method assumes that the storage and associated files exist.

      Returns:
      true if the deletion is successful, false otherwise.