public class RuntimeSelectionPluginFactory extends Object implements org.azyva.dragom.model.plugin.NodePluginFactory
NodePluginFactory which allows selecting a specific NodePlugin
implementation at runtime based on a runtime property.
It is not for all NodePlugin's that it makes sense to dynamically select which
implementation to use at runtime. For instance, only one ScmPlugin is generally
expected to be defined for a given Node.
However for some NodePlugin's this makes sense. For example different
SelectStaticVersionPlugin's can implement different algorithms for
selecting the new static Version (release Version, temporary development
Version, etc.) which need to be selected at runtime.
Here is how this NodePlugin works:
The Model must be such that for a NodePlugin class and plugin ID this
class is used as the implementation class. The process of instantiating the
NodePlugin therefore (see SimpleNode.getNodePlugin(java.lang.Class<NodePluginInterface>, java.lang.String)) obtains the
NodePluginFactory using the getInstance() method since it is defined.
Then, getPlugin(java.lang.Class<NodePluginInterface>, org.azyva.dragom.model.Node) is called with the NodePlugin class specified in the
Model. This method uses the runtime property
SPECIFIC_PLUGIN_ID.<NodePlugin class> as the plugin ID and delegates to
Node.getNodePlugin(java.lang.Class<NodePluginInterface>, java.lang.String) with the same NodePlugin class and the plugin ID
obtained from the runtime property.
If no such runtime property exists and the runtime property IND_ALLOW_USER_SPECIFIED_PLUGIN_ID.<NodePlugin class> is not true, null is used as the plugin ID. If it is true, an interaction with the user is performed using the CAN_REUSE_PLUGIN_ID.<NodePlugin class> and REUSE_PLUGIN_ID.<NodePlugin class> runtime properties to ask the user for the plugin ID and handle the reuse of a previously specified plugin ID.
| Constructor and Description |
|---|
RuntimeSelectionPluginFactory() |
| Modifier and Type | Method and Description |
|---|---|
Class<? extends org.azyva.dragom.model.plugin.NodePlugin> |
getDefaultClassNodePlugin() |
String |
getDefaultPluginId(Class<? extends org.azyva.dragom.model.plugin.NodePlugin> classNodePlugin) |
static org.azyva.dragom.model.plugin.NodePluginFactory |
getInstance() |
<NodePluginInterface extends org.azyva.dragom.model.plugin.NodePlugin> |
getPlugin(Class<NodePluginInterface> classNodePlugin,
org.azyva.dragom.model.Node node) |
<NodePluginInterface extends org.azyva.dragom.model.plugin.NodePlugin> |
isPluginSupported(Class<NodePluginInterface> classNodePlugin) |
public static org.azyva.dragom.model.plugin.NodePluginFactory getInstance()
RuntimeSelectionPluginFactory.public Class<? extends org.azyva.dragom.model.plugin.NodePlugin> getDefaultClassNodePlugin()
getDefaultClassNodePlugin in interface org.azyva.dragom.model.plugin.NodePluginFactorypublic String getDefaultPluginId(Class<? extends org.azyva.dragom.model.plugin.NodePlugin> classNodePlugin)
getDefaultPluginId in interface org.azyva.dragom.model.plugin.NodePluginFactorypublic <NodePluginInterface extends org.azyva.dragom.model.plugin.NodePlugin> boolean isPluginSupported(Class<NodePluginInterface> classNodePlugin)
isPluginSupported in interface org.azyva.dragom.model.plugin.NodePluginFactorypublic <NodePluginInterface extends org.azyva.dragom.model.plugin.NodePlugin> NodePluginInterface getPlugin(Class<NodePluginInterface> classNodePlugin, org.azyva.dragom.model.Node node)
getPlugin in interface org.azyva.dragom.model.plugin.NodePluginFactoryCopyright © 2015–2016 AZYVA INC.. All rights reserved.