Class PluginRuntime

    • Constructor Detail

      • PluginRuntime

        public PluginRuntime​(Class<? extends IFCPlugin> clazz,
                             String scopeKey,
                             String runtimeKey)
        Creates a new plugin runtime for a single plugin that is managed by the system.
        Parameters:
        clazz - Runtime class of the plugin.
        scopeKey - The scope of the plugin.
        runtimeKey - The runtime key of the plugin.
      • PluginRuntime

        public PluginRuntime​(org.reflections.Reflections reflect,
                             String runtimeName,
                             String scopeKey,
                             String runtimeKey)
        Creates a new plugin runtime for a plugin from a JAR file with plugin classes.
        Parameters:
        reflect - Reflection helper to access classes and resources from the JAR file.
        runtimeName - The technical name of the plugin.
        scopeKey - The scope of the plugin.
        runtimeKey - The runtime key of the plugin.
      • PluginRuntime

        public PluginRuntime​(org.reflections.Reflections reflect,
                             String runtimeName,
                             String scopeKey,
                             String runtimeKey,
                             boolean isTemporary)
        Creates a new plugin runtime for a plugin from a JAR file with plugin classes.
        Parameters:
        reflect - Reflection helper to access classes and resources from the JAR file.
        runtimeName - The technical name of the plugin.
        scopeKey - The scope of the plugin.
        runtimeKey - The runtime key of the plugin.
        isTemporary - The isTemporary of the plugin.
    • Method Detail

      • getScopeKey

        public String getScopeKey()
        Finds the scope key of this plugin. Each plugin has a scope to which it applies. Attempting to access a plugin from outside the scope will result in the plugin not being found. Available scopes are:
        • System scope, or the global scope. Plugins in this scope are always available.
        • Client scope. Plugins in this scope are available only within a particular client.
        Returns:
        The scope key of this plugin, i.e. either the system scope key or a client scope key.
      • getRuntimeKey

        public String getRuntimeKey()
        Finds the runtime key of this plugin. Each plugin has a runtime key that identifies it. Note that this key is only required to be unique within the plugin's scope, two different scopes may have plugins with the same runtime key. If you want to loopup a plugin, always include the scope.
        Returns:
        The runtime key of the plugin, i.e. the key that uniquely identifies this plugin within its scope.
      • getClassLoader

        public ClassLoader getClassLoader()
        Finds the class loader for accessing classes and resoures of the plugin. It inherits from the default class loader for loading application classes. This will return null for system managed plugins.
        Returns:
        The class loader for accessing plugin classes and resources.
      • getClassLoaders

        @Deprecated
        public ClassLoader[] getClassLoaders()
        Deprecated.
        Returns:
        The class loaders for accessing plugin classes. It inherits from the default class loader for loading application classes.
      • isSystemManaged

        public boolean isSystemManaged()
        Checks whether this plugin is managed by the system. A system managed plugin is provided by the application itself and lives within the class path of the application. getClassLoader(), getJarFile(), getManifest() , and getReflections(), will return null for such a plugin.
        Returns:
        true if this plugin is managed by the system.
      • isUnpacked

        public boolean isUnpacked()
        Checks whether the plugin JAR file was unpacked and the classpath points to the unpacked files, or whether classpath points directly to the JAR file.
        Returns:
        true if the class loader uses a classpath constructed with the files from an unpacked JAR file; false if it uses a classpath constructed directly from the plugin JAR file. Also returns false if this is a temporary runtime without a class loader.
      • isSystemScope

        public boolean isSystemScope()
        Returns:
        true if this plugin's scope is the global system scope.
      • getJarFile

        public File getJarFile()
        Returns:
        The JAR file of this plugin which contains all classes and resources. This will return null for system managed plugins.
      • getReflections

        public org.reflections.Reflections getReflections()
        Returns:
        The reflection helper for accessing plugin resources and classes of the getJarFile(). This will return null for system managed plugins.
      • getName

        public String getName()
        Finds the technical (non-localized) name of this plugin. Both the name and the combination of (scope, runtimeKey} uniquely identify a plugin. The difference is that the scope and runtime key is generated by the system and may be different each time the plugin is loaded or the application is restarted, while the name is provided by the plugin stays the same.
        Returns:
        The technical (non-localized) name of this plugin.
      • addPlugin

        public void addPlugin​(IFCPlugin plugin)
        Adds an additional plugin to the list of plugins managed by this runtime.
        Parameters:
        plugin - Plugin to add.
      • getUnregisteredPlugins

        public Set<Class<? extends IFCPlugin>> getUnregisteredPlugins()
        Returns:
        All unregistered plugins, i.e. plugins that are available in the class path of the plugin, but cannot be registered (such as when the license does not allow it or the plugin is not available on the master or frontend server).
      • addUnregisteredPlugin

        public void addUnregisteredPlugin​(Class<? extends IFCPlugin> pluginClazz)
        Adds a plugin to the list of unregistered plugins, i.e. plugins that are available in the class path of the plugin, but cannot be registered (such as when the license does not allow it or the plugin is not available on the master or frontend server).
        Parameters:
        pluginClazz - A plugin to add.
      • getPluginsOfType

        public <T extends IFCPluginSet<T> getPluginsOfType​(Class<T> clazz)
        Parameters:
        clazz - the plugin class
        Returns:
        A Set of IFCPlugin of the given class.
      • getProperties

        public de.xima.cmn.props.FileBasedPropertiesConfiguration getProperties()
        Getter für die Plugin-Properties
        Returns:
        Properties die Plugin-Properties
      • saveProperties

        public void saveProperties​(Properties props)
                            throws IOException
        Methode zum Speichern der Properties eines Mandanten-Plugins
        Parameters:
        props - Properties
        Throws:
        IOException - on errors while saving
      • getPropertiesConfiguration

        public Map<String,​IBundleConfigParam> getPropertiesConfiguration​(Locale locale)
        Returns a map with definitions of bundle configuration parameters. Key is the parameter name, value is a IBundleConfigParam that specifies which parameters are available.
        Parameters:
        locale - The locale for the current language.
        Returns:
        A Map with objects of type IBundleConfigParam.
      • setPropertyConfiguration

        public void setPropertyConfiguration​(List<IBundleProperties> propertyConfiguration)
        Sets the user-defined properties of the plugin. This will overwrite any previous properties.
        Parameters:
        propertyConfiguration - The new properties of the plugin.
      • hasPersitedData

        @Deprecated
        public boolean hasPersitedData()
        Deprecated.
        Use getJarFile() != null to check.
        Returns:
        Whether this runtime is associated with a JAR file.
      • getInstantiationTime

        public Instant getInstantiationTime()
        Returns:
        The point in time when this plugin runtime was created.
      • getFutureScopeKey

        @Deprecated
        public String getFutureScopeKey()
        Deprecated.
        Returns:
        The scope key of this plugin, either the system scope or a client scope.
      • isTemporary

        public boolean isTemporary()
      • setTemporary

        public void setTemporary​(boolean isTemporary)