Package de.xima.fc.plugin.runtime
Class PluginRuntime
java.lang.Object
de.xima.fc.plugin.runtime.PluginRuntime
- All Implemented Interfaces:
Serializable
Model-class for a registered plugin
- Author:
- XIMA MEDIA GmbH
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPluginRuntime
(Class<? extends IFCPlugin> clazz, String scopeKey, String runtimeKey) Creates a new plugin runtime for a single plugin that ismanaged by the system
.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.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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an additional plugin to the list of plugins managed by this runtime.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).void
delete()
Deprecated.Finds the class loader for accessing classes and resoures of the plugin.Deprecated.UsegetClassLoader()
.Deprecated.usegetScopeKey()
long
Deprecated.getName()
Finds the technical (non-localized) name of this plugin.<T extends IFCPlugin>
TgetPluginByName
(String name, Class<T> pluginType) Gets the plugin with the given name, if it exists.getPluginsOfType
(Class<T> clazz) de.xima.cmn.props.FileBasedPropertiesConfiguration
Getter für die Plugin-PropertiesgetPropertiesConfiguration
(Locale locale) Returns a map with definitions of bundle configuration parameters.org.reflections.Reflections
Finds the runtime key of this plugin.Finds the scope key of this plugin.boolean
Deprecated.UsegetJarFile() != null
to check.boolean
isHasPluginsOfType
(Class<? extends IFCPlugin> pluginType) Checks if this runtime has any plugins of the given type.boolean
Checks whether this plugin is managed by the system.boolean
boolean
boolean
Checks whether the plugin JAR file was unpacked and the classpath points to the unpacked files, or whether classpath points directly to theJAR file
.void
saveProperties
(Properties props) Methode zum Speichern der Properties eines Mandanten-Pluginsvoid
setPropertyConfiguration
(List<IBundleProperties> propertyConfiguration) Sets the user-defined properties of the plugin.void
setTemporary
(boolean isTemporary) void
shutdown()
Deprecated.
-
Constructor Details
-
PluginRuntime
Creates a new plugin runtime for a single plugin that ismanaged by the system
.- Parameters:
clazz
- Runtime class of the plugin.scopeKey
- Thescope
of the plugin.runtimeKey
- Theruntime 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
- Thetechnical name
of the plugin.scopeKey
- Thescope
of the plugin.runtimeKey
- Theruntime 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
- Thetechnical name
of the plugin.scopeKey
- Thescope
of the plugin.runtimeKey
- Theruntime key
of the plugin.isTemporary
- TheisTemporary
of the plugin.
-
-
Method Details
-
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
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'sscope
, two different scopes may have plugins with the same runtime key. If you want to look up 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
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 returnnull
forsystem managed
plugins.- Returns:
- The class loader for accessing plugin classes and resources.
-
getClassLoaders
Deprecated.UsegetClassLoader()
.- 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()
, andgetReflections()
, will returnnull
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 theJAR file
.- Returns:
true
if theclass 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 returnsfalse
if this is atemporary
runtime without aclass loader
.
-
isSystemScope
public boolean isSystemScope()- Returns:
true
if this plugin'sscope
is the global system scope.
-
getJarFile
- Returns:
- The JAR file of this plugin which contains all classes and resources. This will return
null
forsystem managed
plugins.
-
getReflections
public org.reflections.Reflections getReflections()- Returns:
- The reflection helper for accessing plugin resources and classes of the
getJarFile()
. This will returnnull
forsystem managed
plugins.
-
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
Adds an additional plugin to the list of plugins managed by this runtime.- Parameters:
plugin
- Plugin to add.
-
getAllPlugins
- Returns:
- All registered plugins known to this runtime. This does not include the
getUnregisteredPlugins()
.
-
getPluginByName
Gets the plugin with the given name, if it exists.- Type Parameters:
T
- Type of the plugin.- Parameters:
name
- Name of the plugin.pluginType
- Expected type of the plugin.- Returns:
- The plugin with the given name,
null
if no such plugin exists or it is of the wrong type.
-
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
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
-
isHasPluginsOfType
Checks if this runtime has any plugins of the given type.- Parameters:
pluginType
- Plugin type to check.- Returns:
- Whether any plugins of the given type exist.
-
getProperties
public de.xima.cmn.props.FileBasedPropertiesConfiguration getProperties()Getter für die Plugin-Properties- Returns:
Properties
die Plugin-Properties
-
saveProperties
Methode zum Speichern der Properties eines Mandanten-Plugins- Parameters:
props
-Properties
- Throws:
IOException
- on errors while saving
-
getManifest
- Returns:
- The data of the
MANIFEST.MF
contained in the plugingetJarFile()
. This will returnnull
forsystem managed
plugins.
-
getPropertiesConfiguration
Returns a map with definitions of bundle configuration parameters. Key is the parameter name, value is aIBundleConfigParam
that specifies which parameters are available.- Parameters:
locale
- The locale for the current language.- Returns:
- A
Map
with objects of type IBundleConfigParam.
-
setPropertyConfiguration
Sets the user-defined properties of the plugin. This will overwrite any previous properties.- Parameters:
propertyConfiguration
- The new properties of the plugin.
-
hasPersitedData
Deprecated.UsegetJarFile() != null
to check.- Returns:
- Whether this runtime is associated with a JAR file.
-
getInstantiationTime
- Returns:
- The point in time when this plugin runtime was created.
-
getInstanciationTime
Deprecated.- Returns:
- Milliseconds since January 1, 1970, 00:00:00 GMT when this plugin runtime was created.
-
shutdown
Deprecated.- Throws:
IOException
- on errors while shutdown
-
getFutureScopeKey
Deprecated.usegetScopeKey()
- Returns:
- The scope key of this plugin, either the system scope or a client scope.
-
delete
Deprecated.- Throws:
IOException
- on errors while deletion
-
isTemporary
public boolean isTemporary() -
setTemporary
public void setTemporary(boolean isTemporary)
-
PluginManager.deletePlugin(PluginRuntime)