当前位置: 首页>>代码示例>>Java>>正文


Java EffectorParam类代码示例

本文整理汇总了Java中org.apache.brooklyn.core.annotation.EffectorParam的典型用法代码示例。如果您正苦于以下问题:Java EffectorParam类的具体用法?Java EffectorParam怎么用?Java EffectorParam使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EffectorParam类属于org.apache.brooklyn.core.annotation包,在下文中一共展示了EffectorParam类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startService

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Override
public void startService(@EffectorParam(name = "Cluster name") String cluster,
                         @EffectorParam(name = "Service name") final String service) {
    waitForServiceUp();

    final Request request = restAdapter.create(ServiceEndpoint.class).updateService(cluster, service, ImmutableMap.builder()
            .put("RequestInfo", ImmutableMap.builder()
                    .put("context", String.format("Start %s service", service))
                    .build())
            .put("ServiceInfo", ImmutableMap.builder()
                    .put("state", "STARTED")
                    .build())
            .build());

    RequestCheckRunnable.check(request)
            .headers(ImmutableMap.of(HttpHeaders.AUTHORIZATION, HttpTool.toBasicAuthorizationValue(usernamePasswordCredentials)))
            .errorMessage(String.format("Error during the start of service \"%s\". Please check the Ambari console for more details: %s", service, ambariUri))
            .build()
            .run();
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:21,代码来源:AmbariServerImpl.java

示例2: changeLoad

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Effector(description = "Adjust the generated load. Generated requests/second will be " +
        "roughly newThreadCount * (1000 / newDelayCount)")
void changeLoad(
        @Nullable
        @EffectorParam(name = "newThreadCount",
                description = "The number of threads the plan should use",
                nullable = true)
        Integer newThreadCount,
        @Nullable
        @EffectorParam(name="newDelayCount",
                description="The period in milliseconds each thread should wait between requests",
                nullable=true)
        Integer newDelayCount);
 
开发者ID:cloudsoft,项目名称:jmeter-entity,代码行数:14,代码来源:JMeterNode.java

示例3: addHostToCluster

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Override
public void addHostToCluster(@EffectorParam(name = "Cluster name") String cluster,
                             @EffectorParam(name = "Host FQDN") String hostName) {
    waitForServiceUp();
    restAdapter.create(HostEndpoint.class).addHost(cluster, hostName);

}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:8,代码来源:AmbariServerImpl.java

示例4: createCluster

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Override
public void createCluster(@EffectorParam(name = "Cluster Name") String clusterName,
                          @EffectorParam(name = "Blueprint Name") String blueprintName,
                          @EffectorParam(name = "Stack Name") String stackName,
                          @EffectorParam(name = "Stack version") String stackVersion,
                          @EffectorParam(name = "Hosts", description = "List of FQDNs to add to cluster") List<String> hosts,
                          @EffectorParam(name = "Services", description = "List of services to install on cluster") List<String> services,
                          @EffectorParam(name = "Configurations", description = "Map of configurations to apply to blueprint") Map<String, Map> config) {
    final RecommendationWrappers recommendationWrappers = getRecommendations(stackName, stackVersion, hosts, services);

    deployCluster(clusterName, blueprintName, recommendationWrappers.getRecommendationWrappers().size() > 0 ? recommendationWrappers.getRecommendationWrappers().get(0) : null, config);
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:13,代码来源:AmbariServerImpl.java

示例5: updateStackRepository

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Override
public void updateStackRepository(@EffectorParam(name = "Stack Name") String stackName, @EffectorParam(name = "Stack Version") String stackVersion, @EffectorParam(name = "Operating System") String os, @EffectorParam(name = "Repository Name") String repoName, @EffectorParam(name = "Repository URL") String url) {
    waitForServiceUp();
    restAdapter.create(StackEndpoint.class)
            .updateStackRepository(stackName, stackVersion, os, repoName, ImmutableMap.builder()
                    .put("Repositories", ImmutableMap.builder()
                            .put("base_url", url)
                            .put("verify_base_url", true)
                            .build())
                    .build());
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:12,代码来源:AmbariServerImpl.java

示例6: createServiceConfiguration

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Override
public void createServiceConfiguration(@EffectorParam(name = "Cluster name") String cluster,
                                       @EffectorParam(name = "Component configuration key") String configurationKey,
                                       @EffectorParam(name = "Component configuration") Map<Object, Object> configuration) {
    waitForServiceUp();
    restAdapter.create(ConfigurationEnpoint.class).createConfiguration(cluster, ImmutableMap.builder()
            .put("Clusters", ImmutableMap.builder()
                    .put("desired_configs", ImmutableMap.builder()
                            .put("type", configurationKey)
                            .put("tag", String.format("version%d", System.currentTimeMillis()))
                            .put("properties", configuration)
                            .build())
                    .build())
            .build());
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:16,代码来源:AmbariServerImpl.java

示例7: addAlertGroup

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Override
public void addAlertGroup(@EffectorParam(name = "Name") String name,
                          @EffectorParam(name = "Definitions") List<Integer> definitions) {

    ImmutableMap<String, ImmutableMap<Object, Object>> alertGroupRequest = ImmutableMap.of("AlertGroup", ImmutableMap.builder()
            .put("name", name)
            .put("definitions", definitions)
            .build());

    restAdapter.create(AlertGroupEndpoint.class).createAlertGroup(getConfig(AmbariCluster.CLUSTER_NAME), alertGroupRequest);
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:12,代码来源:AmbariServerImpl.java

示例8: createCluster

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Effector(description = "Create, configure and install a cluster, based on Ambari recommendation from the given hosts and services")
public void createCluster(@EffectorParam(name = "Cluster Name") String clusterName,
                          @EffectorParam(name = "Blueprint Name") String blueprintName,
                          @EffectorParam(name = "Stack Name") String stackName,
                          @EffectorParam(name = "Stack version") String stackVersion,
                          @EffectorParam(name = "Hosts", description = "List of FQDNs to add to cluster") List<String> hosts,
                          @EffectorParam(name = "Services", description = "List of services to install on cluster") List<String> services,
                          @EffectorParam(name = "Configurations", description = "Map of configurations to apply to blueprint") Map<String, Map> config);
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:9,代码来源:AmbariServer.java

示例9: setEnv

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Override
@Effector(description="Set an environment variable that can be retrieved by the web application")
public void setEnv(@EffectorParam(name = "name", description = "Name of the variable") String key,
                   @EffectorParam(name = "value", description = "Value of the environment variable") String value) {
    PaasWebAppDriver driver = getDriver();
    if (driver != null) {
        driver.setEnv(key, value);   
    } else {
        log.error("Error setting environment variable {} = {} on entity {}", key, this.getEntityTypeName());
    }
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:12,代码来源:CloudFoundryWebAppImpl.java

示例10: setInstancesNumber

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Override
@SuppressWarnings("all")
@Effector(description="Set the instances number that will be user by the web application")
public void setInstancesNumber(@EffectorParam(name = "instancesNumber", description = "Number of " +
        "instances that are being used by the application") int instancesNumber){
    if(instancesNumber<=0){
        log.info("The number of instances should be greater than 0 in effector " +
                "setInstancesNumbre of {} but was received {}", this, instancesNumber);
    }
    getDriver().changeInstancesNumber(instancesNumber);
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:12,代码来源:CloudFoundryWebAppImpl.java

示例11: setDiskQuota

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Override
@SuppressWarnings("all")
@Effector(description="Set the disk quota that will be used by the web application")
public void setDiskQuota(@EffectorParam(name = "diskQuota", description = "Disk amount" +
        " that will be used by the web application") int diskQuota){
    if(diskQuota<=0){
        log.info("The disk amount should be greater than 0 in effector " +
                "setInstancesNumbre of {} but was received {}", this, diskQuota);
    }
    getDriver().updateApplicationDiskQuota(diskQuota);
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:12,代码来源:CloudFoundryWebAppImpl.java

示例12: setAmountMemory

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Override
@SuppressWarnings("all")
@Effector(description="Set an Ram Memory limit for the web application")
public void setAmountMemory(@EffectorParam(name = "memory", description = "Disk amount" +
        " that will be used by the web application") int memory){
    if(memory<=0){
        log.info("The memory amount should be greater than 0 in effector " +
                "setInstancesNumbre of {} but was received {}", this, memory);
    }
    getDriver().updateApplicationMemory(memory);
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:12,代码来源:CloudFoundryWebAppImpl.java

示例13: addServiceToCluster

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Override
public void addServiceToCluster(@EffectorParam(name = "cluster", description = "Cluster name") final String cluster,
                                @EffectorParam(name = "service", description = "Service name") final String service,
                                @EffectorParam(name = "mappings", description = "Mappings of component to host") Map<String, String> mappings,
                                @EffectorParam(name = "configuration", description = "Services Configuration", nullable = true, defaultValue = EffectorParam.MAGIC_STRING_MEANING_NULL) Map<String, Map<Object, Object>> configuration) {
    waitForServiceUp();

    final ServiceEndpoint serviceEndpoint = restAdapter.create(ServiceEndpoint.class);
    final HostEndpoint hostEndpoint = restAdapter.create(HostEndpoint.class);

    // Step 1 - Add the service to the cluster
    serviceEndpoint.addService(cluster, service);

    // Step 2 - Add Components to the service
    // Step 3 - Create host components
    for (Map.Entry<String, String> mapping : mappings.entrySet()) {
        serviceEndpoint.createComponent(cluster, service, mapping.getKey());
        hostEndpoint.createHostComponent(cluster, mapping.getValue(), mapping.getKey());
    }

    // Step 4 - Create configuration, if needed
    if (configuration != null) {
        for (Map.Entry<String, Map<Object, Object>> entry : configuration.entrySet()) {
            createServiceConfiguration(cluster, entry.getKey(), entry.getValue());
        }
    }

    final Task installationTask = Tasks.builder()
            .name(String.format("Install %s service", service))
            .description(String.format("Install %s service on specified hosts through Ambari REST API", service))
            .body(new Runnable() {
                @Override
                public void run() {
                    // Step 5 - Install the service
                    final Request request = serviceEndpoint.updateService(cluster, service, ImmutableMap.builder()
                            .put("RequestInfo", ImmutableMap.builder()
                                    .put("context", String.format("Install %s service", service))
                                    .build())
                            .put("ServiceInfo", ImmutableMap.builder()
                                    .put("state", "INSTALLED")
                                    .build())
                            .build());

                    RequestCheckRunnable.check(request)
                            .headers(ImmutableMap.of(HttpHeaders.AUTHORIZATION, HttpTool.toBasicAuthorizationValue(usernamePasswordCredentials)))
                            .errorMessage(String.format("Error during installation of service \"%s\". Please check the Ambari console for more details: %s", service, ambariUri))
                            .build()
                            .run();
                }
            }).build();
    final Task startTask = Tasks.builder()
            .name(String.format("Start %s service", service))
            .description(String.format("Start %s service on specified hosts through Ambari REST API", service))
            .body(new Runnable() {
                @Override
                public void run() {
                    // Step 6 - Start the service
                    startService(cluster, service);
                }
            }).build();

    // Queue the "Installation" subtask and wait for its completion. If something goes wrong during execution, an
    // exception will be thrown which will stop the effector and prevent the "start" subtask to run.
    DynamicTasks.queue(installationTask);
    // Queue the "Start" subtask. At this point, everything went fine. If something goes wrong during execution, an
    // exception will be thrown which will stop the effector.
    DynamicTasks.queue(startTask);
}
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:69,代码来源:AmbariServerImpl.java

示例14: addHostToCluster

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Effector(description = "Adds a new host to a cluster")
public void addHostToCluster(@EffectorParam(name = "Cluster name") String cluster,
                             @EffectorParam(name = "Host FQDN") String hostName);
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:4,代码来源:AmbariServer.java

示例15: updateStackRepository

import org.apache.brooklyn.core.annotation.EffectorParam; //导入依赖的package包/类
@Effector(description = "Update the stack url")
public void updateStackRepository(@EffectorParam(name = "Stack Name") String stackName,
                                  @EffectorParam(name = "Stack Version") String stackVersion,
                                  @EffectorParam(name = "Operating System") String os,
                                  @EffectorParam(name = "Repository Name") String repoName,
                                  @EffectorParam(name = "Repository URL") String url);
 
开发者ID:brooklyncentral,项目名称:brooklyn-ambari,代码行数:7,代码来源:AmbariServer.java


注:本文中的org.apache.brooklyn.core.annotation.EffectorParam类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。