@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
  /**
   * The default is (in-order) to:
   *
   * <ol>
   *   <li>Use the local repo, if any (defaulting to $HOME/.brooklyn/repository)
   *   <li>Use brooklyn properties for any download overrides defined there (see {@link
   *       DownloadPropertiesResolver}
   *   <li>Use the entity's Attributes.DOWNLOAD_URL
   *   <li>Use the cloudsoft fallback repo
   * </ol>
   *
   * @param config
   * @return
   */
  public static BasicDownloadsManager newDefault(StringConfigMap config) {
    BasicDownloadsManager result = new BasicDownloadsManager();

    // In-order, will look up: local repo, overrides defined in the properties, and then
    // the entity's attribute to get the download URL
    DownloadProducerFromLocalRepo localRepoProducer = new DownloadProducerFromLocalRepo(config);
    DownloadProducerFromProperties propertiesProducer = new DownloadProducerFromProperties(config);
    DownloadProducerFromUrlAttribute attributeProducer = new DownloadProducerFromUrlAttribute();
    DownloadProducerFromCloudsoftRepo cloudsoftRepoProducer =
        new DownloadProducerFromCloudsoftRepo(config);

    result.registerProducer(localRepoProducer);
    result.registerProducer(propertiesProducer);
    result.registerProducer(attributeProducer);
    result.registerProducer(cloudsoftRepoProducer);

    result.registerFilenameProducer(FilenameProducers.fromFilenameProperty());
    result.registerFilenameProducer(FilenameProducers.firstPrimaryTargetOf(propertiesProducer));
    result.registerFilenameProducer(FilenameProducers.firstPrimaryTargetOf(attributeProducer));

    return result;
  }