text:
package com.ibm.mqlight.api;

import java.lang.reflect.Type;
import java.nio.ByteBuffer;
import java.util.Map;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ibm.mqlight.api.callback.CallbackService;
import com.ibm.mqlight.api.endpoint.EndpointService;
import com.ibm.mqlight.api.impl.NonBlockingClientImpl;
import com.ibm.mqlight.api.network.NetworkService;
import com.ibm.mqlight.api.timer.TimerService;

/**
 * A Java MQ Light client implementation that never blocks the calling thread when
 * carrying out messaging operations.  Notification of completion for any
 * (potentially blocking) operation is via a callback.
 *

 * Example code for using the non-blocking client to send a message
 *

 * NonBlockingClient.create("amqp://localhost", new NonBlockingClientAdapter<Void>() {
 *     public void onStarted(NonBlockingClient client, Void context) {
 *         SendOptions opts = SendOptions.builder().setQos(QOS.AT_LEAST_ONCE).build();
 *         client.send("/kittens", "Hello kitty!", null, opts, new CompletionListener<Void>() {
 *             public void onSuccess(NonBlockingClient client, Void context) {
 *                 client.stop(null, null);
 *             }
 *             public void onError(NonBlockingClient client, Void context, Exception exception) {
 *                 client.stop(null, null);
 *             }
 *         }, null);
 *     }
 *     public void onDrain(NonBlockingClient client, Void context) {}
 * }, null);
 *

 *

 *
 * Example code for receiving messages published to the '/kittens' topic.
 *

 * public static void main(String[] args) {
 *     NonBlockingClient client = NonBlockingClient.create("amqp://localhost", null, null);
 *     client.subscribe("/kittens", new DestinationAdapter<Void>() {
 *         public void onMessage(NonBlockingClient client, Void context, Delivery delivery) {
 *             switch (delivery.getType()) {
 *             case BYTES:
 *                 BytesDelivery bd = (BytesDelivery)delivery;
 *                 System.out.println(bd.getData());
 *                 break;
 *             case STRING:
 *                 StringDelivery sd = (StringDelivery)delivery;
 *                 System.out.println(sd.getData());
 *                 break;
 *             }
 *         }
 *     }, null, null);
 * }
 *

 */
public abstract class NonBlockingClient {
    protected static final ClientOptions defaultClientOptions = ClientOptions.builder().build();
    protected static final SendOptions defaultSendOptions = SendOptions.builder().build();
    protected static final SubscribeOptions defaultSubscribeOptions = SubscribeOptions.builder().build();

    /**
     * Creates a new instance of the NonBlockingClient in starting state.
     * @param service a URI for the service to connect to, for example: amqp://example.org:5672.
     *        This URI can start with either amqp:// or amqps:// (for SSL/TLS based
     *        connections).  User names and passwords may be embedded into the URL - for example:
     *        amqp://user:pass@example.com.  If a value of null is specified then
     *        the client will attempt to locate a suitable service based on its environment.  Currently it
     *        is capable of locating services in this way when run in the IBM Bluemix environment.
     * @param options a set of options that determine the behaviour of the client.
     * @param listener a listener that is notified of major life-cycle events for the client.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the create method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a new instance of NonBlockingClient
     * @throws IllegalArgumentException thrown if one or more of the options is not valid.
     */
    public static <T> NonBlockingClient create(String service, ClientOptions options,
            NonBlockingClientListener<T> listener, T context)
    throws IllegalArgumentException {
        return new NonBlockingClientImpl(service, options, listener, context);
    }

    /**
     * Creates a new instance of the NonBlockingClient in starting state.  The client
     * will use the set of plugable services, provided as arguments to this method.
     * @param endpointService used to lookup the location of the MQ Light server.
     * @param callbackService used to run each call back into application code.
     * @param networkService used to establish network connections to the MQ Light server.
     * @param timerService used to schedule work to be performed in the future.
     * @param gsonBuilder used to deserialize Json format messages.
     * @param options a set of options that determine the behaviour of the client.
     * @param listener a listener that is notified of major life-cycle events for the client.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the create method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a new instance of NonBlockingClient
     * @throws IllegalArgumentException thrown if one or more of the options is not valid.
     */
    public static <T> NonBlockingClient create(EndpointService endpointService,
                                               CallbackService callbackService,
                                               NetworkService networkService,
                                               TimerService timerService,
                                               GsonBuilder gsonBuilder,
                                               ClientOptions options,
                                               NonBlockingClientListener<T>listener,
                                               T context)
    throws IllegalArgumentException {
        return new NonBlockingClientImpl(endpointService, callbackService, networkService, timerService, gsonBuilder, options, listener, context);
    }

    /**
     * Creates a new instance of the NonBlockingClient in starting state.  This is equivalent to calling:
     * create(service, ClientOptions.create, listener, context);
     * @param service a URI for the service to connect to, for example: amqp://example.org:5672.
     *        This URI can start with either amqp:// or amqps:// (for SSL/TLS based
     *        connections).  User names and passwords may be embedded into the URL - for example:
     *        amqp://user:pass@example.com.  If a value of null is specified then
     *        the client will attempt to locate a suitable service based on its environment.  Currently it
     *        is capable of locating services in this way when run in the IBM Bluemix environment.
     * @param listener a listener that is notified of major life-cycle events for the client.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the create method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a new instance of NonBlockingClient
     * @see NonBlockingClient#create(String, ClientOptions, NonBlockingClientListener, Object)
     */
    public static <T> NonBlockingClient create(String service, NonBlockingClientListener<T> listener, T context) {
        return create(service, defaultClientOptions, listener, context);
    }

    /**
     * @return the client ID, as assigned to this instance of the client either explicitly via the
     *         {@link ClientOptions} object passed in to the {@link NonBlockingClient#create(String, NonBlockingClientListener, Object)}
     *         method, or if this value is omitted, then the client ID will be set to a probabilistically
     *         unique string by the client implementation.
     */
    public abstract String getId();

    /**
     * @return the service to which the client is connected (as specified on the
     *         {@link NonBlockingClient#create(String, NonBlockingClientListener, Object)} call or
     *         null if the client is not, currently, connected to the MQ Light server.
     */
    public abstract String getService();

    /**
     * @return the current state of this client.
     */
    public abstract ClientState getState();

    /**
     * Sends a string message to a topic.
     * @param topic the topic to send the message to. Cannot be null.
     * @param data the string data to send to the topic. Cannot be null.
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @param sendOptions a set of options that determine how the send operation works.
     * @param listener a listener object that is notified when the send operation completes.  For 'at most once' quality of
     *                 service messages, this is notified (of success) when the message has been flushed to the network.
     *                 For 'at least once' quality of service messages, this is notified (of success) when receipt of the
     *                 message has been confirmed by the service.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the send method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     */
    public abstract <T> boolean send(String topic, String data, Map<String, Object> properties, SendOptions sendOptions, CompletionListener<T> listener, T context)
    throws StoppedException, IllegalArgumentException;

    /**
     * Sends a ByteBuffer to a topic.
     * @param topic the topic to send the message to. Cannot be null.
     * @param data the byte buffer to send to the topic. Cannot be null.
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @param sendOptions a set of options that determine exactly how the send operation works.
     * @param listener a listener object that is notified when the send operation completes.  For 'at most once' quality of
     *                 service messages, this is notified (of success) when the message has been flushed to the network.
     *                 For 'at least once' quality of service messages, this is notified (of success) when receipt of the
     *                 message has been confirmed by the service.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the send method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     */
    public abstract <T> boolean send(String topic, ByteBuffer data, Map<String, Object> properties, SendOptions sendOptions, CompletionListener<T> listener, T context)
    throws StoppedException, IllegalArgumentException;

    /**
     * Sends a JSON object to a topic.
     * @param topic the topic to send the message to. Cannot be null.
     * @param json the object to send as a JSON object.  The send method will convert this object to JSON using the
     *             Google Gson library to convert the object to JSON (essentially calling {@link Gson#toJson(Object)} to
     *             perform the conversion).
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @param sendOptions a set of options that determine exactly how the send operation works.
     * @param listener a listener object that is notified when the send operation completes.  For 'at most once' quality of
     *                 service messages, this is notified (of success) when the message has been flushed to the network.
     *                 For 'at least once' quality of service messages, this is notified (of success) when receipt of the
     *                 message has been confirmed by the service.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the send method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     */
    public abstract <T> boolean send(String topic, Object json, Map<String, Object> properties, SendOptions sendOptions, CompletionListener<T> listener, T context)
            throws StoppedException, IllegalArgumentException;

