blob: 227bb2ff7cfc08003fb3f4d624ad0897e0d8de20 [file] [log] [blame]
tejeshwer degala3fe1ed52016-04-22 17:04:01 +05301/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.isis.controller.impl;
17
18import org.jboss.netty.channel.ChannelPipeline;
19import org.jboss.netty.channel.ChannelPipelineFactory;
20import org.jboss.netty.channel.Channels;
21
22/**
23 * Creates a ChannelPipeline for a client-side ISIS channel.
24 */
25public class IsisPipelineFactory implements ChannelPipelineFactory {
26 private IsisChannelHandler isisChannelHandler;
27
28 /**
29 * Creates an instance of ISIS channel pipeline factory.
30 *
31 * @param isisChannelHandler ISIS channel handler instance
32 */
33 public IsisPipelineFactory(IsisChannelHandler isisChannelHandler) {
34 this.isisChannelHandler = isisChannelHandler;
35 }
36
37 @Override
38 public ChannelPipeline getPipeline() throws Exception {
39 ChannelPipeline pipeline = Channels.pipeline();
40 pipeline.addLast("encoder", new IsisMessageDecoder());
41 pipeline.addLast("decoder", new IsisMessageEncoder());
42 pipeline.addLast("handler", isisChannelHandler);
43
44 return pipeline;
45 }
46}