Class FolderContextManager
java.lang.Object
org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.lifecycle.Lifecycle
org.eclipse.emf.cdo.server.db.evolution.phased.FolderContextManager
- All Implemented Interfaces:
Context.Manager,org.eclipse.net4j.util.event.INotifier,org.eclipse.net4j.util.event.INotifier.INotifier2,org.eclipse.net4j.util.lifecycle.IDeactivateable,org.eclipse.net4j.util.lifecycle.ILifecycle,org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation
public class FolderContextManager
extends org.eclipse.net4j.util.lifecycle.Lifecycle
implements Context.Manager
A context manager that saves and loads the evolution contexts to and from a folder on disk.
The folder is determined by PhasedModelEvolutionSupport.getEvolutionFolder().
Each model is saved as an individual .ecore file. The file name is derived from the model ID by encoding it
to a safe file name using IOUtil.encodeFileName(String). Additionally, an
evolution.properties file is created to map the model file names to their original types and
timestamps.
If the saveNewModels property is set to true, the new
models are also saved to disk during evolution. The new model files have the same name as the original
model files, but with a _new suffix before the .ecore extension.
These extra files can be useful for debugging and verification purposes.
- Since:
- 4.14
- Author:
- Eike Stepper
- No Implement
- This package is currently considered provisional.
- No Extend
- This package is currently considered provisional.
- No Reference
- This package is currently considered provisional.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.event.Notifier.CancelationNested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle
org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivationNested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier
org.eclipse.net4j.util.event.INotifier.INotifier2 -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe factory type of the folder context manager implementation.Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
USE_LABELFields inherited from interface org.eclipse.emf.cdo.server.db.evolution.phased.Context.Manager
PRODUCT_GROUP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new context by loading the models from the database.Returns the model evolution support.booleanReturns whether to save the new models to disk during evolution.Loads the context from disk.protected List<Context.Model> loadModelsFromDatabase(IDBStore store) Loads the models from the database.protected List<Context.Model> loadModelsFromDisk(File folder) Loads the models from disk.voidsaveContext(Context context) Saves the context to disk.protected voidsaveModelsToDisk(File folder, Collection<Context.Model> models) Saves the models to disk.voidsetSaveNewModels(boolean saveNewModels) Sets whether to save the new models to disk during evolution.voidsetSupport(PhasedModelEvolutionSupport support) Sets the model evolution support.Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, doDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toStringMethods inherited from class org.eclipse.net4j.util.event.Notifier
addListener, addUniqueListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.net4j.util.event.INotifier
addListener, getListeners, hasListeners, removeListener
-
Field Details
-
FACTORY_TYPE
The factory type of the folder context manager implementation.- See Also:
-
-
Constructor Details
-
FolderContextManager
public FolderContextManager()Creates a new folder context manager.
-
-
Method Details
-
getSupport
Returns the model evolution support.- Specified by:
getSupportin interfaceContext.Manager
-
setSupport
Sets the model evolution support.- Specified by:
setSupportin interfaceContext.Manager- No Reference
- This method is not intended to be called by clients.
-
isSaveNewModels
public boolean isSaveNewModels()Returns whether to save the new models to disk during evolution. -
setSaveNewModels
public void setSaveNewModels(boolean saveNewModels) Sets whether to save the new models to disk during evolution. -
createContext
Creates a new context by loading the models from the database.- Specified by:
createContextin interfaceContext.Manager- Throws:
Exception
-
loadContext
Loads the context from disk.- Specified by:
loadContextin interfaceContext.Manager- Throws:
Exception
-
saveContext
Saves the context to disk.- Specified by:
saveContextin interfaceContext.Manager- Throws:
Exception
-
loadModelsFromDatabase
Loads the models from the database.- Throws:
SQLException
-
loadModelsFromDisk
Loads the models from disk.- Throws:
IOException
-
saveModelsToDisk
Saves the models to disk.- Throws:
IOException
-