text:
package com.amazonaws.services.cloudhsm;

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

/**
 * Interface for accessing CloudHSM asynchronously. Each asynchronous method
 * will return a Java Future object representing the asynchronous operation;
 * overloads which accept an {@code AsyncHandler} can be used to receive
 * notification when an asynchronous operation completes.
 *

 * <fullname>AWS CloudHSM Service</fullname>
 */
public interface AWSCloudHSMAsync extends AWSCloudHSM {

    /**
     *

     * 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 A Java Future containing the result of the AddTagsToResource
     *         operation returned by the service.
     * @sample AWSCloudHSMAsync.AddTagsToResource
     */
    java.util.concurrent.Future<AddTagsToResourceResult> addTagsToResourceAsync(
            AddTagsToResourceRequest addTagsToResourceRequest);

    /**
     *

     * 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
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the AddTagsToResource
     *         operation returned by the service.
     * @sample AWSCloudHSMAsyncHandler.AddTagsToResource
     */
    java.util.concurrent.Future<AddTagsToResourceResult> addTagsToResourceAsync(
            AddTagsToResourceRequest addTagsToResourceRequest,
            com.amazonaws.handlers.AsyncHandler<AddTagsToResourceRequest, AddTagsToResourceResult> asyncHandler);

    /**
     *

     * 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 A Java Future containing the result of the CreateHapg operation
     *         returned by the service.
     * @sample AWSCloudHSMAsync.CreateHapg
     */
    java.util.concurrent.Future<CreateHapgResult> createHapgAsync(
            CreateHapgRequest createHapgRequest);

    /**
     *

     * 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.
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the CreateHapg operation
     *         returned by the service.
     * @sample AWSCloudHSMAsyncHandler.CreateHapg
     */
    java.util.concurrent.Future<CreateHapgResult> createHapgAsync(
            CreateHapgRequest createHapgRequest,
            com.amazonaws.handlers.AsyncHandler<CreateHapgRequest, CreateHapgResult> asyncHandler);

    /**
     *

     * 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 A Java Future containing the result of the CreateHsm operation
     *         returned by the service.
     * @sample AWSCloudHSMAsync.CreateHsm
     */
    java.util.concurrent.Future<CreateHsmResult> createHsmAsync(
            CreateHsmRequest createHsmRequest);

    /**
     *

     * 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.
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the CreateHsm operation
     *         returned by the service.
     * @sample AWSCloudHSMAsyncHandler.CreateHsm
     */
    java.util.concurrent.Future<CreateHsmResult> createHsmAsync(
            CreateHsmRequest createHsmRequest,
            com.amazonaws.handlers.AsyncHandler<CreateHsmRequest, CreateHsmResult> asyncHandler);

    /**
     *

     * Creates an HSM client.
     *

     *
     * @param createLunaClientRequest
     *        Contains the inputs for the CreateLunaClient action.
     * @return A Java Future containing the result of the CreateLunaClient
     *         operation returned by the service.
     * @sample AWSCloudHSMAsync.CreateLunaClient
     */
    java.util.concurrent.Future<CreateLunaClientResult> createLunaClientAsync(
            CreateLunaClientRequest createLunaClientRequest);

    /**
     *

     * Creates an HSM client.
     *

     *
     * @param createLunaClientRequest
     *        Contains the inputs for the CreateLunaClient action.
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the CreateLunaClient
     *         operation returned by the service.
     * @sample AWSCloudHSMAsyncHandler.CreateLunaClient
     */
    java.util.concurrent.Future<CreateLunaClientResult> createLunaClientAsync(
            CreateLunaClientRequest createLunaClientRequest,
            com.amazonaws.handlers.AsyncHandler<CreateLunaClientRequest, CreateLunaClientResult> asyncHandler);

    /**
     *

     * Deletes a high-availability partition group.
     *

     *
     * @param deleteHapgRequest
     *        Contains the inputs for the DeleteHapg action.
     * @return A Java Future containing the result of the DeleteHapg operation
     *         returned by the service.
     * @sample AWSCloudHSMAsync.DeleteHapg
     */
    java.util.concurrent.Future<DeleteHapgResult> deleteHapgAsync(
            DeleteHapgRequest deleteHapgRequest);

    /**
     *

     * Deletes a high-availability partition group.
     *

     *
     * @param deleteHapgRequest
     *        Contains the inputs for the DeleteHapg action.
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the DeleteHapg operation
     *         returned by the service.
     * @sample AWSCloudHSMAsyncHandler.DeleteHapg
     */
    java.util.concurrent.Future<DeleteHapgResult> deleteHapgAsync(
            DeleteHapgRequest deleteHapgRequest,
            com.amazonaws.handlers.AsyncHandler<DeleteHapgRequest, DeleteHapgResult> asyncHandler);

    /**
     *

     * 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 A Java Future containing the result of the DeleteHsm operation
     *         returned by the service.
     * @sample AWSCloudHSMAsync.DeleteHsm
     */
    java.util.concurrent.Future<DeleteHsmResult> deleteHsmAsync(
            DeleteHsmRequest deleteHsmRequest);

    /**
     *

     * 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.
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the DeleteHsm operation
     *         returned by the service.
     * @sample AWSCloudHSMAsyncHandler.DeleteHsm
     */
    java.util.concurrent.Future<DeleteHsmResult> deleteHsmAsync(
            DeleteHsmRequest deleteHsmRequest,
            com.amazonaws.handlers.AsyncHandler<DeleteHsmRequest, DeleteHsmResult> asyncHandler);

    /**
     *

     * Deletes a client.
     *

     *
     * @param deleteLunaClientRequest
     * @return A Java Future containing the result of the DeleteLunaClient
     *         operation returned by the service.
     * @sample AWSCloudHSMAsync.DeleteLunaClient
     */
    java.util.concurrent.Future<DeleteLunaClientResult> deleteLunaClientAsync(
            DeleteLunaClientRequest deleteLunaClientRequest);

    /**
     *

     * Deletes a client.
     *

     *
     * @param deleteLunaClientRequest
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the DeleteLunaClient
     *         operation returned by the service.
     * @sample AWSCloudHSMAsyncHandler.DeleteLunaClient
     */
    java.util.concurrent.Future<DeleteLunaClientResult> deleteLunaClientAsync(
            DeleteLunaClientRequest deleteLunaClientRequest,
            com.amazonaws.handlers.AsyncHandler<DeleteLunaClientRequest, DeleteLunaClientResult> asyncHandler);

    /**
     *

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

     *
     * @param describeHapgRequest
     *        Contains the inputs for the DescribeHapg action.
     * @return A Java Future containing the result of the DescribeHapg operation
     *         returned by the service.
     * @sample AWSCloudHSMAsync.DescribeHapg
     */
    java.util.concurrent.Future<DescribeHapgResult> describeHapgAsync(
            DescribeHapgRequest describeHapgRequest);

    /**
     *

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

     *
     * @param describeHapgRequest
     *        Contains the inputs for the DescribeHapg action.
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the DescribeHapg operation
     *         returned by the service.
     * @sample AWSCloudHSMAsyncHandler.DescribeHapg
     */
    java.util.concurrent.Future<DescribeHapgResult> describeHapgAsync(
            DescribeHapgRequest describeHapgRequest,
            com.amazonaws.handlers.AsyncHandler<DescribeHapgRequest, DescribeHapgResult> asyncHandler);

    /**
     *

     * 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 A Java Future containing the result of the DescribeHsm operation
     *         returned by the service.
     * @sample AWSCloudHSMAsync.DescribeHsm
     */
    java.util.concurrent.Future<DescribeHsmResult> describeHsmAsync(
            DescribeHsmRequest describeHsmRequest);

    /**
     *

     * 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.
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the DescribeHsm operation
     *         returned by the service.
     * @sample AWSCloudHSMAsyncHandler.DescribeHsm
     */
    java.util.concurrent.Future<DescribeHsmResult> describeHsmAsync(
            DescribeHsmRequest describeHsmRequest,
            com.amazonaws.handlers.AsyncHandler<DescribeHsmRequest, DescribeHsmResult> asyncHandler);

    /**
     * Simplified method form for invoking the DescribeHsm operation.
     *
     * @see #describeHsmAsync(DescribeHsmRequest)
     */
    java.util.concurrent.Future<DescribeHsmResult> describeHsmAsync();

    /**
     * Simplified method form for invoking the DescribeHsm operation with an
     * AsyncHandler.
     *
     * @see #describeHsmAsync(DescribeHsmRequest,
     *      com.amazonaws.handlers.AsyncHandler)
     */
    java.util.concurrent.Future<DescribeHsmResult> describeHsmAsync(
            com.amazonaws.handlers.AsyncHandler<DescribeHsmRequest, DescribeHsmResult> asyncHandler);

