Extensibility support (serialization part)
[openflowjava.git] / openflow-protocol-spi / src / main / java / org / opendaylight / openflowjava / protocol / spi / connection / SwitchConnectionProvider.java
index c6f8ba48ad3bdbe7d2b1eb55799e8250c0c0d779..8b4b958aee25793c8ebb176f7231e7fd35381111 100644 (file)
@@ -1,46 +1,57 @@
-/**
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.openflowjava.protocol.spi.connection;
 
-import java.util.concurrent.Future;
+package org.opendaylight.openflowjava.protocol.spi.connection;
 
+import org.opendaylight.openflowjava.protocol.api.connection.ConnectionConfiguration;
 import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+import com.google.common.util.concurrent.ListenableFuture;
 
 /**
  * @author mirehak
+ * @author michal.polkorab
  *
  */
-public interface SwitchConnectionProvider {
+public interface SwitchConnectionProvider extends AutoCloseable {
 
     /**
-     * @param configuration contains protocols, ports, addresses and similar connection parameters
-     * TODO - create configuration interface proposal
+     * @param configuration [protocol, port, address and supported features]
      */
-    public void configure(Object configuration);
+    void setConfiguration(ConnectionConfiguration configuration);
     
     /**
      * start listening to switches, but please don't forget to do
-     * {@link #setSwitchConnectionListener(SwitchConnectionHandler)} first
-     * @return future, triggered to true, when all listening channels are up and running
+     * {@link #setSwitchConnectionHandler(SwitchConnectionHandler)} first
+     * @return future, triggered to true, when listening channel is up and running
      */
-    public Future<Boolean> startup();
+    ListenableFuture<Boolean> startup();
     
     /**
      * stop listening to switches
      * @return future, triggered to true, when all listening channels are down
      */
-    public Future<Boolean> shutdown();
-    
+    ListenableFuture<Boolean> shutdown();
     
     /**
-     * @param switchConListener instance being informed when new switch connects
+     * @param switchConHandler instance being informed when new switch connects
      */
-    public void setSwitchConnectionListener(SwitchConnectionHandler switchConListener);
-    
+    void setSwitchConnectionHandler(SwitchConnectionHandler switchConHandler);
+
+    /**
+     * Registers custom serializer
+     * @param key used for serializer lookup
+     * @param serializer serializer implementation
+     */
+    public  <E extends DataObject> void registerCustomSerializer(MessageTypeKey<E> key,
+            OFSerializer<E> serializer);
 }