    /**
     * Sends a JSON object to a topic.  This form of send can handle objects that use Java Generics.
     * @param topic the topic to send the message to. Cannot be null.
     * @param json the object to send as a JSON object.  The send method will convert this object to JSON using the
     *             Google Gson library to convert the object to JSON (essentially calling {@link Gson#toJson(Object, Type)} to
     *             perform the conversion).
     * @param type provides type information about the json object.  This allows Java types that make use of
     *             Java Generics to be converted to JSON.
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @param sendOptions a set of options that determine exactly how the send operation works.
     * @param listener a listener object that is notified when the send operation completes.  For 'at most once' quality of
     *                 service messages, this is notified (of success) when the message has been flushed to the network.
     *                 For 'at least once' quality of service messages, this is notified (of success) when receipt of the
     *                 message has been confirmed by the service.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the send method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     */
    public abstract <T> boolean send(String topic, Object json, Type type, Map<String, Object> properties, SendOptions sendOptions, CompletionListener<T> listener, T context)
            throws StoppedException, IllegalArgumentException;

    /**
     * Sends a String containing JSON data to a topic.  This form of send can be used to integrate with other
     * JSON libraries.
     * @param topic the topic to send the message to. Cannot be null.
     * @param json a String which is assumed to contain JSON information.  No checking is performed on this string, it is
     *             simply transferred as the body of a message which the appropriate
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @param sendOptions a set of options that determine exactly how the send operation works.
     * @param listener a listener object that is notified when the send operation completes.  For 'at most once' quality of
     *                 service messages, this is notified (of success) when the message has been flushed to the network.
     *                 For 'at least once' quality of service messages, this is notified (of success) when receipt of the
     *                 message has been confirmed by the service.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the send method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     */
    public abstract <T> boolean sendJson(String topic, String json, Map<String, Object> properties, SendOptions sendOptions, CompletionListener<T> listener, T context)
            throws StoppedException, IllegalArgumentException;
    /**
     * Send a message to the MQ Light server.  This is equivalent to calling:
     * send(topic, data, properties, SendOptions.builder().build(), listener, context)
     * @param topic the topic to send the message to. Cannot be null.
     * @param data the string data to send to the topic. Cannot be null.
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @param listener a listener object that is notified when the send operation completes.  For 'at most once' quality of
     *                 service messages, this is notified (of success) when the message has been flushed to the network.
     *                 For 'at least once' quality of service messages, this is notified (of success) when receipt of the
     *                 message has been confirmed by the service.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the send method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#send(String, String, Map, SendOptions, CompletionListener, Object)
     */
    public <T> boolean send(String topic, String data, Map<String, Object> properties, CompletionListener<T> listener, T context)
    throws StoppedException, IllegalArgumentException {
        return send(topic, data, properties, defaultSendOptions, listener, context);
    }

    /**
     * Send a message to the MQ Light server.  This is equivalent to calling:
     * send(topic, data, properties, SendOptions.builder().build(), listener, context)
     * @param topic the topic to send the message to. Cannot be null.
     * @param data the byte buffer to send to the topic. Cannot be null.
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @param listener a listener object that is notified when the send operation completes.  For 'at most once' quality of
     *                 service messages, this is notified (of success) when the message has been flushed to the network.
     *                 For 'at least once' quality of service messages, this is notified (of success) when receipt of the
     *                 message has been confirmed by the service.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the send method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#send(String, ByteBuffer, Map, SendOptions, CompletionListener, Object)
     */
    public <T> boolean send(String topic, ByteBuffer data, Map<String, Object> properties, CompletionListener<T> listener, T context)
    throws StoppedException, IllegalArgumentException {
        return send(topic, data, properties, defaultSendOptions, listener, context);
    }

    /**
     * Sends a message to the MQ Light server.  This is equivalent to calling:
     * send(topic, json, properties, SendOptions.builder().build(), listener, context)
     * @param topic the topic to send the message to. Cannot be null.
     * @param json the object to send as a JSON object.  The send method will convert this object to JSON using the
     *             Google Gson library to convert the object to JSON (essentially calling {@link Gson#toJson(Object, Type)} to
     *             perform the conversion).
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @param listener a listener object that is notified when the send operation completes.  For 'at most once' quality of
     *                 service messages, this is notified (of success) when the message has been flushed to the network.
     *                 For 'at least once' quality of service messages, this is notified (of success) when receipt of the
     *                 message has been confirmed by the service.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the send method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#send(String, Object, Map, SendOptions, CompletionListener, Object)
     */
    public <T> boolean send(String topic, Object json, Map<String, Object> properties, CompletionListener<T> listener, T context)
    throws StoppedException, IllegalArgumentException {
        return send(topic, json, properties, defaultSendOptions, listener, context);
    }

    /**
     * Sends a message to the MQ Light server.  This is equivalent to calling:
     * send(topic, json, type, properties, SendOptions.builder().build(), listener, context)
     * @param topic the topic to send the message to. Cannot be null.
     * @param json the object to send as a JSON object.  The send method will convert this object to JSON using the
     *             Google Gson library to convert the object to JSON (essentially calling {@link Gson#toJson(Object, Type)} to
     *             perform the conversion).
     * @param type provides type information about the json object.  This allows Java types that make use of
     *             Java Generics to be converted to JSON.
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @param listener a listener object that is notified when the send operation completes.  For 'at most once' quality of
     *                 service messages, this is notified (of success) when the message has been flushed to the network.
     *                 For 'at least once' quality of service messages, this is notified (of success) when receipt of the
     *                 message has been confirmed by the service.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the send method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#send(String, Object, Type, Map, SendOptions, CompletionListener, Object)
     */
    public <T> boolean send(String topic, Object json, Type type, Map<String, Object> properties, CompletionListener<T> listener, T context)
    throws StoppedException, IllegalArgumentException {
        return send(topic, json, type, properties, defaultSendOptions, listener, context);
    }

    /**
     * Sends a message to the MQ Light server.  This is equivalent to calling:
     * sendJson(topic, json, properties, SendOptions.builder().build(), listener, context)
     * @param topic the topic to send the message to. Cannot be null.
     * @param json a String which is assumed to contain JSON information.  No checking is performed on this string, it is
     *             simply transferred as the body of a message which the appropriate
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @param listener a listener object that is notified when the send operation completes.  For 'at most once' quality of
     *                 service messages, this is notified (of success) when the message has been flushed to the network.
     *                 For 'at least once' quality of service messages, this is notified (of success) when receipt of the
     *                 message has been confirmed by the service.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the send method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#sendJson(String, String, Map, SendOptions, CompletionListener, Object)
     */
    public <T> boolean sendJson(String topic, String json, Map<String, Object> properties, CompletionListener<T> listener, T context)
    throws StoppedException, IllegalArgumentException {
        return sendJson(topic, json, properties, defaultSendOptions, listener, context);
    }

    /**
     * Send a message to the MQ Light server.  This is equivalent to calling:
     * send(topic, data, properties, SendOptions.builder().build(), null, null)
     * @param topic the topic to send the message to. Cannot be null.
     * @param data the string data to send to the topic. Cannot be null.
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#send(String, String, Map, SendOptions, CompletionListener, Object)
     */
    public boolean send(String topic, String data, Map<String, Object> properties) throws StoppedException, IllegalArgumentException {
        return send(topic, data, properties, defaultSendOptions, null, null);
    }

    /**
     * Send a message to the MQ Light server.  This is equivalent to calling:
     * send(topic, data, properties, SendOptions.builder().build(), null, null)
     * @param topic the topic to send the message to. Cannot be null.
     * @param data the byte buffer to send to the topic. Cannot be null.
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#send(String, ByteBuffer, Map, SendOptions, CompletionListener, Object)
     */
    public boolean send(String topic, ByteBuffer data, Map<String, Object> properties) throws StoppedException, IllegalArgumentException {
        return send(topic, data, properties, defaultSendOptions, null, null);
    }

