Merge "Prevent ConfigPusher from killing its thread"
[controller.git] / opendaylight / md-sal / remoterpc-routingtable / integrationtest / test-nb / src / main / java / org / opendaylight / controller / tests / zmqroutingtable / rest / RouteIdentifierImpl.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.controller.tests.zmqroutingtable.rest;
9
10 import org.opendaylight.controller.sal.connector.api.RpcRouter;
11 import org.opendaylight.yangtools.yang.common.QName;
12 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
13
14 import java.io.Serializable;
15 import java.net.URI;
16
17 /**
18  * @author: syedbahm
19  * Date: 12/10/13
20  */
21 public class RouteIdentifierImpl implements RpcRouter.RouteIdentifier, Serializable {
22
23     private final URI namespace;
24     private final QName QNAME;
25     private final QName instance;
26
27     public RouteIdentifierImpl() {
28         namespace = URI.create("http://cisco.com/example");
29         QNAME = new QName(namespace, "global");
30         instance = new QName(URI.create("127.0.0.1"), "local");
31     }
32
33     public RouteIdentifierImpl(String url,String instanceIP){
34         namespace = URI.create(url);
35         QNAME = new QName(namespace,"global");
36         instance =  new QName(URI.create(instanceIP), "local");
37     }
38
39
40     @Override
41     public QName getContext() {
42         return QNAME;
43     }
44
45     @Override
46     public QName getType() {
47         return QNAME;
48     }
49
50     @Override
51     public org.opendaylight.yangtools.yang.data.api.InstanceIdentifier getRoute() {
52         return InstanceIdentifier.of(instance);
53     }
54
55     @Override
56     public boolean equals(Object o) {
57         if (this == o) return true;
58         if (o == null || getClass() != o.getClass()) return false;
59
60         RouteIdentifierImpl that = (RouteIdentifierImpl) o;
61
62         if (!QNAME.equals(that.QNAME)) return false;
63         if (!instance.equals(that.instance)) return false;
64         if (!namespace.equals(that.namespace)) return false;
65
66         return true;
67     }
68
69     @Override
70     public int hashCode() {
71         int result = namespace.hashCode();
72         result = 31 * result + QNAME.hashCode();
73         result = 31 * result + instance.hashCode();
74         return result;
75     }
76 }