Small refactor of the Java agent's TCP client
[lttng-ust.git] / liblttng-ust-java-agent / java / lttng-ust-agent-common / org / lttng / ust / agent / client / SessiondEnableHandler.java
diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondEnableHandler.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondEnableHandler.java
deleted file mode 100644 (file)
index ec49cb2..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License, version 2.1 only,
- * as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.lttng.ust.agent.client;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.lttng.ust.agent.AbstractLttngAgent;
-
-class SessiondEnableHandler implements ISessiondResponse, ISessiondCommand {
-
-       private static final int INT_SIZE = 4;
-
-       /** Event name to enable in the tracing session */
-       private String eventName;
-
-       /** Return status code to the session daemon. */
-       public LttngAgentRetCode code;
-
-       @Override
-       public void populate(byte[] data) {
-               int dataOffset = INT_SIZE * 2;
-
-               ByteBuffer buf = ByteBuffer.wrap(data);
-               buf.order(ByteOrder.LITTLE_ENDIAN);
-               buf.getInt(); //logLevel, currently unused
-               buf.getInt(); //logLevelType, currently unused
-               eventName = new String(data, dataOffset, data.length - dataOffset).trim();
-       }
-
-       @Override
-       public byte[] getBytes() {
-               byte data[] = new byte[INT_SIZE];
-               ByteBuffer buf = ByteBuffer.wrap(data);
-               buf.order(ByteOrder.BIG_ENDIAN);
-               buf.putInt(code.getCode());
-               return data;
-       }
-
-       public String getEventName() {
-               return eventName;
-       }
-
-       /**
-        * Execute enable handler action which is to enable the given handler to the
-        * received name.
-        *
-        * @param agent
-        *            The agent on which to execute the command
-        */
-       public void execute(AbstractLttngAgent<?> agent) {
-               if (agent.eventEnabled(this.eventName)) {
-                       this.code = LttngAgentRetCode.CODE_SUCCESS_CMD;
-               } else {
-                       this.code = LttngAgentRetCode.CODE_INVALID_CMD;
-               }
-       }
-}
This page took 0.024374 seconds and 4 git commands to generate.