Fix typo in match types yang model
[controller.git] / opendaylight / netconf / netconf-util / src / main / java / org / opendaylight / controller / netconf / util / AbstractChannelInitializer.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.netconf.util;
10
11 import io.netty.channel.socket.SocketChannel;
12 import io.netty.util.concurrent.Promise;
13 import org.opendaylight.controller.netconf.api.NetconfSession;
14 import org.opendaylight.controller.netconf.util.handler.FramingMechanismHandlerFactory;
15 import org.opendaylight.controller.netconf.util.handler.NetconfHandlerFactory;
16 import org.opendaylight.controller.netconf.util.handler.NetconfMessageAggregator;
17 import org.opendaylight.controller.netconf.util.messages.FramingMechanism;
18 import org.opendaylight.controller.netconf.util.messages.NetconfMessageFactory;
19
20 public abstract class AbstractChannelInitializer {
21
22     public void initialize(SocketChannel ch, Promise<? extends NetconfSession> promise){
23         NetconfHandlerFactory handlerFactory = new NetconfHandlerFactory(new NetconfMessageFactory());
24         ch.pipeline().addLast("aggregator", new NetconfMessageAggregator(FramingMechanism.EOM));
25         ch.pipeline().addLast(handlerFactory.getDecoders());
26         initializeAfterDecoder(ch, promise);
27         ch.pipeline().addLast("frameEncoder", FramingMechanismHandlerFactory.createHandler(FramingMechanism.EOM));
28         ch.pipeline().addLast(handlerFactory.getEncoders());
29     }
30
31     protected abstract void initializeAfterDecoder(SocketChannel ch, Promise<? extends NetconfSession> promise);
32
33 }