From 54bbcb3663510a46542a609b89814be0575c24a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 9 Jul 2015 10:06:36 +0300 Subject: [PATCH] Remove StompCommands It is used in only two places and duplicates constants with Stomp.Commands and Stomp.Responses. --- .../core/protocol/stomp/StompCommands.java | 50 ------------------- .../protocol/stomp/StompProtocolManager.java | 2 +- .../core/protocol/stomp/StompSession.java | 2 +- 3 files changed, 2 insertions(+), 52 deletions(-) delete mode 100644 artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompCommands.java diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompCommands.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompCommands.java deleted file mode 100644 index e6317b1c20..0000000000 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompCommands.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.activemq.artemis.core.protocol.stomp; - -public enum StompCommands -{ - ABORT("ABORT"), - ACK("ACK"), - NACK("NACK"), - BEGIN("BEGIN"), - COMMIT("COMMIT"), - CONNECT("CONNECT"), - CONNECTED("CONNECTED"), - DISCONNECT("DISCONNECT"), - ERROR("ERROR"), - MESSAGE("MESSAGE"), - RECEIPT("RECEIPT"), - SEND("SEND"), - STOMP("STOMP"), - SUBSCRIBE("SUBSCRIBE"), - UNSUBSCRIBE("UNSUBSCRIBE"); - - private String command; - - private StompCommands(String command) - { - this.command = command; - } - - @Override - public String toString() - { - return command; - } - -} diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java index 747239cf47..fd06f929e3 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java @@ -209,7 +209,7 @@ class StompProtocolManager implements ProtocolManager, No public boolean isProtocol(byte[] array) { String frameStart = new String(array, StandardCharsets.US_ASCII); - return frameStart.startsWith(StompCommands.CONNECT.name()) || frameStart.startsWith(StompCommands.STOMP.name()); + return frameStart.startsWith(Stomp.Commands.CONNECT) || frameStart.startsWith(Stomp.Commands.STOMP); } @Override diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java index d5c4b6b40a..d12fa06b88 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java @@ -210,7 +210,7 @@ public class StompSession implements SessionCallback StompSubscription stompSubscription = subscriptions.remove(consumerId.getID()); if (stompSubscription != null) { - StompFrame frame = connection.getFrameHandler().createStompFrame(StompCommands.ERROR.toString()); + StompFrame frame = connection.getFrameHandler().createStompFrame(Stomp.Responses.ERROR); frame.setBody("consumer with ID " + consumerId + " disconnected by server"); connection.sendFrame(frame); }