org.ops4j.peaberry.cache
Class RegistryChain

java.lang.Object
  extended by org.ops4j.peaberry.cache.RegistryChain
All Implemented Interfaces:
ServiceRegistry, ServiceWatcher<Object>

public class RegistryChain
extends Object
implements ServiceRegistry

A ServiceRegistry that delegates to a series of other registries.

Author:
mcculls@gmail.com (Stuart McCulloch)

Constructor Summary
RegistryChain(ServiceRegistry mainRegistry, ServiceRegistry[] extraRegistries)
           
 
Method Summary
<T> Export<T>
add(Import<T> service)
          Add the given service to this watcher.
 boolean equals(Object rhs)
           
 int hashCode()
           
<T> Iterable<Import<T>>
lookup(Class<T> clazz, AttributeFilter filter)
          Lookup services from the registry, constrained by the given filter.
 String toString()
           
<T> void
watch(Class<T> clazz, AttributeFilter filter, ServiceWatcher<? super T> watcher)
          Watch for services in the registry, constrained by the given filter.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RegistryChain

@Inject
public RegistryChain(ServiceRegistry mainRegistry,
                            ServiceRegistry[] extraRegistries)
Method Detail

lookup

public final <T> Iterable<Import<T>> lookup(Class<T> clazz,
                                            AttributeFilter filter)
Description copied from interface: ServiceRegistry
Lookup services from the registry, constrained by the given filter.

Specified by:
lookup in interface ServiceRegistry
Parameters:
clazz - expected service interface
filter - service attribute filter
Returns:
ordered sequence of imported services, most recommended first

watch

public final <T> void watch(Class<T> clazz,
                            AttributeFilter filter,
                            ServiceWatcher<? super T> watcher)
Description copied from interface: ServiceRegistry
Watch for services in the registry, constrained by the given filter.

Specified by:
watch in interface ServiceRegistry
Parameters:
clazz - expected service interface
filter - service attribute filter
watcher - the watcher that should receive any matching services

add

public final <T> Export<T> add(Import<T> service)
Description copied from interface: ServiceWatcher
Add the given service to this watcher.

Specified by:
add in interface ServiceWatcher<Object>
Parameters:
service - imported service handle
Returns:
exported service handle, null if the watcher is not interested

toString

public final String toString()
Overrides:
toString in class Object

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

equals

public final boolean equals(Object rhs)
Overrides:
equals in class Object


Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.