@Override
  public void reloadBrooklynProperties() {
    log.info("Reloading brooklyn properties from " + builder);
    if (builder.hasDelegateOriginalProperties())
      log.warn(
          "When reloading, mgmt context "
              + this
              + " properties are fixed, so reload will be of limited utility");

    BrooklynProperties properties = builder.build();
    configMap = properties;
    if (brooklynAdditionalProperties != null) {
      log.info("Reloading additional brooklyn properties from " + brooklynAdditionalProperties);
      configMap.addFromMap(brooklynAdditionalProperties);
    }
    this.downloadsManager = BasicDownloadsManager.newDefault(configMap);

    // Force reload of location registry
    this.locationRegistry = null;

    // Notify listeners that properties have been reloaded
    for (PropertiesReloadListener listener : reloadListeners) {
      listener.reloaded();
    }
  }
  public LocalManagementContext(
      Builder builder,
      Map<String, Object> brooklynAdditionalProperties,
      DataGridFactory datagridFactory) {
    super(builder.build(), datagridFactory);
    // TODO in a persisted world the planeId may be injected
    this.managementPlaneId = Strings.makeRandomId(8);

    this.managementNodeId = Strings.makeRandomId(8);
    checkNotNull(configMap, "brooklynProperties");
    this.builder = builder;
    this.brooklynAdditionalProperties = brooklynAdditionalProperties;
    if (brooklynAdditionalProperties != null) configMap.addFromMap(brooklynAdditionalProperties);

    this.locationManager = new LocalLocationManager(this);
    this.accessManager = new LocalAccessManager();
    this.usageManager = new LocalUsageManager(this);

    if (configMap.getConfig(OsgiManager.USE_OSGI)) {
      this.osgiManager = new OsgiManager();
      osgiManager.start();
    }

    INSTANCES.add(this);
    log.debug("Created management context " + this);
  }
 public LocalManagementContext(
     BrooklynProperties brooklynProperties, Map<String, Object> brooklynAdditionalProperties) {
   this(Builder.fromProperties(brooklynProperties), brooklynAdditionalProperties, null);
 }
 /**
  * Creates a new LocalManagementContext.
  *
  * @param brooklynProperties the BrooklynProperties.
  * @param datagridFactory the DataGridFactory to use. If this instance is null, it means that the
  *     system is going to use BrooklynProperties to figure out which instance to load or otherwise
  *     use a default instance.
  */
 @VisibleForTesting
 public LocalManagementContext(
     BrooklynProperties brooklynProperties, DataGridFactory datagridFactory) {
   this(Builder.fromProperties(brooklynProperties), datagridFactory);
 }