Class MemoryOllamaEndpoint

java.lang.Object
com.developer.nefarious.zjoule.plugin.memory.MemoryOllamaEndpoint
All Implemented Interfaces:
IMemoryObject<String>

public class MemoryOllamaEndpoint extends Object implements IMemoryObject<String>
A singleton class for managing the persistence of the Ollama endpoint in Eclipse preferences.

The MemoryOllamaEndpoint class stores, retrieves, and clears the Ollama endpoint using the Eclipse preferences system. It follows a singleton pattern and must be initialized before use.

  • Field Details

    • KEY

      public static final String KEY
      The key used for storing the Ollama endpoint in Eclipse preferences.
      See Also:
  • Method Details

    • getInstance

      public static MemoryOllamaEndpoint getInstance()
      Retrieves the singleton instance of MemoryOllamaEndpoint.
      Returns:
      the singleton instance.
      Throws:
      IllegalStateException - if the instance has not been initialized.
    • initialize

      public static void initialize(IEclipseMemory eclipseMemory)
      Initializes the singleton instance of MemoryOllamaEndpoint.

      This method must be called before accessing getInstance().

      Parameters:
      eclipseMemory - the IEclipseMemory instance to be used for preference storage.
    • resetInstance

      public static void resetInstance()
      Resets the singleton instance.

      This method clears the instance reference, allowing re-initialization.

    • isEmpty

      public Boolean isEmpty()
      Checks if the stored data is empty or invalid.
      Specified by:
      isEmpty in interface IMemoryObject<String>
      Returns:
      true if the stored data is empty or invalid; false otherwise.
    • load

      public String load()
      Loads the data from memory.
      Specified by:
      load in interface IMemoryObject<String>
      Returns:
      the stored object of type T, or null if no data is found or loading fails.
    • save

      public void save(String ollamaEndpoint)
      Saves the given data to memory.
      Specified by:
      save in interface IMemoryObject<String>
      Parameters:
      ollamaEndpoint - the object of type T to save.
    • clear

      public void clear()
      Specified by:
      clear in interface IMemoryObject<String>