Open Kilda Java Documentation
CtrlRequest.java
Go to the documentation of this file.
1 /* Copyright 2017 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.messaging.ctrl;
17 
18 import static com.google.common.base.MoreObjects.toStringHelper;
19 import static org.openkilda.messaging.Utils.*;
20 
21 import com.fasterxml.jackson.annotation.JsonCreator;
22 import com.fasterxml.jackson.annotation.JsonInclude;
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
25 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
28 
32 @JsonSerialize
33 @JsonInclude(JsonInclude.Include.NON_NULL)
34 @JsonPropertyOrder(value = {
35  DESTINATION,
36  PAYLOAD,
37  TIMESTAMP,
38  CORRELATION_ID})
39 public class CtrlRequest extends Message {
43  private static final long serialVersionUID = 1L;
44 
45  @JsonProperty(ROUTE)
46  private String route = "*";
47 
51  @JsonProperty(PAYLOAD)
52  private RequestData data;
53 
62  @JsonCreator
63  public CtrlRequest(@JsonProperty(ROUTE) String route,
64  @JsonProperty(PAYLOAD) final RequestData data,
65  @JsonProperty(TIMESTAMP) final long timestamp,
66  @JsonProperty(CORRELATION_ID) final String correlationId,
67  @JsonProperty(DESTINATION) final Destination destination) {
68  super(timestamp, correlationId, destination);
69  this.route = route;
70  this.data = data;
71  }
72 
78  public RequestData getData() {
79  return data;
80  }
81 
82  public String getRoute() {
83  return route;
84  }
85 
89  @Override
90  public String toString() {
91  return toStringHelper(this)
92  .add(TIMESTAMP, timestamp)
93  .add(CORRELATION_ID, correlationId)
94  .add(DESTINATION, destination)
95  .add(PAYLOAD, data)
96  .toString();
97  }
98 }
value
Definition: nodes.py:62
CtrlRequest(@JsonProperty(ROUTE) String route, @JsonProperty(PAYLOAD) final RequestData data, @JsonProperty(TIMESTAMP) final long timestamp, @JsonProperty(CORRELATION_ID) final String correlationId, @JsonProperty(DESTINATION) final Destination destination)