private ArrayList<Object> papStatusData;
private ArrayList<Object> policyActivityData;
+ private PolicyController policyController;
+ public PolicyController getPolicyController() {
+ return policyController;
+ }
+ public void setPolicyController(PolicyController policyController) {
+ this.policyController = policyController;
+ }
+
+ private PolicyController getPolicyControllerInstance(){
+ return policyController != null ? getPolicyController() : new PolicyController();
+ }
@RequestMapping(value={"/get_DashboardLoggingData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("availableLoggingDatas", mapper.writeValueAsString(systemDAO.getLoggingData()));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
response.getWriter().write(j.toString());
}
catch (Exception e){
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
}
}
@RequestMapping(value={"/get_DashboardSystemAlertData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getSystemAlertData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("systemAlertsTableDatas", mapper.writeValueAsString(systemDAO.getSystemAlertData()));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
response.getWriter().write(j.toString());
}
catch (Exception e){
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
}
}
@RequestMapping(value={"/get_DashboardPAPStatusData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPAPStatusData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
addPAPToTable();
response.getWriter().write(j.toString());
}
catch (Exception e){
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
}
}
@RequestMapping(value={"/get_DashboardPDPStatusData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPDPStatusData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
- this.pdpConatiner = new PDPGroupContainer(PolicyController.getPapEngine());
+ PolicyController controller = getPolicyControllerInstance();
+ this.pdpConatiner = new PDPGroupContainer(controller.getPapEngine());
addPDPToTable();
model.put("pdpTableDatas", mapper.writeValueAsString(pdpStatusData));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
response.getWriter().write(j.toString());
}
catch (Exception e){
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
}
}
@RequestMapping(value={"/get_DashboardPolicyActivityData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPolicyActivityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
- this.pdpConatiner = new PDPGroupContainer(PolicyController.getPapEngine());
+ PolicyController controller = getPolicyControllerInstance();
+ this.pdpConatiner = new PDPGroupContainer(controller.getPapEngine());
addPolicyToTable();
model.put("policyActivityTableDatas", mapper.writeValueAsString(policyActivityData));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
response.getWriter().write(j.toString());
}
catch (Exception e){
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
}
}
* Add the PAP information to the PAP Table
*/
public void addPAPToTable(){
- papStatusData = new ArrayList<Object>();
+ papStatusData = new ArrayList<>();
String papStatus = null;
try {
- Set<EcompPDPGroup> groups = PolicyController.getPapEngine().getEcompPDPGroups();
+ PolicyController controller = getPolicyControllerInstance();
+ Set<EcompPDPGroup> groups = controller.getPapEngine().getEcompPDPGroups();
if (groups == null) {
papStatus = "UNKNOWN";
throw new PAPException("PAP not running");
*/
public void addPDPToTable(){
pdpCount = 0;
- pdpStatusData = new ArrayList<Object>();
+ pdpStatusData = new ArrayList<>();
long naCount;
long denyCount = 0;
long permitCount = 0;
logger.error("MalformedObjectNameException for JMX connection");
} catch (MBeanException e) {
logger.error("MBeanException for JMX connection");
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
} catch (ReflectionException e) {
logger.error("ReflectionException for JMX connection");
}
* Add the information to the Policy Table
*/
private void addPolicyToTable() {
- policyActivityData = new ArrayList<Object>();
+ policyActivityData = new ArrayList<>();
int i = 1;
String policyID = null;
int policyFireCount = 0;
logger.error("MalformedObjectNameException for JMX connection");
} catch (MBeanException e) {
logger.error("MBeanException for JMX connection");
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
} catch (ReflectionException e) {
logger.error("ReflectionException for JMX connection");
}