    /**
     * Send a message to the MQ Light server.  This is equivalent to calling:
     * send(topic, json, properties, SendOptions.builder().build(), null, null)
     * @param topic the topic to send the message to. Cannot be null.
     * @param json the object to send as a JSON object.  The send method will convert this object to JSON using the
     *             Google Gson library to convert the object to JSON (essentially calling {@link Gson#toJson(Object)} to
     *             perform the conversion).
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#send(String, Object, Map, SendOptions, CompletionListener, Object)
     */
    public boolean send(String topic, Object json, Map<String, Object> properties) throws StoppedException, IllegalArgumentException {
        return send(topic, json, properties, defaultSendOptions, null, null);
    }

    /**
     * Send a message to the MQ Light server.  This is equivalent to calling:
     * send(topic, json, type, properties, SendOptions.builder().build(), null, null)
     * @param topic the topic to send the message to. Cannot be null.
     * @param json the object to send as a JSON object.  The send method will convert this object to JSON using the
     *             Google Gson library to convert the object to JSON (essentially calling {@link Gson#toJson(Object, Type)} to
     *             perform the conversion).
     * @param type provides type information about the json object.  This allows Java types that make use of
     *             Java Generics to be converted to JSON.
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#send(String, Object, Type, Map, SendOptions, CompletionListener, Object)
     */
    public boolean send(String topic, Object json, Type type, Map<String, Object> properties) throws StoppedException, IllegalArgumentException {
        return send(topic, json, type, properties, defaultSendOptions, null, null);
    }

    /**
     * Send a message to the MQ Light server.  This is equivalent to calling:
     * send(topic, json, properties, SendOptions.builder().build(), null, null)
     * @param topic the topic to send the message to. Cannot be null.
     * @param json a String which is assumed to contain JSON information.  No checking is performed on this string, it is
     *             simply transferred as the body of a message which the appropriate
     * @param properties a {@link Map} of properties that will be carried alongside the message.  Keys must be non-null and values
     *                   must be one of the following types: null, Boolean, Byte,
     *                   Short, Integer, Long, Float, Double,
     *                   byte[], and String.
     * @return a boolean true if the message was sent
     *         immediately, or false if the message was buffered in
     *         memory due to a backlog of messages to send over the network)
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#sendJson(String, String, Map, SendOptions, CompletionListener, Object)
     */
    public boolean sendJson(String topic, String json, Map<String, Object> properties) throws StoppedException, IllegalArgumentException {
        return sendJson(topic, json, properties, defaultSendOptions, null, null);
    }

    /**
     * Requests that the client transitions into started state.
     * This prepares the client to send and/or receive messages from the server. As new instances of
     * NonBlockingClient are created in starting state, this method need
     * only be called if an instance of the client has been stopped using the
     * {@link NonBlockingClient#stop(CompletionListener, Object)} method.
     *
     * @param listener this listener will be invoked when the start operation completes.  This can
     *                 either be when the client has attained started state, or when a subsequent
     *                 call to stop results in the client attaining stopped state before it ever
     *                 achieves started state.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the start method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return the instance of NonBlockingClient that the start method was invoked upon.
     * @throws StoppedException if the client is in the process of stopping when this method is invoked.
     */
    public abstract <T> NonBlockingClient start(CompletionListener<T> listener, T context) throws StoppedException;

    /**
     * Requests that the client transitions into stopped state, automatically unsubscribing from
     * any destinations previously subscribed to using the subscribe(...) methods.
     * Any messages held by the client, pending transmission to the server, will not be transmitted.
     * @param listener a listener that is notified when the stop operation has completed and
     *                 the client has attained stopped state.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the stop method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @throws StartingException if the client is in the process of starting when this method is invoked.
     */
    public abstract <T> void stop(CompletionListener<T> listener, T context) throws StartingException;

    /**
     * Subscribes the client to a destination, based on the supplied topic pattern and
     * share parameters.  The topicPattern parameter is matched against the
     * topic that messages are sent to, allowing the messaging service to determine whether a
     * particular message will be delivered to a particular destination, and hence the subscribing client.
     * @param topicPattern the topic pattern to subscribe to.  This determines which messages will be
     *                     held at the subscribed to destination pending delivery to this client. Cannot be null.
     * @param subOptions a set of options that control the behaviour of the destination subscribed to
     *                   and influence how this client receives messages from the destination.
     * @param destListener a listener that is notified when messages arrive at the client and also
     *                      when the destination is unsubscribed from using the
     *                      {@link NonBlockingClient#unsubscribe(String, String, int, CompletionListener, Object)} method.
     *                      Cannot be null.
     * @param compListener a listener that is notified when the subscribe operation completes.  If a
     *                     value of null is specified then no-one is notified.
     * @param context a context object that is passed into the listeners registered using this method.
     *                The object supplied can be used within the listener code to identify the specific
     *                instance of the subscribe method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return the instance of NonBlockingClient that the subscribe method was invoked upon.  This is to
     *         allow invocations of the subscribe method to be chained.
     * @throws SubscribedException if the client is already subscribed to the destination identified by a combination
     *                             of the topic pattern and share options.
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     */
    public abstract <T> NonBlockingClient subscribe(String topicPattern, SubscribeOptions subOptions,
                                                    DestinationListener<T> destListener, CompletionListener<T> compListener, T context)
    throws SubscribedException, StoppedException, IllegalArgumentException;

    /**
     * Subscribes to a destination.  This is equivalent to calling:
     * subscribe(topicPattern, new SubscribeOptions(), listener, context)
     * @param topicPattern the topic pattern to subscribe to.  This determines which messages will be
     *                     held at the subscribed to destination pending delivery to this client. Cannot be null.
     * @param destListener a listener that is notified when messages arrive at the client and also
     *                      when the destination is unsubscribed from using the
     *                      {@link NonBlockingClient#unsubscribe(String, String, int, CompletionListener, Object)} method.
     *                      Cannot be null.
     * @param compListener a listener that is notified when the subscribe operation completes.  If a
     *                     value of null is specified then no-one is notified.
     * @param context a context object that is passed into the listeners registered using this method.
     *                The object supplied can be used within the listener code to identify the specific
     *                instance of the subscribe method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return the instance of NonBlockingClient that the subscribe method was invoked upon.  This is to
     *         allow invocations of the subscribe method to be chained.
     * @throws SubscribedException if the client is already subscribed to the destination identified by a combination
     *                             of the topic pattern and share options.
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#subscribe(String, SubscribeOptions, DestinationListener, CompletionListener, Object)
     */
    public <T> NonBlockingClient subscribe(String topicPattern, DestinationListener<T> destListener, CompletionListener<T> compListener, T context)
    throws SubscribedException, StoppedException, IllegalArgumentException {
        return subscribe(topicPattern, defaultSubscribeOptions, destListener, compListener, context);
    }

    /**
     * Unsubscribes from a destination.  Once complete, this stops messages received by the destination
     * from being sent to this client.
     * @param topicPattern a topic pattern that identifies the destination to unsubscribe from.  This must match
     *                     one of the topic patterns previously subscribed to using the
     *                     {@link NonBlockingClient#subscribe(String, SubscribeOptions, DestinationListener, CompletionListener, Object)}
     *                     method.
     * @param share a share name that identifies the destination to unsubscribe from.  This must match the
     *              share option specified when the corresponding topic pattern was subscribed to.  If a value
     *              of null is supplied for this parameter then the client will attempt to
     *              unsubscribe from a private destination.
     * @param ttl the new time-to-live value to assign to the destination.  Currently the only supported value for this
     *            parameter is zero.
     * @param listener a listener that is notified when the unsubscribe operation has completed.  Invocation of this
     *                 listener is deferred until any messages, buffered pending delivery to a DestiantionListener
     *                 registered with the client, have been delivered.  If a value of null is supplied for this
     *                 parameter then no notification will be generated.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the stop method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return the instance of NonBlockingClient that the unsubscribe method was invoked upon.  This is to
     *         allow invocations of the unsubscribe method to be chained.
     * @throws UnsubscribedException if an attempt is made to unsubscribe from a destination that the client is not
     *                               currently subscribed to.
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     */
    public abstract <T> NonBlockingClient unsubscribe(String topicPattern, String share, int ttl, CompletionListener<T> listener, T context)
    throws UnsubscribedException, StoppedException, IllegalArgumentException;

