/** * Method blocks until the registry is not handling any tasks and is currently consistent. * * Note: If you have just modified the registry this method can maybe return immediately if the task is not yet received by the registry controller. So you should prefer the futures of the modification methods for synchronization tasks. * * @throws InterruptedException is thrown in case the thread was externally interrupted. * @throws org.openbase.jul.exception.CouldNotPerformException is thrown if the wait could not be performed. */ public static void waitUntilReady() throws InterruptedException, CouldNotPerformException { getRegistry().waitUntilReady(); }
/** * Returns an initialized and activated remote registry. * * @param waitForData defines if this call should block until the registry data is available. * @return the remote registry instance. * @throws NotAvailableException * @throws InterruptedException is thrown if thread is externally interrupted. */ public static UserRegistryRemote getUserRegistry(final boolean waitForData) throws CouldNotPerformException, InterruptedException { if (waitForData) { CachedUserRegistryRemote.getRegistry().waitForData(); } return CachedUserRegistryRemote.getRegistry(); }
@Override public Boolean isConsistent() throws CouldNotPerformException { return isAuthorizationGroupConfigRegistryConsistent() && isUserConfigRegistryConsistent(); } }
public synchronized static void reinitialize() throws InterruptedException, CouldNotPerformException { try { getRegistry().reinit(REMOTE_LOCK); getRegistry().requestData().get(10, TimeUnit.SECONDS); } catch (ExecutionException | TimeoutException | CouldNotPerformException | CancellationException ex) { throw new CouldNotPerformException("Could not reinitialize " + CachedUserRegistryRemote.class.getSimpleName() + "!", ex); } }
@Override public List<UnitConfig> getAuthorizationGroupConfigs() throws CouldNotPerformException { validateData(); return authorizationGroupConfigRemoteRegistry.getMessages(); }
/** * {@inheritDoc} * * @return {@inheritDoc} * @throws CouldNotPerformException {@inheritDoc} */ @Override public Boolean isUserConfigRegistryConsistent() throws CouldNotPerformException { try { validateData(); return getData().getUserUnitConfigRegistryConsistent(); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not check consistency!", ex); } }
/** * Returns an initialized and activated remote registry. * * @return the remote registry instance. * @throws NotAvailableException * @throws InterruptedException is thrown if thread is externally interrupted. */ public static UserRegistryRemote getUserRegistry() throws NotAvailableException, InterruptedException { return CachedUserRegistryRemote.getRegistry(); }
@Override protected void registerRemoteRegistries() throws CouldNotPerformException { registerRemoteRegistry(authorizationGroupConfigRemoteRegistry); registerRemoteRegistry(userConfigRemoteRegistry); }
@Override protected void bindRegistryRemoteToRemoteRegistries() { try { bindRegistryRemoteToRemoteRegistry(userConfigRemoteRegistry, unitRegistry, UnitRegistryData.USER_UNIT_CONFIG_FIELD_NUMBER); bindRegistryRemoteToRemoteRegistry(authorizationGroupConfigRemoteRegistry, unitRegistry, UnitRegistryData.AUTHORIZATION_GROUP_UNIT_CONFIG_FIELD_NUMBER); } catch (CouldNotPerformException ex) { new FatalImplementationErrorException("Could not bind registries", this, ex); } }
@Override protected void registerRegistryRemotes() throws InitializationException, InterruptedException { try { unitRegistry = CachedUnitRegistryRemote.getRegistry(); registerRegistryRemote(unitRegistry); } catch (NotAvailableException ex) { throw new InitializationException(this, ex); } }
public static void waitForData() throws InterruptedException, CouldNotPerformException { getRegistry().waitForData(); }
@Override public Boolean containsUserConfig(final UnitConfig userConfig) throws CouldNotPerformException { validateData(); return userConfigRemoteRegistry.contains(userConfig); }
/** * {@inheritDoc} * * @return {@inheritDoc} * @throws CouldNotPerformException {@inheritDoc} */ @Override public Boolean isAuthorizationGroupConfigRegistryConsistent() throws CouldNotPerformException { try { validateData(); return getData().getAuthorizationGroupUnitConfigRegistryConsistent(); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not check consistency!", ex); } }
public static void waitForData(long timeout, TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException { getRegistry().waitForData(timeout, timeUnit); }
@Override public UnitConfig getAuthorizationGroupConfigById(String groupConfigId) throws CouldNotPerformException { validateData(); return authorizationGroupConfigRemoteRegistry.getMessage(groupConfigId); }
@Override public Boolean containsUserConfigById(final String userConfigId) throws CouldNotPerformException { validateData(); return userConfigRemoteRegistry.contains(userConfigId); }
@Override public List<UnitConfig> getUserConfigs() throws CouldNotPerformException, NotAvailableException { validateData(); List<UnitConfig> messages = userConfigRemoteRegistry.getMessages(); return messages; }
@Override public UnitConfig getUserConfigById(String userConfigId) throws CouldNotPerformException, NotAvailableException { validateData(); return userConfigRemoteRegistry.getMessage(userConfigId); }
@Override public Boolean containsAuthorizationGroupConfig(UnitConfig groupConfig) throws CouldNotPerformException { validateData(); return authorizationGroupConfigRemoteRegistry.contains(groupConfig); }
@Override public Boolean containsAuthorizationGroupConfigById(String groupConfigId) throws CouldNotPerformException { validateData(); return authorizationGroupConfigRemoteRegistry.contains(groupConfigId); }