當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。