public static boolean hasLocationData(UnitConfig config) throws InterruptedException, CouldNotPerformException { try { Registries.getLocationRegistry(true).getUnitToRootTransformationFuture(config).get(10000, TimeUnit.SECONDS); } catch (CouldNotPerformException | TimeoutException ex) { throw new CouldNotPerformException("GlobalTransformReceiver not available.", ex); } catch (ExecutionException ex) { return false; } return true; }
/** * Method returns the transformation leading from the given unit to the root location. * * @param unitConfig the unit where the transformation leads to. * @return a transformation future */ public static Future<Transform> getUnitToRootTransformationFuture(final UnitConfig unitConfig) { final Future<LocationRegistryDataType.LocationRegistryData> dataFuture; try { try { dataFuture = Registries.getLocationRegistry().getDataFuture(); return GlobalCachedExecutorService.allOfInclusiveResultFuture(Registries.getLocationRegistry().getUnitToRootTransformationFuture(unitConfig), dataFuture); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new FatalImplementationErrorException("getLocationRegistry should not throw InterruptedExceptions anymore!", Units.class, ex); } } catch (CouldNotPerformException ex) { return FutureProcessor.canceledFuture(Transform.class, new NotAvailableException("UnitTransformation", ex)); } }