Class TemporaryMemoryOllamaEndpoint
java.lang.Object
com.developer.nefarious.zjoule.plugin.login.memory.TemporaryMemoryOllamaEndpoint
- All Implemented Interfaces:
ITemporaryMemoryObject
,IMemoryObject<String>
public class TemporaryMemoryOllamaEndpoint
extends Object
implements IMemoryObject<String>, ITemporaryMemoryObject
A temporary memory storage for the Ollama endpoint used during the login process.
The TemporaryMemoryOllamaEndpoint
stores the Ollama endpoint in Eclipse preferences
temporarily before persisting it permanently. It provides methods to load, save, clear,
and persist data. This class follows a singleton pattern and requires explicit initialization.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Retrieves the singleton instance ofTemporaryMemoryOllamaEndpoint
.static void
initialize
(IEclipseMemory eclipseMemory) Initializes the singleton instance ofTemporaryMemoryOllamaEndpoint
.isEmpty()
Checks if the stored data is empty or invalid.load()
Loads the data from memory.void
persist()
Persists the temporary memory object to permanent storage.static void
Resets the singleton instance.void
Saves the given data to memory.
-
Field Details
-
KEY
The preference key used for temporarily storing the Ollama endpoint.- See Also:
-
-
Method Details
-
getInstance
Retrieves the singleton instance ofTemporaryMemoryOllamaEndpoint
.- Returns:
- the singleton instance.
- Throws:
IllegalStateException
- if the instance has not been initialized.
-
initialize
Initializes the singleton instance ofTemporaryMemoryOllamaEndpoint
.This method must be called before accessing
getInstance()
.- Parameters:
eclipseMemory
- theIEclipseMemory
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
Checks if the stored data is empty or invalid.- Specified by:
isEmpty
in interfaceIMemoryObject<String>
- Returns:
true
if the stored data is empty or invalid;false
otherwise.
-
load
Loads the data from memory.- Specified by:
load
in interfaceIMemoryObject<String>
- Returns:
- the stored object of type
T
, ornull
if no data is found or loading fails.
-
persist
public void persist()Persists the temporary memory object to permanent storage.- Specified by:
persist
in interfaceITemporaryMemoryObject
-
save
Saves the given data to memory.- Specified by:
save
in interfaceIMemoryObject<String>
- Parameters:
ollamaEndpoint
- the object of typeT
to save.
-
clear
public void clear()- Specified by:
clear
in interfaceIMemoryObject<String>
-