KEY - ENTRY - MAP - R - public class MockRegistrySandbox<KEY,ENTRY extends Identifiable<KEY>,MAP extends Map<KEY,ENTRY>,R extends Registry<KEY,ENTRY>> extends Object implements RegistrySandbox<KEY,ENTRY,MAP,R>
Shutdownable.ShutdownDeamonTYPE_FIELD_NAME| Constructor and Description |
|---|
MockRegistrySandbox(Registry<KEY,ENTRY> registry) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDependencyObserver(org.openbase.jul.pattern.Observer<Map<KEY,ENTRY>> observer) |
void |
addObserver(org.openbase.jul.pattern.Observer<Map<KEY,ENTRY>> observer) |
void |
checkWriteAccess() |
void |
clear() |
boolean |
contains(ENTRY entry) |
boolean |
contains(KEY key) |
ENTRY |
get(KEY key) |
List<ENTRY> |
getEntries()
Copies all entries into a list.
|
Map<KEY,ENTRY> |
getEntryMap()
An unmodifiable map of the current entry map.
|
String |
getName()
Method returns the name of this registry.
|
Map<KEY,ENTRY> |
getValue() |
Future<Map<KEY,ENTRY>> |
getValueFuture() |
boolean |
isConsistent() |
boolean |
isEmpty()
Return true if this registry does not contain any entries.
|
boolean |
isReadOnly() |
boolean |
isReady()
This method checks if the registry is not handling any tasks or notification and is currently consistent.
|
boolean |
isSandbox() |
boolean |
isValueAvailable() |
ENTRY |
load(ENTRY entry) |
boolean |
recursiveTryLockRegistry(Set<Registry> lockedRegistries)
Try to acquire the write lock for this registry and the registries it depends
on recursively.
|
ENTRY |
register(ENTRY entry)
Method registers the given entry.
|
void |
registerConsistencyHandler(ConsistencyHandler<KEY,ENTRY,MAP,R> consistencyHandler) |
ENTRY |
remove(ENTRY entry) |
ENTRY |
remove(KEY entry) |
void |
removeConsistencyHandler(ConsistencyHandler<KEY,ENTRY,MAP,R> consistencyHandler) |
void |
removeDependencyObserver(org.openbase.jul.pattern.Observer<Map<KEY,ENTRY>> observer) |
void |
removeObserver(org.openbase.jul.pattern.Observer<Map<KEY,ENTRY>> observer) |
void |
replaceInternalMap(Map<KEY,ENTRY> map) |
void |
shutdown() |
int |
size()
Method returns the amount of registry entries.
|
void |
sync(MAP map) |
String |
toString() |
boolean |
tryLockRegistry()
Try to acquire the write lock for this registry.
|
void |
unlockRegistry()
Unlock the write lock of the registry.
|
ENTRY |
update(ENTRY entry) |
void |
waitForValue(long timeout,
TimeUnit timeUnit) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisWritableregisterShutdownHook, registerShutdownHookpublic ENTRY register(ENTRY entry) throws CouldNotPerformException
Registryregister in interface Registry<KEY,ENTRY extends Identifiable<KEY>>entry - the new entry to register which is not yet included in the registryCouldNotPerformException - is thrown if the given entry is not valid, already registered or something else went wrong during the registration.public ENTRY update(ENTRY entry) throws CouldNotPerformException
update in interface Registry<KEY,ENTRY extends Identifiable<KEY>>CouldNotPerformExceptionpublic void sync(MAP map)
public void registerConsistencyHandler(ConsistencyHandler<KEY,ENTRY,MAP,R> consistencyHandler) throws CouldNotPerformException
registerConsistencyHandler in interface RegistrySandbox<KEY,ENTRY extends Identifiable<KEY>,MAP extends Map<KEY,ENTRY>,R extends Registry<KEY,ENTRY>>CouldNotPerformExceptionpublic void removeConsistencyHandler(ConsistencyHandler<KEY,ENTRY,MAP,R> consistencyHandler) throws CouldNotPerformException
removeConsistencyHandler in interface RegistrySandbox<KEY,ENTRY extends Identifiable<KEY>,MAP extends Map<KEY,ENTRY>,R extends Registry<KEY,ENTRY>>CouldNotPerformExceptionpublic ENTRY remove(ENTRY entry) throws CouldNotPerformException
remove in interface Registry<KEY,ENTRY extends Identifiable<KEY>>CouldNotPerformExceptionpublic ENTRY remove(KEY entry) throws CouldNotPerformException
remove in interface Registry<KEY,ENTRY extends Identifiable<KEY>>CouldNotPerformExceptionpublic ENTRY get(KEY key) throws CouldNotPerformException
get in interface Registry<KEY,ENTRY extends Identifiable<KEY>>CouldNotPerformExceptionpublic List<ENTRY> getEntries()
RegistrygetEntries in interface Registry<KEY,ENTRY extends Identifiable<KEY>>public boolean contains(ENTRY entry) throws CouldNotPerformException
contains in interface Registry<KEY,ENTRY extends Identifiable<KEY>>CouldNotPerformExceptionpublic boolean contains(KEY key) throws CouldNotPerformException
contains in interface Registry<KEY,ENTRY extends Identifiable<KEY>>CouldNotPerformExceptionpublic void clear()
throws CouldNotPerformException
clear in interface Registry<KEY,ENTRY extends Identifiable<KEY>>CouldNotPerformExceptionpublic void checkWriteAccess()
throws RejectedException
checkWriteAccess in interface WritableRejectedExceptionpublic boolean isReadOnly()
isReadOnly in interface Registry<KEY,ENTRY extends Identifiable<KEY>>public void replaceInternalMap(Map<KEY,ENTRY> map)
replaceInternalMap in interface RegistrySandbox<KEY,ENTRY extends Identifiable<KEY>,MAP extends Map<KEY,ENTRY>,R extends Registry<KEY,ENTRY>>public int size()
Registrypublic String getName()
RegistrygetName in interface NameProvidergetName in interface Registry<KEY,ENTRY extends Identifiable<KEY>>public ENTRY load(ENTRY entry) throws CouldNotPerformException
load in interface RegistrySandbox<KEY,ENTRY extends Identifiable<KEY>,MAP extends Map<KEY,ENTRY>,R extends Registry<KEY,ENTRY>>CouldNotPerformExceptionpublic boolean isConsistent()
isConsistent in interface Registry<KEY,ENTRY extends Identifiable<KEY>>public void addObserver(org.openbase.jul.pattern.Observer<Map<KEY,ENTRY>> observer)
addObserver in interface org.openbase.jul.pattern.Observable<Map<KEY,ENTRY extends Identifiable<KEY>>>public void removeObserver(org.openbase.jul.pattern.Observer<Map<KEY,ENTRY>> observer)
removeObserver in interface org.openbase.jul.pattern.Observable<Map<KEY,ENTRY extends Identifiable<KEY>>>public Map<KEY,ENTRY> getValue() throws NotAvailableException
getValue in interface org.openbase.jul.pattern.Observable<Map<KEY,ENTRY extends Identifiable<KEY>>>NotAvailableExceptionpublic boolean isValueAvailable()
isValueAvailable in interface org.openbase.jul.pattern.Observable<Map<KEY,ENTRY extends Identifiable<KEY>>>public void shutdown()
shutdown in interface Shutdownablepublic boolean isSandbox()
public boolean isEmpty()
Registrypublic boolean isReady()
Registrypublic void waitForValue(long timeout,
TimeUnit timeUnit)
throws NotAvailableException,
InterruptedException
waitForValue in interface org.openbase.jul.pattern.Observable<Map<KEY,ENTRY extends Identifiable<KEY>>>NotAvailableExceptionInterruptedExceptionpublic boolean tryLockRegistry()
throws RejectedException
RegistrytryLockRegistry in interface Registry<KEY,ENTRY extends Identifiable<KEY>>RejectedException - If the registry does not support to be locked externally which is for example the case for remote registries.public void unlockRegistry()
RegistryunlockRegistry in interface Registry<KEY,ENTRY extends Identifiable<KEY>>public Future<Map<KEY,ENTRY>> getValueFuture()
getValueFuture in interface org.openbase.jul.pattern.Observable<Map<KEY,ENTRY extends Identifiable<KEY>>>public Map<KEY,ENTRY> getEntryMap()
RegistrygetEntryMap in interface Registry<KEY,ENTRY extends Identifiable<KEY>>public void addDependencyObserver(org.openbase.jul.pattern.Observer<Map<KEY,ENTRY>> observer)
addDependencyObserver in interface Registry<KEY,ENTRY extends Identifiable<KEY>>public void removeDependencyObserver(org.openbase.jul.pattern.Observer<Map<KEY,ENTRY>> observer)
removeDependencyObserver in interface Registry<KEY,ENTRY extends Identifiable<KEY>>public boolean recursiveTryLockRegistry(Set<Registry> lockedRegistries) throws RejectedException
RegistryrecursiveTryLockRegistry in interface Registry<KEY,ENTRY extends Identifiable<KEY>>lockedRegistries - Set of already locked registries. Should be given empty to this method and will contain all locked registries afterwards.RejectedException - If the registry does not support to be locked externally which is for example the case for remote registries.Copyright © 2015–2018 openbase.org. All rights reserved.