-
Notifications
You must be signed in to change notification settings - Fork 0
/
Flow.java
57 lines (48 loc) · 1.67 KB
/
Flow.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package de.tum.ei.lkn.eces.tenantmanager;
import de.tum.ei.lkn.eces.core.Component;
import de.tum.ei.lkn.eces.core.annotations.ComponentBelongsTo;
import de.tum.ei.lkn.eces.tenantmanager.matching.Matching;
import de.tum.ei.lkn.eces.tenantmanager.traffic.TrafficContract;
/**
* Component representing a flow. This component is supposed to be attached to its counterparts in the RoutingSystem
* (requests/responses).
*
* @author Amaury Van Bemten
*/
@ComponentBelongsTo(system = TenantManagerSystem.class)
public class Flow extends Component {
private String name;
private VirtualMachine source;
private VirtualMachine destination;
private Matching matching;
private TrafficContract trafficContract;
Flow(String name, VirtualMachine source, VirtualMachine destination, Matching matching, TrafficContract trafficContract) {
this.name = name;
this.source = source;
this.destination = destination;
this.matching = matching;
this.trafficContract = trafficContract;
}
public VirtualMachine getSource() {
return source;
}
public VirtualMachine getDestination() {
return destination;
}
public Matching getMatching() {
return matching;
}
public TrafficContract getTrafficContract() {
return trafficContract;
}
@Override
public String toString() {
return getIdForString() + "(" + name + ")@[" + source.toString() + "->" + destination.toString() + "]";
}
private String getIdForString() {
if(this.getEntity() == null)
return Integer.toHexString(this.hashCode());
else
return String.valueOf(this.getId());
}
}