biz.hammurapi.rules
Class PojoCollectionManager

java.lang.Object
  extended by biz.hammurapi.config.ComponentBase
      extended by biz.hammurapi.rules.PojoCollectionManager
All Implemented Interfaces:
biz.hammurapi.config.Component, biz.hammurapi.config.Context, biz.hammurapi.metrics.MeasurementCollector, biz.hammurapi.metrics.MeasurementConsumer, CollectionManager, Negatable

public class PojoCollectionManager
extends biz.hammurapi.config.ComponentBase
implements biz.hammurapi.config.Component, CollectionManager

Collection manager which holds collections in memory and can use storage to persist state.

Version:
${Revision}
Author:
Pavel Vlasov

Field Summary
 
Fields inherited from class biz.hammurapi.config.ComponentBase
owner
 
Constructor Summary
PojoCollectionManager()
           
 
Method Summary
 void clear()
          Clears all collections.
 java.util.Collection get(java.lang.String ruleName, java.lang.String listName, java.lang.Object monitor)
          Retrieves collection from the manager.
 boolean isNegatedBy(Negator negator)
          Iterates over all collections and removes negated facts.
 void setCollectionType(java.lang.Class collectionType)
           
 void setCollectionType(java.lang.String collectionType)
           
 void setStorageReference(java.lang.String storageReference)
          Path to object storage.
 void start()
          Starts collection manager.
 void stop()
          Empty method.
 
Methods inherited from class biz.hammurapi.config.ComponentBase
addMeasurement, get, getChild, getMeasurementConsumer, getOwner, getOwner, setMeasurementConsumer, setOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface biz.hammurapi.config.Component
setOwner
 

Constructor Detail

PojoCollectionManager

public PojoCollectionManager()
Method Detail

setStorageReference

public void setStorageReference(java.lang.String storageReference)
Path to object storage.

Parameters:
storageReference -

start

public void start()
           throws biz.hammurapi.config.ConfigurationException
Starts collection manager. Loads collections from storage if storage reference is not null.

Specified by:
start in interface biz.hammurapi.config.Component
Throws:
biz.hammurapi.config.ConfigurationException

stop

public void stop()
          throws biz.hammurapi.config.ConfigurationException
Empty method. Storage of collections is performed by object storage if storage reference is set.

Specified by:
stop in interface biz.hammurapi.config.Component
Throws:
biz.hammurapi.config.ConfigurationException

get

public java.util.Collection get(java.lang.String ruleName,
                                java.lang.String listName,
                                java.lang.Object monitor)
Description copied from interface: CollectionManager
Retrieves collection from the manager. If a collection for this name doesn't exist it should be created.

Specified by:
get in interface CollectionManager
Parameters:
ruleName - Name of the rule this collection belongs to.
listName - Name of the collection withing the rule.
monitor - Collection monitor for synchronization.
Returns:
Collection, never null.
See Also:
biz.hammurapi.rules.CollectionManager#getList(java.lang.String, java.lang.String)

clear

public void clear()
Description copied from interface: CollectionManager
Clears all collections.

Specified by:
clear in interface CollectionManager

isNegatedBy

public boolean isNegatedBy(Negator negator)
Iterates over all collections and removes negated facts. Collection operations are synchronized using monitor object passed in get() method for a given collection or collection itself if monitor is null.

Specified by:
isNegatedBy in interface Negatable
Returns:
true if negator negates this instance.

setCollectionType

public void setCollectionType(java.lang.String collectionType)

setCollectionType

public void setCollectionType(java.lang.Class collectionType)


Copyright © 2005 Hammurapi Group. All Rights Reserved.