コード例 #1
0
  @Override
  public void initApp() {
    StringConfigMap config = getManagementContext().getConfig();

    GeoscalingDnsService geoDns =
        addChild(
            EntitySpec.create(GeoscalingDnsService.class)
                .displayName("GeoScaling DNS")
                .configure(
                    "username",
                    checkNotNull(config.getFirst("brooklyn.geoscaling.username"), "username"))
                .configure(
                    "password",
                    checkNotNull(config.getFirst("brooklyn.geoscaling.password"), "password"))
                .configure(
                    "primaryDomainName",
                    checkNotNull(
                        config.getFirst("brooklyn.geoscaling.primaryDomain"), "primaryDomain"))
                .configure("smartSubdomainName", "brooklyn"));

    DynamicRegionsFabric webFabric =
        addChild(
            EntitySpec.create(DynamicRegionsFabric.class)
                .displayName("Web Fabric")
                .configure(DynamicRegionsFabric.FACTORY, new ElasticJavaWebAppService.Factory())

                // specify the WAR file to use
                .configure(
                    JavaWebAppService.ROOT_WAR, Entities.getRequiredUrlConfig(this, WAR_PATH)));

    // tell GeoDNS what to monitor
    geoDns.setTargetEntityProvider(webFabric);
  }
コード例 #2
0
  @Override
  public void init() {
    super.init();

    getMutableEntityType()
        .addEffector(
            EXECUTE_SCRIPT,
            new EffectorBody<String>() {
              @Override
              public String call(ConfigBag parameters) {
                return executeScript((String) parameters.getStringKey("commands"));
              }
            });

    Entities.checkRequiredUrl(this, getCassandraConfigTemplateUrl());
    Entities.getRequiredUrlConfig(this, CASSANDRA_RACKDC_CONFIG_TEMPLATE_URL);

    connectEnrichers();
  }