Class ModelFactoryRegistry

All Implemented Interfaces:
ConfMgrRegistry, ADEPT2Service, AuthenticatingService, LogService, NameResolution, ServiceThreadHandling, ModelViewerProvider

@ConfigurationDescription(properties={@Property(name="Components.ProcessModelFactory",isRequired=true,description="the process model factory"),,,,,,,,,,}) public final class ModelFactoryRegistry extends InstanceToInstanceRegistry implements ModelViewerProvider
This class extends the InstanceToInstanceRegistry to support all model factories in ADEPT2. These factories are used to encapsulate the users of data models (defined via interfaces) from the underlying implementations.

This class parses the following properties from the registry configuration (when checking instance declarations):

  • Components.<ComponentType>
  • PluginData.Instances
  • <InstanceName>.Implementation
  • Field Details

    • declaredModelViewers

      protected final Map<String,Class<?>> declaredModelViewers
      The model viewer class objects for the plug-in data (ID -> class). Model viewer allow to extend normal model elements ( PluginDataContainer) by additional data and provide type-safe access. This way they build a special view on the model elements and their additional plugin data.
  • Constructor Details

    • ModelFactoryRegistry

      public ModelFactoryRegistry(UrlConfigurationManager confMgr, Configuration configuration, Registry registry) throws ConfigurationException
      Constructs a new model factory registry supporting factory for the creation of model implementations. It calls the constructor of InstanceToInstanceRegistry.
      Parameters:
      confMgr - The initial configuration manager that provides configurations for the loaded component instances.
      configuration - The configuration of the registry.
      registry - The parent registry of this registry.
      Throws:
      ConfigurationException - If the password cannot be parsed from the configuration, a ConfigurationException will be thrown.
  • Method Details

    • authenticateService

      protected void authenticateService()
      The ModelFactoryRegistry does not need an authentication, therefore this implementation is empty.
      Overrides:
      authenticateService in class AbstractAuthenticatedService
    • renewConfiguration

      protected void renewConfiguration(Configuration conf) throws ConfigurationException
      Renews the configuration of this registry by renewing via the superclass and reading the declared model viewer classes for plugin data.
      Overrides:
      renewConfiguration in class InstanceToInstanceRegistry
      Parameters:
      conf - The (new) root configuration for this registry.
      Throws:
      ConfigurationException - If a model viewer class is declared but it is not found by this registry, a ConfigurationException will be thrown.
    • readDeclaredModelViewerClasses

      protected void readDeclaredModelViewerClasses(Configuration conf) throws ConfigurationException
      Reads all declared model viewer classes from the configuration and loads the classes.
      Parameters:
      conf - The (new) root configuration for this registry containing the declared model viewer classes.
      Throws:
      ConfigurationException - If a model viewer class is declared but it is not found by this registry, a ConfigurationException will be thrown.
    • getProcessModelFactory

      public ProcessModelFactory getProcessModelFactory(String usingInstance) throws ServiceNotKnownException
      Gets the instance of the process model factory configured for the designated component instance.
      Parameters:
      usingInstance - The name of the component instance requesting the process model factory. Use the empty string if the instance name is not defined.
      Returns:
      The instance of a process model factory configured for the requesting component instance or the anonymous instance of the process model factory.
      Throws:
      ServiceNotKnownException - If
      • no component interface is registered/configured for the process model factory,
      • the instantiation mode of the process model factory is set to off,
      • the creation of the process model factory instance fails,
      • the used instance of the process model factory is not declared properly,
      • the configuration of the used instance does not provide required configuration values,
      a ServiceNotKnownException will be thrown.
    • getActivityModelFactory

      public ActivityModelFactory getActivityModelFactory(String usingInstance) throws ServiceNotKnownException
      Gets the instance of the activity model factory configured for the designated component instance.
      Parameters:
      usingInstance - The name of the component instance requesting the activity model factory. Use the empty string if the instance name is not defined.
      Returns:
      The instance of an activity model factory configured for the requesting component instance or the anonymous instance of the activity model factory.
      Throws:
      ServiceNotKnownException - If
      • no component interface is registered/configured for the activity model factory,
      • the instantiation mode of the activity model factory is set to off,
      • the creation of the activity model factory instance fails,
      • the used instance of the activity model factory is not declared properly,
      • the configuration of the used instance does not provide required configuration values,
      a ServiceNotKnownException will be thrown.
    • getWorklistModelFactory

      public WorklistModelFactory getWorklistModelFactory(String usingInstance) throws ServiceNotKnownException
      Gets the instance of the worklist model factory configured for the designated component instance.
      Parameters:
      usingInstance - The name of the component instance requesting the worklist model factory. Use the empty string if the instance name is not defined.
      Returns:
      The instance of a worklist model factory configured for the requesting component instance or the anonymous instance of the worklist model factory.
      Throws:
      ServiceNotKnownException - If
      • no component interface is registered/configured for the worklist model factory,
      • the instantiation mode of the worklist model factory is set to off,
      • the creation of the worklist model factory instance fails,
      • the used instance of the worklist model factory is not declared properly,
      • the configuration of the used instance does not provide required configuration values,
      a ServiceNotKnownException will be thrown.
    • getModelFilterFactory

      public FilterFactory getModelFilterFactory(String usingInstance) throws ServiceNotKnownException
      Gets the instance of the filter factory configured for the designated component instance.
      Parameters:
      usingInstance - The name of the component instance requesting the filter factory. Use the empty string if the instance name is not defined.
      Returns:
      The instance of a filter factory configured for the requesting component instance or the anonymous instance of the filter factory.
      Throws:
      ServiceNotKnownException - If
      • no component interface is registered/configured for the filter factory,
      • the instantiation mode of the filter factory is set to off,
      • the creation of the filter factory instance fails,
      • the used instance of the filter factory is not declared properly,
      • the configuration of the used instance does not provide required configuration values,
      a ServiceNotKnownException will be thrown.
    • getExecutionFactory

      public ExecutionFactory getExecutionFactory(String usingInstance) throws ServiceNotKnownException
      Gets the instance of the execution factory configured for the designated component instance.
      Parameters:
      usingInstance - The name of the component instance requesting the execution factory. Use the empty string if the instance name is not defined.
      Returns:
      The instance of an execution factory configured for the requesting component instance or the anonymous instance of the execution factory.
      Throws:
      ServiceNotKnownException - If
      • no component interface is registered/configured for the execution factory,
      • the instantiation mode of the execution factory is set to off,
      • the creation of the execution factory instance fails,
      • the used instance of the execution factory is not declared properly,
      • the configuration of the used instance does not provide required configuration values,
      a ServiceNotKnownException will be thrown.
    • getGraphicalModelFactory

      public GraphicalModelFactory getGraphicalModelFactory(String usingInstance) throws ServiceNotKnownException
      Gets the instance of the graphical model factory configured for the designated component instance.
      Parameters:
      usingInstance - The name of the component instance requesting the graphical model factory. Use the empty string if the instance name is not defined.
      Returns:
      The instance of a graphical model factory configured for the requesting component instance or the anonymous instance of the graphical model factory.
      Throws:
      ServiceNotKnownException - If
      • no component interface is registered/configured for the graphical model factory,
      • the instantiation mode of the graphical model factory is set to off,
      • the creation of the graphical model factory instance fails,
      • the used instance of the graphical model factory is not declared properly,
      • the configuration of the used instance does not provide required configuration values,
      a ServiceNotKnownException will be thrown.
    • getInitTabFactory

      public InitTabFactory getInitTabFactory(String usingInstance) throws ServiceNotKnownException
      Gets the instance of the init tab model factory configured for the designated component instance.
      Parameters:
      usingInstance - The name of the component instance requesting the init tab model factory. Use the empty string if the instance name is not defined.
      Returns:
      The instance of an init tab factory configured for the requesting component instance or the anonymous instance of the init tab model factory.
      Throws:
      ServiceNotKnownException - If
      • no component interface is registered/configured for the init tab model factory,
      • the instantiation mode of the init tab factory is set to off,
      • the creation of the init tab factory instance fails,
      • the used instance of the init tab factory is not declared properly,
      • the configuration of the used instance does not provide required configuration values,
      a ServiceNotKnownException will be thrown.
    • getResourceModelFactory

      public de.aristaflow.adept2.model.resourcemodel.builder.ResourceModelFactory getResourceModelFactory(String usingInstance) throws ServiceNotKnownException
      Gets the instance of the resource model factory configured for the designated component instance.
      Parameters:
      usingInstance - The name of the component instance requesting the resource model factory. Use the empty string if the instance name is not defined.
      Returns:
      The instance of a resource model factory configured for the requesting component instance or the anonymous instance of the resource model factory.
      Throws:
      ServiceNotKnownException - If
      • no component interface is registered/configured for the resource model factory,
      • the instantiation mode of the resource model factory is set to off,
      • the creation of the resource model factory instance fails,
      • the used instance of the resource model factory is not declared properly,
      • the configuration of the used instance does not provide required configuration values,
      a ServiceNotKnownException will be thrown.
    • getLocalisationFactory

      public LocalisationFactory getLocalisationFactory(String usingInstance) throws ServiceNotKnownException
      Gets the instance of the localisation factory configured for the designated component instance.
      Parameters:
      usingInstance - The name of the component instance requesting the localisation factory. Use the empty string if the instance name is not defined.
      Returns:
      The instance of a localisation factory configured for the requesting component instance or the anonymous instance of the localisation factory.
      Throws:
      ServiceNotKnownException - If
      • no component interface is registered/configured for the localisation factory,
      • the instantiation mode of the localisation factory is set to off,
      • the creation of the localisation factory instance fails,
      • the used instance of the localisation factory is not declared properly,
      • the configuration of the used instance does not provide required configuration values,
      a ServiceNotKnownException will be thrown.
    • getFormatterFactory

      public SystemDataFormatterFactory getFormatterFactory(String usingInstance) throws ServiceNotKnownException
      Gets the instance of the system data formatter configured for the designated component instance.
      Parameters:
      usingInstance - The name of the component instance requesting the system data formatter factory. Use the empty string if the instance name is not defined.
      Returns:
      The instance of a system data formatter factory configured for the requesting component instance or the anonymous instance of the system data formatter factory.
      Throws:
      ServiceNotKnownException - If
      • no component interface is registered/configured for the system data formatter factory,
      • the instantiation mode of the system data formatter factory is set to off,
      • the creation of the system data formatter factory instance fails,
      • the used instance of the system data formatter factory is not declared properly,
      • the configuration of the used instance does not provide required configuration values,
      a ServiceNotKnownException will be thrown.
    • getFactory

      protected <T> T getFactory(String usingInstance, String factoryType, Class<T> factoryClass) throws ServiceNotKnownException
      Gets the instance of the designated factory configured for the component instance with the designated instance name.
      Type Parameters:
      T - The type of the model factory which to retrieve.
      Parameters:
      usingInstance - The name of the component instance requesting the model factory. Use the empty string if the instance name is not defined.
      factoryType - The type name of the model factory which to retrieve.
      factoryClass - The class of the model factory which to retrieve.
      Returns:
      The instance of a model factory configured for the requesting component instance or the anonymous instance of the model factory.
      Throws:
      ServiceNotKnownException - If
      • no component interface is registered/configured for the model factory,
      • the instantiation mode of the model factory is set to off,
      • the creation of the model factory instance fails,
      • the used instance of the model factory is not declared properly,
      • the configuration of the used instance does not provide required configuration values,
      a ServiceNotKnownException will be thrown.
    • getModelViewerClass

      public Class<?> getModelViewerClass(String pluginID)
      Gets the model viewer class for the designated plugin ID. If the plugin ID is not known, null will be returned.
      Specified by:
      getModelViewerClass in interface ModelViewerProvider
      Parameters:
      pluginID - The ID of the plugin to retrieve a model viewer class for. This provides type-safe access to the data of the plugin which is stored by a PluginDataContainer.
      Returns:
      The model viewer class for the designated plugin or null in case the plugin ID is not known.
    • getModelFactoryRegistry

      @Deprecated public static ModelFactoryRegistry getModelFactoryRegistry() throws ServiceNotKnownException
      Deprecated.
      Throws:
      ServiceNotKnownException
    • shutdown

      public void shutdown(boolean emergency)
      Description copied from class: PluginRegistry
      Signals the shutdown of this registry. No access except the privileged threads may access this registry afterwards.

      This method has to be called at an arbitrary time in the shutdown-procedure of overriding classes. Closes all corresponding class loaders in case of a non-emergency shutdown.

      Specified by:
      shutdown in interface ADEPT2Service
      Overrides:
      shutdown in class PluginRegistry
      Parameters:
      emergency - Whether the shutdown will be an emergency shutdown.