Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright 2010-2015, Inc. or its affiliates. All Rights Reserved.
  * Licensed under the Apache License, Version 2.0 (the "License").
  * You may not use this file except in compliance with the License.
  * A copy of the License is located at
 * or in the "license" file accompanying this file. This file is distributed
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
package com.amazonaws.metrics.internal.cloudwatch.spi;
Service specific metric transformer factory.
    private static final String REQUEST_TRANSFORMER_CLASSNAME_SUFFIX = "RequestMetricTransformer";
    public static String getTransformerPackage() {
        return ;
    public static void setTransformerPackage(
            String transformPackage) {
        if (transformPackage == null)
            throw new IllegalArgumentException();
        . = transformPackage;

By default, the transformer class for each AWS specific service is assumed to reside in the Java package DEFAULT_METRIC_TRANSFORM_PROVIDER_PACKAGE and follow the naming convention of <AwsPrefix>MetricTransformer. The "AwsPrefix" is the same as the enum literal name. Since each service specific request metric transformer internally contains static reference to service specific classes, this dynamic class loading mechansim allows service specific transformers to be skipped in case some service specific class files are absent in the classpath.
    private volatile RequestMetricTransformer requestMetricTransformer;

Returns the fully qualified class name of the request metric transformer, given the specific AWS prefix.
    public static String buildRequestMetricTransformerFQCN(String awsPrefixString packageName) {
        return packageName + "." 
             + awsPrefix + 


fqcn fully qualified class name.
       Log log = LogFactory.getLog(AWSMetricTransformerFactory.class);
       if (log.isDebugEnabled()) {
           log.debug("Loading " + fqcn);
        try {
            Class<?> c = Class.forName(fqcn);
            return (RequestMetricTransformer)c.newInstance();
        } catch (Throwable e) {
            if (log.isDebugEnabled()) {
                log.debug("Failed to load " + fqcn
                        + "; therefore ignoring " +
                        + " specific predefined metrics"e);
        return .;
        RequestMetricTransformer transformer = ;
        String packageName = ;
        if (transformer != null
        &&  packageName.equals(transformer.getClass().getPackage().getName())) {
            return transformer;
        String fqcn = AWSMetricTransformerFactory
            .buildRequestMetricTransformerFQCN(name(), packageName);
        return this. = loadRequestMetricTransformer(fqcn);
New to GrepCode? Check out our FAQ X