2 * Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.neutron.hostconfig.vpp;
11 import com.google.common.base.Preconditions;
13 public class SocketInfo {
15 private final String socketPath;
16 private final String socketPrefix;
17 private final String vhostuserMode;
18 private static final String PORT_ID = "$PORT_ID";
20 public SocketInfo(String socketPath, String socketPrefix, String vhostuserMode) {
21 this.socketPath = Preconditions.checkNotNull(socketPath);
22 this.socketPrefix = Preconditions.checkNotNull(socketPrefix);
23 this.vhostuserMode = Preconditions.checkNotNull(vhostuserMode);
26 public String getSocketPath() {
30 public String getSocketPrefix() {
34 public String getVhostuserMode() {
38 public String getVhostUserSocket() {
39 return new StringBuilder().append(socketPath).append(socketPrefix).append(PORT_ID).toString();
43 public int hashCode() {
46 result = prime * result + ((socketPath == null) ? 0 : socketPath.hashCode());
47 result = prime * result + ((socketPrefix == null) ? 0 : socketPrefix.hashCode());
48 result = prime * result + ((vhostuserMode == null) ? 0 : vhostuserMode.hashCode());
53 public boolean equals(Object obj) {
60 if (getClass() != obj.getClass()) {
63 SocketInfo other = (SocketInfo) obj;
64 if (socketPath == null) {
65 if (other.socketPath != null) {
68 } else if (!socketPath.equals(other.socketPath)) {
71 if (socketPrefix == null) {
72 if (other.socketPrefix != null) {
75 } else if (!socketPrefix.equals(other.socketPrefix)) {
78 if (vhostuserMode == null) {
79 if (other.vhostuserMode != null) {
82 } else if (!vhostuserMode.equals(other.vhostuserMode)) {