001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.activemq.transport.stomp;
018    
019    public interface Stomp {
020        String NULL = "\u0000";
021        String NEWLINE = "\n";
022    
023        public static interface Commands {
024            String CONNECT = "CONNECT";
025            String SEND = "SEND";
026            String DISCONNECT = "DISCONNECT";
027            String SUBSCRIBE = "SUB";
028            String UNSUBSCRIBE = "UNSUB";
029    
030            String BEGIN_TRANSACTION = "BEGIN";
031            String COMMIT_TRANSACTION = "COMMIT";
032            String ABORT_TRANSACTION = "ABORT";
033            String BEGIN = "BEGIN";
034            String COMMIT = "COMMIT";
035            String ABORT = "ABORT";
036            String ACK = "ACK";
037        }
038    
039        public interface Responses {
040            String CONNECTED = "CONNECTED";
041            String ERROR = "ERROR";
042            String MESSAGE = "MESSAGE";
043            String RECEIPT = "RECEIPT";
044        }
045    
046        public interface Headers {
047            String SEPERATOR = ":";
048            String RECEIPT_REQUESTED = "receipt";
049            String TRANSACTION = "transaction";
050            String CONTENT_LENGTH = "content-length";
051            String TRANSFORMATION = "transformation";
052            String TRANSFORMATION_ERROR = "transformation-error";
053    
054            public interface Response {
055                String RECEIPT_ID = "receipt-id";
056            }
057    
058            public interface Send {
059                String DESTINATION = "destination";
060                String CORRELATION_ID = "correlation-id";
061                String REPLY_TO = "reply-to";
062                String EXPIRATION_TIME = "expires";
063                String PRIORITY = "priority";
064                String TYPE = "type";
065                Object PERSISTENT = "persistent";
066            }
067    
068            public interface Message {
069                String MESSAGE_ID = "message-id";
070                String DESTINATION = "destination";
071                String CORRELATION_ID = "correlation-id";
072                String EXPIRATION_TIME = "expires";
073                String REPLY_TO = "reply-to";
074                String PRORITY = "priority";
075                String REDELIVERED = "redelivered";
076                String TIMESTAMP = "timestamp";
077                String TYPE = "type";
078                String SUBSCRIPTION = "subscription";
079                String USERID = "JMSXUserID";
080            }
081    
082            public interface Subscribe {
083                String DESTINATION = "destination";
084                String ACK_MODE = "ack";
085                String ID = "id";
086                String SELECTOR = "selector";
087    
088                public interface AckModeValues {
089                    String AUTO = "auto";
090                    String CLIENT = "client";
091                    String INDIVIDUAL = "client-individual";
092                }
093            }
094    
095            public interface Unsubscribe {
096                String DESTINATION = "destination";
097                String ID = "id";
098            }
099    
100            public interface Connect {
101                String LOGIN = "login";
102                String PASSCODE = "passcode";
103                String CLIENT_ID = "client-id";
104                String REQUEST_ID = "request-id";
105            }
106    
107            public interface Error {
108                String MESSAGE = "message";
109            }
110    
111            public interface Connected {
112                String SESSION = "session";
113                String RESPONSE_ID = "response-id";
114            }
115    
116            public interface Ack {
117                String MESSAGE_ID = "message-id";
118            }
119        }
120        
121            public enum Transformations {
122                    JMS_BYTE, JMS_OBJECT_XML, JMS_OBJECT_JSON, JMS_MAP_XML, JMS_MAP_JSON;
123                    
124                    public String toString() {
125                            return name().replaceAll("_", "-").toLowerCase();
126                    }
127                    
128                    public static Transformations getValue(String value) {
129                            return valueOf(value.replaceAll("-", "_").toUpperCase());
130                    }
131            }    
132    }