gr.uoa.di.madgik.rr.plugins
Class Plugin

java.lang.Object
  extended by 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

  1. plugins of type Plugin.Type.PRE_RETRIEVE are triggered just before the initiation of the retrieval phase of the bridging cycle
  2. plugins of type Plugin.Type.POST_RETRIEVE are triggered just after the completion of the retrieval phase of the bridging cycle
  3. plugins of type Plugin.Type.PRE_UPDATE are triggered just before the initiation of the update phase of the bridging cycle
  4. 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
  1. Plugins of type Plugin.Type.PERIODIC should operate only on RRContext.DatastoreType.LOCAL
  2. 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

Nested Class Summary
static class Plugin.ProcessedItemType
           
static class Plugin.Type
           
 
Field Summary
protected  Map<Plugin.ProcessedItemType,Set<? extends IDaoElement>> itemDaos
           
protected  Map<Plugin.ProcessedItemType,Set<? extends IRRElement>> items
           
protected  long period
           
protected  TimeUnit periodUnit
           
protected  Set<Plugin.ProcessedItemType> processedItems
           
protected  Plugin.Type type
           
 
Constructor Summary
Plugin()
           
 
Method Summary
 void addProcessedItemDaos(Plugin.ProcessedItemType type, Set<? extends IDaoElement> items)
           
 void addProcessedItems(Plugin.ProcessedItemType type, Set<? extends IRRElement> items)
           
protected abstract  void execute(Set<Class<?>> targets)
           
 void executePlugin(Set<Class<?>> targets)
           
 long getPeriod()
           
 TimeUnit getPeriodUnit()
           
 Set<Plugin.ProcessedItemType> getProcessedItems()
          Returns the set of items this plugin processes during its operation.
 Plugin.Type getType()
          Returns the type of the plugin.
 void readConfiguration(String prefix, Properties properties)
           
abstract  void setup()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

Plugin

public Plugin()
Method Detail

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
  1. plugins of type Plugin.Type.PRE_RETRIEVE are triggered just before the initiation of the retrieval phase of the bridging cycle
  2. plugins of type Plugin.Type.POST_RETRIEVE are triggered just after the completion of the retrieval phase of the bridging cycle
  3. plugins of type Plugin.Type.PRE_UPDATE are triggered just before the initiation of the update phase of the bridging cycle
  4. plugins of type Plugin.Type.POST_UPDATEare triggered just after the completion of the update phase of the bridging cycle
  5. 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 © 2013. All Rights Reserved.