01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.net.protocol.transport;
05:
06: import com.tc.async.api.Sink;
07: import com.tc.net.protocol.ProtocolSwitch;
08: import com.tc.net.protocol.TCProtocolAdaptor;
09:
10: public class WireProtocolAdaptorFactoryImpl implements
11: WireProtocolAdaptorFactory {
12:
13: private final Sink httpSink;
14:
15: // This version is for the server and will use the HTTP protocol switcher thingy
16: public WireProtocolAdaptorFactoryImpl(Sink httpSink) {
17: this .httpSink = httpSink;
18: }
19:
20: public WireProtocolAdaptorFactoryImpl() {
21: this (null);
22: }
23:
24: public TCProtocolAdaptor newWireProtocolAdaptor(
25: WireProtocolMessageSink sink) {
26: if (httpSink != null) {
27: return new ProtocolSwitch(
28: new WireProtocolAdaptorImpl(sink), httpSink);
29: }
30: return new WireProtocolAdaptorImpl(sink);
31: }
32: }
|