ProtocolOutputConverterRegistry.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 
22 /*
23  * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
24  * Supported AMQP versions:
25  *   8-0
26  */
27 package org.apache.qpid.server.output;
28 
29 import org.apache.qpid.server.output.ProtocolOutputConverter.Factory;
30 import org.apache.qpid.server.protocol.AMQProtocolSession;
31 import org.apache.qpid.framing.ProtocolVersion;
32 
33 import java.util.Map;
34 import java.util.HashMap;
35 
36 public class ProtocolOutputConverterRegistry
37 {
38 
39     private static final Map<ProtocolVersion, Factory> _registry =
40             new HashMap<ProtocolVersion, Factory>();
41 
42 
43     static
44     {
45         register(ProtocolVersion.v8_0, org.apache.qpid.server.output.amqp0_8.ProtocolOutputConverterImpl.getInstanceFactory());
46         register(ProtocolVersion.v0_9, org.apache.qpid.server.output.amqp0_9.ProtocolOutputConverterImpl.getInstanceFactory());
47 
48     }
49 
50     private static void register(ProtocolVersion version, Factory converter)
51     {
52 
53         _registry.put(version,converter);
54     }
55 
56 
57     public static ProtocolOutputConverter getConverter(AMQProtocolSession session)
58     {
59         return _registry.get(session.getProtocolVersion()).newInstance(session);
60     }
61 }