KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > net > protocol > transport > WireProtocolAdaptorFactoryImpl


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.net.protocol.transport;
5
6 import com.tc.async.api.Sink;
7 import com.tc.net.protocol.ProtocolSwitch;
8 import com.tc.net.protocol.TCProtocolAdaptor;
9
10 public class WireProtocolAdaptorFactoryImpl implements WireProtocolAdaptorFactory {
11
12   private final Sink httpSink;
13
14   // This version is for the server and will use the HTTP protocol switcher thingy
15
public WireProtocolAdaptorFactoryImpl(Sink httpSink) {
16     this.httpSink = httpSink;
17   }
18
19   public WireProtocolAdaptorFactoryImpl() {
20     this(null);
21   }
22
23   public TCProtocolAdaptor newWireProtocolAdaptor(WireProtocolMessageSink sink) {
24     if (httpSink != null) { return new ProtocolSwitch(new WireProtocolAdaptorImpl(sink), httpSink); }
25     return new WireProtocolAdaptorImpl(sink);
26   }
27 }
28
Popular Tags