Class TemporaryMemoryResourceGroup

java.lang.Object
com.developer.nefarious.zjoule.plugin.login.memory.TemporaryMemoryResourceGroup
All Implemented Interfaces:
ITemporaryMemoryObject, IMemoryObject<String>

public class TemporaryMemoryResourceGroup extends Object implements IMemoryObject<String>, ITemporaryMemoryObject
Manages temporary storage and retrieval of resource group information during the login process.

The TemporaryMemoryResourceGroup class provides methods to save, load, and persist temporary resource group data using Eclipse preferences. It implements IMemoryObject<String> and ITemporaryMemoryObject.

  • Field Details

    • KEY

      public static final String KEY
      Key used for storing and retrieving the temporary resource group in Eclipse preferences.
      See Also:
  • Method Details

    • getInstance

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

      public static void initialize(IEclipseMemory eclipseMemory)
      Initializes the TemporaryMemoryResourceGroup singleton with the specified dependencies.
      Parameters:
      eclipseMemory - the manager for Eclipse preferences storage.
    • resetInstance

      public static void resetInstance()
      Resets the singleton instance. Useful for testing or reinitialization.
    • 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.
    • persist

      public void persist()
      Persists the temporary memory object to permanent storage.
      Specified by:
      persist in interface ITemporaryMemoryObject
    • save

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