    /**
     * Unsubscribes from a destination.  This is equivalent to calling:
     * unsubscribe(topicPattern, null, ttl)
     * @param topicPattern a topic pattern that identifies the destination to unsubscribe from.  This must match
     *                     one of the topic patterns previously subscribed to using the
     *                     {@link NonBlockingClient#subscribe(String, SubscribeOptions, DestinationListener, CompletionListener, Object)}
     *                     method.
     * @param ttl the new time-to-live value to assign to the destination.  Currently the only supported value for this
     *            parameter is zero.
     * @param listener a listener that is notified when the unsubscribe operation has completed.  Invocation of this
     *                 listener is deferred until any messages, buffered pending delivery to a DestiantionListener
     *                 registered with the client, have been delivered.  If a value of null is supplied for this
     *                 parameter then no notification will be generated.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the stop method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return the instance of NonBlockingClient that the unsubscribe method was invoked upon.  This is to
     *         allow invocations of the unsubscribe method to be chained.
     * @throws UnsubscribedException if an attempt is made to unsubscribe from a destination that the client is not
     *                               currently subscribed to.
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#unsubscribe(String, String, int, CompletionListener, Object)
     */
    public <T> NonBlockingClient unsubscribe(String topicPattern, int ttl, CompletionListener<T> listener, T context)
    throws UnsubscribedException, StoppedException, IllegalArgumentException {
        return unsubscribe(topicPattern, null, ttl, listener, context);
    }

    /**
     * Unsubscribes from a destination.  This is equivalent to calling the
     * {@link NonBlockingClient#unsubscribe(String, String, int, CompletionListener, Object)} method without
     * specifying a ttl (time-to-live) value.  This has the effect of unsubscribing from the destination
     * without changing the ttl value currently assigned to the destination.
     * @param topicPattern a topic pattern that identifies the destination to unsubscribe from.  This must match
     *                     one of the topic patterns previously subscribed to using the
     *                     {@link NonBlockingClient#subscribe(String, SubscribeOptions, DestinationListener, CompletionListener, Object)}
     *                     method.
     * @param share a share name that identifies the destination to unsubscribe from.  This must match the
     *              share option specified when the corresponding topic pattern was subscribed to.  If a value
     *              of null is supplied for this parameter then the client will attempt to
     *              unsubscribe from a private destination.
     * @param listener a listener that is notified when the unsubscribe operation has completed.  Invocation of this
     *                 listener is deferred until any messages, buffered pending delivery to a DestiantionListener
     *                 registered with the client, have been delivered.  If a value of null is supplied for this
     *                 parameter then no notification will be generated.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the stop method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return the instance of NonBlockingClient that the unsubscribe method was invoked upon.  This is to
     *         allow invocations of the unsubscribe method to be chained.
     * @throws UnsubscribedException if an attempt is made to unsubscribe from a destination that the client is not
     *                               currently subscribed to.
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     */
    public abstract <T> NonBlockingClient unsubscribe(String topicPattern, String share, CompletionListener<T> listener, T context)
    throws UnsubscribedException, StoppedException, IllegalArgumentException;

    /**
     * Unsubscribes from a destination.  This is equivalent to calling:
     * unsubscribe(topicPattern, null, listerner, context)
     * @param topicPattern a topic pattern that identifies the destination to unsubscribe from.  This must match
     *                     one of the topic patterns previously subscribed to using the
     *                     {@link NonBlockingClient#subscribe(String, SubscribeOptions, DestinationListener, CompletionListener, Object)}
     *                     method.
     * @param listener a listener that is notified when the unsubscribe operation has completed.  Invocation of this
     *                 listener is deferred until any messages, buffered pending delivery to a DestiantionListener
     *                 registered with the client, have been delivered.  If a value of null is supplied for this
     *                 parameter then no notification will be generated.
     * @param context a context object that is passed into the listener.  This can be used within the listener code to
     *                identify the specific instance of the stop method relating to the listener invocation.
     * @param <T> the type of the context, used to propagate an arbitrary object between method calls on an
     *            instance of this object, and the various listeners that are used to provide notification
     *            of client related events.
     * @return the instance of NonBlockingClient that the unsubscribe method was invoked upon.  This is to
     *         allow invocations of the unsubscribe method to be chained.
     * @throws UnsubscribedException if an attempt is made to unsubscribe from a destination that the client is not
     *                               currently subscribed to.
     * @throws StoppedException if the client is in stopped or stopping state when this method is invoked.
     * @throws IllegalArgumentException if an invalid value is specified for one of the arguments.
     * @see NonBlockingClient#unsubscribe(String, String, CompletionListener, Object)
     */
    public <T> NonBlockingClient unsubscribe(String topicPattern, CompletionListener<T> listener, T context)
    throws UnsubscribedException, StoppedException, IllegalArgumentException {
        return unsubscribe(topicPattern, null, listener, context);
    }
}


text:
// Copyright 2014 The Bazel Authors. 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.

package com.google.devtools.build.lib.bazel.repository;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import com.google.common.base.Optional;
import com.google.devtools.build.lib.util.OS;
import com.google.devtools.build.lib.vfs.PathFragment;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
 * Tests {@link StripPrefixedPath}.
 */
@RunWith(JUnit4.class)
public class StripPrefixedPathTest {
  @Test
  public void testStrip() {
    StripPrefixedPath result = StripPrefixedPath.maybeDeprefix("foo/bar", Optional.of("foo"));
    assertEquals(result.getPathFragment(), new PathFragment("bar"));
    assertTrue(result.foundPrefix());
    assertFalse(result.skip());

    result = StripPrefixedPath.maybeDeprefix("foo", Optional.of("foo"));
    assertTrue(result.skip());

    result = StripPrefixedPath.maybeDeprefix("bar/baz", Optional.of("foo"));
    assertFalse(result.foundPrefix());

    result = StripPrefixedPath.maybeDeprefix("foof/bar", Optional.of("foo"));
    assertFalse(result.foundPrefix());
  }

  @Test
  public void testAbsolute() {
    StripPrefixedPath result = StripPrefixedPath.maybeDeprefix(
        "/foo/bar", Optional.<String>absent());
    assertThat(result.getPathFragment()).isEqualTo(new PathFragment("foo/bar"));

    result = StripPrefixedPath.maybeDeprefix("///foo/bar/baz", Optional.<String>absent());
    assertThat(result.getPathFragment()).isEqualTo(new PathFragment("foo/bar/baz"));

    result = StripPrefixedPath.maybeDeprefix("/foo/bar/baz", Optional.of("/foo"));
    assertThat(result.getPathFragment()).isEqualTo(new PathFragment("bar/baz"));
  }

  @Test
  public void testWindowsAbsolute() {
    if (OS.getCurrent() != OS.WINDOWS) {
      return;
    }
    StripPrefixedPath result = StripPrefixedPath.maybeDeprefix(
        "c:/foo/bar", Optional.<String>absent());
    assertThat(result.getPathFragment()).isEqualTo(new PathFragment("foo/bar"));
  }

