Initial framework migration to netty.
[bgpcep.git] / framework / src / main / java / org / opendaylight / protocol / framework / Dispatcher.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 package org.opendaylight.protocol.framework;
9
10 import io.netty.util.concurrent.Future;
11
12 import java.io.IOException;
13 import java.net.InetSocketAddress;
14
15 /**
16  * Dispatcher class for creating protocol servers and clients.
17  */
18 public interface Dispatcher {
19         /**
20          * Creates server. Each server needs factories to pass their instances to client sessions.
21          * 
22          * @param connectionFactory factory for connection specific attributes
23          * @param sfactory to create specific session
24          * @param handlerFactory protocol specific channel handlers factory
25          * 
26          * @return instance of ProtocolServer
27          */
28         public ProtocolServer createServer(final InetSocketAddress address, final ProtocolConnectionFactory connectionFactory,
29                         final ProtocolSessionFactory sfactory) throws IOException;
30
31         /**
32          * Creates a client.
33          * 
34          * @param connection connection specific attributes
35          * @param sfactory protocol session factory to create a specific session
36          * @param handlerFactory protocol-specific channel handlers factory
37          * 
38          * @return session associated with this client
39          */
40         public Future<ProtocolSession> createClient(final ProtocolConnection connection, final ProtocolSessionFactory sfactory)
41                         throws IOException;
42 }