import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.lttng.ust.agent.AbstractLttngAgent;
+import java.util.Collection;
/**
* Session daemon command asking the Java agent to list its registered loggers,
* @author Alexandre Montplaisir
* @author David Goulet
*/
-class SessiondListLoggersCommand implements ISessiondCommand {
+class SessiondListLoggersCommand extends SessiondCommand {
@Override
- public ILttngAgentResponse execute(AbstractLttngAgent<?> agent) {
- final List<String> loggerList = new ArrayList<String>();
+ public LttngAgentResponse execute(ILttngTcpClientListener agent) {
+ final Collection<String> loggerList = agent.listAvailableEvents();
int dataSize = 0;
- for (String event : agent.listEnabledEvents()) {
- loggerList.add(event);
+ for (String event : agent.listAvailableEvents()) {
dataSize += event.length() + 1;
}
return new SessiondListLoggersResponse(loggerList, dataSize);
}
- private static class SessiondListLoggersResponse implements ILttngAgentResponse {
+ private static class SessiondListLoggersResponse extends LttngAgentResponse {
private final static int SIZE = 12;
- private final List<String> loggers;
+ private final Collection<String> loggers;
private final int dataSize;
- public SessiondListLoggersResponse(List<String> loggers, int dataSize) {
+ public SessiondListLoggersResponse(Collection<String> loggers, int dataSize) {
this.loggers = loggers;
this.dataSize = dataSize;
}
@Override
public ReturnCode getReturnCode() {
/* This command can't really fail */
- return ILttngAgentResponse.SUCESS_RESPONSE.getReturnCode();
+ return ReturnCode.CODE_SUCCESS_CMD;
}
@Override