@Plugin(name="Persistence Service Plugin", id="persistence-service", description="Service that facilitates persisting data between the graphical console sessions.") public class PersistenceService extends ConsolePlugin implements ConsoleService
| Constructor and Description |
|---|
PersistenceService() |
| Modifier and Type | Method and Description |
|---|---|
void |
delete(Persistable.Descriptor descriptor)
Deletes the specified descriptor from storage.
|
Persistable |
edit(Persistable in,
String title,
Component parent)
Takes user input and modifies the provided
Persistable instance. |
List<Creator> |
getFactories(String category)
Utility method that returns all registered instance creators in the specified category.
|
Creator |
getFactory(String category,
String path)
Utility method that returns an instance creator identified by category and path.
|
ArrayList<Persistable.Descriptor> |
getSavedDescriptors(String category)
Returns a list of saved descriptors in the specified category.
|
Persistable.Descriptor |
load(String category,
String title,
Component parent)
Lets the user select one of the saved descriptors in the specified category.
|
Persistable |
make(Persistable.Descriptor descriptor)
Creates a
Persistable instance based on the provided descriptor. |
Persistable |
make(Persistable.Descriptor descriptor,
String title,
Component parent,
String category)
Creates a
Persistable instance by letting the user to select one of
the available creators in the given category, and using the provided
descriptor (if any) as the starting point. |
void |
save(Persistable.Descriptor descriptor)
Saves the specified descriptor to disk, making it available in future console sessions.
|
void |
saveAs(Persistable.Descriptor descriptor,
String title,
Component parent)
Saves the descriptor to disk, letting the user specify path, name, and description.
|
void |
startService()
Called by the framework to start the service.
|
getConsole, getServices, initialize, propertiesChanged, restore, save, setServicesProvider, shutdown, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitstopServicepublic void startService()
startService in interface ConsoleServicepublic Persistable make(Persistable.Descriptor descriptor)
Persistable instance based on the provided descriptor.
No user interaction. An instance of Persistable is constructed by
the Creator identified in the descriptor, then its restore(...)
method is called.descriptor - JavaBean that describes the Persistable type and state.Persistable, or null if it cannot be created.public Persistable make(Persistable.Descriptor descriptor, String title, Component parent, String category)
Persistable instance by letting the user to select one of
the available creators in the given category, and using the provided
descriptor (if any) as the starting point.
Returns null if the user cancels creation.
Throws RuntimeException if editing fails for any other reason.descriptor - Object state to be used as a starting point.title - User-interaction dialog title, or null if the default title should be used.parent - Graphical component to be use as a parent for user-interaction dialog(s).category - Object category.Persistable, or null if the object creation was canceled by the user.public Persistable edit(Persistable in, String title, Component parent)
Persistable instance.
Returns null if the user cancels editing.
Throws RuntimeException if editing fails for any other reason.in - Instance to be edited.title - User-interaction dialog title, or null if the default title should be used.parent - Graphical component to be use as a parent for user-interaction dialog(s).in parameter.public void save(Persistable.Descriptor descriptor)
descriptor - Descriptor to be saved.public void saveAs(Persistable.Descriptor descriptor, String title, Component parent)
descriptor - Descriptor to be saved.title - User interaction dialog title.parent - User interaction dialog parent component, or null if the parent is the console window.public void delete(Persistable.Descriptor descriptor)
descriptor - Descriptor to be removed.public Persistable.Descriptor load(String category, String title, Component parent)
category - Persistable object category.title - User interaction dialog title.parent - User interaction dialog parent component, or null if the parent is the console window.public Creator getFactory(String category, String path)
category - Creator category.path - Creator path.null if no such factory is known to this service.public List<Creator> getFactories(String category)
category - Persistable object category.public ArrayList<Persistable.Descriptor> getSavedDescriptors(String category)
category - Persistable object category.Copyright © 2019 LSST. All rights reserved.