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; 018 019import org.apache.activemq.transport.amqp.message.InboundTransformer; 020import org.apache.activemq.wireformat.WireFormat; 021import org.apache.activemq.wireformat.WireFormatFactory; 022 023/** 024 * Creates the default AMQP WireFormat object used to configure the protocol support. 025 */ 026public class AmqpWireFormatFactory implements WireFormatFactory { 027 028 private long maxFrameSize = AmqpWireFormat.DEFAULT_MAX_FRAME_SIZE; 029 private int maxAmqpFrameSize = AmqpWireFormat.DEFAULT_ANQP_FRAME_SIZE; 030 private int idelTimeout = AmqpWireFormat.DEFAULT_IDLE_TIMEOUT; 031 private int producerCredit = AmqpWireFormat.DEFAULT_PRODUCER_CREDIT; 032 private String transformer = InboundTransformer.TRANSFORMER_NATIVE; 033 private boolean allowNonSaslConnections = AmqpWireFormat.DEFAULT_ALLOW_NON_SASL_CONNECTIONS; 034 035 @Override 036 public WireFormat createWireFormat() { 037 AmqpWireFormat wireFormat = new AmqpWireFormat(); 038 039 wireFormat.setMaxFrameSize(getMaxFrameSize()); 040 wireFormat.setMaxAmqpFrameSize(getMaxAmqpFrameSize()); 041 wireFormat.setIdleTimeout(getIdelTimeout()); 042 wireFormat.setProducerCredit(getProducerCredit()); 043 wireFormat.setTransformer(getTransformer()); 044 wireFormat.setAllowNonSaslConnections(isAllowNonSaslConnections()); 045 046 return wireFormat; 047 } 048 049 public int getMaxAmqpFrameSize() { 050 return maxAmqpFrameSize; 051 } 052 053 public void setMaxAmqpFrameSize(int maxAmqpFrameSize) { 054 this.maxAmqpFrameSize = maxAmqpFrameSize; 055 } 056 057 public long getMaxFrameSize() { 058 return maxFrameSize; 059 } 060 061 public void setMaxFrameSize(long maxFrameSize) { 062 this.maxFrameSize = maxFrameSize; 063 } 064 065 public int getIdelTimeout() { 066 return idelTimeout; 067 } 068 069 public void setIdelTimeout(int idelTimeout) { 070 this.idelTimeout = idelTimeout; 071 } 072 073 public int getProducerCredit() { 074 return producerCredit; 075 } 076 077 public void setProducerCredit(int producerCredit) { 078 this.producerCredit = producerCredit; 079 } 080 081 public String getTransformer() { 082 return transformer; 083 } 084 085 public void setTransformer(String transformer) { 086 this.transformer = transformer; 087 } 088 089 public boolean isAllowNonSaslConnections() { 090 return allowNonSaslConnections; 091 } 092 093 public void setAllowNonSaslConnections(boolean allowNonSaslConnections) { 094 this.allowNonSaslConnections = allowNonSaslConnections; 095 } 096}