Move out element info from {Switch,Port,Link,Host}Impl
(ONOS-1719)
Change-Id: I8df50ce044173195474fd5c5168bab52f68907b3
diff --git a/src/main/java/net/onrc/onos/core/topology/LinkImpl.java b/src/main/java/net/onrc/onos/core/topology/LinkImpl.java
index fce965a..5ad0194 100644
--- a/src/main/java/net/onrc/onos/core/topology/LinkImpl.java
+++ b/src/main/java/net/onrc/onos/core/topology/LinkImpl.java
@@ -20,15 +20,6 @@
//////////////////////////////////////////////////////
private LinkEvent linkObj;
- // TODO remove?
- protected static final Double DEFAULT_CAPACITY = Double.POSITIVE_INFINITY;
- protected Double capacity = DEFAULT_CAPACITY;
-
- ///////////////////
- /// In-memory index
- ///////////////////
-
- // none
/**
* Creates a Link object based on {@link LinkEvent}.
@@ -116,13 +107,20 @@
@Override
public Double getCapacity() {
- return capacity;
+ return this.linkObj.getCapacity();
}
void setCapacity(Double capacity) {
- this.capacity = capacity;
+ if (this.linkObj.isFrozen()) {
+ this.linkObj = new LinkEvent(this.linkObj);
+ this.linkObj.setCapacity(capacity);
+ this.linkObj.freeze();
+ } else {
+ this.linkObj.setCapacity(capacity);
+ }
}
+ // XXX actually replaces everything
void replaceStringAttributes(LinkEvent updated) {
Validate.isTrue(this.linkObj.getSrc().equals(updated.getSrc()),
"Wrong LinkEvent given.");