gr.uoa.di.madgik.rr.plugins
Class Plugin
java.lang.Object
gr.uoa.di.madgik.rr.plugins.Plugin
public abstract class Plugin
- extends Object
A Resource Registry plugin is a module which performs value added functionality, independent of the specifics of the implementation
of each provider. A plugin operates on top of the common model without being aware of the origin of the items it processes, much less about
the operations providers perform in order to conform to the model.
Plugins are grouped according to the condition which triggers their execution.
The type of plugins whose condition of triggering depends on the beginning or end of bridging cycle phases corresponds to condition of triggering itself.
Specifically
- plugins of type
Plugin.Type.PRE_RETRIEVE are triggered just before the initiation of the retrieval phase of the bridging cycle
- plugins of type
Plugin.Type.POST_RETRIEVE are triggered just after the completion of the retrieval phase of the bridging cycle
- plugins of type
Plugin.Type.PRE_UPDATE are triggered just before the initiation of the update phase of the bridging cycle
- plugins of type
Plugin.Type.POST_UPDATEare triggered just after the completion of the update phase of the bridging cycle
Plugins whose operations do not or cannot depend on a specific bridging cycle phase can be declared with type Plugin.Type.PERIODIC or Plugin.Type.ONE_OFF.
As the operation of plugins of such types is not supported by the built-in mechanisms of ResourceRegistry, implementations of this type should be careful
not to corrupt the underlying datastores or process inconsistent data. Specifically
- Plugins of type
Plugin.Type.PERIODIC should operate only on RRContext.DatastoreType.LOCAL
- Plugins of type
Plugin.Type.PERIODIC should hold a lock on RRContext.DatastoreType.LOCAL during the entire time of their operation
The same applies for plugins of type Plugin.Type.ONE_OFF, however such plugins are not expected to perform database operations as their primary purpose is
to handle environment setup tasks.
- Author:
- gerasimos.farantatos
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
type
protected Plugin.Type type
period
protected long period
periodUnit
protected TimeUnit periodUnit
processedItems
protected Set<Plugin.ProcessedItemType> processedItems
items
protected Map<Plugin.ProcessedItemType,Set<? extends IRRElement>> items
itemDaos
protected Map<Plugin.ProcessedItemType,Set<? extends IDaoElement>> itemDaos
Plugin
public Plugin()
readConfiguration
public void readConfiguration(String prefix,
Properties properties)
throws ResourceRegistryException
- Throws:
ResourceRegistryException
getType
public Plugin.Type getType()
- Returns the type of the plugin.
Plugins are grouped according to the condition which triggers their execution.
Specifically
- plugins of type
Plugin.Type.PRE_RETRIEVE are triggered just before the initiation of the retrieval phase of the bridging cycle
- plugins of type
Plugin.Type.POST_RETRIEVE are triggered just after the completion of the retrieval phase of the bridging cycle
- plugins of type
Plugin.Type.PRE_UPDATE are triggered just before the initiation of the update phase of the bridging cycle
- plugins of type
Plugin.Type.POST_UPDATEare triggered just after the completion of the update phase of the bridging cycle
- plugins whose operations do not or cannot depend on a specific bridging cycle phase can be declared with type
Plugin.Type.PERIODIC.
- Returns:
- the type of the plugin
getProcessedItems
public Set<Plugin.ProcessedItemType> getProcessedItems()
- Returns the set of items this plugin processes during its operation.
Plugins declare these items so that
ResourceRegistry can provide collections of prefetched items
- Returns:
addProcessedItems
public void addProcessedItems(Plugin.ProcessedItemType type,
Set<? extends IRRElement> items)
addProcessedItemDaos
public void addProcessedItemDaos(Plugin.ProcessedItemType type,
Set<? extends IDaoElement> items)
getPeriod
public long getPeriod()
getPeriodUnit
public TimeUnit getPeriodUnit()
setup
public abstract void setup()
throws ResourceRegistryException
- Throws:
ResourceRegistryException
execute
protected abstract void execute(Set<Class<?>> targets)
throws ResourceRegistryException
- Throws:
ResourceRegistryException
executePlugin
public void executePlugin(Set<Class<?>> targets)
throws ResourceRegistryException
- Throws:
ResourceRegistryException
Copyright © 2012. All Rights Reserved.