    /**
     *

     * Retrieves information about an HSM client.
     *

     *
     * @param describeLunaClientRequest
     * @return A Java Future containing the result of the DescribeLunaClient
     *         operation returned by the service.
     * @sample AWSCloudHSMAsync.DescribeLunaClient
     */
    java.util.concurrent.Future<DescribeLunaClientResult> describeLunaClientAsync(
            DescribeLunaClientRequest describeLunaClientRequest);

    /**
     *

     * Retrieves information about an HSM client.
     *

     *
     * @param describeLunaClientRequest
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the DescribeLunaClient
     *         operation returned by the service.
     * @sample AWSCloudHSMAsyncHandler.DescribeLunaClient
     */
    java.util.concurrent.Future<DescribeLunaClientResult> describeLunaClientAsync(
            DescribeLunaClientRequest describeLunaClientRequest,
            com.amazonaws.handlers.AsyncHandler<DescribeLunaClientRequest, DescribeLunaClientResult> asyncHandler);

    /**
     * Simplified method form for invoking the DescribeLunaClient operation.
     *
     * @see #describeLunaClientAsync(DescribeLunaClientRequest)
     */
    java.util.concurrent.Future<DescribeLunaClientResult> describeLunaClientAsync();

    /**
     * Simplified method form for invoking the DescribeLunaClient operation with
     * an AsyncHandler.
     *
     * @see #describeLunaClientAsync(DescribeLunaClientRequest,
     *      com.amazonaws.handlers.AsyncHandler)
     */
    java.util.concurrent.Future<DescribeLunaClientResult> describeLunaClientAsync(
            com.amazonaws.handlers.AsyncHandler<DescribeLunaClientRequest, DescribeLunaClientResult> asyncHandler);

    /**
     *

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

     *
     * @param getConfigRequest
     * @return A Java Future containing the result of the GetConfig operation
     *         returned by the service.
     * @sample AWSCloudHSMAsync.GetConfig
     */
    java.util.concurrent.Future<GetConfigResult> getConfigAsync(
            GetConfigRequest getConfigRequest);

    /**
     *

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

     *
     * @param getConfigRequest
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the GetConfig operation
     *         returned by the service.
     * @sample AWSCloudHSMAsyncHandler.GetConfig
     */
    java.util.concurrent.Future<GetConfigResult> getConfigAsync(
            GetConfigRequest getConfigRequest,
            com.amazonaws.handlers.AsyncHandler<GetConfigRequest, GetConfigResult> asyncHandler);

    /**
     *

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

     *
     * @param listAvailableZonesRequest
     *        Contains the inputs for the ListAvailableZones action.
     * @return A Java Future containing the result of the ListAvailableZones
     *         operation returned by the service.
     * @sample AWSCloudHSMAsync.ListAvailableZones
     */
    java.util.concurrent.Future<ListAvailableZonesResult> listAvailableZonesAsync(
            ListAvailableZonesRequest listAvailableZonesRequest);

    /**
     *

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

     *
     * @param listAvailableZonesRequest
     *        Contains the inputs for the ListAvailableZones action.
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the ListAvailableZones
     *         operation returned by the service.
     * @sample AWSCloudHSMAsyncHandler.ListAvailableZones
     */
    java.util.concurrent.Future<ListAvailableZonesResult> listAvailableZonesAsync(
            ListAvailableZonesRequest listAvailableZonesRequest,
            com.amazonaws.handlers.AsyncHandler<ListAvailableZonesRequest, ListAvailableZonesResult> asyncHandler);

    /**
     * Simplified method form for invoking the ListAvailableZones operation.
     *
     * @see #listAvailableZonesAsync(ListAvailableZonesRequest)
     */
    java.util.concurrent.Future<ListAvailableZonesResult> listAvailableZonesAsync();

    /**
     * Simplified method form for invoking the ListAvailableZones operation with
     * an AsyncHandler.
     *
     * @see #listAvailableZonesAsync(ListAvailableZonesRequest,
     *      com.amazonaws.handlers.AsyncHandler)
     */
    java.util.concurrent.Future<ListAvailableZonesResult> listAvailableZonesAsync(
            com.amazonaws.handlers.AsyncHandler<ListAvailableZonesRequest, ListAvailableZonesResult> asyncHandler);

    /**
     *

     * 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 A Java Future containing the result of the ListHapgs operation
     *         returned by the service.
     * @sample AWSCloudHSMAsync.ListHapgs
     */
    java.util.concurrent.Future<ListHapgsResult> listHapgsAsync(
            ListHapgsRequest listHapgsRequest);

    /**
     *

     * 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
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the ListHapgs operation
     *         returned by the service.
     * @sample AWSCloudHSMAsyncHandler.ListHapgs
     */
    java.util.concurrent.Future<ListHapgsResult> listHapgsAsync(
            ListHapgsRequest listHapgsRequest,
            com.amazonaws.handlers.AsyncHandler<ListHapgsRequest, ListHapgsResult> asyncHandler);

    /**
     * Simplified method form for invoking the ListHapgs operation.
     *
     * @see #listHapgsAsync(ListHapgsRequest)
     */
    java.util.concurrent.Future<ListHapgsResult> listHapgsAsync();

    /**
     * Simplified method form for invoking the ListHapgs operation with an
     * AsyncHandler.
     *
     * @see #listHapgsAsync(ListHapgsRequest,
     *      com.amazonaws.handlers.AsyncHandler)
     */
    java.util.concurrent.Future<ListHapgsResult> listHapgsAsync(
            com.amazonaws.handlers.AsyncHandler<ListHapgsRequest, ListHapgsResult> asyncHandler);

    /**
     *

     * 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 A Java Future containing the result of the ListHsms operation
     *         returned by the service.
     * @sample AWSCloudHSMAsync.ListHsms
     */
    java.util.concurrent.Future<ListHsmsResult> listHsmsAsync(
            ListHsmsRequest listHsmsRequest);

    /**
     *

     * 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
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the ListHsms operation
     *         returned by the service.
     * @sample AWSCloudHSMAsyncHandler.ListHsms
     */
    java.util.concurrent.Future<ListHsmsResult> listHsmsAsync(
            ListHsmsRequest listHsmsRequest,
            com.amazonaws.handlers.AsyncHandler<ListHsmsRequest, ListHsmsResult> asyncHandler);

    /**
     * Simplified method form for invoking the ListHsms operation.
     *
     * @see #listHsmsAsync(ListHsmsRequest)
     */
    java.util.concurrent.Future<ListHsmsResult> listHsmsAsync();

    /**
     * Simplified method form for invoking the ListHsms operation with an
     * AsyncHandler.
     *
     * @see #listHsmsAsync(ListHsmsRequest, com.amazonaws.handlers.AsyncHandler)
     */
    java.util.concurrent.Future<ListHsmsResult> listHsmsAsync(
            com.amazonaws.handlers.AsyncHandler<ListHsmsRequest, ListHsmsResult> asyncHandler);

    /**
     *

     * 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 A Java Future containing the result of the ListLunaClients
     *         operation returned by the service.
     * @sample AWSCloudHSMAsync.ListLunaClients
     */
    java.util.concurrent.Future<ListLunaClientsResult> listLunaClientsAsync(
            ListLunaClientsRequest listLunaClientsRequest);

    /**
     *

     * 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
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the ListLunaClients
     *         operation returned by the service.
     * @sample AWSCloudHSMAsyncHandler.ListLunaClients
     */
    java.util.concurrent.Future<ListLunaClientsResult> listLunaClientsAsync(
            ListLunaClientsRequest listLunaClientsRequest,
            com.amazonaws.handlers.AsyncHandler<ListLunaClientsRequest, ListLunaClientsResult> asyncHandler);

    /**
     * Simplified method form for invoking the ListLunaClients operation.
     *
     * @see #listLunaClientsAsync(ListLunaClientsRequest)
     */
    java.util.concurrent.Future<ListLunaClientsResult> listLunaClientsAsync();

    /**
     * Simplified method form for invoking the ListLunaClients operation with an
     * AsyncHandler.
     *
     * @see #listLunaClientsAsync(ListLunaClientsRequest,
     *      com.amazonaws.handlers.AsyncHandler)
     */
    java.util.concurrent.Future<ListLunaClientsResult> listLunaClientsAsync(
            com.amazonaws.handlers.AsyncHandler<ListLunaClientsRequest, ListLunaClientsResult> asyncHandler);

