Package net.ssehub.easy.dslCore
Class TopLevelModelAccessor
java.lang.Object
net.ssehub.easy.dslCore.TopLevelModelAccessor
Defines the generic access to the top-level model. This class is needed as some
models and their editors shall be optional.
- Author:
- Holger Eichelberger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTopLevelModelAccessor.AbstractDefaultModelAccessor<M extends net.ssehub.easy.basics.modelManagement.IModel>Implements the register methods empty.static classTopLevelModelAccessor.AbstractModelAccessor<M extends net.ssehub.easy.basics.modelManagement.IModel>Basic implementation ofTopLevelModelAccessor.IModelAccessorperforming model loader registration and location registration.static interfaceTopLevelModelAccessor.IModelAccessor<M extends net.ssehub.easy.basics.modelManagement.IModel>Defines the interface for the model accessor. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Map<String, TopLevelModelAccessor.IModelAccessor<?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLocation(File location, net.ssehub.easy.basics.progress.ProgressObserver observer, boolean failOnFirst) Called to add a model location (optional).static TopLevelModelAccessor.IModelAccessor<?> getAccessor(String extension) Returns the registered accessor forextension.static intReturns the number of registered accessors.static net.ssehub.easy.basics.modelManagement.ModelInfo<?> getTopLevelModel(String extension, String projectName, Object project) Returns the top-level model info through a registered accessor forextension.static voidregister(String extension, TopLevelModelAccessor.IModelAccessor<?> accessor) Registers an accessor via the model file extension / id.static Iterable<TopLevelModelAccessor.IModelAccessor<?>> Returns the registered accessors.static voidregisterLoader(net.ssehub.easy.basics.progress.ProgressObserver observer, boolean failOnFirst) Called to register the model loader (optional).voidremoveLocation(File location, net.ssehub.easy.basics.progress.ProgressObserver observer, boolean failOnFirst) Called to remove a model location (optional).static voidunregister(String extension) Removes a registered accessor.voidunregisterLoader(net.ssehub.easy.basics.progress.ProgressObserver observer, boolean failOnFirst) Called to unregister the model loader (optional).
-
Field Details
-
ACCESSORS
-
-
Constructor Details
-
TopLevelModelAccessor
private TopLevelModelAccessor()Prevents external instantiation.
-
-
Method Details
-
register
Registers an accessor via the model file extension / id.- Parameters:
extension- the model extensionaccessor- the model accessor
-
unregister
Removes a registered accessor.- Parameters:
extension- the model extension / id
-
registered
Returns the registered accessors.- Returns:
- the registered accessors
-
getRegisteredCount
public static int getRegisteredCount()Returns the number of registered accessors.- Returns:
- the number of registered accessors
-
getAccessor
Returns the registered accessor forextension.- Parameters:
extension- the model extension / id- Returns:
- the registered accessor (may be null if none was registered)
-
getTopLevelModel
public static net.ssehub.easy.basics.modelManagement.ModelInfo<?> getTopLevelModel(String extension, String projectName, Object project) Returns the top-level model info through a registered accessor forextension.- Parameters:
extension- the model extension / idprojectName- the name of the containing project (EASy convention)project- an optional instance to access the top level model from some EASy instance- Returns:
- the registered accessor (may be null if none was registered)
-
registerLoader
public static void registerLoader(net.ssehub.easy.basics.progress.ProgressObserver observer, boolean failOnFirst) throws net.ssehub.easy.basics.modelManagement.ModelManagementException Called to register the model loader (optional). Bulk operation on all registered accessors.s- Parameters:
observer- the progress observerfailOnFirst- iftrue, bulk stops on first exception thrown and that exception is also thrown by this method, iffalsetry all bulk operations and throw only the first exception occurred- Throws:
net.ssehub.easy.basics.modelManagement.ModelManagementException- in case of failures
-
unregisterLoader
public void unregisterLoader(net.ssehub.easy.basics.progress.ProgressObserver observer, boolean failOnFirst) throws net.ssehub.easy.basics.modelManagement.ModelManagementException Called to unregister the model loader (optional). Bulk operation on all registered accessors.- Parameters:
observer- the progress observerfailOnFirst- iftrue, bulk stops on first exception thrown and that exception is also thrown by this method, iffalsetry all bulk operations and throw only the first exception occurred- Throws:
net.ssehub.easy.basics.modelManagement.ModelManagementException- in case of failures
-
addLocation
public void addLocation(File location, net.ssehub.easy.basics.progress.ProgressObserver observer, boolean failOnFirst) throws net.ssehub.easy.basics.modelManagement.ModelManagementException Called to add a model location (optional). Bulk operation on all registered accessors.- Parameters:
location- the locationobserver- the progress observerfailOnFirst- iftrue, bulk stops on first exception thrown and that exception is also thrown by this method, iffalsetry all bulk operations and throw only the first exception occurred- Throws:
net.ssehub.easy.basics.modelManagement.ModelManagementException- in case of failures
-
removeLocation
public void removeLocation(File location, net.ssehub.easy.basics.progress.ProgressObserver observer, boolean failOnFirst) throws net.ssehub.easy.basics.modelManagement.ModelManagementException Called to remove a model location (optional). Bulk operation on all registered accessors.- Parameters:
location- the locationobserver- the progress observerfailOnFirst- iftrue, bulk stops on first exception thrown and that exception is also thrown by this method, iffalsetry all bulk operations and throw only the first exception occurred- Throws:
net.ssehub.easy.basics.modelManagement.ModelManagementException- in case of failures
-