Class TopLevelModelAccessor

java.lang.Object
net.ssehub.easy.dslCore.TopLevelModelAccessor

public class TopLevelModelAccessor extends Object
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
  • Field Details

  • Constructor Details

    • TopLevelModelAccessor

      private TopLevelModelAccessor()
      Prevents external instantiation.
  • Method Details

    • register

      public static void register(String extension, TopLevelModelAccessor.IModelAccessor<?> accessor)
      Registers an accessor via the model file extension / id.
      Parameters:
      extension - the model extension
      accessor - the model accessor
    • unregister

      public static void unregister(String extension)
      Removes a registered accessor.
      Parameters:
      extension - the model extension / id
    • registered

      public static Iterable<TopLevelModelAccessor.IModelAccessor<?>> 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

      public static TopLevelModelAccessor.IModelAccessor<?> getAccessor(String extension)
      Returns the registered accessor for extension.
      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 for extension.
      Parameters:
      extension - the model extension / id
      projectName - 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 observer
      failOnFirst - if true, bulk stops on first exception thrown and that exception is also thrown by this method, if false try 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 observer
      failOnFirst - if true, bulk stops on first exception thrown and that exception is also thrown by this method, if false try 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 location
      observer - the progress observer
      failOnFirst - if true, bulk stops on first exception thrown and that exception is also thrown by this method, if false try 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 location
      observer - the progress observer
      failOnFirst - if true, bulk stops on first exception thrown and that exception is also thrown by this method, if false try all bulk operations and throw only the first exception occurred
      Throws:
      net.ssehub.easy.basics.modelManagement.ModelManagementException - in case of failures