4444import com .rabbitmq .utility .BlockingCell ;
4545import com .rabbitmq .utility .Utility ;
4646
47+ final class Copyright {
48+ final static String COPYRIGHT ="Copyright (C) 2007-2012 VMware, Inc." ;
49+ final static String LICENSE ="Licensed under the MPL. See http://www.rabbitmq.com/" ;
50+ }
51+
4752/**
4853 * Concrete class representing and managing an AMQP connection to a broker.
4954 * <p>
@@ -63,21 +68,22 @@ public class AMQConnection extends ShutdownNotifierComponent implements Connecti
6368 * @see Connection#getClientProperties
6469 */
6570 public static final Map <String , Object > defaultClientProperties () {
71+ Map <String ,Object > props = new HashMap <String , Object >();
72+ props .put ("product" , LongStringHelper .asLongString ("RabbitMQ" ));
73+ props .put ("version" , LongStringHelper .asLongString (ClientVersion .VERSION ));
74+ props .put ("platform" , LongStringHelper .asLongString ("Java" ));
75+ props .put ("copyright" , LongStringHelper .asLongString (Copyright .COPYRIGHT ));
76+ props .put ("information" , LongStringHelper .asLongString (Copyright .LICENSE ));
77+
6678 Map <String , Object > capabilities = new HashMap <String , Object >();
6779 capabilities .put ("publisher_confirms" , true );
6880 capabilities .put ("exchange_exchange_bindings" , true );
6981 capabilities .put ("basic.nack" , true );
7082 capabilities .put ("consumer_cancel_notify" , true );
71- return buildTable (new Object [] {
72- "product" , LongStringHelper .asLongString ("RabbitMQ" ),
73- "version" , LongStringHelper .asLongString (ClientVersion .VERSION ),
74- "platform" , LongStringHelper .asLongString ("Java" ),
75- "copyright" , LongStringHelper .asLongString (
76- "Copyright (C) 2007-2012 VMware, Inc." ),
77- "information" , LongStringHelper .asLongString (
78- "Licensed under the MPL. See http://www.rabbitmq.com/" ),
79- "capabilities" , capabilities
80- });
83+
84+ props .put ("capabilities" , capabilities );
85+
86+ return props ;
8187 }
8288
8389 private static final Version clientVersion =
@@ -799,20 +805,4 @@ public void close(int closeCode,
799805 private String getHostAddress () {
800806 return getAddress () == null ? null : getAddress ().getHostAddress ();
801807 }
802-
803- /**
804- * Utility for constructing a java.util.Map instance from an
805- * even-length array containing alternating String keys (on the
806- * even elements, starting at zero) and values (on the odd
807- * elements, starting at one).
808- */
809- private static final Map <String , Object > buildTable (Object [] keysValues ) {
810- Map <String , Object > result = new HashMap <String , Object >();
811- for (int index = 0 ; index < keysValues .length ; index += 2 ) {
812- String key = (String ) keysValues [index ];
813- Object value = keysValues [index + 1 ];
814- result .put (key , value );
815- }
816- return result ;
817- }
818808}
0 commit comments