81d740fea96c6320730b575e73a45ec83c60489d
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / md / core / NotificationQueueWrapper.java
1 /**
2  * Copyright (c) 2014 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.openflowplugin.api.openflow.md.core;
9
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
12 import org.opendaylight.yangtools.yang.binding.DataContainer;
13 import org.opendaylight.yangtools.yang.binding.Notification;
14
15 /**
16  * 
17  */
18 public class NotificationQueueWrapper implements OfHeader {
19     
20     private final Notification notification;
21     private final Short version;
22     private Long xid = -1L;
23
24     
25     /**
26      * @param notification
27      * @param version 
28      */
29     public NotificationQueueWrapper(final Notification notification, final Short version) {
30         Preconditions.checkArgument(notification != null, "wrapped notification must not be null");
31         Preconditions.checkArgument(version != null, "message version of wrapped notification must not be null");
32         this.notification = notification; 
33         this.version = version;
34     }
35
36     @Override
37     public Class<? extends DataContainer> getImplementedInterface() {
38         return NotificationQueueWrapper.class;
39     }
40
41     @Override
42     public Short getVersion() {
43         return version;
44     }
45
46     @Override
47     public Long getXid() {
48         return xid;
49     }
50
51     /**
52      * @return the notification
53      */
54     public Notification getNotification() {
55         return notification;
56     }
57
58     /**
59      * @param xid the xid to set
60      */
61     public void setXid(Long xid) {
62         this.xid = xid;
63     }
64 }