Package de.xima.fc.plugin.runtime
Class PluginRuntime
- java.lang.Object
-
- de.xima.fc.plugin.runtime.PluginRuntime
-
- All Implemented Interfaces:
Serializable
public class PluginRuntime extends Object implements Serializable
Model-class for a registered plugin- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PluginRuntime(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.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addPlugin(IFCPlugin plugin)
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.Set<IFCPlugin>
getAllPlugins()
ClassLoader
getClassLoader()
Finds the class loader for accessing classes and resoures of the plugin.ClassLoader[]
getClassLoaders()
Deprecated.UsegetClassLoader()
.String
getFutureScopeKey()
Deprecated.usegetScopeKey()
long
getInstanciationTime()
Deprecated.Instant
getInstantiationTime()
File
getJarFile()
PluginManifest
getManifest()
String
getName()
Finds the technical (non-localized) name of this plugin.<T extends IFCPlugin>
Set<T>getPluginsOfType(Class<T> clazz)
org.apache.commons.configuration.PropertiesConfiguration
getProperties()
Getter für die Plugin-PropertiesMap<String,IBundleConfigParam>
getPropertiesConfiguration(Locale locale)
Returns a map with definitions of bundle configuration parameters.org.reflections.Reflections
getReflections()
String
getRuntimeKey()
Finds the runtime key of this plugin.String
getScopeKey()
Finds the scope key of this plugin.Set<Class<? extends IFCPlugin>>
getUnregisteredPlugins()
boolean
hasPersitedData()
Deprecated.UsegetJarFile() != null
to check.boolean
isSystemManaged()
Checks whether this plugin is managed by the system.boolean
isSystemScope()
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
shutdown()
Deprecated.
-
-
-
Constructor Detail
-
PluginRuntime
public PluginRuntime(Class<? extends IFCPlugin> clazz, String scopeKey, String runtimeKey)
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.
-
-
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'sscope
, 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 returnnull
forsystem managed
plugins.- Returns:
- The class loader for accessing plugin classes and resources.
-
getClassLoaders
@Deprecated public ClassLoader[] 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.
-
isSystemScope
public boolean isSystemScope()
- Returns:
true
if this plugin'sscope
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
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
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.
-
getAllPlugins
public Set<IFCPlugin> getAllPlugins()
- Returns:
- All registered plugins known to this runtime. This does not include the
getUnregisteredPlugins()
.
-
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.
-
getProperties
public org.apache.commons.configuration.PropertiesConfiguration 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
-
getManifest
public PluginManifest getManifest()
- Returns:
- The data of the
MANIFEST.MF
contained in the plugingetJarFile()
. This will returnnull
forsystem managed
plugins.
-
getPropertiesConfiguration
public Map<String,IBundleConfigParam> getPropertiesConfiguration(Locale locale)
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
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.UsegetJarFile() != 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.
-
getInstanciationTime
@Deprecated public long getInstanciationTime()
Deprecated.- Returns:
- Milliseconds since January 1, 1970, 00:00:00 GMT when this plugin runtime was created.
-
shutdown
@Deprecated public void shutdown() throws IOException
Deprecated.- Throws:
IOException
- on errors while shutdown
-
getFutureScopeKey
@Deprecated public String getFutureScopeKey()
Deprecated.usegetScopeKey()
- Returns:
- The scope key of this plugin, either the system scope or a client scope.
-
delete
@Deprecated public void delete() throws IOException
Deprecated.- Throws:
IOException
- on errors while deletion
-
-