KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > net > protocol > delivery > OnceAndOnlyOnceProtocolNetworkLayerFactoryImpl


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.delivery;
5
6 import com.tc.async.api.Sink;
7
8 /**
9  * Creates new instances of OnceAndOnlyOnceProtocolNetworkLayers. This is used so that a mock one may be injected
10  * into the once and only once network stack harness for testing.
11  */

12 public class OnceAndOnlyOnceProtocolNetworkLayerFactoryImpl implements OnceAndOnlyOnceProtocolNetworkLayerFactory {
13
14   public OnceAndOnlyOnceProtocolNetworkLayer createNewInstance(Sink workSink) {
15     
16     OOOProtocolMessageHeader.ProtocolMessageHeaderFactory headerFactory = new OOOProtocolMessageHeader.ProtocolMessageHeaderFactory();
17     OOOProtocolMessageFactory messageFactory = new OOOProtocolMessageImpl.ProtocolMessageFactoryImpl(headerFactory);
18     OOOProtocolMessageParser messageParser = new OOOProtocolMessageImpl.ProtocolMessageParserImpl(headerFactory,
19                                                                                             messageFactory);
20     return new OnceAndOnlyOnceProtocolNetworkLayerImpl(messageFactory, messageParser, workSink);
21   }
22
23 }
24
Popular Tags