@Override @Deprecated public Location manage(Location loc) { if (isInitialManagementContextReal()) { return initialManagementContext.getLocationManager().manage(loc); } else { throw new IllegalStateException("Non-deployment context "+this+" is not valid for this operation: cannot manage "+loc); } }
/** * Registers the given location (and all its children) with the management context. * @throws IllegalStateException if the parent location is not already managed * * @since 0.6.0 (added only for backwards compatibility, where locations are being created directly; previously in {@link Entities}). * @deprecated in 0.6.0; use {@link LocationManager#createLocation(LocationSpec)} instead. */ @Deprecated public static void manage(Location loc, ManagementContext managementContext) { if (!managementContext.getLocationManager().isManaged(loc)) { log.warn("Deprecated use of unmanaged location ("+loc+"); will be managed automatically now but not supported in future versions"); // FIXME this occurs MOST OF THE TIME e.g. including BrooklynLauncher.location(locationString) // not sure what is the recommend way to convert from locationString to locationSpec, or the API we want to expose; // deprecating some of the LocationRegistry methods seems sensible? log.debug("Stack trace for location of: Deprecated use of unmanaged location; will be managed automatically now but not supported in future versions", new Exception("TRACE for: Deprecated use of unmanaged location")); managementContext.getLocationManager().manage(loc); } }
@Override public void reloaded() { Location resolved = context.getLocationRegistry().resolve(definition); context.getLocationRegistry().updateDefinedLocation(definition); context.getLocationManager().manage(resolved); } };
getManagementContext().getLocationManager().manage(l);