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 */ 017package org.apache.activemq.transport.amqp.message; 018 019import javax.jms.Message; 020 021public abstract class OutboundTransformer { 022 023 JMSVendor vendor; 024 String prefixVendor; 025 026 String prefixDeliveryAnnotations = "DA_"; 027 String prefixMessageAnnotations= "MA_"; 028 String prefixFooter = "FT_"; 029 030 String messageFormatKey; 031 String nativeKey; 032 String firstAcquirerKey; 033 String prefixDeliveryAnnotationsKey; 034 String prefixMessageAnnotationsKey; 035 String contentTypeKey; 036 String contentEncodingKey; 037 String replyToGroupIDKey; 038 String prefixFooterKey; 039 040 public OutboundTransformer(JMSVendor vendor) { 041 this.vendor = vendor; 042 this.setPrefixVendor("JMS_AMQP_"); 043 } 044 045 public abstract EncodedMessage transform(Message jms) throws Exception; 046 047 public String getPrefixVendor() { 048 return prefixVendor; 049 } 050 051 public void setPrefixVendor(String prefixVendor) { 052 this.prefixVendor = prefixVendor; 053 054 messageFormatKey = prefixVendor + "MESSAGE_FORMAT"; 055 nativeKey = prefixVendor + "NATIVE"; 056 firstAcquirerKey = prefixVendor + "FirstAcquirer"; 057 prefixDeliveryAnnotationsKey = prefixVendor + prefixDeliveryAnnotations; 058 prefixMessageAnnotationsKey = prefixVendor + prefixMessageAnnotations; 059 contentTypeKey = prefixVendor +"ContentType"; 060 contentEncodingKey = prefixVendor +"ContentEncoding"; 061 replyToGroupIDKey = prefixVendor +"ReplyToGroupID"; 062 prefixFooterKey = prefixVendor + prefixFooter; 063 064 } 065 066 public JMSVendor getVendor() { 067 return vendor; 068 } 069 070 public void setVendor(JMSVendor vendor) { 071 this.vendor = vendor; 072 } 073}