  @Test
  public void testNormalize() {
    StripPrefixedPath result = StripPrefixedPath.maybeDeprefix(
        "../bar", Optional.<String>absent());
    assertThat(result.getPathFragment()).isEqualTo(new PathFragment("../bar"));

    result = StripPrefixedPath.maybeDeprefix("foo/../baz", Optional.<String>absent());
    assertThat(result.getPathFragment()).isEqualTo(new PathFragment("baz"));

    result = StripPrefixedPath.maybeDeprefix("foo/../baz", Optional.of("foo"));
    assertThat(result.getPathFragment()).isEqualTo(new PathFragment("baz"));
  }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

/* TwigBundle:Exception:logs.html.twig */
class __TwigTemplate_8b941c1203962055185a4b95617d8f9e6228db72fcf405b85f720d312dacdbdd extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $__internal_398d75f5139c014c56a2db93fe0b9e06385ca82b46cfbdae6361c9df005cbca4 = $this->env->getExtension("Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension");
        $__internal_398d75f5139c014c56a2db93fe0b9e06385ca82b46cfbdae6361c9df005cbca4->enter($__internal_398d75f5139c014c56a2db93fe0b9e06385ca82b46cfbdae6361c9df005cbca4_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "TwigBundle:Exception:logs.html.twig"));

        $__internal_b89dbc4c74ee8ef81acca283ef14af41926473bde4433b43bd0f0d122dc1a2a8 = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension");
        $__internal_b89dbc4c74ee8ef81acca283ef14af41926473bde4433b43bd0f0d122dc1a2a8->enter($__internal_b89dbc4c74ee8ef81acca283ef14af41926473bde4433b43bd0f0d122dc1a2a8_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "TwigBundle:Exception:logs.html.twig"));

        // line 1
        $context["channel_is_defined"] = $this->getAttribute(twig_first($this->env, ($context["logs"] ?? $this->getContext($context, "logs"))), "channel", array(), "any", true, true);
        // line 2
        echo "

            Level
            ";
        // line 7
        if (($context["channel_is_defined"] ?? $this->getContext($context, "channel_is_defined"))) {
            echo "Channel	";
        }
        // line 8
        echo "            Message

    ";
        // line 13
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["logs"] ?? $this->getContext($context, "logs")));
        foreach ($context['_seq'] as $context["_key"] => $context["log"]) {
            // line 14
            echo "
getAttribute($context["log"], "priority", array()) >= 400)) ? ("error") : (((($this->getAttribute($context["log"], "priority", array()) >= 300)) ? ("warning") : ("normal"))));
            echo "\">

                ";
            // line 16
            echo twig_escape_filter($this->env, $this->getAttribute($context["log"], "priorityName", array()), "html", null, true);
            echo "
                ";
            // line 17
            echo twig_escape_filter($this->env, twig_date_format_filter($this->env, $this->getAttribute($context["log"], "timestamp", array()), "H:i:s"), "html", null, true);
            echo "

            ";
            // line 19
            if (($context["channel_is_defined"] ?? $this->getContext($context, "channel_is_defined"))) {
                // line 20
                echo "
                    ";
                // line 21
                echo twig_escape_filter($this->env, $this->getAttribute($context["log"], "channel", array()), "html", null, true);
                echo "

            ";
            }
            // line 24
            echo "            ";
            echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\CodeExtension')->formatLogMessage($this->getAttribute($context["log"], "message", array()), $this->getAttribute($context["log"], "context", array()));
            echo "

    ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['log'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 27
        echo "

";

        $__internal_398d75f5139c014c56a2db93fe0b9e06385ca82b46cfbdae6361c9df005cbca4->leave($__internal_398d75f5139c014c56a2db93fe0b9e06385ca82b46cfbdae6361c9df005cbca4_prof);

        $__internal_b89dbc4c74ee8ef81acca283ef14af41926473bde4433b43bd0f0d122dc1a2a8->leave($__internal_b89dbc4c74ee8ef81acca283ef14af41926473bde4433b43bd0f0d122dc1a2a8_prof);

    }

    public function getTemplateName()
    {
        return "TwigBundle:Exception:logs.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  85 => 27,  75 => 24,  69 => 21,  66 => 20,  64 => 19,  59 => 17,  55 => 16,  49 => 14,  45 => 13,  38 => 8,  34 => 7,  27 => 2,  25 => 1,);
    }

    /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
    public function getSource()
    {
        @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);

        return $this->getSourceContext()->getCode();
    }

    public function getSourceContext()
    {
        return new Twig_Source("{% set channel_is_defined = (logs|first).channel is defined %}

            Level
            {% if channel_is_defined %}Channel	{% endif %}
            Message

    {% for log in logs %}

= 400 ? 'error' : log.priority >= 300 ? 'warning' : 'normal' }}\">

                {{ log.priorityName }}
                {{ log.timestamp|date('H:i:s') }}

            {% if channel_is_defined %}

                    {{ log.channel }}

            {% endif %}
            {{ log.message|format_log_message(log.context) }}

    {% endfor %}

", "TwigBundle:Exception:logs.html.twig", "C:\\Users\\Edward\\Curso-Componiendo-Con-Symfony\\vendor\\symfony\\symfony\\src\\Symfony\\Bundle\\TwigBundle/Resources/views/Exception/logs.html.twig");
    }
}


text:
import { IFiltersState } from './i-filters-state.model';
import { IWorklogsListState } from './i-worklogs-list-state.model';

export interface IWorklogsReducers {
  filters: IFiltersState;
  worklogsList: IWorklogsListState;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="picker_today">Šiandien</string>
    <string name="picker_pm">PM</string>
    <string name="picker_am">AM</string>
</resources>


text:
using System;
using System.Runtime.Serialization;

namespace MongoDB.Driver.Communication.Security.Mechanisms.Sspi
{
    /// <summary>
    /// Thrown from a win32 wrapped operation.
    /// </summary>
    [Serializable]
    public class Win32Exception : Exception
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Win32Exception" /> class.
        /// </summary>
        /// <param name="errorCode">The error code.</param>
        public Win32Exception(long errorCode)
        {
            HResult = (int)errorCode;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Win32Exception" /> class.
        /// </summary>
        /// <param name="errorCode">The error code.</param>
        /// <param name="message">The message.</param>
        public Win32Exception(long errorCode, string message)
            : base(message)
        {
            HResult = (int)errorCode;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Win32Exception" /> class.
        /// </summary>
        /// <param name="info">The info.</param>
        /// <param name="context">The context.</param>
        protected Win32Exception(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }
    }
}


text:
layout: page
title: Light Technologies Executive Retreat
date: 2016-05-24
author: Kevin Gaines
tags: weekly links, java
status: published
summary: Phasellus eleifend sodales hendrerit. Suspendisse semper pharetra mi non.
banner: images/banner/office-01.jpg
booking:
  startDate: 04/15/2016
  endDate: 04/17/2016
  ctyhocn: SEALYHX
  groupCode: LTER
published: true
---
Fusce a leo nisi. Suspendisse rutrum laoreet ante, facilisis mattis nisl dictum at. Pellentesque ac interdum nibh. Nullam dolor elit, faucibus non elementum id, ornare nec libero. Donec vel tincidunt libero. Cras non risus eu purus maximus pharetra. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin lacinia eleifend erat quis tincidunt. Nullam suscipit erat interdum mauris pharetra, molestie tincidunt sapien sodales. Morbi vel purus aliquet, condimentum ligula vitae, iaculis ipsum.

* Vestibulum efficitur velit in nisl tincidunt, id accumsan odio condimentum
* Curabitur posuere nulla eget nulla finibus, a tempor risus tincidunt
* Proin nec sem gravida, tempor metus eu, tincidunt nisl
* Vivamus sagittis mauris ac mauris rutrum iaculis
* Quisque vel nunc sit amet mauris sollicitudin pretium nec eu ligula
* Sed quis justo facilisis velit tincidunt feugiat cursus sit amet erat.

Nullam justo urna, lacinia eget velit vitae, viverra ornare nisl. In in ipsum ut leo ultrices rutrum. Vestibulum finibus lectus venenatis nulla mollis, eget commodo lorem ultricies. Duis eget arcu eu neque semper lobortis. Donec ullamcorper ipsum in pharetra fermentum. Ut dictum odio eros, sed tempor leo pretium ac. Fusce id lacus justo. Donec eu dui eget lectus tincidunt ultricies. Nunc risus felis, scelerisque et blandit a, rutrum sit amet dui. Etiam ut urna libero. Pellentesque quis ante auctor, venenatis ante eget, consequat tellus. Proin nec nisl metus.
Praesent nec gravida urna. Suspendisse potenti. Maecenas dictum lacus ipsum. Etiam vulputate tortor ac ex ornare congue. Sed egestas tincidunt urna non elementum. Sed sagittis, leo quis tempor vulputate, magna libero pellentesque dolor, nec imperdiet velit est eu dui. Quisque nec urna malesuada, dictum augue in, suscipit eros.


text:
package org.bpmscript.exec.js;

import org.bpmscript.IProcessDefinition;

/**
 * Javascript Process Definition definition. Contains a "source" string
 */
public interface IJavascriptProcessDefinition extends IProcessDefinition {

