protected Location getLocation(@Nullable Collection<? extends Location> locations) { if (locations==null || locations.isEmpty()) locations = entity().getLocations(); if (locations.isEmpty()) { MachineProvisioningLocation<?> provisioner = entity().getAttribute(SoftwareProcess.PROVISIONING_LOCATION); if (provisioner!=null) locations = Arrays.<Location>asList(provisioner); } locations = Locations.getLocationsCheckingAncestors(locations, entity()); Maybe<MachineLocation> ml = Locations.findUniqueMachineLocation(locations); if (ml.isPresent()) return ml.get(); if (locations.isEmpty()) throw new IllegalArgumentException("No locations specified when starting "+entity()); if (locations.size() != 1 || Iterables.getOnlyElement(locations)==null) throw new IllegalArgumentException("Ambiguous locations detected when starting "+entity()+": "+locations); return Iterables.getOnlyElement(locations); }
protected MachineLocation getMachine() { Supplier<MachineLocation> supplier = config().get(MACHINE); if (supplier != null) { return supplier.get(); } else { return Locations.findUniqueMachineLocation(entity.getLocations()).get(); } }
Collection<? extends Location> locations = entity.getLocations(); if (!locations.isEmpty()) { Maybe<? extends Location> lo = Locations.findUniqueMachineLocation(locations); if (!lo.isPresent()) {