    /**
     *

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

     *
     * @param listTagsForResourceRequest
     * @return A Java Future containing the result of the ListTagsForResource
     *         operation returned by the service.
     * @sample AWSCloudHSMAsync.ListTagsForResource
     */
    java.util.concurrent.Future<ListTagsForResourceResult> listTagsForResourceAsync(
            ListTagsForResourceRequest listTagsForResourceRequest);

    /**
     *

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

     *
     * @param listTagsForResourceRequest
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the ListTagsForResource
     *         operation returned by the service.
     * @sample AWSCloudHSMAsyncHandler.ListTagsForResource
     */
    java.util.concurrent.Future<ListTagsForResourceResult> listTagsForResourceAsync(
            ListTagsForResourceRequest listTagsForResourceRequest,
            com.amazonaws.handlers.AsyncHandler<ListTagsForResourceRequest, ListTagsForResourceResult> asyncHandler);

    /**
     *

     * Modifies an existing high-availability partition group.
     *

     *
     * @param modifyHapgRequest
     * @return A Java Future containing the result of the ModifyHapg operation
     *         returned by the service.
     * @sample AWSCloudHSMAsync.ModifyHapg
     */
    java.util.concurrent.Future<ModifyHapgResult> modifyHapgAsync(
            ModifyHapgRequest modifyHapgRequest);

    /**
     *

     * Modifies an existing high-availability partition group.
     *

     *
     * @param modifyHapgRequest
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the ModifyHapg operation
     *         returned by the service.
     * @sample AWSCloudHSMAsyncHandler.ModifyHapg
     */
    java.util.concurrent.Future<ModifyHapgResult> modifyHapgAsync(
            ModifyHapgRequest modifyHapgRequest,
            com.amazonaws.handlers.AsyncHandler<ModifyHapgRequest, ModifyHapgResult> asyncHandler);

    /**
     *

     * 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 A Java Future containing the result of the ModifyHsm operation
     *         returned by the service.
     * @sample AWSCloudHSMAsync.ModifyHsm
     */
    java.util.concurrent.Future<ModifyHsmResult> modifyHsmAsync(
            ModifyHsmRequest modifyHsmRequest);

    /**
     *

     * 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.
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the ModifyHsm operation
     *         returned by the service.
     * @sample AWSCloudHSMAsyncHandler.ModifyHsm
     */
    java.util.concurrent.Future<ModifyHsmResult> modifyHsmAsync(
            ModifyHsmRequest modifyHsmRequest,
            com.amazonaws.handlers.AsyncHandler<ModifyHsmRequest, ModifyHsmResult> asyncHandler);

    /**
     *

     * 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 A Java Future containing the result of the ModifyLunaClient
     *         operation returned by the service.
     * @sample AWSCloudHSMAsync.ModifyLunaClient
     */
    java.util.concurrent.Future<ModifyLunaClientResult> modifyLunaClientAsync(
            ModifyLunaClientRequest modifyLunaClientRequest);

    /**
     *

     * 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
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the ModifyLunaClient
     *         operation returned by the service.
     * @sample AWSCloudHSMAsyncHandler.ModifyLunaClient
     */
    java.util.concurrent.Future<ModifyLunaClientResult> modifyLunaClientAsync(
            ModifyLunaClientRequest modifyLunaClientRequest,
            com.amazonaws.handlers.AsyncHandler<ModifyLunaClientRequest, ModifyLunaClientResult> asyncHandler);

    /**
     *

     * 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 A Java Future containing the result of the RemoveTagsFromResource
     *         operation returned by the service.
     * @sample AWSCloudHSMAsync.RemoveTagsFromResource
     */
    java.util.concurrent.Future<RemoveTagsFromResourceResult> removeTagsFromResourceAsync(
            RemoveTagsFromResourceRequest removeTagsFromResourceRequest);

    /**
     *

     * 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
     * @param asyncHandler
     *        Asynchronous callback handler for events in the lifecycle of the
     *        request. Users can provide an implementation of the callback
     *        methods in this interface to receive notification of successful or
     *        unsuccessful completion of the operation.
     * @return A Java Future containing the result of the RemoveTagsFromResource
     *         operation returned by the service.
     * @sample AWSCloudHSMAsyncHandler.RemoveTagsFromResource
     */
    java.util.concurrent.Future<RemoveTagsFromResourceResult> removeTagsFromResourceAsync(
            RemoveTagsFromResourceRequest removeTagsFromResourceRequest,
            com.amazonaws.handlers.AsyncHandler<RemoveTagsFromResourceRequest, RemoveTagsFromResourceResult> asyncHandler);

}


text:
package org.eclipse.ceylon.tools.importjar;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.eclipse.ceylon.cmr.api.ModuleDependencyInfo;
import org.eclipse.ceylon.cmr.api.ModuleSearchResult.ModuleDetails;
import org.eclipse.ceylon.cmr.ceylon.LegacyImporter;
import org.eclipse.ceylon.cmr.ceylon.LegacyImporter.DependencyErrors;
import org.eclipse.ceylon.cmr.ceylon.LegacyImporter.DependencyResults;
import org.eclipse.ceylon.cmr.ceylon.LegacyImporter.ImporterFeedback;
import org.eclipse.ceylon.common.Messages;
import org.eclipse.ceylon.common.ModuleSpec;
import org.eclipse.ceylon.common.OSUtil;
import org.eclipse.ceylon.common.tool.Argument;
import org.eclipse.ceylon.common.tool.Description;
import org.eclipse.ceylon.common.tool.Hidden;
import org.eclipse.ceylon.common.tool.Option;
import org.eclipse.ceylon.common.tool.OptionArgument;
import org.eclipse.ceylon.common.tool.RemainingSections;
import org.eclipse.ceylon.common.tool.Summary;
import org.eclipse.ceylon.common.tool.ToolUsageError;
import org.eclipse.ceylon.common.tools.CeylonTool;
import org.eclipse.ceylon.common.tools.OutputRepoUsingTool;
import org.eclipse.ceylon.model.cmr.RepositoryException;

@Summary("Imports a jar file into a Ceylon module repository")
@Description("Imports the given `<jar-file>` using the module name and version " +
        "given by `<module>` into the repository named by the " +
        "`--out` option.\n" +
        "\n" +
        "`<module>` is a module name and version separated with a slash, for example " +
        "`com.example.foobar/1.2.0`.\n" +
        "\n" +
        "`<jar-file>` is the name of the Jar file to import.\n" +
        "\n" +
        "`<source-jar-file>` is an optional name of a Jar file containing the sources " +
        "for the Jar file to import.\n")
@RemainingSections("## Descriptors" +
        "\n\n" +
        "When the import-jar tool analyses the <jar-file> and complains about missing " +
        "dependencies a module descriptor file should be provided. The name of this " +
        "file can be provided using the `--descriptor` option or, when left out, the tool " +
        "will look for `<jar-file>.module.properties` or `<jar-file>.module.xml`. " +
        "\n\n" +
        "The format of these `.properties` or `.xml` files is documented online: " +
        "http://www.ceylon-lang.org/documentation/1.1/reference/structure/module/#legacy_modules " +
        "\n\n" +
        "If the option `--update-descriptor` is given the tool will try to update the " +
        "given descriptor file with the available information (for now this only works " +
        "for the `.properties` files). If the file didn't exist yet it will be created." +
        "\n\n" +
        "If the option `--source-jar-file` is given the tool will try to include the " +
        "source jar into the module as well, including a SHA1 of that source jar." +
        "\n\n" +
        OutputRepoUsingTool.DOCSECTION_REPOSITORIES)
public class CeylonImportJarTool extends OutputRepoUsingTool {

    private ModuleSpec module;
    private File jarFile;
    private File sourceJarFile;
    private File descriptor;
    private boolean updateDescriptor;
    private boolean force;
    private boolean dryRun;
    private boolean showClasses;
    private boolean showSuggestions;
    private boolean allowCars;
    private boolean ignoreAnnotations;
    private List<String> missingDependenciesPackages;
    private Map<String, List<String>> parsedMissingDependenciesPackages;

    public CeylonImportJarTool() {
        super(ImportJarMessages.RESOURCE_BUNDLE);
    }

    @OptionArgument(longName="missing-dependency-packages")
    @Description("Specifies which packages a missing dependency contains. Can be specified multiple times. " +
            "Format: `module-name/module-version=package-wildcard(,package-wildcard)*`, where "+
            "`package-wildcard` supports `*`, `**` and `?` wildcards.")
    public void setMissingDependencyPackages(List<String> missingDependencyPackages) {
        this.missingDependenciesPackages = missingDependencyPackages;
    }