    public static String DEFINITION_TYPE_JAVASCRIPT = "Javascript";

    /**
     * @return The source code for this Javascript process
     */
    String getSource();
}


text:
Student::Student(const char* name, int id, int fn, int grade)
	: Person(name, id), fn(fn), grade(grade) {}

void Student::print() const
{
	Person::print();
	printMe();
}

void Student::printMe() const
{
	std::cout << "Az sam studen\n";
	std::cout << fn << std::endl;
	std::cout << grade << std::endl;
}


text:
package io.cattle.platform.docker.process.account;

import io.cattle.platform.archaius.util.ArchaiusUtil;
import io.cattle.platform.core.addon.ServicesPortRange;
import io.cattle.platform.core.constants.AccountConstants;
import io.cattle.platform.core.constants.NetworkConstants;
import io.cattle.platform.core.constants.NetworkServiceConstants;
import io.cattle.platform.core.constants.NetworkServiceProviderConstants;
import io.cattle.platform.core.dao.GenericResourceDao;
import io.cattle.platform.core.dao.NetworkDao;
import io.cattle.platform.core.model.Account;
import io.cattle.platform.core.model.Network;
import io.cattle.platform.docker.constants.DockerNetworkConstants;
import io.cattle.platform.engine.handler.HandlerResult;
import io.cattle.platform.engine.handler.ProcessPostListener;
import io.cattle.platform.engine.process.ProcessInstance;
import io.cattle.platform.engine.process.ProcessState;
import io.cattle.platform.json.JsonMapper;
import io.cattle.platform.object.meta.ObjectMetaDataManager;
import io.cattle.platform.object.util.DataAccessor;
import io.cattle.platform.process.common.handler.AbstractObjectProcessLogic;
import io.cattle.platform.util.type.CollectionUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import com.netflix.config.DynamicStringListProperty;

public class DockerAccountCreate extends AbstractObjectProcessLogic implements ProcessPostListener {
    DynamicStringListProperty KINDS = ArchaiusUtil.getList("docker.network.create.account.types");
    DynamicStringListProperty DOCKER_NETWORK_SUBNET_CIDR = ArchaiusUtil.getList("docker.network.subnet.cidr");
    DynamicStringListProperty DOCKER_VIP_SUBNET_CIDR = ArchaiusUtil.getList("docker.vip.subnet.cidr");

    @Inject
    NetworkDao networkDao;

    @Inject
    GenericResourceDao resourceDao;

    @Inject
    JsonMapper jsonMapper;

    @Override
    public String[] getProcessNames() {
        return new String[]{"account.create"};
    }

    @Override
    public HandlerResult handle(ProcessState state, ProcessInstance process) {
        Account account = (Account)state.getResource();
        if (!KINDS.get().contains(account.getKind())) {
            return null;
        }

        Map<String, Network> networksByKind = getNetworksByUuid(account);

        createNetwork(DockerNetworkConstants.KIND_DOCKER_HOST, account, networksByKind, "Docker Host Network Mode", null);
        createNetwork(DockerNetworkConstants.KIND_DOCKER_NONE, account, networksByKind, "Docker None Network Mode", null);
        createNetwork(DockerNetworkConstants.KIND_DOCKER_CONTAINER, account, networksByKind, "Docker Container Network Mode", null);
        createNetwork(DockerNetworkConstants.KIND_DOCKER_BRIDGE, account, networksByKind, "Docker Bridge Network Mode", null);

        ServicesPortRange portRange = DataAccessor.field(account, AccountConstants.FIELD_PORT_RANGE, jsonMapper,
                ServicesPortRange.class);
        if (portRange == null) {
            portRange = AccountConstants.getDefaultServicesPortRange();
        }

        Network managedNetwork = createManagedNetwork(account, networksByKind);
        return new HandlerResult(AccountConstants.FIELD_DEFAULT_NETWORK_ID, managedNetwork.getId(),
                AccountConstants.FIELD_PORT_RANGE, portRange).withShouldContinue(true);
    }

    protected Network createManagedNetwork(Account account, Map<String, Network> networksByKind) {
        Network network = createNetwork(NetworkConstants.KIND_HOSTONLY, account, networksByKind,
                "Rancher Managed Network",
                NetworkConstants.FIELD_HOST_VNET_URI, "bridge://docker0",
                NetworkConstants.FIELD_DYNAMIC_CREATE_VNET, true);

        networkDao.addManagedNetworkSubnet(network);
        createAgentInstanceProvider(network);
        return network;
    }

    protected void createAgentInstanceProvider(Network network) {
        List<String> servicesKinds = new ArrayList<String>();
        servicesKinds.add(NetworkServiceConstants.KIND_DNS);
        servicesKinds.add(NetworkServiceConstants.KIND_LINK);
        servicesKinds.add(NetworkServiceConstants.KIND_IPSEC_TUNNEL);
        servicesKinds.add(NetworkServiceConstants.KIND_PORT_SERVICE);
        servicesKinds.add(NetworkServiceConstants.KIND_HOST_NAT_GATEWAY);
        servicesKinds.add(NetworkServiceConstants.KIND_HEALTH_CHECK);
        networkDao.createNsp(network, servicesKinds, NetworkServiceProviderConstants.KIND_AGENT_INSTANCE);
    }

    protected Network createNetwork(String kind, Account account, Map<String, Network> networksByKind,
                                  String name, String key, Object... valueKeyValue) {
        Network network = networksByKind.get(kind);
        if (network != null) {
            return network;
        }
        Map<String, Object> data = key == null ? new HashMap<String, Object>() :
                CollectionUtils.asMap(key, valueKeyValue);

        data.put(ObjectMetaDataManager.NAME_FIELD, name);
        data.put(ObjectMetaDataManager.ACCOUNT_FIELD, account.getId());
        data.put(ObjectMetaDataManager.KIND_FIELD, kind);

        return resourceDao.createAndSchedule(Network.class, data);
    }

