Changed the way ProviderId is made to include URI scheme portion.
diff --git a/core/api/src/main/java/org/onlab/onos/net/provider/ProviderId.java b/core/api/src/main/java/org/onlab/onos/net/provider/ProviderId.java
index a945354..e9af0eb 100644
--- a/core/api/src/main/java/org/onlab/onos/net/provider/ProviderId.java
+++ b/core/api/src/main/java/org/onlab/onos/net/provider/ProviderId.java
@@ -9,6 +9,7 @@
*/
public class ProviderId {
+ private final String scheme;
private final String id;
/**
@@ -16,15 +17,26 @@
* The providers are expected to follow the reverse DNS convention, e.g.
* {@code org.onlab.onos.provider.of.device}
*
- * @param id string identifier
+ * @param scheme device URI scheme to which this provider is bound, e.g. "of", "snmp"
+ * @param id string identifier
*/
- public ProviderId(String id) {
+ public ProviderId(String scheme, String id) {
+ this.scheme = scheme;
this.id = id;
}
+ /**
+ * Returns the device URI scheme to which this provider is bound.
+ *
+ * @return device URI scheme
+ */
+ public String scheme() {
+ return scheme;
+ }
+
@Override
public int hashCode() {
- return Objects.hash(id);
+ return Objects.hash(scheme, id);
}
@Override
@@ -36,12 +48,13 @@
return false;
}
final ProviderId other = (ProviderId) obj;
- return Objects.equals(this.id, other.id);
+ return Objects.equals(this.scheme, other.scheme) &&
+ Objects.equals(this.id, other.id);
}
@Override
public String toString() {
- return toStringHelper(this).add("id", id).toString();
+ return toStringHelper(this).add("scheme", scheme).add("id", id).toString();
}
}