org.softamis.net.registry
Interface ConsumingRegistry<K extends java.io.Serializable,V extends java.io.Serializable>

Type Parameters:
K - type of keys used to identify registry items
V - type of values stored in the registry
All Known Implementing Classes:
AbstractConsumingRegistry, DefaultConsumingRegistry, DefaultConsumingRegistry

public interface ConsumingRegistry<K extends java.io.Serializable,V extends java.io.Serializable>

Generic interface for ConsumingRegistry. ConsumingRegistry is used to obtain information about items stored in distributed registry. Since there can be several ProvidingRegistries that publish different items under the same key, the ConsumingRegistry allows to obtain the set of items published by them under the particular key.

In addition to obtaining information on current state of distributed registry, the ConsumingRegistry may also indicate that some items in the registry are invalid (therefore, if there are several ConsumingRegistries, they may handle such a notification).

Author:
Andrew Sazonov
See Also:
ProvidingRegistry

Method Summary
 void addRegistryEventProcessor(RegistryEventProcessor<K,V> aListener)
          Adds listener to list of registered RegistryEventProcessors which performs the further processing of obtained external notifications
 void close()
          Closes this registry instance and performs all necessary cleanup.
 java.util.Set<V> getItems(K aItemKey)
          Returns the set of items stored in the distributed registry under given key.
 java.util.Set<K> getKeys(boolean aForceRefresh)
          Returns list of available keys currently stored in registry (ones which are actually stored in particular instance of consuming registry or all published ones)
 boolean isClosed()
          Indicated whether registry it in closed state
 boolean isDirty(K aItemKey)
          Indicates whether there were any changes in distributed registry occurred due to synchronization since the last call of the getItems() for given key.
 void markItemInvalid(K aItemKey, V aItem)
          Provides ability to mark specific item stored in the distributed registry as invalid one.
 void removeRegistryEventProcessor(RegistryEventProcessor<K,V> aListener)
          Removes listener from list of registered RegistryEventProcessors which performs further processing of obtained external notifications
 void requestItems(K aItemKey)
          Initiates requesting of items for given key by sending appropriate notifications to ProvidingRegistries
 

Method Detail

isDirty

boolean isDirty(K aItemKey)
Indicates whether there were any changes in distributed registry occurred due to synchronization since the last call of the getItems() for given key.

Parameters:
aItemKey - key for items
Returns:
true if the set of data items stored under the given key was changed since the last call of getItems(K)
See Also:
getItems(K)

getItems

java.util.Set<V> getItems(K aItemKey)
Returns the set of items stored in the distributed registry under given key.

Parameters:
aItemKey - key of items
Returns:
set of items stored under given key

getKeys

java.util.Set<K> getKeys(boolean aForceRefresh)
Returns list of available keys currently stored in registry (ones which are actually stored in particular instance of consuming registry or all published ones)

Parameters:
aForceRefresh - indicates whether request for available items should be issued to distributed registry before returning set of key
Returns:
a set of available keys

markItemInvalid

void markItemInvalid(K aItemKey,
                     V aItem)
Provides ability to mark specific item stored in the distributed registry as invalid one. It there are several ConsumingRegistries in the same distributed registry, they can be notified of and be handled properly. It's assumed that this call will not affect ProvidingRegistries somehow.

Parameters:
aItemKey - key of the item
aItem - the item which should be marked invalid

requestItems

void requestItems(K aItemKey)
Initiates requesting of items for given key by sending appropriate notifications to ProvidingRegistries

Parameters:
aItemKey - if null, will request items for all available keys

removeRegistryEventProcessor

void removeRegistryEventProcessor(RegistryEventProcessor<K,V> aListener)
Removes listener from list of registered RegistryEventProcessors which performs further processing of obtained external notifications

Parameters:
aListener - processor to be removed

addRegistryEventProcessor

void addRegistryEventProcessor(RegistryEventProcessor<K,V> aListener)
Adds listener to list of registered RegistryEventProcessors which performs the further processing of obtained external notifications

Parameters:
aListener - processor to be added

close

void close()
Closes this registry instance and performs all necessary cleanup. As soon as registry is closed, no actions may be performed within it, so calling this methods actually ends registry instance lifecycle.


isClosed

boolean isClosed()
Indicated whether registry it in closed state

Returns:
true if registry instance is closed, false otherwise
See Also:
close()