    @OptionArgument(argumentName="file")
    @Description("Specify a module.xml or module.properties file to be used "
            + "as the module descriptor")
    public void setDescriptor(File descriptor) {
        this.descriptor = descriptor;
    }

    @Argument(argumentName="module", multiplicity="1", order=0)
    public void setModuleSpec(String module) {
        setModuleSpec(ModuleSpec.parse(module,
                ModuleSpec.Option.VERSION_REQUIRED,
                ModuleSpec.Option.DEFAULT_MODULE_PROHIBITED));
    }

    public void setModuleSpec(ModuleSpec module) {
        this.module = module;
    }

    @Argument(argumentName="jar-file", multiplicity="1", order=1)
    public void setFile(File jarFile) {
        this.jarFile = jarFile;
    }

    @Argument(argumentName="source-jar-file", multiplicity="?", order=2)
    public void setSourceJarFile(File sourceJarFile) {
        this.sourceJarFile = sourceJarFile;
    }

    @Option(longName="update-descriptor")
    @Description("Whenever possible will create or adjust the descriptor file with the necessary definitions.")
    public void setUpdateDescriptor(boolean updateDescriptor) {
        this.updateDescriptor = updateDescriptor;
    }

    @Option(longName="force")
    @Description("Skips sanity checks and forces publication of the JAR.")
    public void setForce(boolean force) {
        this.force = force;
    }

    @Option(longName="ignore-annotations")
    @Description("Do not check annotations for imports (default: `false`).")
    public void setIgnoreAnnotations(boolean ignoreAnnotations) {
        this.ignoreAnnotations = ignoreAnnotations;
    }

    @Hidden
    @Option(longName="allow-cars")
    @Description("Allows importing car files [for tests only].")
    public void setAllowCars(boolean allowCars) {
        this.allowCars = allowCars;
    }

    @Option(longName="dry-run")
    @Description("Performs all the sanity checks but does not publish the JAR.")
    public void setDryRun(boolean dryRun) {
        this.dryRun = dryRun;
    }

    @Option(longName="show-classes")
    @Description("Shows all external classes that are not declared as imports instead of their packages only.")
    public void setShowClasses(boolean showClasses) {
        this.showClasses = showClasses;
    }

    @Option(longName="show-suggestions")
    @Description("Shows suggestions for modules based on missing package names (this can take a long time).")
    public void setShowSuggestions(boolean showSuggestions) {
        this.showSuggestions = showSuggestions;
    }

    @Override
    protected boolean needsSystemRepo() {
        return false;
    }

    @Override
    public void initialize(CeylonTool mainTool) {
        File f = assertJar(jarFile, "error.jarFile", "error.jarFile.notJar");

        if (sourceJarFile != null) {
             assertJar(sourceJarFile, "error.sourceJarFile", "error.sourceJarFile.notJar");
        }

        if (descriptor == null) {
            String baseName = f.getName().substring(0, f.getName().length() - 4);
            File desc = new File(f.getParentFile(), baseName + ".module.xml");
            if (!desc.isFile()) {
                desc = new File(f.getParentFile(), baseName + ".module.properties");
                if (desc.isFile() || updateDescriptor) {
                    descriptor = desc;
                }
            } else {
                descriptor = desc;
            }
        }
        if (descriptor != null) {
            checkReadableFile(applyCwd(descriptor), "error.descriptorFile", !updateDescriptor);
            if(!(descriptor.toString().toLowerCase().endsWith(".xml") ||
                    descriptor.toString().toLowerCase().endsWith(".properties")))
                throw new ImportJarException("error.descriptorFile.badSuffix", new Object[]{descriptor}, null);
        }
        if(missingDependenciesPackages != null){
            parsedMissingDependenciesPackages = new HashMap<>();
            for(String spec : missingDependenciesPackages){
                int moduleSeparator = spec.indexOf('=');
                if(moduleSeparator == -1)
                    throw new ImportJarException("error.missingDependenciesPackages.badSyntax", new Object[]{spec}, null);
                String moduleSpec = spec.substring(0, moduleSeparator);
                String packagesSpec = spec.substring(moduleSeparator+1);
                if(moduleSpec.isEmpty() || packagesSpec.isEmpty())
                    throw new ImportJarException("error.missingDependenciesPackages.badSyntax", new Object[]{spec}, null);
                List<String> packages = new LinkedList<>();
                for(String pkg : packagesSpec.split(",")){
                    if(pkg.isEmpty())
                        throw new ImportJarException("error.missingDependenciesPackages.badSyntax", new Object[]{spec}, null);
                    packages.add(pkg);
                }
                if(packages.isEmpty())
                    throw new ImportJarException("error.missingDependenciesPackages.badSyntax", new Object[]{spec}, null);
                parsedMissingDependenciesPackages.put(moduleSpec, packages);
            }
        }
    }

    private File assertJar(File aJarFile, String errorResource1, String errorResource2) {
        File aJarFileWithCwd = applyCwd(aJarFile);
        checkReadableFile(aJarFileWithCwd, errorResource1, true);

        String fileName = aJarFileWithCwd.getName().toLowerCase();
        // allow: jar OK, car OK, other OK
        // !allow: jar OK, car, other
        if (! fileName.endsWith(".jar")
                 && !(allowCars && fileName.endsWith(".car"))) {
            throw new ImportJarException(errorResource2,
                                         new Object[] { aJarFile.toString() },
                                         null);
        }

        return aJarFileWithCwd;
    }

    private void checkReadableFile(File f, String keyPrefix, boolean required) {
        if (f.exists()) {
            if(f.isDirectory())
                throw new ImportJarException(keyPrefix + ".isDirectory", new Object[]{f.toString()}, null);
            if(!f.canRead())
                throw new ImportJarException(keyPrefix + ".notReadable", new Object[]{f.toString()}, null);
        } else if (required) {
            throw new ImportJarException(keyPrefix + ".doesNotExist", new Object[]{f.toString()}, null);
        }
    }

    private LegacyImporter createImporter() {
        LegacyImporter importer = new LegacyImporter(module.getName(), module.getVersion(), applyCwd(jarFile), applyCwd(sourceJarFile), getOutputRepositoryManager(), getRepositoryManager(), getLogger(), new ImporterFeedback() {
            @Override
            public void beforeDependencies() throws IOException {
                msg("info.checkingDependencies").newline();
            }

            @Override
            public void beforeDependency(ModuleDependencyInfo dep) throws IOException {
                append("    ").append(dep).append(" ... [");
            }

            @Override
            public void dependency(DependencyResults result, ModuleDependencyInfo dep) throws IOException {
                String txt = "";
                switch (result) {
                case DEP_OK:
                    txt = OSUtil.color(Messages.msg(bundle, "info.ok"), OSUtil.Color.green);
                    break;
                case DEP_OK_UNUSED:
                    txt = OSUtil.color(Messages.msg(bundle, "info.okButUnused"), OSUtil.Color.green);
                    break;
                case DEP_MARK_SHARED:
                    txt = OSUtil.color(Messages.msg(bundle, "error.markShared"), OSUtil.Color.yellow);
                    break;
                case DEP_MARK_UNSHARED:
                    txt = OSUtil.color(Messages.msg(bundle, "info.markUnshared"), OSUtil.Color.yellow);
                    break;
                case DEP_NOT_FOUND:
                    txt = OSUtil.color(Messages.msg(bundle, "info.notFound"), OSUtil.Color.red);
                    break;
                case DEP_CHECK_FAILED:
                    txt = OSUtil.color(Messages.msg(bundle, "error.checkFailed"), OSUtil.Color.red);
                    break;
                case DEP_TRANSITIVE_ERROR:
                    txt = OSUtil.color(Messages.msg(bundle, "error.transitiveError"), OSUtil.Color.red);
                    break;
                case DEP_JDK:
                    append("    ").append(dep.getName());
                    if(dep.isExport())
                        append(" ... [shared]");
                    newline();
                    break;
                default:
                    break;
                }
                append(txt);
            }

            @Override
            public void dependencyError(DependencyErrors error, ModuleDependencyInfo dep) {
                switch (error) {
                case DEPERR_INVALID_MODULE_DEFAULT:
                    throw new ImportJarException("error.descriptorFile.invalid.module.default");
                case DEPERR_INVALID_MODULE_NAME:
                    throw new ImportJarException("error.descriptorFile.invalid.module", new Object[]{dep.getName()}, null);
                case DEPERR_INVALID_MODULE_VERSION:
                    throw new ImportJarException("error.descriptorFile.invalid.module.version", new Object[]{dep.getVersion()}, null);
                }
            }

            @Override
            public void afterDependency(ModuleDependencyInfo dep) throws IOException {
                append("]").newline();
            }

            @Override
            public void afterDependencies() {
            }

            @Override
            public void beforeJdkModules() throws IOException {
                msg("info.declare.jdk.imports").newline();
            }

            @Override
            public void afterJdkModules() {
            }

            @Override
            public void beforePackages() throws IOException {
                msg("info.declare.module.imports").newline();
                if (!showSuggestions) {
                    msg("info.try.suggestions").newline();
                }
            }

            @Override
            public void packageName(String pkg, boolean shared) throws IOException {
                append("    ").append(pkg);
                if(shared)
                    append(" ... [shared]");
                newline();
            }

            @Override
            public void afterPackages() {
            }

            @Override
            public void beforeClasses() throws IOException {
                msg("info.declare.class.imports").newline();
            }

            @Override
            public void className(String cls, boolean shared) throws IOException {
                append("    ").append(cls);
                if(shared)
                    append(" ... [shared]");
                newline();
            }

            @Override
            public void afterClasses() {
            }

            @Override
            public ModuleDependencyInfo suggestions(String pkg, Set<ModuleDetails> suggestions) throws IOException {
                ModuleDependencyInfo dep = null;
                if (!suggestions.isEmpty()) {
                    append(", ");
                    if (suggestions.size() > 1) {
                        msg("info.try.importing.multiple");
                        for (ModuleDetails md : suggestions) {
                            newline();
                            String modver = md.getName() + "/" + md.getLastVersion().getVersion();
                            append("        ").append(modver);
                            dep = new ModuleDependencyInfo(null, md.getName(), md.getLastVersion().getVersion(), false, true);
                        }
                    } else {
                        ModuleDetails md = suggestions.iterator().next();
                        String modver = md.getName() + "/" + md.getLastVersion().getVersion();
                        msg("info.try.importing", modver);
                        dep = new ModuleDependencyInfo(null, md.getName(), md.getLastVersion().getVersion(), false, true);
                    }
                }
                return dep;
            }
        });
        return importer;
    }

