| 1 | /* |
| 2 | * SPDX-License-Identifier: LGPL-2.1-only |
| 3 | * |
| 4 | * Copyright (C) 2015 EfficiOS Inc. |
| 5 | * Copyright (C) 2015 Alexandre Montplaisir <alexmonthy@efficios.com> |
| 6 | */ |
| 7 | |
| 8 | package org.lttng.ust.agent.client; |
| 9 | |
| 10 | import java.util.Collection; |
| 11 | |
| 12 | import org.lttng.ust.agent.session.EventRule; |
| 13 | |
| 14 | /** |
| 15 | * TCP client listener interface. |
| 16 | * |
| 17 | * This interface contains callbacks that are called when the TCP client |
| 18 | * receives commands from the session daemon. These callbacks will define what |
| 19 | * do to with each command. |
| 20 | * |
| 21 | * @author Alexandre Montplaisir |
| 22 | */ |
| 23 | public interface ILttngTcpClientListener { |
| 24 | |
| 25 | /** |
| 26 | * Callback for the TCP client to notify the listener agent that a request |
| 27 | * for enabling an event rule was sent from the session daemon. |
| 28 | * |
| 29 | * @param eventRule |
| 30 | * The event rule that was requested to be enabled |
| 31 | * @return Since we do not track individual sessions, right now this command |
| 32 | * cannot fail. It will always return true. |
| 33 | */ |
| 34 | boolean eventEnabled(EventRule eventRule); |
| 35 | |
| 36 | /** |
| 37 | * Callback for the TCP client to notify the listener agent that a request |
| 38 | * for disabling an event was sent from the session daemon. |
| 39 | * |
| 40 | * @param eventName |
| 41 | * The name of the event that was requested to be disabled. |
| 42 | * @return True if the command completed successfully, false if we should |
| 43 | * report an error (event was not enabled, etc.) |
| 44 | */ |
| 45 | boolean eventDisabled(String eventName); |
| 46 | |
| 47 | /** |
| 48 | * Callback for the TCP client to notify the listener agent that a request |
| 49 | * for enabling an application-specific context was sent from the session |
| 50 | * daemon. |
| 51 | * |
| 52 | * @param contextRetrieverName |
| 53 | * The name of the retriever in which the context is present. |
| 54 | * This is used to namespace the contexts. |
| 55 | * @param contextName |
| 56 | * The name of the context that was requested to be enabled |
| 57 | * @return Since we do not track individual sessions, right now this command |
| 58 | * cannot fail. It will always return true. |
| 59 | */ |
| 60 | boolean appContextEnabled(String contextRetrieverName, String contextName); |
| 61 | |
| 62 | /** |
| 63 | * Callback for the TCP client to notify the listener agent that a request |
| 64 | * for disabling an application-specific context was sent from the session |
| 65 | * daemon. |
| 66 | * |
| 67 | * @param contextRetrieverName |
| 68 | * The name of the retriever in which the context is present. |
| 69 | * This is used to namespace the contexts. |
| 70 | * @param contextName |
| 71 | * The name of the context that was requested to be disabled. |
| 72 | * @return True if the command completed successfully, false if we should |
| 73 | * report an error (context was not previously enabled for example) |
| 74 | */ |
| 75 | boolean appContextDisabled(String contextRetrieverName, String contextName); |
| 76 | |
| 77 | /** |
| 78 | * List the events that are available in the agent's tracing domain. |
| 79 | * |
| 80 | * In Java terms, this means loggers that have at least one LTTng log |
| 81 | * handler of their corresponding domain attached. |
| 82 | * |
| 83 | * @return The list of available events |
| 84 | */ |
| 85 | Collection<String> listAvailableEvents(); |
| 86 | } |