public abstract class AbstractRegistryView extends java.lang.Object implements IRegistryView
IRegistryView
implementation that stores the registry, the set of listeners added to the view and
the FQN to entry map of the view itself. The only responsibility of subclasses is to decide whether an entry received
as an addition or removal notification is relevant to the view.Modifier and Type | Field and Description |
---|---|
protected boolean |
allowDuplicateFQNs |
protected IMultiLookup<java.lang.String,IQuerySpecificationRegistryEntry> |
fqnToEntryMap |
protected java.util.Set<IQuerySpecificationRegistryChangeListener> |
listeners |
protected IQuerySpecificationRegistry |
registry |
Constructor and Description |
---|
AbstractRegistryView(IQuerySpecificationRegistry registry,
boolean allowDuplicateFQNs)
Creates a new view instance for the given registry.
|
Modifier and Type | Method and Description |
---|---|
void |
addViewListener(IQuerySpecificationRegistryChangeListener listener)
Adds a listener to the view that will be notified when an entry is added to or removed from the view.
|
void |
entryAdded(IQuerySpecificationRegistryEntry entry)
Called when a new entry is added to the registry.
|
void |
entryRemoved(IQuerySpecificationRegistryEntry entry)
Called when an existing entry is removed from the registry.
|
java.lang.Iterable<IQuerySpecificationRegistryEntry> |
getEntries() |
java.util.Set<IQuerySpecificationRegistryEntry> |
getEntries(java.lang.String fullyQualifiedName) |
java.util.Set<java.lang.String> |
getQuerySpecificationFQNs() |
IQuerySpecificationRegistry |
getRegistry() |
boolean |
hasQuerySpecificationFQN(java.lang.String fullyQualifiedName) |
protected abstract boolean |
isEntryRelevant(IQuerySpecificationRegistryEntry entry)
This method is called both when an addition or removal notification is received from the registry.
|
void |
removeViewListener(IQuerySpecificationRegistryChangeListener listener)
Removes a listener that was previously added to the view.
|
protected final IQuerySpecificationRegistry registry
protected final IMultiLookup<java.lang.String,IQuerySpecificationRegistryEntry> fqnToEntryMap
protected final java.util.Set<IQuerySpecificationRegistryChangeListener> listeners
protected final boolean allowDuplicateFQNs
public AbstractRegistryView(IQuerySpecificationRegistry registry, boolean allowDuplicateFQNs)
registry
- protected abstract boolean isEntryRelevant(IQuerySpecificationRegistryEntry entry)
entry
- that is added or removed in the registrypublic IQuerySpecificationRegistry getRegistry()
getRegistry
in interface IRegistryView
public java.lang.Iterable<IQuerySpecificationRegistryEntry> getEntries()
getEntries
in interface IRegistryView
public java.util.Set<java.lang.String> getQuerySpecificationFQNs()
getQuerySpecificationFQNs
in interface IRegistryView
public boolean hasQuerySpecificationFQN(java.lang.String fullyQualifiedName)
hasQuerySpecificationFQN
in interface IRegistryView
fullyQualifiedName
- that is looked up in the viewpublic java.util.Set<IQuerySpecificationRegistryEntry> getEntries(java.lang.String fullyQualifiedName)
getEntries
in interface IRegistryView
fullyQualifiedName
- of the entries that are requestedpublic void addViewListener(IQuerySpecificationRegistryChangeListener listener)
IRegistryView
addViewListener
in interface IRegistryView
listener
- that is addedpublic void removeViewListener(IQuerySpecificationRegistryChangeListener listener)
IRegistryView
removeViewListener
in interface IRegistryView
listener
- that is removedpublic void entryAdded(IQuerySpecificationRegistryEntry entry)
IQuerySpecificationRegistryChangeListener
entryAdded
in interface IQuerySpecificationRegistryChangeListener
entry
- that is addedpublic void entryRemoved(IQuerySpecificationRegistryEntry entry)
IQuerySpecificationRegistryChangeListener
entryRemoved
in interface IQuerySpecificationRegistryChangeListener
entry
- that is removed