@Test public void testHandleIncomingHttpNotification() { handleIncomingNotifications.handleIncomingHttpNotification(null, ONE, GROUP, null, null); handleIncomingNotifications.handleIncomingHttpNotification(null, ONE, GROUP, null, null); handleIncomingNotifications.handleIncomingHttpNotification(null, ONE, "policy", null, null); handleIncomingNotifications.handleIncomingHttpNotification(null, ONE, PDP, null, null); populatePdpEntityDb(TWO, groupEntity); handleIncomingNotifications.handleIncomingHttpNotification(null, TWO, PDP, null, null); }
public void handleIncomingHttpNotification(String url, String entityId, String entityType, String extraData, XACMLPapServlet xacmlPapServlet) { logger.info("DBDao url: " + url + " has reported an update on " + entityType + " entity " + entityId); PolicyDbDaoTransaction transaction = PolicyDbDao.getPolicyDbDaoInstance().getNewTransaction(); int retries; try { retries = Integer .parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_INCOMINGNOTIFICATION_TRIES)); } catch (Exception e) { logger.error("xacml.rest.pap.incomingnotification.tries property not set, using a default of 3." + e); retries = 3; } if (retries < 1) { retries = 1; } int pauseBetweenRetries = 1000; switch (entityType) { case POLICY_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingPolicyChange(entityId); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingPolicyChange(" + url + ", " + entityId + ", " + extraData + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; case PDP_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingPdpChange(entityId, transaction); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingPdpChange(" + url + ", " + entityId + ", " + transaction + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; case GROUP_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingGroupChange(entityId, extraData, transaction); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingGroupChange(" + url + ", " + entityId + ", " + extraData + ", " + transaction + ", " + xacmlPapServlet + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; default: } transaction.rollbackTransaction(); }
HandleIncomingNotifications { public void handleIncomingHttpNotification(String url, String entityId, String entityType, String extraData, XACMLPapServlet xacmlPapServlet) { logger.info("DBDao url: " + url + " has reported an update on " + entityType + " entity " + entityId); PolicyDbDaoTransaction transaction = PolicyDbDao.getPolicyDbDaoInstance().getNewTransaction(); int retries; try { retries = Integer .parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_INCOMINGNOTIFICATION_TRIES)); } catch (Exception e) { logger.error("xacml.rest.pap.incomingnotification.tries property not set, using a default of 3." + e); retries = 3; } if (retries < 1) { retries = 1; } int pauseBetweenRetries = 1000; switch (entityType) { case POLICY_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingPolicyChange(entityId); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingPolicyChange(" + url + ", " + entityId + ", " + extraData + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; case PDP_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingPdpChange(entityId, transaction); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingPdpChange(" + url + ", " + entityId + ", " + transaction + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; case GROUP_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingGroupChange(entityId, extraData, transaction); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingGroupChange(" + url + ", " + entityId + ", " + extraData + ", " + transaction + ", " + xacmlPapServlet + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; default: } transaction.rollbackTransaction(); } }
HandleIncomingNotifications { public void handleIncomingHttpNotification(String url, String entityId, String entityType, String extraData, XACMLPapServlet xacmlPapServlet) { logger.info("DBDao url: " + url + " has reported an update on " + entityType + " entity " + entityId); PolicyDbDaoTransaction transaction = PolicyDbDao.getPolicyDbDaoInstance().getNewTransaction(); int retries; try { retries = Integer .parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_INCOMINGNOTIFICATION_TRIES)); } catch (Exception e) { logger.error("xacml.rest.pap.incomingnotification.tries property not set, using a default of 3." + e); retries = 3; } if (retries < 1) { retries = 1; } int pauseBetweenRetries = 1000; switch (entityType) { case POLICY_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingPolicyChange(entityId); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingPolicyChange(" + url + ", " + entityId + ", " + extraData + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; case PDP_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingPdpChange(entityId, transaction); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingPdpChange(" + url + ", " + entityId + ", " + transaction + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; case GROUP_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingGroupChange(entityId, extraData, transaction); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingGroupChange(" + url + ", " + entityId + ", " + extraData + ", " + transaction + ", " + xacmlPapServlet + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; default: } transaction.rollbackTransaction(); } @Autowired  HandleIncomingNotifications(SessionFactory sessionfactory);  HandleIncomingNotifications(); }
HandleIncomingNotifications { public void handleIncomingHttpNotification(String url, String entityId, String entityType, String extraData, XACMLPapServlet xacmlPapServlet) { logger.info("DBDao url: " + url + " has reported an update on " + entityType + " entity " + entityId); PolicyDbDaoTransaction transaction = PolicyDbDao.getPolicyDbDaoInstance().getNewTransaction(); int retries; try { retries = Integer .parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_INCOMINGNOTIFICATION_TRIES)); } catch (Exception e) { logger.error("xacml.rest.pap.incomingnotification.tries property not set, using a default of 3." + e); retries = 3; } if (retries < 1) { retries = 1; } int pauseBetweenRetries = 1000; switch (entityType) { case POLICY_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingPolicyChange(entityId); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingPolicyChange(" + url + ", " + entityId + ", " + extraData + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; case PDP_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingPdpChange(entityId, transaction); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingPdpChange(" + url + ", " + entityId + ", " + transaction + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; case GROUP_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingGroupChange(entityId, extraData, transaction); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingGroupChange(" + url + ", " + entityId + ", " + extraData + ", " + transaction + ", " + xacmlPapServlet + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; default: } transaction.rollbackTransaction(); } @Autowired  HandleIncomingNotifications(SessionFactory sessionfactory);  HandleIncomingNotifications(); void handleIncomingHttpNotification(String url, String entityId, String entityType, String extraData,
            XACMLPapServlet xacmlPapServlet); }
HandleIncomingNotifications { public void handleIncomingHttpNotification(String url, String entityId, String entityType, String extraData, XACMLPapServlet xacmlPapServlet) { logger.info("DBDao url: " + url + " has reported an update on " + entityType + " entity " + entityId); PolicyDbDaoTransaction transaction = PolicyDbDao.getPolicyDbDaoInstance().getNewTransaction(); int retries; try { retries = Integer .parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_INCOMINGNOTIFICATION_TRIES)); } catch (Exception e) { logger.error("xacml.rest.pap.incomingnotification.tries property not set, using a default of 3." + e); retries = 3; } if (retries < 1) { retries = 1; } int pauseBetweenRetries = 1000; switch (entityType) { case POLICY_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingPolicyChange(entityId); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingPolicyChange(" + url + ", " + entityId + ", " + extraData + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; case PDP_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingPdpChange(entityId, transaction); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingPdpChange(" + url + ", " + entityId + ", " + transaction + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; case GROUP_NOTIFICATION: for (int i = 0; i < retries; i++) { try { handleIncomingGroupChange(entityId, extraData, transaction); break; } catch (Exception e) { logger.debug(e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR, "Caught exception on handleIncomingGroupChange(" + url + ", " + entityId + ", " + extraData + ", " + transaction + ", " + xacmlPapServlet + ")"); } try { Thread.sleep(pauseBetweenRetries); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } break; default: } transaction.rollbackTransaction(); } @Autowired  HandleIncomingNotifications(SessionFactory sessionfactory);  HandleIncomingNotifications(); void handleIncomingHttpNotification(String url, String entityId, String entityType, String extraData,
            XACMLPapServlet xacmlPapServlet); static final String JSON_CONFIG; static final String XML_CONFIG; static final String PROPERTIES_CONFIG; static final String OTHER_CONFIG; static final String AUDIT_USER; }