    protected Map<String, Network> getNetworksByUuid(Account account) {
        Map<String, Network> result = new HashMap<>();

        for (Network network : networkDao.getNetworksForAccount(account.getId(), null)) {
            result.put(network.getKind(), network);
        }

        return result;
    }
}


text:
This repo is no longer being maintained. Users are welcome to fork it, but we make no warranty of its functionality.

[![Circle CI](https://circleci.com/gh/CenturyLinkLabs/clcgo/tree/master.svg?style=svg)](https://circleci.com/gh/CenturyLinkLabs/clcgo/tree/master)
[![GoDoc](http://godoc.org/github.com/CenturyLinkLabs/clcgo?status.png)](http://godoc.org/github.com/CenturyLinkLabs/clcgo)

clcgo is an API wrapper for the CenturyLink Cloud V2 API written in Go. You can read about its usage in [the
GoDocs](http://godoc.org/github.com/CenturyLinkLabs/clcgo), and about the API's capabilities in [CenturyLink Cloud documentation](https://t3n.zendesk.com/categories/20067994-API-v2-0-Beta-).


text:
class AddCurrentMissionIdToUsers < ActiveRecord::Migration[4.2]
  def change
    add_column :users, :current_mission_id, :integer
  end
end


text:
from pyislands.selection import ktournament

import functools as fcn

def get_assimilation(airport, policy):
    '''
    This function returns assimilate function:
        new_population = assimilate(population)
    '''
    return fcn.partial(__assimilate, policy, airport)

def __assimilate(policy, airport, population):
    '''
    Assimilation imports all immigrants from the airport.
    The airport should support get, put and empty methods (e.g. Queue.Queue or
    multiprocessing.Queue).

    Immigrants are then mixed with the population using migration policy:
        new_population = policy(population, immigrants)
    '''

# import immigrants
    immigrants = []
    while not airport.empty():
        genotype = airport.get()
        immigrants.append(genotype)

# mix immigrants with the population
    new_population = policy(population, immigrants)

    return new_population

def policy_2tournament(population, immigrants):
    ''' assimilation policy of some population '''

    new_population = list(population)

    for immigrant in immigrants:
        _, idxs = ktournament(2, population)
        bad_idx = idxs[1]

        new_population[bad_idx] = immigrant

    return tuple(new_population)


text:
package domains

import (
	src "cloud.google.com/go/domains/apiv1beta1/domainspb"
	grpc "google.golang.org/grpc"
)

// Deprecated: Please use consts in: cloud.google.com/go/domains/apiv1beta1/domainspb
const (
	ContactNotice_CONTACT_NOTICE_UNSPECIFIED          = src.ContactNotice_CONTACT_NOTICE_UNSPECIFIED
	ContactNotice_PUBLIC_CONTACT_DATA_ACKNOWLEDGEMENT = src.ContactNotice_PUBLIC_CONTACT_DATA_ACKNOWLEDGEMENT
	ContactPrivacy_CONTACT_PRIVACY_UNSPECIFIED        = src.ContactPrivacy_CONTACT_PRIVACY_UNSPECIFIED
	ContactPrivacy_PRIVATE_CONTACT_DATA               = src.ContactPrivacy_PRIVATE_CONTACT_DATA
	ContactPrivacy_PUBLIC_CONTACT_DATA                = src.ContactPrivacy_PUBLIC_CONTACT_DATA
	ContactPrivacy_REDACTED_CONTACT_DATA              = src.ContactPrivacy_REDACTED_CONTACT_DATA
	DnsSettings_DS_RECORDS_PUBLISHED                  = src.DnsSettings_DS_RECORDS_PUBLISHED
	DnsSettings_DS_RECORDS_UNPUBLISHED                = src.DnsSettings_DS_RECORDS_UNPUBLISHED
	DnsSettings_DS_STATE_UNSPECIFIED                  = src.DnsSettings_DS_STATE_UNSPECIFIED
	DnsSettings_DsRecord_ALGORITHM_UNSPECIFIED        = src.DnsSettings_DsRecord_ALGORITHM_UNSPECIFIED
	DnsSettings_DsRecord_DH                           = src.DnsSettings_DsRecord_DH
	DnsSettings_DsRecord_DIGEST_TYPE_UNSPECIFIED      = src.DnsSettings_DsRecord_DIGEST_TYPE_UNSPECIFIED
	DnsSettings_DsRecord_DSA                          = src.DnsSettings_DsRecord_DSA
	DnsSettings_DsRecord_DSANSEC3SHA1                 = src.DnsSettings_DsRecord_DSANSEC3SHA1
	DnsSettings_DsRecord_ECC                          = src.DnsSettings_DsRecord_ECC
	DnsSettings_DsRecord_ECCGOST                      = src.DnsSettings_DsRecord_ECCGOST
	DnsSettings_DsRecord_ECDSAP256SHA256              = src.DnsSettings_DsRecord_ECDSAP256SHA256
	DnsSettings_DsRecord_ECDSAP384SHA384              = src.DnsSettings_DsRecord_ECDSAP384SHA384
	DnsSettings_DsRecord_ED25519                      = src.DnsSettings_DsRecord_ED25519
	DnsSettings_DsRecord_ED448                        = src.DnsSettings_DsRecord_ED448
	DnsSettings_DsRecord_GOST3411                     = src.DnsSettings_DsRecord_GOST3411
	DnsSettings_DsRecord_INDIRECT                     = src.DnsSettings_DsRecord_INDIRECT
	DnsSettings_DsRecord_PRIVATEDNS                   = src.DnsSettings_DsRecord_PRIVATEDNS
	DnsSettings_DsRecord_PRIVATEOID                   = src.DnsSettings_DsRecord_PRIVATEOID
	DnsSettings_DsRecord_RSAMD5                       = src.DnsSettings_DsRecord_RSAMD5
	DnsSettings_DsRecord_RSASHA1                      = src.DnsSettings_DsRecord_RSASHA1
	DnsSettings_DsRecord_RSASHA1NSEC3SHA1             = src.DnsSettings_DsRecord_RSASHA1NSEC3SHA1
	DnsSettings_DsRecord_RSASHA256                    = src.DnsSettings_DsRecord_RSASHA256
	DnsSettings_DsRecord_RSASHA512                    = src.DnsSettings_DsRecord_RSASHA512
	DnsSettings_DsRecord_SHA1                         = src.DnsSettings_DsRecord_SHA1
	DnsSettings_DsRecord_SHA256                       = src.DnsSettings_DsRecord_SHA256
	DnsSettings_DsRecord_SHA384                       = src.DnsSettings_DsRecord_SHA384
	DomainNotice_DOMAIN_NOTICE_UNSPECIFIED            = src.DomainNotice_DOMAIN_NOTICE_UNSPECIFIED
	DomainNotice_HSTS_PRELOADED                       = src.DomainNotice_HSTS_PRELOADED
	ManagementSettings_AUTOMATIC_RENEWAL              = src.ManagementSettings_AUTOMATIC_RENEWAL
	ManagementSettings_MANUAL_RENEWAL                 = src.ManagementSettings_MANUAL_RENEWAL
	ManagementSettings_RENEWAL_METHOD_UNSPECIFIED     = src.ManagementSettings_RENEWAL_METHOD_UNSPECIFIED
	RegisterParameters_AVAILABILITY_UNSPECIFIED       = src.RegisterParameters_AVAILABILITY_UNSPECIFIED
	RegisterParameters_AVAILABLE                      = src.RegisterParameters_AVAILABLE
	RegisterParameters_UNAVAILABLE                    = src.RegisterParameters_UNAVAILABLE
	RegisterParameters_UNKNOWN                        = src.RegisterParameters_UNKNOWN
	RegisterParameters_UNSUPPORTED                    = src.RegisterParameters_UNSUPPORTED
	Registration_ACTIVE                               = src.Registration_ACTIVE
	Registration_CONTACT_SUPPORT                      = src.Registration_CONTACT_SUPPORT
	Registration_EXPORTED                             = src.Registration_EXPORTED
	Registration_ISSUE_UNSPECIFIED                    = src.Registration_ISSUE_UNSPECIFIED
	Registration_REGISTRATION_FAILED                  = src.Registration_REGISTRATION_FAILED
	Registration_REGISTRATION_PENDING                 = src.Registration_REGISTRATION_PENDING
	Registration_STATE_UNSPECIFIED                    = src.Registration_STATE_UNSPECIFIED
	Registration_SUSPENDED                            = src.Registration_SUSPENDED
	Registration_TRANSFER_FAILED                      = src.Registration_TRANSFER_FAILED
	Registration_TRANSFER_PENDING                     = src.Registration_TRANSFER_PENDING
	Registration_UNVERIFIED_EMAIL                     = src.Registration_UNVERIFIED_EMAIL
	TransferLockState_LOCKED                          = src.TransferLockState_LOCKED
	TransferLockState_TRANSFER_LOCK_STATE_UNSPECIFIED = src.TransferLockState_TRANSFER_LOCK_STATE_UNSPECIFIED
	TransferLockState_UNLOCKED                        = src.TransferLockState_UNLOCKED
)

// Deprecated: Please use vars in: cloud.google.com/go/domains/apiv1beta1/domainspb
var (
	ContactNotice_name                              = src.ContactNotice_name
	ContactNotice_value                             = src.ContactNotice_value
	ContactPrivacy_name                             = src.ContactPrivacy_name
	ContactPrivacy_value                            = src.ContactPrivacy_value
	DnsSettings_DsRecord_Algorithm_name             = src.DnsSettings_DsRecord_Algorithm_name
	DnsSettings_DsRecord_Algorithm_value            = src.DnsSettings_DsRecord_Algorithm_value
	DnsSettings_DsRecord_DigestType_name            = src.DnsSettings_DsRecord_DigestType_name
	DnsSettings_DsRecord_DigestType_value           = src.DnsSettings_DsRecord_DigestType_value
	DnsSettings_DsState_name                        = src.DnsSettings_DsState_name
	DnsSettings_DsState_value                       = src.DnsSettings_DsState_value
	DomainNotice_name                               = src.DomainNotice_name
	DomainNotice_value                              = src.DomainNotice_value
	File_google_cloud_domains_v1beta1_domains_proto = src.File_google_cloud_domains_v1beta1_domains_proto
	ManagementSettings_RenewalMethod_name           = src.ManagementSettings_RenewalMethod_name
	ManagementSettings_RenewalMethod_value          = src.ManagementSettings_RenewalMethod_value
	RegisterParameters_Availability_name            = src.RegisterParameters_Availability_name
	RegisterParameters_Availability_value           = src.RegisterParameters_Availability_value
	Registration_Issue_name                         = src.Registration_Issue_name
	Registration_Issue_value                        = src.Registration_Issue_value
	Registration_State_name                         = src.Registration_State_name
	Registration_State_value                        = src.Registration_State_value
	TransferLockState_name                          = src.TransferLockState_name
	TransferLockState_value                         = src.TransferLockState_value
)

// Defines an authorization code.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type AuthorizationCode = src.AuthorizationCode

// Request for the `ConfigureContactSettings` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ConfigureContactSettingsRequest = src.ConfigureContactSettingsRequest

// Request for the `ConfigureDnsSettings` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ConfigureDnsSettingsRequest = src.ConfigureDnsSettingsRequest

// Request for the `ConfigureManagementSettings` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ConfigureManagementSettingsRequest = src.ConfigureManagementSettingsRequest

// Notices related to contact information.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ContactNotice = src.ContactNotice

// Defines a set of possible contact privacy settings for a `Registration`.
// [ICANN](https://icann.org/) maintains the WHOIS database, a publicly
// accessible mapping from domain name to contact information, and requires
// that each domain name have an entry. Choose from these options to control
// how much information in your `ContactSettings` is published.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ContactPrivacy = src.ContactPrivacy

// Defines the contact information associated with a `Registration`.
// [ICANN](https://icann.org/) requires all domain names to have associated
// contact information. The `registrant_contact` is considered the domain's
// legal owner, and often the other contacts are identical.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ContactSettings = src.ContactSettings

// Details required for a contact associated with a `Registration`.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ContactSettings_Contact = src.ContactSettings_Contact

// Request for the `DeleteRegistration` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DeleteRegistrationRequest = src.DeleteRegistrationRequest

// Defines the DNS configuration of a `Registration`, including name servers,
// DNSSEC, and glue records.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DnsSettings = src.DnsSettings

// Configuration for an arbitrary DNS provider.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DnsSettings_CustomDns = src.DnsSettings_CustomDns
type DnsSettings_CustomDns_ = src.DnsSettings_CustomDns_

// Defines a Delegation Signer (DS) record, which is needed to enable DNSSEC
// for a domain. It contains a digest (hash) of a DNSKEY record that must be
// present in the domain's DNS zone.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DnsSettings_DsRecord = src.DnsSettings_DsRecord

// List of algorithms used to create a DNSKEY. Certain algorithms are not
// supported for particular domains.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DnsSettings_DsRecord_Algorithm = src.DnsSettings_DsRecord_Algorithm

// List of hash functions that may have been used to generate a digest of a
// DNSKEY.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DnsSettings_DsRecord_DigestType = src.DnsSettings_DsRecord_DigestType

// The publication state of DS records for a `Registration`.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DnsSettings_DsState = src.DnsSettings_DsState

// Defines a host on your domain that is a DNS name server for your domain
// and/or other domains. Glue records are a way of making the IP address of a
// name server known, even when it serves DNS queries for its parent domain.
// For example, when `ns.example.com` is a name server for `example.com`, the
// host `ns.example.com` must have a glue record to break the circular DNS
// reference.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DnsSettings_GlueRecord = src.DnsSettings_GlueRecord

// Configuration for using the free DNS zone provided by Google Domains as a
// `Registration`'s `dns_provider`. You cannot configure the DNS zone itself
// using the API. To configure the DNS zone, go to [Google
// Domains](https://domains.google/).
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DnsSettings_GoogleDomainsDns = src.DnsSettings_GoogleDomainsDns
type DnsSettings_GoogleDomainsDns_ = src.DnsSettings_GoogleDomainsDns_

// Notices about special properties of certain domains.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DomainNotice = src.DomainNotice

// DomainsClient is the client API for Domains service. For semantics around
// ctx use and closing/ending streaming RPCs, please refer to
// https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DomainsClient = src.DomainsClient

// DomainsServer is the server API for Domains service.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type DomainsServer = src.DomainsServer

// Request for the `ExportRegistration` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ExportRegistrationRequest = src.ExportRegistrationRequest

// Request for the `GetRegistration` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type GetRegistrationRequest = src.GetRegistrationRequest

// Request for the `ListRegistrations` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ListRegistrationsRequest = src.ListRegistrationsRequest

// Response for the `ListRegistrations` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ListRegistrationsResponse = src.ListRegistrationsResponse

// Defines renewal, billing, and transfer settings for a `Registration`.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ManagementSettings = src.ManagementSettings

// Defines how the `Registration` is renewed.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ManagementSettings_RenewalMethod = src.ManagementSettings_RenewalMethod

// Represents the metadata of the long-running operation. Output only.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type OperationMetadata = src.OperationMetadata

// Request for the `RegisterDomain` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type RegisterDomainRequest = src.RegisterDomainRequest

// Parameters required to register a new domain.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type RegisterParameters = src.RegisterParameters

// Possible availability states of a domain name.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type RegisterParameters_Availability = src.RegisterParameters_Availability

// The `Registration` resource facilitates managing and configuring domain
// name registrations. There are several ways to create a new `Registration`
// resource: To create a new `Registration` resource, find a suitable domain
// name by calling the `SearchDomains` method with a query to see available
// domain name options. After choosing a name, call
// `RetrieveRegisterParameters` to ensure availability and obtain information
// like pricing, which is needed to build a call to `RegisterDomain`. Another
// way to create a new `Registration` is to transfer an existing domain from
// another registrar. First, go to the current registrar to unlock the domain
// for transfer and retrieve the domain's transfer authorization code. Then
// call `RetrieveTransferParameters` to confirm that the domain is unlocked and
// to get values needed to build a call to `TransferDomain`.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type Registration = src.Registration

// Possible issues with a `Registration` that require attention.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type Registration_Issue = src.Registration_Issue

// Possible states of a `Registration`.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type Registration_State = src.Registration_State

// Request for the `ResetAuthorizationCode` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type ResetAuthorizationCodeRequest = src.ResetAuthorizationCodeRequest

// Request for the `RetrieveAuthorizationCode` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type RetrieveAuthorizationCodeRequest = src.RetrieveAuthorizationCodeRequest

// Request for the `RetrieveRegisterParameters` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type RetrieveRegisterParametersRequest = src.RetrieveRegisterParametersRequest

// Response for the `RetrieveRegisterParameters` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type RetrieveRegisterParametersResponse = src.RetrieveRegisterParametersResponse

// Request for the `RetrieveTransferParameters` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type RetrieveTransferParametersRequest = src.RetrieveTransferParametersRequest

// Response for the `RetrieveTransferParameters` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type RetrieveTransferParametersResponse = src.RetrieveTransferParametersResponse

// Request for the `SearchDomains` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type SearchDomainsRequest = src.SearchDomainsRequest

// Response for the `SearchDomains` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type SearchDomainsResponse = src.SearchDomainsResponse

// Request for the `TransferDomain` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type TransferDomainRequest = src.TransferDomainRequest

// Possible states of a `Registration`'s transfer lock.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type TransferLockState = src.TransferLockState

// Parameters required to transfer a domain from another registrar.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type TransferParameters = src.TransferParameters

// UnimplementedDomainsServer can be embedded to have forward compatible
// implementations.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type UnimplementedDomainsServer = src.UnimplementedDomainsServer

// Request for the `UpdateRegistration` method.
//
// Deprecated: Please use types in: cloud.google.com/go/domains/apiv1beta1/domainspb
type UpdateRegistrationRequest = src.UpdateRegistrationRequest

// Deprecated: Please use funcs in: cloud.google.com/go/domains/apiv1beta1/domainspb
func NewDomainsClient(cc grpc.ClientConnInterface) DomainsClient { return src.NewDomainsClient(cc) }

// Deprecated: Please use funcs in: cloud.google.com/go/domains/apiv1beta1/domainspb
func RegisterDomainsServer(s *grpc.Server, srv DomainsServer) { src.RegisterDomainsServer(s, srv) }