    @Override
    public void run() throws Exception {
        LegacyImporter importer = createImporter()
                .moduleDescriptor(applyCwd(descriptor))
                .missingDependenciesPackages(parsedMissingDependenciesPackages);
        importer.setIgnoreAnnotations(ignoreAnnotations);
        if (!force || updateDescriptor) {
            try {
                importer.loadModuleDescriptor();
            } catch (ImportJarException x) {
                throw x;
            } catch (Exception x) {
                String key = "error.descriptorFile.invalid.";
                if (descriptor.getName().endsWith(".xml")) {
                    key += "xml";
                } else {
                    key += "properties";
                }
                throw new ImportJarException(key, new Object[]{descriptor.getPath(), x.getMessage()}, x);
            }

            if (!showClasses) {
                importer.listPackages(showSuggestions);
            } else {
                importer.listClasses();
            }
        }
        boolean hasErrors = importer.hasErrors();
        if (importer.hasProblems()) {
            if (updateDescriptor && descriptor != null) {
                if (!dryRun) {
                    importer.updateModuleDescriptor();
                }
            } else {
                hasErrors = true;
            }
        }
        if (!hasErrors || force) {
            if (!hasErrors) {
                if (force && !updateDescriptor) {
                    msg("info.forcedUpdate");
                } else {
                    msg("info.noProblems");
                }
            } else {
                msg("error.problemsFoundForced");
            }
            if (!dryRun) {
                msg("info.noProblems.publishing").newline();
                try {
                    importer.publish();
                } catch(RepositoryException x) {
                    throw new ImportJarException("error.failedWriteArtifact", new Object[]{module, x.getLocalizedMessage()}, x);
                } catch(Exception x) {
                    // FIXME: remove when the whole CMR is using RepositoryException
                    throw new ImportJarException("error.failedWriteArtifact", new Object[]{module, x.getLocalizedMessage()}, x);
                }
                String repoString = this.getOutputRepositoryManager().getRepositoriesDisplayString().toString();

                msg("info.published", this.module.toString(), repoString.substring(1, repoString.length()-1));
            }
            append(".").newline();
        } else {
            String msgKey;
            if (!updateDescriptor && descriptor == null) {
                msgKey = "error.problemsFoundSuggest";
            } else {
                msgKey = "error.problemsFound";
            }
            throw new ToolUsageError(Messages.msg(ImportJarMessages.RESOURCE_BUNDLE, msgKey));
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
"""
ros.py
=====

This module containes classes for ROS integration.

"""

__all__ = ["ROSAdapter"]

from abc import ABCMeta, abstractmethod
import copy
import numpy

# BriCA imports
from unit import *

# ROS imporets
import rospy
from std_msgs.msg import Int16MultiArray, MultiArrayDimension

class ROSAdapter(Unit):
    """
    `ROSAdapter` is a BriCA `Unit` which is intented to provide a bridge over the
    ROS Publisher/Subscriber and BriCA `Agent`.
    """

    __metaclass__ = ABCMeta

    def __init__(self, name="BriCA1 Node"):
        """ Create a new `ROSAdapter` instance.

        Args:
          None.

        Returns:
          ROSAdapter: a new `ROSAdapter` instance.

        """

        super(ROSAdapter, self).__init__()
        self.inputs = {}
        self.states = {}
        self.results = {}

        rospy.init_node(name, anonymous=True)

    def setup_subscriber(self, topic, msg_type, id, length, converter):
        """ Setup a ROS subscriber

        Args:
          topic (str): a topic to subscribe to.
          msg_type (msg): incoming message type.
          id (str): a string ID.
          length (int): an initial length of the value vector.

        Returns:
          None.

        """

        self.make_out_port(id, length)

        def callback(data):
            self.get_out_port(id).buffer = converter(data)

        rospy.Subscriber(topic, msg_type, callback)

    def setup_publisher(self, topic, id, length):
        """ Setup a ROS subscriber

        Args:
          topic (str): a topic to subscribe to.
          id (str): a string ID.
          length (int): an initial length of the value vector.

        Returns:
          None.

        """

        self.make_in_port(id, length)
        pub = rospy.Publisher(topic, Int16MultiArray, queue_size=10)

        def callback(data):
            msg = Int16MultiArray()
            msg.data = data
            msg.layout.dim = [MultiArrayDimension("data", 1, length)]
            pub.publish(msg)

        self.get_in_port(id).register_callback(callback)

    def connect(self, target, from_id, to_id):
        """ Connect an out-port of another `Unit` to an in-port.

        Args:
          target (Unit): a `Unit` to connect to.
          from_id (str): an out-port of the target `Unit`.
          to_id(str): an in-port of this `Unit`.

        Returns:
          None.

        """

        super(ROSAdapter, self).connect(target, from_id, to_id)
        from_port = target.get_out_port(from_id)
        to_port = self.get_in_port(to_id)

        def callback(data):
            to_port.sync()
            to_port.invoke_callbacks()

        from_port.register_callback(callback)


text:
package com.github.koraktor.steamcondenser.steam.packets;

import com.github.koraktor.steamcondenser.Helper;

/**
 * This packet class represents a A2S_PLAYER request send to a game server
 *

 * It is used to request the list of players currently playing on the server.
 *

 * This packet type requires the client to challenge the server in advance,
 * which is done automatically if required.
 *
 * @author Sebastian Staudt
 * @see com.github.koraktor.steamcondenser.steam.servers.GameServer#updatePlayers
 */
public class A2S_PLAYER_Packet extends SteamPacket {

    /**
     * Creates a new A2S_PLAYER request object including the challenge number
     *
     * @param challengeNumber The challenge number received from the server
     */
    public A2S_PLAYER_Packet(int challengeNumber) {
        super(SteamPacket.A2S_PLAYER_HEADER, Helper.byteArrayFromInteger(Integer.reverseBytes(challengeNumber)));
    }
}


text:
<?php

namespace Oro\Bundle\ConfigBundle\Config;

use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

class UserConfigManager extends ConfigManager
{
    /**
     * @var TokenStorageInterface
     */
    protected $tokenStorage;

    /**
     * DI setter for token storage
     *
     * @param TokenStorageInterface $tokenStorage
     */
    public function setSecurity(TokenStorageInterface $tokenStorage)
    {
        $this->tokenStorage = $tokenStorage;

        // if we have a user - try to merge his scoped settings into global settings array
        if ($token = $this->tokenStorage->getToken()) {
            if (is_object($user = $token->getUser())) {
                foreach ($user->getGroups() as $group) {
                    $this->loadStoredSettings('group', $group->getId());
                }

                $this->loadStoredSettings('user', $user->getId());
            }
        }
    }

    /**
     * @return string
     */
    public function getScopedEntityName()
    {
        return 'user';
    }

    /**
     * @return int
     */
    public function getScopeId()
    {
        return 0;
    }
}


text:
<?php

namespace ZfrOAuth2\Server\Exception;

use RuntimeException as BaseRuntimeException;

/**
 * @author  Michaël Gallego <mic.gallego@gmail.com>
 * @licence MIT
 */
class RuntimeException extends BaseRuntimeException implements ExceptionInterface
{
}


text:
var App = require('app');
require('controllers/main/admin/highAvailability_controller');
require('models/host_component');
require('models/host');
require('utils/ajax/ajax');

describe('App.HighAvailabilityProgressPageController', function () {

  var controller = App.HighAvailabilityProgressPageController.create();

  describe('#reconfigureSites()', function () {
    var tests = [
      {
        content: {
          controllerName: "rMHighAvailabilityWizardController"
        },
        siteNames: ["site1", "site2"],
        data: {
          items: [
            {
              type: "site1",
              properties: {
                site1_property1: "site1_property1_value",
                site1_property2: "site1_property2_value"
              },
              properties_attributes: {
                final: {
                  site1_property1: "true"
                }
              }
            },
            {
              type: "site2",
              properties: {
                site2_property1: "site2_property1_value",
                site2_property2: "site2_property2_value"
              }
            },
            {
              type: "site3",
              properties: {
                site3_property: "site3_property_value"
              }
            }
          ]
        },
        result: [
          {
            type: "site1",
            tag: "version1",
            properties: {
              site1_property1: "site1_property1_value",
              site1_property2: "site1_property2_value"
            },
            service_config_version_note: Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format("ResourceManager"),
            properties_attributes: {
              final: {
                site1_property1: "true"
              }
            }
          },
          {
            type: "site2",
            tag: "version1",
            properties: {
              site2_property1: "site2_property1_value",
              site2_property2: "site2_property2_value"
            },
            service_config_version_note: Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format("ResourceManager")
          }
        ]
      },
      {
        content: {
          controllerName: "anyOther"
        },
        siteNames: ["site1"],
        data: {
          items: [
            {
              type: "site1",
              properties: {
                site1_property1: "site1_property1_value",
                site1_property2: "site1_property2_value"
              },
              properties_attributes: {
                final: {
                  site1_property1: "true"
                }
              }
            }
          ]
        },
        result: [
          {
            type: "site1",
            tag: "version1",
            properties: {
              site1_property1: "site1_property1_value",
              site1_property2: "site1_property2_value"
            },
            service_config_version_note: Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format("NameNode"),
            properties_attributes: {
              final: {
                site1_property1: "true"
              }
            }
          }
        ]
      }];
    beforeEach(function() {
      App.set('testMode', true);
    });
    afterEach(function() {
      App.set('testMode', false);
    });
    it("reconfigures configs after HA", function() {
      tests.forEach(function(t) {
        controller.set('content', t.content);
        expect(controller.reconfigureSites(t.siteNames, t.data)).to.eql(t.result);
      });
    });
  });

});


text:
#include <assert.h>
#include <errno.h>
#include "pthreadP.h"

int
__pthread_attr_setscope (attr, scope)
     pthread_attr_t *attr;
     int scope;
{
  struct pthread_attr *iattr;

  assert (sizeof (*attr) >= sizeof (struct pthread_attr));
  iattr = (struct pthread_attr *) attr;

  /* Catch invalid values.  */
  switch (scope)
    {
    case PTHREAD_SCOPE_SYSTEM:
      iattr->flags &= ~ATTR_FLAG_SCOPEPROCESS;
      break;

    case PTHREAD_SCOPE_PROCESS:
      return ENOTSUP;

    default:
      return EINVAL;
    }

  return 0;
}
strong_alias (__pthread_attr_setscope, pthread_attr_setscope)


text:
/*
 * Created on 2005. 1. 25.
 */
package org.metaworks.dao;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Jinyoung Jang
 */
public class UniqueKeyGenerator {

	public static Long issueKey(String forWhat, ConnectionFactory cf) throws Exception{
		return issueKey(forWhat, null, cf);
	}

	public static Long issueKey(String forWhat, Map options, ConnectionFactory cf) throws Exception{
		KeyGeneratorDAO kg = DAOFactory.getInstance(cf).createKeyGenerator(forWhat, options);
		kg.select();
		kg.next();

		Number number = kg.getKeyNumber();

		if(number!=null){
			return new Long(number.longValue());
		}else
			return null;
	}

	public static Long issueProcessDefinitionKey(ConnectionFactory cf) throws Exception{
		return issueKey("ProcDef", cf);
	}

	public static Long issueProcessDefinitionVersionKey(ConnectionFactory cf) throws Exception{
		return issueKey("ProcDefVer", cf);
	}

	public static Long issueProcessInstanceKey(ConnectionFactory cf) throws Exception{
		return issueKey("ProcInst", cf);
	}

	public static Long issueProcessVariableKey(ConnectionFactory cf) throws Exception{
		return issueKey("ProcVar", cf);
	}

	public static Long issueRoleMappingKey(ConnectionFactory cf) throws Exception{
		Map options = new HashMap();
		options.put("useTableNameHeader", true);

		return issueKey("RoleMapping", options, cf);
	}

	public static Long issueWorkItemKey(ConnectionFactory cf) throws Exception{
		return issueKey("WorkItem", cf);
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:color="@color/m4399_rec_color_white"
        android:state_enabled="true" android:state_pressed="true"/>
    <item android:color="@color/m4399_rec_color_white"
        android:state_enabled="true" android:state_selected="true"/>
    <item android:color="@color/m4399_rec_color_white"
        android:state_enabled="true" android:state_focused="true"/>
    <item android:color="@color/m4399_rec_sdk_color_black"/>

</selector>


text:
/* -*- C++ -*- */
/**
 *  @file Event.h
 *
 *  $Id: Event.h 935 2008-12-10 21:47:27Z mitza $
 *
 *  @author Pradeep Gore <pradeep@oomworks.com>
 *
 *
 */

#ifndef TAO_NOTIFY_EVENT_H
#define TAO_NOTIFY_EVENT_H

#include /**/ "ace/pre.h"

#include "orbsvcs/Notify/notify_serv_export.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "orbsvcs/Notify/Refcountable.h"
#include "orbsvcs/Notify/Property.h"
#include "orbsvcs/Notify/Property_Boolean.h"
#include "orbsvcs/Notify/Property_T.h"

#include "orbsvcs/Event_ForwarderS.h"
#include "orbsvcs/CosNotifyFilterC.h"
#include "orbsvcs/CosNotificationC.h"

#include "ace/Copy_Disabled.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

class TAO_Notify_Consumer;
class TAO_Notify_EventType;

/**
 * @class TAO_Notify_Event
 *
 * @brief Base class abstraction for Events flowing through the EventChannel.
 *
 */
class TAO_Notify_Serv_Export TAO_Notify_Event
    : public TAO_Notify_Refcountable
    , private ACE_Copy_Disabled
{
public:
  typedef TAO_Notify_Refcountable_Guard_T<TAO_Notify_Event> Ptr;

  // Codes to distinguish marshaled events in persistent storage
  enum {MARSHAL_ANY=1,MARSHAL_STRUCTURED=2};
  /// Constructor
  TAO_Notify_Event (void);

  /// Destructor
  virtual ~TAO_Notify_Event ();

  /// Translate Any to Structured
  static void translate (const CORBA::Any& any, CosNotification::StructuredEvent& notification);

  /// Translate Structured to Any
  static void translate (const CosNotification::StructuredEvent& notification, CORBA::Any& any);

  /// Get the event type.
  virtual const TAO_Notify_EventType& type (void) const = 0;

  /// Returns true if the filter matches.
  virtual CORBA::Boolean do_match (CosNotifyFilter::Filter_ptr filter) const = 0;

  /// Convert to CosNotification::Structured type
  virtual void convert (CosNotification::StructuredEvent& notification) const = 0;

  /// Push event to consumer
  virtual void push (TAO_Notify_Consumer* consumer) const = 0;

  /// Push event to the Event_Forwarder interface
  virtual void push (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder) const = 0;

  /// Push event to the Event_Forwarder interface
  virtual void push_no_filtering (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder) const = 0;

  /// Push event to the Event_Forwarder interface
  virtual void push (Event_Forwarder::ProxyPushSupplier_ptr forwarder) const = 0;

  /// Push event to the Event_Forwarder interface
  virtual void push_no_filtering (Event_Forwarder::ProxyPushSupplier_ptr forwarder) const = 0;

  /// Return a pointer to a copy of this event on the heap.  The
  /// event is not owned by the caller, so it should not be deleted or
  /// released.
  TAO_Notify_Event* queueable_copy (void) const;

  /// marshal this event into a CDR buffer (for persistence)
  virtual void marshal (TAO_OutputCDR& cdr) const = 0;

  /// Unmarshal an event from a CDR. (for persistence)
  static TAO_Notify_Event* unmarshal (TAO_InputCDR & cdr);

  ///= Accessors
  /// Priority
  const TAO_Notify_Property_Short& priority (void) const;

  /// Timeout
  const TAO_Notify_Property_Time& timeout (void) const;

  /// Reliable
  const TAO_Notify_Property_Boolean& reliable(void) const;

  /// Event creation time
  const ACE_Time_Value& creation_time (void) const;

protected:
  /// = QoS properties

  /// Priority.
  TAO_Notify_Property_Short priority_;

  /// Timeout.
  TAO_Notify_Property_Time timeout_;

  /// Reliability
  TAO_Notify_Property_Boolean reliable_;

private:
  /// Return a pointer to a copy of this event on the heap
  virtual TAO_Notify_Event* copy (void) const = 0;

  virtual void release (void);

  mutable Ptr clone_;
  bool        is_on_heap_;
  ACE_Time_Value time_;
};

TAO_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
#include "orbsvcs/Notify/Event.inl"
#endif /* __ACE_INLINE__ */

#include /**/ "ace/post.h"

#endif /* TAO_NOTIFY_EVENT_H */


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.ninty</groupId>
    <artifactId>ninty</artifactId>
    <version>1.0</version>

    <dependencies>
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>1.4</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <attach>true</attach>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>com.ninty.Ninty</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>assembly</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

        </plugins>
    </build>

</project>


text:
//
// Copyright (c) Microsoft.  All rights reserved.
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//    http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.

namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
{
    using System;
    using System.Management.Automation;
    using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;

    [Cmdlet(VerbsCommon.Set, "AzureRMApiManagementUser")]
    [OutputType(typeof(PsApiManagementUser))]
    public class SetAzureApiManagementUser : AzureApiManagementCmdletBase
    {
        [Parameter(
            ValueFromPipelineByPropertyName = true,
            Mandatory = true,
            HelpMessage = "Instance of PsApiManagementContext. This parameter is required.")]
        [ValidateNotNullOrEmpty]
        public PsApiManagementContext Context { get; set; }

        [Parameter(
            ValueFromPipelineByPropertyName = true,
            Mandatory = true,
            HelpMessage = "Identifier of existing user. This parameter is required. ")]
        [ValidateNotNullOrEmpty]
        public String UserId { get; set; }

        [Parameter(
            ValueFromPipelineByPropertyName = true,
            Mandatory = false,
            HelpMessage = "User first name. This parameter is optional. Must be 1 to 100 characters long.")]
        public String FirstName { get; set; }

        [Parameter(
            ValueFromPipelineByPropertyName = true,
            Mandatory = false,
            HelpMessage = "User last name. This parameter is optional. Must be 1 to 100 characters long.")]
        public String LastName { get; set; }

        [Parameter(
            ValueFromPipelineByPropertyName = true,
            Mandatory = false,
            HelpMessage = "User email. This parameter is optional.")]
        public String Email { get; set; }

        [Parameter(
            ValueFromPipelineByPropertyName = true,
            Mandatory = false,
            HelpMessage = "User password. This parameter is optional.")]
        public String Password { get; set; }

        [Parameter(
            ValueFromPipelineByPropertyName = true,
            Mandatory = false,
            HelpMessage = "User state. This parameter is optional. Default value is Active.")]
        public PsApiManagementUserState State { get; set; }

        [Parameter(
            ValueFromPipelineByPropertyName = true,
            Mandatory = false,
            HelpMessage = "Note on the user. This parameter is optional. Default value is $null.")]
        public String Note { get; set; }

        [Parameter(
            ValueFromPipelineByPropertyName = true,
            Mandatory = false,
            HelpMessage = "If specified then instance of Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementUser type representing the modified user.")]
        public SwitchParameter PassThru { get; set; }

        public override void ExecuteApiManagementCmdlet()
        {
            Client.UserSet(Context, UserId, FirstName, LastName, Password, Email, State, Note);

            if (PassThru)
            {
                var user = Client.UserById(Context, UserId);
                WriteObject(user);
            }
        }
    }
}


text:
package org.apache.jena.assembler.assemblers;

import org.apache.jena.assembler.* ;
import org.apache.jena.rdf.model.Resource ;
import org.apache.jena.util.* ;

/**
    An assembler to create location mappings: all the work is done by the
    LocationMapper constructor (which has its own vocabulary).
*/
public class LocationMapperAssembler extends AssemblerBase
    {
    @SuppressWarnings("deprecation")
    @Override
    public Object open( Assembler a, Resource root, Mode irrelevant )
        {
        checkType( root, JA.LocationMapper );
        return new LocationMapper( ResourceUtils.reachableClosure( root ) );
        }
    }


text:
> Convert a string/promise/array/iterable/asynciterable/buffer/typedarray/arraybuffer/object into a stream

Correctly chunks up the input and handles backpressure.

## Install

```
$ npm install into-stream
```

## Usage

```js
import intoStream from 'into-stream';

intoStream('unicorn').pipe(process.stdout);
//=> 'unicorn'
```

## API

### intoStream(input)

Type: `Buffer | TypedArray | ArrayBuffer | string | Iterable<Buffer | string> | AsyncIterable<Buffer | string> | Promise`\
Returns: [Readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable)

Adheres to the requested chunk size, except for `array` where each element will be a chunk.

### intoStream.object(input)

Type: `object | Iterable<object> | AsyncIterable<object> | Promise`\
Returns: [Readable object stream](https://nodejs.org/api/stream.html#stream_object_mode)

## Related

- [to-readable-stream](https://github.com/sindresorhus/to-readable-stream) - Simpler version of this package
- [get-stream](https://github.com/sindresorhus/get-stream) - The opposite of this package


text:
$: << File.dirname(__FILE__) + "/lib"

require 'rubygems'
require 'sinatra'
require 'lighthouse'
require 'flash'
require 'andand'

use Flash

configure :production do
  # Use drop.io as a default until we can set these in production properly.
  Sinatra::Default.set :account, "dropio"
  Sinatra::Default.set :project_id, 8242
end

configure do
  USERS = {}

  ActiveResource::Base.logger = Logger.new(STDOUT)
  ActiveResource::Base.logger.level = Logger::WARN

  Sinatra::Default.set :ticket_lists_file, "data/ticket_order.yml"

  env_file = File.dirname(__FILE__) + "/config/environment.rb"
  load env_file if File.exist? env_file

  # Required options
  [:account, :project_id].each do |option|
    Sinatra::Application.send(option) rescue raise("Required option not set: #{option}")
  end

  Lighthouse.account = Sinatra::Application.account

  enable :sessions
end

helpers do
  def flash
    session[:flash]
  end

  # "Alfred E. Newman" => "AEN"
  def initials(name)
    name.split(/\s+/).map { |part| part[0,1] }.join.upcase
  end

  def load_lists
    lists = YAML.load_file(options.ticket_lists_file) rescue {}
    lists = {} unless lists.is_a? Hash
    lists
  end

  def write_lists(lists)
    File.open(options.ticket_lists_file, 'w') do |file|
      file.write lists.to_yaml
    end
  end

  def write_list(name, list)
    write_lists load_lists.merge(name => list)
  end

  def ticket_url(ticket)
    "http://#{options.account}.lighthouseapp.com/projects/#{options.project_id}/tickets/#{ticket.id}-#{ticket.permalink}"
  end

  def ticket_details(ticket)
    {
      :id => ticket.id,
      :url => ticket_url(ticket),
      :title => ticket.title,
      :requester => ticket.creator_id.andand { |id| user(id).name },
      :responsible => ticket.assigned_user_id.andand { |id| user(id).name },
      :responsible_initials => ticket.assigned_user_id.andand { |id| initials(user(id).name) },
      :state => ticket.state,
      :description => ticket.attributes['body_html'],
      :tags => ticket.tags.join(", ")
    }
  end

  def user(id, the_token=token)
    raise ArgumentError, "Can't look up user with nil id" if id.nil?
    USERS[id] ||= Lighthouse::User.find(id, :params => { :_token => the_token })
  end

  ## Sessions

  def login(token)
    begin
      token_object = Lighthouse::Token.find(token, :params => { :_token => token })
      user = user(token_object.user_id, token)
      session[:token] = token
      session[:user_name] = user.name
    rescue ActiveResource::UnauthorizedAccess
      flash[:error] = "That token wasn't accepted for the account #{options.account}"
      redirect '/login'
    end
  end

  def logout
    session[:token] = nil
    session[:user_name] = nil
  end

  def logged_in?
    not (session[:token].nil? || session[:token].empty?)
  end

  def token
    session[:token]
  end

  def user_name
    session[:user_name]
  end
end

## Pages

get '/' do
  redirect '/login'
end

get '/login' do
  haml :login, :locals => { :account => options.account }
end

post '/login' do
  login params[:token]
  redirect '/dashboard'
end

get '/logout' do
  logout
  redirect '/'
end

get '/dashboard' do
  redirect '/login' unless logged_in?
  haml :dashboard
end

## Ajax Calls

get '/tickets' do
  page = params[:page] || 1
  tickets = Lighthouse::Ticket.find(:all, :params => { :_token => token, :project_id => options.project_id, :q => "state:open sort:number", :page => page })
  tickets.map {|t| ticket_details(t) }.to_json
end

get '/tickets/:id' do
  ticket_details(Lighthouse::Ticket.find(params[:id], :params => { :_token => token, :project_id => options.project_id})).to_json
end

get '/lists' do
  load_lists.to_json
end

get '/lists/:list' do
  lists = load_lists
  throw :halt, [404, "Not found"] unless lists.key? params[:list]
  load_lists[params[:list]].to_json
end

post '/lists/:list' do
  throw :halt, [404, "Not found"] if params[:list] == "icebox"
  # ticket_param will be a single ticket id, not a one-element array, if only one is given.
  ticket_param = params["ticket[]"] || params["ticket"]  # Handle different versions of Sinatra/Rack
  write_list params[:list], [ticket_param].flatten.compact.map { |tid| tid.to_i }
end

## Stylesheet

get '/stylesheets/tracklight.css' do
  response['Content-Type'] = 'text/css; charset=utf-8'
  sass :tracklight
end


text:
/**
 * CSS files with the .module.css suffix will be treated as CSS modules
 * and scoped locally.
 */

.heroBanner {
  padding: 4rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

@media screen and (max-width: 966px) {
  .heroBanner {
    padding: 2rem;
  }
}

.buttons {
  display: flex;
  align-items: center;
  justify-content: center;
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>org.apache.solr.client.solrj (Solr 4.8.0 API)</title>
<meta name="date" content="2014-04-24">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

org.apache.solr.client.solrj

Classes

ResponseParser

SolrQuery

SolrQuery.SortClause

SolrRequest

SolrResponse

SolrServer

StreamingResponseCallback

Enums

SolrQuery.ORDER

SolrRequest.METHOD

Exceptions

SolrServerException


text:
<?xml version="1.0" encoding="utf-8"?>

<!-- 当前天气布局-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_margin="15dp"
              android:orientation="vertical">
    <!-- 显示当前温度-->
    <TextView
        android:id="@+id/degree_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        android:textColor="#fff"
        android:textSize="60sp"/>
    <!-- 显示天气状况-->
    <TextView
        android:id="@+id/weather_info_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        android:textColor="#fff"
        android:textSize="20sp"/>

</LinearLayout>


text:
package elastigo

import (
	"encoding/json"
	"fmt"
)

// RegisterPercolate allows the caller to register queries against an index,
// and then send percolate requests which include a doc, and getting back the
// queries that match on that doc out of the set of registered queries.  Think
// of it as the reverse operation of indexing and then searching. Instead of
// sending docs, indexing them, and then running queries. One sends queries,
// registers them, and then sends docs and finds out which queries match that
// doc.
// see http://www.elasticsearch.org/guide/reference/api/percolate.html
func (c *Conn) RegisterPercolate(index string, name string, args map[string]interface{}, query OneTermQuery) (BaseResponse, error) {
	var url string
	var retval BaseResponse
	url = fmt.Sprintf("/_percolator/%s/%s", index, name)
	body, err := c.DoCommand("PUT", url, args, query)
	if err != nil {
		return retval, err
	}
	if err == nil {
		// marshall into json
		jsonErr := json.Unmarshal(body, &retval)
		if jsonErr != nil {
			return retval, jsonErr
		}
	}
	return retval, err
}

func (c *Conn) Percolate(index string, _type string, name string, args map[string]interface{}, doc string) (Match, error) {
	var url string
	var retval Match
	url = fmt.Sprintf("/%s/%s/_percolate", index, _type)
	body, err := c.DoCommand("GET", url, args, doc)
	if err != nil {
		return retval, err
	}
	if err == nil {
		// marshall into json
		jsonErr := json.Unmarshal(body, &retval)
		if jsonErr != nil {
			return retval, jsonErr
		}
	}
	return retval, err
}


text:
var npmlog = require('npmlog');
var args = require('optimist').argv;//Noted that this is deprecated.  TODO: replace with either minimist or yargs
var onFinished = require('finished');
var fs = require('fs');
var config = require(args.config || '../config.js');
var rootDirectory = __dirname.substr(0,__dirname.lastIndexOf('/')+1);

function callingFile(index, err) {

    var old = Error.prepareStackTrace;

    Error.prepareStackTrace = function (_, stack) {
        return stack;
    };

    if(err === undefined) {
        err = {};
        Error.captureStackTrace(err);
    }
    callFrame = err.stack[index];

    Error.prepareStackTrace = old;
    return callFrame.getFileName().replace(rootDirectory,'') + ':' + callFrame.getLineNumber();
}

if(args.debug) {
    npmlog.enableColor();
} else {
	npmlog.stream = fs.createWriteStream(config.logFilePath, {'flags':'a'});
	npmlog.stream.write('------------- Restart -----------------');

    switch (config.logLevel){
        case 'info':
            npmlog.level = 'info';
            break;
        case 'error':
            npmlog.level = 'error';
            break;
        case 'silent':
            npmlog.level = 'silent';
            break;
        default:
            npmlog.level = 'info';
    }
}

function ts() {
    return new Date().toTimeString().substring(0,8);
}

function log(level) {
    if(level==='debug' && !args.debug) {
        return;
    }

    var msg = Array.prototype.slice.call(arguments,1);
    npmlog.log.apply(npmlog, [level, ts()+' '+callingFile(2)].concat(msg));
}

process.on('uncaughtException', function(ex){
    npmlog.log('error', ts()+' '+callingFile(0,ex), "Uncaught exception %s", ex.message);
    setTimeout(function(){ process.exit(1); },10);
});

function httpLog(req,res,next) {
    var start = process.hrtime();

    onFinished(res, function(){
        var time = process.hrtime(start);
        time = (time[0] * 1e3) + (time[1]/1e6);
        npmlog.log('http', req.path, '%d time: %d ms', res.statusCode, time);
    });
    next();
}

module.exports = {
    _log: npmlog,
    info: log.bind(null,'info'),
    debug: log.bind(null,'verbose'),
    warn: log.bind(null,'warn'),
    fatal: log.bind(null,'fatal'),
    error: log.bind(null,'error'),
    http: httpLog
};


text:
namespace phoenix {

Size pHorizontalScroller::minimumSize() {
  return {0, 18};
}

void pHorizontalScroller::setLength(unsigned length) {
  length += (length == 0);
  SetScrollRange(hwnd, SB_CTL, 0, length - 1, TRUE);
  horizontalScroller.setPosition(0);
}

void pHorizontalScroller::setPosition(unsigned position) {
  SetScrollPos(hwnd, SB_CTL, position, TRUE);
}

void pHorizontalScroller::constructor() {
  hwnd = CreateWindow(
    L"SCROLLBAR", L"", WS_CHILD | WS_TABSTOP | SBS_HORZ,
    0, 0, 0, 0, parentHwnd, (HMENU)id, GetModuleHandle(0), 0
  );
  SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&horizontalScroller);
  unsigned position = horizontalScroller.state.position;
  setLength(horizontalScroller.state.length);
  horizontalScroller.setPosition(position);
  synchronize();
}

void pHorizontalScroller::destructor() {
  DestroyWindow(hwnd);
}

void pHorizontalScroller::orphan() {
  destructor();
  constructor();
}

void pHorizontalScroller::onChange(WPARAM wparam) {
  unsigned position = ScrollEvent(hwnd, wparam);
  if(position == horizontalScroller.state.position) return;
  horizontalScroller.state.position = position;
  if(horizontalScroller.onChange) horizontalScroller.onChange();
}

}