Turn ISessiondCommand into an abstract class
[lttng-ust.git] / liblttng-ust-java-agent / java / lttng-ust-agent-common / org / lttng / ust / agent / client / SessiondListLoggersCommand.java
index cb20ea90b499d5e2a3dd3c1347d8ae558cf01b49..c1bdaf407007ccf686c5a060ee1e510b0bf5dd49 100644 (file)
@@ -20,10 +20,7 @@ package org.lttng.ust.agent.client;
 
 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,
@@ -32,29 +29,28 @@ import org.lttng.ust.agent.AbstractLttngAgent;
  * @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;
                }
@@ -62,7 +58,7 @@ class SessiondListLoggersCommand implements ISessiondCommand {
                @Override
                public ReturnCode getReturnCode() {
                        /* This command can't really fail */
-                       return ILttngAgentResponse.SUCESS_RESPONSE.getReturnCode();
+                       return ReturnCode.CODE_SUCCESS_CMD;
                }
 
                @Override
This page took 0.023857 seconds and 4 git commands to generate.