コード例 #1
0
  @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();
    }
  }
コード例 #2
0
  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);
  }