text:
package com.amazonaws.services.cloudhsm;

import org.w3c.dom.*;

import java.net.*;
import java.util.*;
import java.util.Map.Entry;

import org.apache.commons.logging.*;

import com.amazonaws.*;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;

import com.amazonaws.services.cloudhsm.model.*;
import com.amazonaws.services.cloudhsm.model.transform.*;

/**
 * Client for accessing CloudHSM. All service calls made using this client are
 * blocking, and will not return until the service call completes.
 *

 * <fullname>AWS CloudHSM Service</fullname>
 */
@ThreadSafe
public class AWSCloudHSMClient extends AmazonWebServiceClient implements
        AWSCloudHSM {
    /** Provider for AWS credentials. */
    private AWSCredentialsProvider awsCredentialsProvider;

    private static final Log log = LogFactory.getLog(AWSCloudHSM.class);

    /** Default signing name for the service. */
    private static final String DEFAULT_SIGNING_NAME = "cloudhsm";

    /** The region metadata service name for computing region endpoints. */
    private static final String DEFAULT_ENDPOINT_PREFIX = "cloudhsm";

    /**
     * Client configuration factory providing ClientConfigurations tailored to
     * this client
     */
    protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();

    /**
     * List of exception unmarshallers for all CloudHSM exceptions.
     */
    protected List<JsonErrorUnmarshallerV2> jsonErrorUnmarshallers = new ArrayList<JsonErrorUnmarshallerV2>();

    /**
     * Constructs a new client to invoke service methods on CloudHSM. A
     * credentials provider chain will be used that searches for credentials in
     * this order:
     *

     *
Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY

     *
Java System Properties - aws.accessKeyId and aws.secretKey

     *
Instance profile credentials delivered through the Amazon EC2
     * metadata service

     *

     *
     *

     * All service calls made using this new client object are blocking, and
     * will not return until the service call completes.
     *
     * @see DefaultAWSCredentialsProviderChain
     */
    public AWSCloudHSMClient() {
        this(new DefaultAWSCredentialsProviderChain(), configFactory
                .getConfig());
    }

    /**
     * Constructs a new client to invoke service methods on CloudHSM. A
     * credentials provider chain will be used that searches for credentials in
     * this order:
     *

     *
Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY

     *
Java System Properties - aws.accessKeyId and aws.secretKey

     *
Instance profile credentials delivered through the Amazon EC2
     * metadata service

     *

     *
     *

     * All service calls made using this new client object are blocking, and
     * will not return until the service call completes.
     *
     * @param clientConfiguration
     *        The client configuration options controlling how this client
     *        connects to CloudHSM (ex: proxy settings, retry counts, etc.).
     *
     * @see DefaultAWSCredentialsProviderChain
     */
    public AWSCloudHSMClient(ClientConfiguration clientConfiguration) {
        this(new DefaultAWSCredentialsProviderChain(), clientConfiguration);
    }

    /**
     * Constructs a new client to invoke service methods on CloudHSM using the
     * specified AWS account credentials.
     *
     *

     * All service calls made using this new client object are blocking, and
     * will not return until the service call completes.
     *
     * @param awsCredentials
     *        The AWS credentials (access key ID and secret key) to use when
     *        authenticating with AWS services.
     */
    public AWSCloudHSMClient(AWSCredentials awsCredentials) {
        this(awsCredentials, configFactory.getConfig());
    }

    /**
     * Constructs a new client to invoke service methods on CloudHSM using the
     * specified AWS account credentials and client configuration options.
     *
     *

     * All service calls made using this new client object are blocking, and
     * will not return until the service call completes.
     *
     * @param awsCredentials
     *        The AWS credentials (access key ID and secret key) to use when
     *        authenticating with AWS services.
     * @param clientConfiguration
     *        The client configuration options controlling how this client
     *        connects to CloudHSM (ex: proxy settings, retry counts, etc.).
     */
    public AWSCloudHSMClient(AWSCredentials awsCredentials,
            ClientConfiguration clientConfiguration) {
        super(clientConfiguration);
        this.awsCredentialsProvider = new StaticCredentialsProvider(
                awsCredentials);
        init();
    }

    /**
     * Constructs a new client to invoke service methods on CloudHSM using the
     * specified AWS account credentials provider.
     *
     *

     * All service calls made using this new client object are blocking, and
     * will not return until the service call completes.
     *
     * @param awsCredentialsProvider
     *        The AWS credentials provider which will provide credentials to
     *        authenticate requests with AWS services.
     */
    public AWSCloudHSMClient(AWSCredentialsProvider awsCredentialsProvider) {
        this(awsCredentialsProvider, configFactory.getConfig());
    }

    /**
     * Constructs a new client to invoke service methods on CloudHSM using the
     * specified AWS account credentials provider and client configuration
     * options.
     *
     *

     * All service calls made using this new client object are blocking, and
     * will not return until the service call completes.
     *
     * @param awsCredentialsProvider
     *        The AWS credentials provider which will provide credentials to
     *        authenticate requests with AWS services.
     * @param clientConfiguration
     *        The client configuration options controlling how this client
     *        connects to CloudHSM (ex: proxy settings, retry counts, etc.).
     */
    public AWSCloudHSMClient(AWSCredentialsProvider awsCredentialsProvider,
            ClientConfiguration clientConfiguration) {
        this(awsCredentialsProvider, clientConfiguration, null);
    }

    /**
     * Constructs a new client to invoke service methods on CloudHSM using the
     * specified AWS account credentials provider, client configuration options,
     * and request metric collector.
     *
     *

     * All service calls made using this new client object are blocking, and
     * will not return until the service call completes.
     *
     * @param awsCredentialsProvider
     *        The AWS credentials provider which will provide credentials to
     *        authenticate requests with AWS services.
     * @param clientConfiguration
     *        The client configuration options controlling how this client
     *        connects to CloudHSM (ex: proxy settings, retry counts, etc.).
     * @param requestMetricCollector
     *        optional request metric collector
     */
    public AWSCloudHSMClient(AWSCredentialsProvider awsCredentialsProvider,
            ClientConfiguration clientConfiguration,
            RequestMetricCollector requestMetricCollector) {
        super(clientConfiguration, requestMetricCollector);
        this.awsCredentialsProvider = awsCredentialsProvider;
        init();
    }

    private void init() {
        jsonErrorUnmarshallers
                .add(new JsonErrorUnmarshallerV2(
                        com.amazonaws.services.cloudhsm.model.CloudHsmServiceException.class,
                        "CloudHsmServiceException"));
        jsonErrorUnmarshallers
                .add(new JsonErrorUnmarshallerV2(
                        com.amazonaws.services.cloudhsm.model.CloudHsmInternalException.class,
                        "CloudHsmInternalException"));
        jsonErrorUnmarshallers
                .add(new JsonErrorUnmarshallerV2(
                        com.amazonaws.services.cloudhsm.model.InvalidRequestException.class,
                        "InvalidRequestException"));
        jsonErrorUnmarshallers
                .add(JsonErrorUnmarshallerV2.DEFAULT_UNMARSHALLER);

        setServiceNameIntern(DEFAULT_SIGNING_NAME);
        setEndpointPrefix(DEFAULT_ENDPOINT_PREFIX);
        // calling this.setEndPoint(...) will also modify the signer accordingly
        setEndpoint("https://cloudhsm.us-east-1.amazonaws.com/");
        HandlerChainFactory chainFactory = new HandlerChainFactory();
        requestHandler2s
                .addAll(chainFactory
                        .newRequestHandlerChain("/com/amazonaws/services/cloudhsm/request.handlers"));
        requestHandler2s
                .addAll(chainFactory
                        .newRequestHandler2Chain("/com/amazonaws/services/cloudhsm/request.handler2s"));
    }

    /**
     *

     * Adds or overwrites one or more tags for the specified resource.
     *

     *

     * Each tag consists of a key and a value. Tag keys must be unique per
     * resource.
     *

     *
     * @param addTagsToResourceRequest
     * @return Result of the AddTagsToResource operation returned by the
     *         service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.AddTagsToResource
     */
    @Override
    public AddTagsToResourceResult addTagsToResource(
            AddTagsToResourceRequest addTagsToResourceRequest) {
        ExecutionContext executionContext = createExecutionContext(addTagsToResourceRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<AddTagsToResourceRequest> request = null;
        Response<AddTagsToResourceResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new AddTagsToResourceRequestMarshaller()
                        .marshall(super
                                .beforeMarshalling(addTagsToResourceRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<AddTagsToResourceResult> responseHandler = new JsonResponseHandler<AddTagsToResourceResult>(
                    new AddTagsToResourceResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Creates a high-availability partition group. A high-availability
     * partition group is a group of partitions that spans multiple physical
     * HSMs.
     *

     *
     * @param createHapgRequest
     *        Contains the inputs for the CreateHapgRequest action.
     * @return Result of the CreateHapg operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.CreateHapg
     */
    @Override
    public CreateHapgResult createHapg(CreateHapgRequest createHapgRequest) {
        ExecutionContext executionContext = createExecutionContext(createHapgRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<CreateHapgRequest> request = null;
        Response<CreateHapgResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new CreateHapgRequestMarshaller().marshall(super
                        .beforeMarshalling(createHapgRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<CreateHapgResult> responseHandler = new JsonResponseHandler<CreateHapgResult>(
                    new CreateHapgResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Creates an uninitialized HSM instance.
     *

     *

     * There is an upfront fee charged for each HSM instance that you create
     * with the CreateHsm operation. If you accidentally provision an HSM
     * and want to request a refund, delete the instance using the
     * DeleteHsm operation, go to the AWS Support
     * Center, create a new case, and select Account and Billing
     * Support.
     *

     * <important>
     *

     * It can take up to 20 minutes to create and provision an HSM. You can
     * monitor the status of the HSM with the DescribeHsm operation. The
     * HSM is ready to be initialized when the status changes to
     * RUNNING.
     *

     * </important>
     *
     * @param createHsmRequest
     *        Contains the inputs for the CreateHsm operation.
     * @return Result of the CreateHsm operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.CreateHsm
     */
    @Override
    public CreateHsmResult createHsm(CreateHsmRequest createHsmRequest) {
        ExecutionContext executionContext = createExecutionContext(createHsmRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<CreateHsmRequest> request = null;
        Response<CreateHsmResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new CreateHsmRequestMarshaller().marshall(super
                        .beforeMarshalling(createHsmRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<CreateHsmResult> responseHandler = new JsonResponseHandler<CreateHsmResult>(
                    new CreateHsmResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Creates an HSM client.
     *

     *
     * @param createLunaClientRequest
     *        Contains the inputs for the CreateLunaClient action.
     * @return Result of the CreateLunaClient operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.CreateLunaClient
     */
    @Override
    public CreateLunaClientResult createLunaClient(
            CreateLunaClientRequest createLunaClientRequest) {
        ExecutionContext executionContext = createExecutionContext(createLunaClientRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<CreateLunaClientRequest> request = null;
        Response<CreateLunaClientResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new CreateLunaClientRequestMarshaller()
                        .marshall(super
                                .beforeMarshalling(createLunaClientRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<CreateLunaClientResult> responseHandler = new JsonResponseHandler<CreateLunaClientResult>(
                    new CreateLunaClientResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Deletes a high-availability partition group.
     *

     *
     * @param deleteHapgRequest
     *        Contains the inputs for the DeleteHapg action.
     * @return Result of the DeleteHapg operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.DeleteHapg
     */
    @Override
    public DeleteHapgResult deleteHapg(DeleteHapgRequest deleteHapgRequest) {
        ExecutionContext executionContext = createExecutionContext(deleteHapgRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<DeleteHapgRequest> request = null;
        Response<DeleteHapgResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new DeleteHapgRequestMarshaller().marshall(super
                        .beforeMarshalling(deleteHapgRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<DeleteHapgResult> responseHandler = new JsonResponseHandler<DeleteHapgResult>(
                    new DeleteHapgResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Deletes an HSM. After completion, this operation cannot be undone and
     * your key material cannot be recovered.
     *

     *
     * @param deleteHsmRequest
     *        Contains the inputs for the DeleteHsm operation.
     * @return Result of the DeleteHsm operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.DeleteHsm
     */
    @Override
    public DeleteHsmResult deleteHsm(DeleteHsmRequest deleteHsmRequest) {
        ExecutionContext executionContext = createExecutionContext(deleteHsmRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<DeleteHsmRequest> request = null;
        Response<DeleteHsmResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new DeleteHsmRequestMarshaller().marshall(super
                        .beforeMarshalling(deleteHsmRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<DeleteHsmResult> responseHandler = new JsonResponseHandler<DeleteHsmResult>(
                    new DeleteHsmResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Deletes a client.
     *

     *
     * @param deleteLunaClientRequest
     * @return Result of the DeleteLunaClient operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.DeleteLunaClient
     */
    @Override
    public DeleteLunaClientResult deleteLunaClient(
            DeleteLunaClientRequest deleteLunaClientRequest) {
        ExecutionContext executionContext = createExecutionContext(deleteLunaClientRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<DeleteLunaClientRequest> request = null;
        Response<DeleteLunaClientResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new DeleteLunaClientRequestMarshaller()
                        .marshall(super
                                .beforeMarshalling(deleteLunaClientRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<DeleteLunaClientResult> responseHandler = new JsonResponseHandler<DeleteLunaClientResult>(
                    new DeleteLunaClientResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Retrieves information about a high-availability partition group.
     *

     *
     * @param describeHapgRequest
     *        Contains the inputs for the DescribeHapg action.
     * @return Result of the DescribeHapg operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.DescribeHapg
     */
    @Override
    public DescribeHapgResult describeHapg(
            DescribeHapgRequest describeHapgRequest) {
        ExecutionContext executionContext = createExecutionContext(describeHapgRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<DescribeHapgRequest> request = null;
        Response<DescribeHapgResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new DescribeHapgRequestMarshaller().marshall(super
                        .beforeMarshalling(describeHapgRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<DescribeHapgResult> responseHandler = new JsonResponseHandler<DescribeHapgResult>(
                    new DescribeHapgResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Retrieves information about an HSM. You can identify the HSM by its ARN
     * or its serial number.
     *

     *
     * @param describeHsmRequest
     *        Contains the inputs for the DescribeHsm operation.
     * @return Result of the DescribeHsm operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.DescribeHsm
     */
    @Override
    public DescribeHsmResult describeHsm(DescribeHsmRequest describeHsmRequest) {
        ExecutionContext executionContext = createExecutionContext(describeHsmRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<DescribeHsmRequest> request = null;
        Response<DescribeHsmResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new DescribeHsmRequestMarshaller().marshall(super
                        .beforeMarshalling(describeHsmRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<DescribeHsmResult> responseHandler = new JsonResponseHandler<DescribeHsmResult>(
                    new DescribeHsmResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    @Override
    public DescribeHsmResult describeHsm() {
        return describeHsm(new DescribeHsmRequest());
    }

    /**
     *

     * Retrieves information about an HSM client.
     *

     *
     * @param describeLunaClientRequest
     * @return Result of the DescribeLunaClient operation returned by the
     *         service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.DescribeLunaClient
     */
    @Override
    public DescribeLunaClientResult describeLunaClient(
            DescribeLunaClientRequest describeLunaClientRequest) {
        ExecutionContext executionContext = createExecutionContext(describeLunaClientRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<DescribeLunaClientRequest> request = null;
        Response<DescribeLunaClientResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new DescribeLunaClientRequestMarshaller()
                        .marshall(super
                                .beforeMarshalling(describeLunaClientRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<DescribeLunaClientResult> responseHandler = new JsonResponseHandler<DescribeLunaClientResult>(
                    new DescribeLunaClientResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    @Override
    public DescribeLunaClientResult describeLunaClient() {
        return describeLunaClient(new DescribeLunaClientRequest());
    }

    /**
     *

     * Gets the configuration files necessary to connect to all high
     * availability partition groups the client is associated with.
     *

     *
     * @param getConfigRequest
     * @return Result of the GetConfig operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.GetConfig
     */
    @Override
    public GetConfigResult getConfig(GetConfigRequest getConfigRequest) {
        ExecutionContext executionContext = createExecutionContext(getConfigRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<GetConfigRequest> request = null;
        Response<GetConfigResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new GetConfigRequestMarshaller().marshall(super
                        .beforeMarshalling(getConfigRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<GetConfigResult> responseHandler = new JsonResponseHandler<GetConfigResult>(
                    new GetConfigResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Lists the Availability Zones that have available AWS CloudHSM capacity.
     *

     *
     * @param listAvailableZonesRequest
     *        Contains the inputs for the ListAvailableZones action.
     * @return Result of the ListAvailableZones operation returned by the
     *         service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.ListAvailableZones
     */
    @Override
    public ListAvailableZonesResult listAvailableZones(
            ListAvailableZonesRequest listAvailableZonesRequest) {
        ExecutionContext executionContext = createExecutionContext(listAvailableZonesRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<ListAvailableZonesRequest> request = null;
        Response<ListAvailableZonesResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new ListAvailableZonesRequestMarshaller()
                        .marshall(super
                                .beforeMarshalling(listAvailableZonesRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<ListAvailableZonesResult> responseHandler = new JsonResponseHandler<ListAvailableZonesResult>(
                    new ListAvailableZonesResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    @Override
    public ListAvailableZonesResult listAvailableZones() {
        return listAvailableZones(new ListAvailableZonesRequest());
    }

    /**
     *

     * Lists the high-availability partition groups for the account.
     *

     *

     * This operation supports pagination with the use of the NextToken
     * member. If more results are available, the NextToken member of the
     * response contains a token that you pass in the next call to
     * ListHapgs to retrieve the next set of items.
     *

     *
     * @param listHapgsRequest
     * @return Result of the ListHapgs operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.ListHapgs
     */
    @Override
    public ListHapgsResult listHapgs(ListHapgsRequest listHapgsRequest) {
        ExecutionContext executionContext = createExecutionContext(listHapgsRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<ListHapgsRequest> request = null;
        Response<ListHapgsResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new ListHapgsRequestMarshaller().marshall(super
                        .beforeMarshalling(listHapgsRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<ListHapgsResult> responseHandler = new JsonResponseHandler<ListHapgsResult>(
                    new ListHapgsResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    @Override
    public ListHapgsResult listHapgs() {
        return listHapgs(new ListHapgsRequest());
    }

    /**
     *

     * Retrieves the identifiers of all of the HSMs provisioned for the current
     * customer.
     *

     *

     * This operation supports pagination with the use of the NextToken
     * member. If more results are available, the NextToken member of the
     * response contains a token that you pass in the next call to
     * ListHsms to retrieve the next set of items.
     *

     *
     * @param listHsmsRequest
     * @return Result of the ListHsms operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.ListHsms
     */
    @Override
    public ListHsmsResult listHsms(ListHsmsRequest listHsmsRequest) {
        ExecutionContext executionContext = createExecutionContext(listHsmsRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<ListHsmsRequest> request = null;
        Response<ListHsmsResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new ListHsmsRequestMarshaller().marshall(super
                        .beforeMarshalling(listHsmsRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<ListHsmsResult> responseHandler = new JsonResponseHandler<ListHsmsResult>(
                    new ListHsmsResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    @Override
    public ListHsmsResult listHsms() {
        return listHsms(new ListHsmsRequest());
    }

    /**
     *

     * Lists all of the clients.
     *

     *

     * This operation supports pagination with the use of the NextToken
     * member. If more results are available, the NextToken member of the
     * response contains a token that you pass in the next call to
     * ListLunaClients to retrieve the next set of items.
     *

     *
     * @param listLunaClientsRequest
     * @return Result of the ListLunaClients operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.ListLunaClients
     */
    @Override
    public ListLunaClientsResult listLunaClients(
            ListLunaClientsRequest listLunaClientsRequest) {
        ExecutionContext executionContext = createExecutionContext(listLunaClientsRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<ListLunaClientsRequest> request = null;
        Response<ListLunaClientsResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new ListLunaClientsRequestMarshaller().marshall(super
                        .beforeMarshalling(listLunaClientsRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<ListLunaClientsResult> responseHandler = new JsonResponseHandler<ListLunaClientsResult>(
                    new ListLunaClientsResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    @Override
    public ListLunaClientsResult listLunaClients() {
        return listLunaClients(new ListLunaClientsRequest());
    }

    /**
     *

     * Returns a list of all tags for the specified resource.
     *

     *
     * @param listTagsForResourceRequest
     * @return Result of the ListTagsForResource operation returned by the
     *         service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.ListTagsForResource
     */
    @Override
    public ListTagsForResourceResult listTagsForResource(
            ListTagsForResourceRequest listTagsForResourceRequest) {
        ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<ListTagsForResourceRequest> request = null;
        Response<ListTagsForResourceResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new ListTagsForResourceRequestMarshaller()
                        .marshall(super
                                .beforeMarshalling(listTagsForResourceRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<ListTagsForResourceResult> responseHandler = new JsonResponseHandler<ListTagsForResourceResult>(
                    new ListTagsForResourceResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Modifies an existing high-availability partition group.
     *

     *
     * @param modifyHapgRequest
     * @return Result of the ModifyHapg operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.ModifyHapg
     */
    @Override
    public ModifyHapgResult modifyHapg(ModifyHapgRequest modifyHapgRequest) {
        ExecutionContext executionContext = createExecutionContext(modifyHapgRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<ModifyHapgRequest> request = null;
        Response<ModifyHapgResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new ModifyHapgRequestMarshaller().marshall(super
                        .beforeMarshalling(modifyHapgRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<ModifyHapgResult> responseHandler = new JsonResponseHandler<ModifyHapgResult>(
                    new ModifyHapgResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Modifies an HSM.
     *

     * <important>
     *

     * This operation can result in the HSM being offline for up to 15 minutes
     * while the AWS CloudHSM service is reconfigured. If you are modifying a
     * production HSM, you should ensure that your AWS CloudHSM service is
     * configured for high availability, and consider executing this operation
     * during a maintenance window.
     *

     * </important>
     *
     * @param modifyHsmRequest
     *        Contains the inputs for the ModifyHsm operation.
     * @return Result of the ModifyHsm operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.ModifyHsm
     */
    @Override
    public ModifyHsmResult modifyHsm(ModifyHsmRequest modifyHsmRequest) {
        ExecutionContext executionContext = createExecutionContext(modifyHsmRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<ModifyHsmRequest> request = null;
        Response<ModifyHsmResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new ModifyHsmRequestMarshaller().marshall(super
                        .beforeMarshalling(modifyHsmRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<ModifyHsmResult> responseHandler = new JsonResponseHandler<ModifyHsmResult>(
                    new ModifyHsmResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Modifies the certificate used by the client.
     *

     *

     * This action can potentially start a workflow to install the new
     * certificate on the client's HSMs.
     *

     *
     * @param modifyLunaClientRequest
     * @return Result of the ModifyLunaClient operation returned by the service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @sample AWSCloudHSM.ModifyLunaClient
     */
    @Override
    public ModifyLunaClientResult modifyLunaClient(
            ModifyLunaClientRequest modifyLunaClientRequest) {
        ExecutionContext executionContext = createExecutionContext(modifyLunaClientRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<ModifyLunaClientRequest> request = null;
        Response<ModifyLunaClientResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new ModifyLunaClientRequestMarshaller()
                        .marshall(super
                                .beforeMarshalling(modifyLunaClientRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<ModifyLunaClientResult> responseHandler = new JsonResponseHandler<ModifyLunaClientResult>(
                    new ModifyLunaClientResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     *

     * Removes one or more tags from the specified resource.
     *

     *

     * To remove a tag, specify only the tag key to remove (not the value). To
     * overwrite the value for an existing tag, use AddTagsToResource.
     *

     *
     * @param removeTagsFromResourceRequest
     * @return Result of the RemoveTagsFromResource operation returned by the
     *         service.
     * @throws CloudHsmServiceException
     *         Indicates that an exception occurred in the AWS CloudHSM service.
     * @throws CloudHsmInternalException
     *         Indicates that an internal error occurred.
     * @throws InvalidRequestException
     *         Indicates that one or more of the request parameters are not
     *         valid.
     * @sample AWSCloudHSM.RemoveTagsFromResource
     */
    @Override
    public RemoveTagsFromResourceResult removeTagsFromResource(
            RemoveTagsFromResourceRequest removeTagsFromResourceRequest) {
        ExecutionContext executionContext = createExecutionContext(removeTagsFromResourceRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<RemoveTagsFromResourceRequest> request = null;
        Response<RemoveTagsFromResourceResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new RemoveTagsFromResourceRequestMarshaller()
                        .marshall(super
                                .beforeMarshalling(removeTagsFromResourceRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            JsonResponseHandler<RemoveTagsFromResourceResult> responseHandler = new JsonResponseHandler<RemoveTagsFromResourceResult>(
                    new RemoveTagsFromResourceResultJsonUnmarshaller());
            responseHandler.setIsPayloadJson(true);
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }

    /**
     * Returns additional metadata for a previously executed successful,
     * request, typically used for debugging issues where a service isn't acting
     * as expected. This data isn't considered part of the result data returned
     * by an operation, so it's available through this separate, diagnostic
     * interface.
     *

     * Response metadata is only cached for a limited period of time, so if you
     * need to access this extra diagnostic information for an executed request,
     * you should use this method to retrieve it as soon as possible after
     * executing the request.
     *
     * @param request
     *        The originally executed request
     *
     * @return The response metadata for the specified request, or null if none
     *         is available.
     */
    public ResponseMetadata getCachedResponseMetadata(
            AmazonWebServiceRequest request) {
        return client.getResponseMetadataForRequest(request);
    }

    private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(
            Request<Y> request,
            HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
            ExecutionContext executionContext) {
        request.setEndpoint(endpoint);
        request.setTimeOffset(timeOffset);

        AWSRequestMetrics awsRequestMetrics = executionContext
                .getAwsRequestMetrics();
        AWSCredentials credentials;
        awsRequestMetrics.startEvent(Field.CredentialsRequestTime);
        try {
            credentials = awsCredentialsProvider.getCredentials();
        } finally {
            awsRequestMetrics.endEvent(Field.CredentialsRequestTime);
        }

        AmazonWebServiceRequest originalRequest = request.getOriginalRequest();
        if (originalRequest != null
                && originalRequest.getRequestCredentials() != null) {
            credentials = originalRequest.getRequestCredentials();
        }

        executionContext.setCredentials(credentials);

        JsonErrorResponseHandlerV2 errorResponseHandler = new JsonErrorResponseHandlerV2(
                jsonErrorUnmarshallers);

        return client.execute(request, responseHandler, errorResponseHandler,
                executionContext);
    }

}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package td.adventure.interactions;

/**
 *
 * @author Jacob Aimino
 */
public interface Openable {

    public boolean open();
    public boolean close();

}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="#xslt"?>
<!DOCTYPE xsl:stylesheet [<!ATTLIST xsl:stylesheet id ID #IMPLIED>]>
<xsl:stylesheet id="xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="xsl:template">
<result>
<xsl:choose>
<xsl:when test='//lambda[starts-with(@string,"tr")][@xml:lang="en-US"][@xml:id="id1"]/eta[not(following-sibling::*)]/alpha[@xml:lang="no-nb"][not(preceding-sibling::*)][following-sibling::beta[@xml:id="id2"][not(following-sibling::*)]//lambda[@xml:lang="en-US"][not(preceding-sibling::*)][not(following-sibling::*)]/rho[contains(@true,"l")][@xml:lang="nb"][@xml:id="id3"][not(following-sibling::*)]]'>
	<xsl:value-of select="'PASS'"/>
</xsl:when>
<xsl:otherwise>FAIL</xsl:otherwise>
</xsl:choose>
</result>
<xsl:if test="false()">
<lambda string="true" xml:lang="en-US" xml:id="id1"><eta><alpha xml:lang="no-nb"/><beta xml:id="id2"><lambda xml:lang="en-US"><rho true="_blank" xml:lang="nb" xml:id="id3"><green>This text must be green</green></rho></lambda></beta></eta></lambda></xsl:if>
</xsl:template>
</xsl:stylesheet>


text:
package com.cloudera.flume.reporter.histogram;

import java.io.IOException;
import java.util.Collection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.cloudera.flume.conf.Context;
import com.cloudera.flume.conf.SinkFactory.SinkBuilder;
import com.cloudera.flume.core.Event;
import com.cloudera.flume.core.EventSink;
import com.cloudera.flume.reporter.MultiReporter;
import com.cloudera.flume.reporter.builder.SimpleRegexReporterBuilder;
import com.google.common.base.Preconditions;

/**
 * This takes a regex and a group index and generates a histogram based on the
 * value extracted. Values that do not match are not counted.
 *
 * For example: the group index and regex combo of: 3, (\d+):(\d+):(\d+)
 *
 * for the following values: 123:456:789, abc:def:xyz, 11:22:33, 55:66:33
 *
 * would result in a histogram with (value, count) : (789, 1), (33,2).
 *
 * NOTE: the NFA-based regex algorithm used by java.util.regex.* (and in this
 * class) is slow and does not scale. It is fully featured but has an
 * exponential worst case running time. This will be replaced with a faster but
 * more memory hungry and less featured DFA-based regex algorithm. (We will lose
 * capture groups).
 */
public class RegexGroupHistogramSink extends HistogramSink {
  Pattern pat;
  int grp;

  public RegexGroupHistogramSink(String name, Pattern pat, int grp) {
    super(name);
    this.pat = pat;
    this.grp = grp;
  }

  @Override
  public String extract(Event e) {
    String s = new String(e.getBody());
    Matcher m = pat.matcher(s);
    if (m.find()) {
      return m.group(grp);
    }
    return null;
  }

  public static SinkBuilder builder() {
    return new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        Preconditions.checkArgument(argv.length == 1,
            "usage: regexhistospec(regexspecfile)");

        String fname = argv[0];
        SimpleRegexReporterBuilder srrb = new SimpleRegexReporterBuilder(fname);
        Collection<RegexGroupHistogramSink> sinks;
        try {
          sinks = srrb.load();
        } catch (IOException e) {
          throw new IllegalArgumentException(
              "Failed to create regex report from spec file " + fname + ": "
                  + e);
        }
        if (sinks.size() == 1)
          return sinks.iterator().next();

        EventSink snk = new MultiReporter(fname, sinks);
        return snk;
      }
    };
  }

  public static SinkBuilder builderSimple() {
    return new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        Preconditions.checkArgument(argv.length == 3,
            "usage: regexhisto(name, regex, idx)");

        String name = argv[0];
        String regex = argv[1];
        Integer idx = Integer.parseInt(argv[2]);
        Pattern pat = Pattern.compile(regex);

        EventSink snk = new RegexGroupHistogramSink(name, pat, idx);
        return snk;

      }
    };
  }

}


text:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.worldbank.armm.app">

    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus"/>
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />

    <uses-permission android:name="android.permission.CAMERA" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />

    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

    <application
        android:name=".Application"
        android:allowBackup="true"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:icon="@drawable/ic_launcher">

        <meta-data
            android:name="API_SERVER"
            android:value="http://opened.urls.ph" />
        <meta-data
            android:name="AA_DB_NAME"
            android:value="ARMM.db" />
        <meta-data
            android:name="AA_DB_VERSION"
            android:value="5" />
        <meta-data
            android:name="com.crashlytics.ApiKey"
            android:value="d6bb9a202bd8401a4abb6aad025f9eb9686dcc17" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyA-wi-yR8wCNiY-sb5fUMgQtsz9hAQT5AE" />
        <meta-data android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <uses-library android:name="com.google.android.maps"/>

        <activity
            android:name=".activities.MainActivity"
            android:label="@string/app_name"
            android:configChanges="keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.SEARCH" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".activities.AboutActivity"
            android:label="@string/app_name"
            android:configChanges="keyboardHidden|orientation|screenSize">
        </activity>

        <activity
            android:name=".activities.LoginTabActivity"
            android:label="@string/app_name"
            android:configChanges="keyboardHidden|orientation|screenSize">
        </activity>

        <activity
            android:name=".activities.SurveyTabActivity"
            android:label="@string/app_name"
            android:configChanges="keyboardHidden|orientation|screenSize">
        </activity>

        <activity
            android:name=".activities.QuestionTabActivity"
            android:label="@string/question"
            android:configChanges="keyboardHidden|orientation|screenSize">
        </activity>

        <activity
            android:name=".activities.AnswerListActivity"
            android:label="@string/answers"
            android:configChanges="keyboardHidden|orientation|screenSize">
        </activity>

    </application>
</manifest>


text:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#C8CBCE" />
    <corners android:radius="2dip"/>
    <stroke
        android:width="0.5dip"
        android:color="#C8CBCE" />
</shape>


text:
package net.cinhtau.demo;

public class Employee {

    private int id;
    private String firstName;
    private String lastName;
    private Gender gender;
    private int salary;
    private int age;
    private Department department;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public Gender getGender() {
        return gender;
    }

    public void setGender(Gender gender) {
        this.gender = gender;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        StringBuilder sb = new StringBuilder();
        sb.append(this.lastName);
        sb.append(", ");
        sb.append(this.firstName);
        return sb.toString();
    }

    public boolean isMale() {
        return this.gender == Gender.MALE;
    }

    public boolean isFemale() {
        return this.gender == Gender.FEMALE;
    }
}


text:
package rooms;

import java.io.File;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;

public class AudioClips
{

	public static void playSound()
	{

	}
		public static void main(String[] args)
		{

			File Clap = new File("C:\\Users\\kg137424\\Desktop\\JavaFinal\\Chad'sQuest\\src\\FF Victory.wav");
			PlaySound(Clap);

		}
		static void PlaySound(File Sound)
		{
			try
			{
				Clip clip = AudioSystem.getClip();
				clip.open(AudioSystem.getAudioInputStream(Sound));
				clip.start();

				Thread.sleep(clip.getMicrosecondLength()/1000);

			}catch(Exception e)
			{

			}

		}
	}


text:
"""
"""

__docformat__ = 'restructuredtext'

# argument spec template
#<name> = (
#    <id_as_positional>, <id_as_option>
#    {<ArgusmentParser.add_arguments_kwargs>}
#)

from ..cmdline.helpers import HelpAction, LogLevelAction

help = (
    'help', ('-h', '--help', '--help-np'),
    dict(nargs=0, action=HelpAction,
         help="""show this help message and exit. --help-np forcefully disables
                 the use of a pager for displaying the help.""")
)

version = (
    'version', ('--version',),
    dict(action='version',
         help="show program's version and license information and exit")
)

log_level = (
    'log-level', ('-l', '--log-level'),
    dict(action=LogLevelAction,
         choices=['critical', 'error', 'warning', 'info', 'debug'] + [str(x) for x in range(1, 10)],
         default='warning',
         help="""level of verbosity. Integers provide even more debugging information""")
)


text:
This constraint is used to make sure the data is a string that matches the regular expression.

## Creation

```js
new Sy.Validator.Constraint.Regex({
    pattern: 'regex pattern string', //required
    flags: 'regex flags string', //optional
    message: 'violation message', //optional
    groups: [], //optional, must be an array
});
```


text:
package com.mikepenz.anticon_typeface_library;

import android.content.Context;
import android.graphics.Typeface;

import com.mikepenz.iconics.typeface.IIcon;
import com.mikepenz.iconics.typeface.ITypeface;

import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;

public class AntIcon implements ITypeface {
    private static final String TTF_FILE = "anticon-font-v1.0.ttf";
    private static Typeface typeface = null;
    private static HashMap<String, Character> mChars;

    @Override
    public IIcon getIcon(String key) {
        return Icon.valueOf(key);
    }

    @Override
    public HashMap<String, Character> getCharacters() {
        if (mChars == null) {
            HashMap<String, Character> aChars = new HashMap<String, Character>();
            for (Icon v : Icon.values()) {
                aChars.put(v.name(), v.character);
            }
            mChars = aChars;
        }
        return mChars;
    }

    @Override
    public String getMappingPrefix() {
        return "ant";
    }

    @Override
    public String getFontName() {
        return "AntIcon";
    }

    @Override
    public String getVersion() {
        return "1.0";
    }

    @Override
    public int getIconCount() {
        return mChars.size();
    }

    @Override
    public Collection<String> getIcons() {
        Collection<String> icons = new LinkedList<String>();
        for (Icon value : Icon.values()) {
            icons.add(value.name());
        }
        return icons;
    }

    @Override
    public String getAuthor() {
        return "Acenosekai";
    }

    @Override
    public String getUrl() {
        return "ant.acenosekai.com";
    }

    @Override
    public String getDescription() {
        return "ant player icon";
    }

    @Override
    public String getLicense() {
        return "Apache 2.0";
    }

    @Override
    public String getLicenseUrl() {
        return "ant.acenosekai.com";
    }

    @Override
    public Typeface getTypeface(Context context) {
        if (typeface == null) {
            try {
                typeface = Typeface.createFromAsset(context.getAssets(), "fonts/" + TTF_FILE);
            } catch (Exception e) {
                return null;
            }
        }
        return typeface;
    }

    public enum Icon implements IIcon {
        ant_cdOutlinesvg('\ue900');

        char character;

        Icon(char character) {
            this.character = character;
        }

        public String getFormattedName() {
            return "{" + name() + "}";
        }

        public char getCharacter() {
            return character;
        }

        public String getName() {
            return name();
        }

        // remember the typeface so we can use it later
        private static ITypeface typeface;

        public ITypeface getTypeface() {
            if (typeface == null) {
                typeface = new AntIcon();
            }
            return typeface;
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HackerRank.ProjectEuler
{
    /// <summary>
    /// Project Euler #3: Largest prime factor
    /// </summary>
    /// <see href="https://www.hackerrank.com/contests/projecteuler/challenges/euler003"/>
    public class ProjectEuler003
    {
        static ulong CalculateLargestPrimeFactor(ulong n)
        {
            ulong d = 2;
            var factors = new List<ulong>();

            while (d <= Math.Sqrt(n))
            {
                while (n % d == 0)
                {
                    n /= d;
                    factors.Add(d);
                }
                d++;
            }
            factors.Add(n);

            return factors.Max();
        }
        public void Main()
        {
            int T = Convert.ToInt32(Console.ReadLine());
            for (int i = 0; i < T; i++)
            {
                ulong N = Convert.ToUInt64(Console.ReadLine());
                ulong sum = CalculateLargestPrimeFactor(N);
                Console.WriteLine(sum.ToString());
            }
        }

        public List<string> Main(List<string> args)
        {
            var result = new List<string>();
            int T = Convert.ToInt32(args[0]);
            for (int i = 0; i < T; i++)
            {
                ulong N = Convert.ToUInt64(args[i + 1]);
                ulong sum = CalculateLargestPrimeFactor(N);
                result.Add((sum).ToString());
            }
            return result;
        }

    }
}


text:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

import { UserEditPage } from '../../pages/user/edit';

import {Http} from '@angular/http';
import 'rxjs/add/operator/map';

@Component({
	templateUrl: 'profile.html'
})

export class UserProfilePage {

	profile: any;
	pgEdit: any;

	constructor(public navCtrl: NavController, private http: Http) {
	}

	ngOnInit(){
		this.profile = {
			name: 'Fulano de tal',
			email: 'fulano@detal.com',
			phone: '43333-3333',
			street: 'rua tal',
			number: '12',
			district: 'bairro x',
			city: 'Uberaba',
			state: 'MG',
		};
		this.pgEdit = UserEditPage;
	}

    openPage(component){
		this.navCtrl.push(component);
    }
}


text:
package ch.heigvd.amt.selenium;

import ch.heigvd.amt.selenium.pages.CreateAppPage;
import ch.heigvd.amt.selenium.pages.EditAppPage;
import ch.heigvd.amt.selenium.pages.EditProfilePage;
import ch.heigvd.amt.selenium.pages.HomePage;
import ch.heigvd.amt.selenium.pages.ListUsersPage;
import ch.heigvd.amt.selenium.pages.LoginPage;
import ch.heigvd.amt.selenium.pages.RegistrationPage;
import io.probedock.client.annotations.ProbeTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

/**
 * @author Mario Ferreira (mario.ferreira@heig-vd.ch)
 */
public class MoussaRaserTest {

    private final String baseUrl = "http://localhost:8080/MoussaRaser/";
    private WebDriver driver;

    @Before
    public void openBrowser() {
        driver = new FirefoxDriver();
    }

    //--------------------------------------------------------------------------
    // Registration page
    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldCorrectlyCreateAccount() {
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("thibaud.duchoud@heig-vd.ch");
        registrationPage.typeFName("Thibaud");
        registrationPage.typeLName("Duchoud");
        registrationPage.typeRPassword("4321");
        registrationPage.typePassword("4321");
        LoginPage loginPage = (LoginPage) registrationPage.submitForm(LoginPage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToCreateAccountWithoutFName() {
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("thibaud.duchoud1@heig-vd.ch");
        registrationPage.typeLName("Duchoud");
        registrationPage.typeRPassword("4321");
        registrationPage.typePassword("4321");
        RegistrationPage registrationPageF = (RegistrationPage) registrationPage.submitForm(RegistrationPage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToCreateAccountWithoutLName() {
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("thibaud.duchoud2@heig-vd.ch");
        registrationPage.typeFName("Thibaud");
        registrationPage.typeRPassword("4321");
        registrationPage.typePassword("4321");
        RegistrationPage registrationPageF = (RegistrationPage) registrationPage.submitForm(RegistrationPage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToCreateAccountWithoutEmail() {
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeFName("Thibaud");
        registrationPage.typeLName("Duchoud");
        registrationPage.typeRPassword("4321");
        registrationPage.typePassword("4321");
        RegistrationPage registrationPageF = (RegistrationPage) registrationPage.submitForm(RegistrationPage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToCreateAccount2DifferentPasswords() {
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("thibaud.duchoud3@heig-vd.ch");
        registrationPage.typeFName("Thibaud");
        registrationPage.typeLName("Duchoud");
        registrationPage.typeRPassword("4321");
        registrationPage.typePassword("1234");
        RegistrationPage registrationPageF = (RegistrationPage) registrationPage.submitForm(RegistrationPage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToCreateAccountWithoutPassword() {
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("thibaud.duchoud4@heig-vd.ch");
        registrationPage.typeFName("Thibaud");
        registrationPage.typeLName("Duchoud");
        RegistrationPage registrationPageF = (RegistrationPage) registrationPage.submitForm(RegistrationPage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToCreateAccountWithExistantEmail() {
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPageTmp = new RegistrationPage(driver);
        registrationPageTmp.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPageTmp.typeFName("Mario");
        registrationPageTmp.typeLName("Ferreira");
        registrationPageTmp.typeRPassword("1234");
        registrationPageTmp.typePassword("1234");

        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");
        RegistrationPage registrationPageF = (RegistrationPage) registrationPage.submitForm(RegistrationPage.class);
    }

    // -------------------------------------------------------------------------
    // Login Page
    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToSigninWithAnInvalidEmail() {
        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("this is not a valid email address");
        loginPage.typePassword("any password");
        loginPage.submitFormExpectingFailure();
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void successfulSigninShouldBringUserToHomePage() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        HomePage homePage = (HomePage) loginPage.submitForm(HomePage.class);
    }

    // -------------------------------------------------------------------------
    // Edit profile page
    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldModifyProfile() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        loginPage.submitForm(HomePage.class);

        driver.get(baseUrl + "editProfile");
        EditProfilePage editProfilePage = new EditProfilePage(driver);
        editProfilePage.typeFName("Mario");
        editProfilePage.typeLName("Ferreira");
        editProfilePage.typeRPassword("5678");
        editProfilePage.typePassword("5678");
        HomePage homePage = (HomePage) editProfilePage.submitForm(HomePage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToModifyAccount2DifferentPasswords() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        loginPage.submitForm(HomePage.class);

        driver.get(baseUrl + "editProfile");
        EditProfilePage editProfilePage = new EditProfilePage(driver);
        editProfilePage.typeFName("Mario");
        editProfilePage.typeLName("Ferreira");
        editProfilePage.typeRPassword("5678");
        editProfilePage.typePassword("8765");
        EditProfilePage editProfilePageF = (EditProfilePage) editProfilePage.submitForm(EditProfilePage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToModifyAccountWithoutFName() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        loginPage.submitForm(HomePage.class);

        driver.get(baseUrl + "editProfile");
        EditProfilePage editProfilePage = new EditProfilePage(driver);
        editProfilePage.typeLName("Ferreira");
        editProfilePage.typeRPassword("5678");
        editProfilePage.typePassword("5678");
        EditProfilePage editProfilePageF = (EditProfilePage) editProfilePage.submitForm(EditProfilePage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToModifyAccountWithoutLName() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        loginPage.submitForm(HomePage.class);

        driver.get(baseUrl + "editProfile");
        EditProfilePage editProfilePage = new EditProfilePage(driver);
        editProfilePage.typeFName("Mario");
        editProfilePage.typeRPassword("5678");
        editProfilePage.typePassword("5678");
        EditProfilePage editProfilePageF = (EditProfilePage) editProfilePage.submitForm(EditProfilePage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToModifyAccountWithoutPassword() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        loginPage.submitForm(HomePage.class);

        driver.get(baseUrl + "editProfile");
        EditProfilePage editProfilePage = new EditProfilePage(driver);
        editProfilePage.typeFName("Mario");
        editProfilePage.typeLName("Ferreira");
        EditProfilePage editProfilePageF = (EditProfilePage) editProfilePage.submitForm(EditProfilePage.class);
    }

    //----------------------------------------------------------------------------
    // Create App
    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldCreateApp() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        loginPage.submitForm(HomePage.class);

        driver.get(baseUrl + "addApp");
        CreateAppPage createAppPage = new CreateAppPage(driver);
        createAppPage.typeDescription("Test Description");
        createAppPage.typeName("Test Name");
        HomePage homePage = (HomePage) createAppPage.submitForm(HomePage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToCreateAppWithoutName() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        loginPage.submitForm(HomePage.class);

        driver.get(baseUrl + "addApp");
        CreateAppPage createAppPage = new CreateAppPage(driver);
        createAppPage.typeDescription("Test Description");
        CreateAppPage createAppPageF = (CreateAppPage) createAppPage.submitForm(CreateAppPage.class);
    }

    //--------------------------------------------------------------------------
    // Edit App
    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldModifyApp() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        loginPage.submitForm(HomePage.class);

        driver.get(baseUrl + "editApp");
        EditAppPage editAppPage = new EditAppPage(driver);
        editAppPage.typeDescription("Test Description");
        editAppPage.typeName("Test Name");
        HomePage homePage = (HomePage) editAppPage.submitForm(HomePage.class);
    }

    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldNotBePossibleToModifyAppWithoutName() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        loginPage.submitForm(HomePage.class);

        driver.get(baseUrl + "addApp");
        EditAppPage editAppPage = new EditAppPage(driver);
        editAppPage.typeDescription("Test Description");
        EditAppPage editAppPageF = (EditAppPage) editAppPage.submitForm(EditAppPage.class);
    }

    //--------------------------------------------------------------------------
    // Logout
    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldLogout() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        loginPage.submitForm(HomePage.class);

        driver.get(baseUrl + "home");
        HomePage homePage = new HomePage(driver);
        LoginPage loginPageC = (LoginPage) homePage.submitLogout(LoginPage.class);
    }

    //--------------------------------------------------------------------------
    // Users List
    @Test
    @ProbeTest(tags = "WebUI")
    public void itShouldDisplayListUsers() {
        // Create account
        driver.get(baseUrl + "registrationPage");
        RegistrationPage registrationPage = new RegistrationPage(driver);
        registrationPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        registrationPage.typeFName("Mario");
        registrationPage.typeLName("Ferreira");
        registrationPage.typeRPassword("1234");
        registrationPage.typePassword("1234");

        driver.get(baseUrl);
        LoginPage loginPage = new LoginPage(driver);
        loginPage.typeEmailAddress("mario.ferreira@heig-vd.ch");
        loginPage.typePassword("1234");
        loginPage.submitForm(HomePage.class);

        driver.get(baseUrl + "home");
        HomePage homePage = new HomePage(driver);
        ListUsersPage listUsersPage = (ListUsersPage) homePage.submitListUsers(ListUsersPage.class);
    }

    @After
    public void closeBrowser() {
        driver.close();
    }
}


text:
<?php

// this example lists all of your websites and the products within those websites

require "config.php";
require "../lib/DPDCartApi.class.php";

$dpd = new DPDCartApi(DPD_CART_USER, DPD_CART_KEY);

$websites = $dpd->listWebsites();
$first_product_id = null;

echo "You have ".count($websites)." websites in your account:\n";

foreach($websites as $i => $website)
{
  $products = $dpd->listProducts($website["id"]);
  echo "\t\"{$website['id']}: {$website['name']}\" has ".count($products)." product(s):\n";

  foreach($products as $product)
  {
    if($first_product_id == null)
      $first_product_id = $product['id'];
    echo "\t\t{$product['id']}: {$product['name']}\n";
  }

  echo "\n";
}


text:
package com.opengamma.financial.analytics.model.sabr;

import static com.opengamma.engine.value.ValueRequirementNames.BLOCK_CURVE_SENSITIVITIES;
import static com.opengamma.financial.analytics.model.sabr.SABRPropertyValues.NO_EXTRAPOLATION;

import java.util.HashSet;
import java.util.Set;

import org.threeten.bp.Instant;

import com.opengamma.analytics.financial.forex.method.FXMatrix;
import com.opengamma.analytics.financial.interestrate.InstrumentDerivative;
import com.opengamma.analytics.financial.interestrate.InstrumentDerivativeVisitor;
import com.opengamma.analytics.financial.provider.calculator.generic.MarketQuoteSensitivityBlockCalculator;
import com.opengamma.analytics.financial.provider.calculator.sabrswaption.PresentValueCurveSensitivitySABRSwaptionCalculator;
import com.opengamma.analytics.financial.provider.curve.CurveBuildingBlockBundle;
import com.opengamma.analytics.financial.provider.description.interestrate.SABRSwaptionProvider;
import com.opengamma.analytics.financial.provider.description.interestrate.SABRSwaptionProviderInterface;
import com.opengamma.analytics.financial.provider.sensitivity.multicurve.MultipleCurrencyMulticurveSensitivity;
import com.opengamma.analytics.financial.provider.sensitivity.multicurve.MultipleCurrencyParameterSensitivity;
import com.opengamma.analytics.financial.provider.sensitivity.parameter.ParameterSensitivityParameterCalculator;
import com.opengamma.engine.ComputationTarget;
import com.opengamma.engine.function.CompiledFunctionDefinition;
import com.opengamma.engine.function.FunctionCompilationContext;
import com.opengamma.engine.function.FunctionExecutionContext;
import com.opengamma.engine.function.FunctionInputs;
import com.opengamma.engine.value.ComputedValue;
import com.opengamma.engine.value.ValueRequirement;
import com.opengamma.engine.value.ValueSpecification;
import com.opengamma.financial.convention.daycount.DayCount;
import com.opengamma.financial.convention.daycount.DayCounts;

/**
 *
 */
public class NoExtrapolationSABRDiscountingBCSFunction extends SABRDiscountingFunction {
  /** The curve sensitivity calculator */
  private static final InstrumentDerivativeVisitor<SABRSwaptionProviderInterface, MultipleCurrencyMulticurveSensitivity> PVCSDC =
      PresentValueCurveSensitivitySABRSwaptionCalculator.getInstance();
  /** The parameter sensitivity calculator */
  private static final ParameterSensitivityParameterCalculator<SABRSwaptionProviderInterface> PSC = new ParameterSensitivityParameterCalculator<>(PVCSDC);
  /** The market quote sensitivity calculator */
  private static final MarketQuoteSensitivityBlockCalculator<SABRSwaptionProviderInterface> CALCULATOR = new MarketQuoteSensitivityBlockCalculator<>(PSC);

  /**
   * Sets the value requirements to {@link com.opengamma.engine.value.ValueRequirementNames#BLOCK_CURVE_SENSITIVITIES}.
   */
  public NoExtrapolationSABRDiscountingBCSFunction() {
    super(BLOCK_CURVE_SENSITIVITIES);
  }

  @Override
  public CompiledFunctionDefinition compile(final FunctionCompilationContext context, final Instant atInstant) {
    return new SABRDiscountingCompiledFunction(getTargetToDefinitionConverter(context), getDefinitionToDerivativeConverter(context), false) {

      @Override
      protected Set<ComputedValue> getValues(final FunctionExecutionContext executionContext, final FunctionInputs inputs,
          final ComputationTarget target, final Set<ValueRequirement> desiredValues, final InstrumentDerivative derivative,
          final FXMatrix fxMatrix) {
        final Set<ComputedValue> result = new HashSet<>();
        final DayCount dayCount = DayCounts.ACT_360; // TODO
        final SABRSwaptionProvider sabrData = getSABRSurfaces(executionContext, inputs, target, fxMatrix, dayCount);
        final CurveBuildingBlockBundle blocks = getMergedCurveBuildingBlocks(inputs);
        final MultipleCurrencyParameterSensitivity sensitivities = CALCULATOR.fromInstrument(derivative, sabrData, blocks);
        for (final ValueRequirement desiredValue : desiredValues) {
          final ValueSpecification spec = new ValueSpecification(BLOCK_CURVE_SENSITIVITIES, target.toSpecification(),
              desiredValue.getConstraints().copy().get());
          result.add(new ComputedValue(spec, sensitivities));
        }
        return result;
      }

      @Override
      protected String getCalculationMethod() {
        return NO_EXTRAPOLATION;
      }
    };
  }

}


text:
import facebook.handlers
import firenado.tornadoweb
import tornado

class FacebookComponent(firenado.tornadoweb.TornadoComponent):

    def get_handlers(self):
        return [
            (r'/', facebook.handlers.MainHandler),
            (r"/auth/login", facebook.handlers.AuthLoginHandler),
            (r"/auth/logout", facebook.handlers.AuthLogoutHandler),
        ]

    def get_ui_modules(self):
        return {"Post": PostModule}

class PostModule(tornado.web.UIModule):
    def render(self, post):
        return self.render_string("modules/post.html", post=post)