Commit 6e21a94c authored by ReemyHasan's avatar ReemyHasan

Code cleaning 4

parent 2c8cc537
package com.example.SnmpReciever.enitites; package com.example.SnmpReciever.enitites;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.snmp4j.PDUv1; import org.snmp4j.PDUv1;
import org.snmp4j.smi.VariableBinding; import org.snmp4j.smi.VariableBinding;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class TrapData { public class TrapData {
@JsonProperty("enterprise") @JsonProperty("enterprise")
public String enterprise; public String enterprise;
...@@ -26,16 +34,16 @@ public class TrapData { ...@@ -26,16 +34,16 @@ public class TrapData {
@JsonProperty("variableBindings") @JsonProperty("variableBindings")
public List<VarBind> variableBindings = new ArrayList<VarBind>(); public List<VarBind> variableBindings = new ArrayList<VarBind>();
public TrapData(String enterprise, String agentAddress, int genericTrap, int specificTrap, long timestamp, List<VariableBinding> trapVariableBindings) { // public TrapData(String enterprise, String agentAddress, int genericTrap, int specificTrap, long timestamp, List<VariableBinding> trapVariableBindings) {
this.enterprise = enterprise; // this.enterprise = enterprise;
this.genericTrap = genericTrap; // this.genericTrap = genericTrap;
this.specificTrap = specificTrap; // this.specificTrap = specificTrap;
this.timestamp = timestamp; // this.timestamp = timestamp;
this.agentAddress = agentAddress; // this.agentAddress = agentAddress;
for (VariableBinding vb : trapVariableBindings) { // for (VariableBinding vb : trapVariableBindings) {
this.variableBindings.add(new VarBind(vb)); // this.variableBindings.add(new VarBind(vb));
} // }
} // }
public TrapData(PDUv1 pdu){ public TrapData(PDUv1 pdu){
this.enterprise = pdu.getEnterprise().toString(); this.enterprise = pdu.getEnterprise().toString();
...@@ -50,56 +58,56 @@ public class TrapData { ...@@ -50,56 +58,56 @@ public class TrapData {
} }
} }
public TrapData() { // public TrapData() {
} // }
public String getEnterprise() { // public String getEnterprise() {
return enterprise; // return enterprise;
} // }
//
public void setEnterprise(String enterprise) { // public void setEnterprise(String enterprise) {
this.enterprise = enterprise; // this.enterprise = enterprise;
} // }
//
public int getGenericTrap() { // public int getGenericTrap() {
return genericTrap; // return genericTrap;
} // }
//
public void setGenericTrap(int genericTrap) { // public void setGenericTrap(int genericTrap) {
this.genericTrap = genericTrap; // this.genericTrap = genericTrap;
} // }
//
public int getSpecificTrap() { // public int getSpecificTrap() {
return specificTrap; // return specificTrap;
} // }
//
public void setSpecificTrap(int specificTrap) { // public void setSpecificTrap(int specificTrap) {
this.specificTrap = specificTrap; // this.specificTrap = specificTrap;
} // }
//
public long getTimestamp() { // public long getTimestamp() {
return timestamp; // return timestamp;
} // }
//
public void setTimestamp(long timestamp) { // public void setTimestamp(long timestamp) {
this.timestamp = timestamp; // this.timestamp = timestamp;
} // }
//
public List<VarBind> getVariableBindings() { // public List<VarBind> getVariableBindings() {
return variableBindings; // return variableBindings;
} // }
//
public void setVariableBindings(List<VarBind> variableBindings) { // public void setVariableBindings(List<VarBind> variableBindings) {
this.variableBindings = variableBindings; // this.variableBindings = variableBindings;
} // }
//
public String getAgentAddress() { // public String getAgentAddress() {
return agentAddress; // return agentAddress;
} // }
//
public void setAgentAddress(String agentAddress) { // public void setAgentAddress(String agentAddress) {
this.agentAddress = agentAddress; // this.agentAddress = agentAddress;
} // }
public void print(){ public void print(){
System.out.println("enterprise = " + this.getEnterprise()); System.out.println("enterprise = " + this.getEnterprise());
System.out.println("enterprise = " + this.getAgentAddress()); System.out.println("enterprise = " + this.getAgentAddress());
......
package com.example.SnmpReciever.enitites; package com.example.SnmpReciever.enitites;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.snmp4j.smi.VariableBinding; import org.snmp4j.smi.VariableBinding;
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class VarBind { public class VarBind {
@JsonProperty("oid") @JsonProperty("oid")
public String oid; public String oid;
@JsonProperty("value") @JsonProperty("value")
public String value; public String value;
public VarBind(String oid, String value) { // public VarBind(String oid, String value) {
this.oid = oid; // this.oid = oid;
this.value = value; // this.value = value;
} // }
public VarBind(VariableBinding vb){ public VarBind(VariableBinding vb){
this.oid = vb.getOid().toString(); this.oid = vb.getOid().toString();
this.value = vb.getVariable().toString(); this.value = vb.getVariable().toString();
} }
public VarBind() { // public VarBind() {
} // }
public String getOid() { // public String getOid() {
return oid; // return oid;
} // }
//
public void setOid(String oid) { // public void setOid(String oid) {
this.oid = oid; // this.oid = oid;
} // }
//
public String getValue() { // public String getValue() {
return value; // return value;
} // }
//
public void setValue(String value) { // public void setValue(String value) {
this.value = value; // this.value = value;
} // }
public void print(){ public void print(){
System.out.println("oid = "+ this.getOid() + "," + "value = "+ this.getValue()); System.out.println("oid = "+ this.getOid() + "," + "value = "+ this.getValue());
} }
......
package com.example.kafkaConsumerSNMP.entities; package com.example.kafkaConsumerSNMP.entities;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.snmp4j.PDUv1; import org.snmp4j.PDUv1;
import org.snmp4j.smi.VariableBinding; import org.snmp4j.smi.VariableBinding;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class TrapData { public class TrapData {
@JsonProperty("enterprise") @JsonProperty("enterprise")
public String enterprise; public String enterprise;
...@@ -20,16 +28,16 @@ public class TrapData { ...@@ -20,16 +28,16 @@ public class TrapData {
public long timestamp; public long timestamp;
@JsonProperty("variableBindings") @JsonProperty("variableBindings")
public List<VarBind> variableBindings = new ArrayList<VarBind>(); public List<VarBind> variableBindings = new ArrayList<VarBind>();
public TrapData(String enterprise, String agentAddress, int genericTrap, int specificTrap, long timestamp, List<VariableBinding> trapVariableBindings) { // public TrapData(String enterprise, String agentAddress, int genericTrap, int specificTrap, long timestamp, List<VariableBinding> trapVariableBindings) {
this.enterprise = enterprise; // this.enterprise = enterprise;
this.genericTrap = genericTrap; // this.genericTrap = genericTrap;
this.specificTrap = specificTrap; // this.specificTrap = specificTrap;
this.timestamp = timestamp; // this.timestamp = timestamp;
this.agentAddress = agentAddress; // this.agentAddress = agentAddress;
for (VariableBinding vb : trapVariableBindings) { // for (VariableBinding vb : trapVariableBindings) {
this.variableBindings.add(new VarBind(vb)); // this.variableBindings.add(new VarBind(vb));
} // }
} // }
public TrapData(PDUv1 pdu){ public TrapData(PDUv1 pdu){
this.enterprise = pdu.getEnterprise().toString(); this.enterprise = pdu.getEnterprise().toString();
this.genericTrap = pdu.getGenericTrap(); this.genericTrap = pdu.getGenericTrap();
...@@ -43,56 +51,56 @@ public class TrapData { ...@@ -43,56 +51,56 @@ public class TrapData {
} }
} }
public TrapData() { // public TrapData() {
} // }
public String getEnterprise() { // public String getEnterprise() {
return enterprise; // return enterprise;
} // }
//
public void setEnterprise(String enterprise) { // public void setEnterprise(String enterprise) {
this.enterprise = enterprise; // this.enterprise = enterprise;
} // }
//
public int getGenericTrap() { // public int getGenericTrap() {
return genericTrap; // return genericTrap;
} // }
//
public void setGenericTrap(int genericTrap) { // public void setGenericTrap(int genericTrap) {
this.genericTrap = genericTrap; // this.genericTrap = genericTrap;
} // }
//
public int getSpecificTrap() { // public int getSpecificTrap() {
return specificTrap; // return specificTrap;
} // }
//
public void setSpecificTrap(int specificTrap) { // public void setSpecificTrap(int specificTrap) {
this.specificTrap = specificTrap; // this.specificTrap = specificTrap;
} // }
//
public long getTimestamp() { // public long getTimestamp() {
return timestamp; // return timestamp;
} // }
//
public void setTimestamp(long timestamp) { // public void setTimestamp(long timestamp) {
this.timestamp = timestamp; // this.timestamp = timestamp;
} // }
//
public List<VarBind> getVariableBindings() { // public List<VarBind> getVariableBindings() {
return variableBindings; // return variableBindings;
} // }
//
public void setVariableBindings(List<VarBind> variableBindings) { // public void setVariableBindings(List<VarBind> variableBindings) {
this.variableBindings = variableBindings; // this.variableBindings = variableBindings;
} // }
//
public String getAgentAddress() { // public String getAgentAddress() {
return agentAddress; // return agentAddress;
} // }
//
public void setAgentAddress(String agentAddress) { // public void setAgentAddress(String agentAddress) {
this.agentAddress = agentAddress; // this.agentAddress = agentAddress;
} // }
public void print(){ public void print(){
System.out.println("enterprise = " + this.getEnterprise()); System.out.println("enterprise = " + this.getEnterprise());
System.out.println("enterprise = " + this.getAgentAddress()); System.out.println("enterprise = " + this.getAgentAddress());
......
package com.example.kafkaConsumerSNMP.entities; package com.example.kafkaConsumerSNMP.entities;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.snmp4j.smi.VariableBinding; import org.snmp4j.smi.VariableBinding;
@AllArgsConstructor
@NoArgsConstructor
@Setter
@Getter
public class VarBind { public class VarBind {
@JsonProperty("oid") @JsonProperty("oid")
public String oid; public String oid;
@JsonProperty("value") @JsonProperty("value")
public String value; public String value;
public VarBind(String oid, String value) { // public VarBind(String oid, String value) {
this.oid = oid; // this.oid = oid;
this.value = value; // this.value = value;
} // }
public VarBind(VariableBinding vb){ public VarBind(VariableBinding vb){
this.oid = vb.getOid().toString(); this.oid = vb.getOid().toString();
this.value = vb.getVariable().toString(); this.value = vb.getVariable().toString();
} }
public VarBind() { // public VarBind() {
} // }
//
public String getOid() { // public String getOid() {
return oid; // return oid;
} // }
//
public void setOid(String oid) { // public void setOid(String oid) {
this.oid = oid; // this.oid = oid;
} // }
//
public String getValue() { // public String getValue() {
return value; // return value;
} // }
//
public void setValue(String value) { // public void setValue(String value) {
this.value = value; // this.value = value;
} // }
public void print(){ public void print(){
System.out.println("oid = "+ this.getOid() + "," + "value = "+ this.getValue()); System.out.println("oid = "+ this.getOid() + "," + "value = "+ this.getValue());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment