Remove StompCommands

It is used in only two places and duplicates constants with
Stomp.Commands and Stomp.Responses.
This commit is contained in:
Ville Skyttä 2015-07-09 10:06:36 +03:00 committed by Clebert Suconic
parent 2a4e9f191a
commit 54bbcb3663
3 changed files with 2 additions and 52 deletions

View File

@ -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;
}
}

View File

@ -209,7 +209,7 @@ class StompProtocolManager implements ProtocolManager<StompFrameInterceptor>, 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

View File

@ -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);
}