Added skeletons for ZeroMQ APIs for Binding Aware ZeroMQ Connector
[controller.git] / opendaylight / md-sal / sal-connector-api / src / main / java / org / opendaylight / controller / sal / connector / api / BindingAwareRpcRouter.java
1 package org.opendaylight.controller.sal.connector.api;
2
3 import java.util.concurrent.Future;
4
5 import org.opendaylight.yangtools.concepts.Immutable;
6
7 public interface BindingAwareRpcRouter extends RpcRouter<String, String, String, byte[]> {
8
9     @Override
10     public Future<org.opendaylight.controller.sal.connector.api.RpcRouter.RpcReply<byte[]>> sendRpc(
11             RpcRequest<String, String, String, byte[]> input);
12
13     class BindingAwareRequest implements RpcRequest<String, String, String, byte[]>, Immutable {
14
15         private final BindingAwareRouteIdentifier routingInformation;
16         private final byte[] payload;
17
18         public BindingAwareRequest(BindingAwareRouteIdentifier routingInformation, byte[] payload) {
19             super();
20             this.routingInformation = routingInformation;
21             this.payload = payload;
22         }
23
24         public BindingAwareRouteIdentifier getRoutingInformation() {
25             return this.routingInformation;
26         }
27
28         @Override
29         public byte[] getPayload() {
30             return payload;
31         }
32     }
33
34     class BindingAwareRouteIdentifier implements RouteIdentifier<String, String, String>, Immutable {
35
36         private final String type;
37         private final String route;
38         private final String content;
39
40         public BindingAwareRouteIdentifier(String type, String route, String content) {
41             super();
42             this.type = type;
43             this.route = route;
44             this.content = content;
45         }
46
47         /**
48          * Java class name of Rpc Context
49          * 
50          * 
51          */
52         @Override
53         public String getContext() {
54             return this.content;
55         }
56
57         /**
58          * String representation of route e.g. node-id
59          * 
60          */
61         @Override
62         public String getRoute() {
63             return this.route;
64         }
65
66         /**
67          * Java class name of Rpc Type e.g org.opendaylight.AddFlowInput
68          * 
69          */
70         @Override
71         public String getType() {
72             return this.type;
73         }
74
75         @Override
76         public int hashCode() {
77             final int prime = 31;
78             int result = 1;
79             result = prime * result + ((content == null) ? 0 : content.hashCode());
80             result = prime * result + ((route == null) ? 0 : route.hashCode());
81             result = prime * result + ((type == null) ? 0 : type.hashCode());
82             return result;
83         }
84
85         @Override
86         public boolean equals(Object obj) {
87             if (this == obj)
88                 return true;
89             if (obj == null)
90                 return false;
91             if (getClass() != obj.getClass())
92                 return false;
93             BindingAwareRouteIdentifier other = (BindingAwareRouteIdentifier) obj;
94             if (content == null) {
95                 if (other.content != null)
96                     return false;
97             } else if (!content.equals(other.content))
98                 return false;
99             if (route == null) {
100                 if (other.route != null)
101                     return false;
102             } else if (!route.equals(other.route))
103                 return false;
104             if (type == null) {
105                 if (other.type != null)
106                     return false;
107             } else if (!type.equals(other.type))
108                 return false;
109             return true;
110         }
111
112     }
113
114 }