Unified extensibility method names
[openflowjava.git] / openflow-protocol-spi / src / main / java / org / opendaylight / openflowjava / protocol / spi / connection / SwitchConnectionProvider.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. 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
10 package org.opendaylight.openflowjava.protocol.spi.connection;
11
12 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionConfiguration;
13 import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
14 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
15 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
16 import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer;
17 import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
18
19 import com.google.common.util.concurrent.ListenableFuture;
20
21 /**
22  * @author mirehak
23  * @author michal.polkorab
24  *
25  */
26 public interface SwitchConnectionProvider extends AutoCloseable {
27
28     /**
29      * @param configuration [protocol, port, address and supported features]
30      */
31     void setConfiguration(ConnectionConfiguration configuration);
32     
33     /**
34      * start listening to switches, but please don't forget to do
35      * {@link #setSwitchConnectionHandler(SwitchConnectionHandler)} first
36      * @return future, triggered to true, when listening channel is up and running
37      */
38     ListenableFuture<Boolean> startup();
39     
40     /**
41      * stop listening to switches
42      * @return future, triggered to true, when all listening channels are down
43      */
44     ListenableFuture<Boolean> shutdown();
45     
46     /**
47      * @param switchConHandler instance being informed when new switch connects
48      */
49     void setSwitchConnectionHandler(SwitchConnectionHandler switchConHandler);
50
51     /**
52      * Registers custom serializer
53      * @param key used for serializer lookup
54      * @param serializer serializer implementation
55      */
56     public  <KEY_TYPE> void registerSerializer(MessageTypeKey<KEY_TYPE> key,
57             OFGeneralSerializer serializer);
58
59     /**
60      * Registers custom deserializer
61      * @param key used for deserializer lookup
62      * @param deserializer deserializer instance
63      */
64     public void registerDeserializer(MessageCodeKey key, OFGeneralDeserializer deserializer);
65
66 }