@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.
|
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 as follows:
Describe annotation or by being an enclosing class, and the target class has
a constructor that takes the descriptor as the only argument, that constructor is used;
Creator factory
identified by it can be found, that factory is used;
Persistable instance is created, 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, or an instance cannot be created for any 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 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.CancellationException - If the user cancels the dialog.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.