@Test public void testMain() throws Exception { try { final String[] args = new String[0]; BrmsGateway.main(args); } catch (final Exception ex) { fail("Not expected an exception: " + ex); } }
public static void main(final String[] args) throws Exception { String configFile = CONFIGFILE; if (args.length == 1) { configFile = args[0]; } else if (args.length > 1) { String errorString = "usage: " + BrmsGateway.class.getCanonicalName() + " [configFile]"; logger.error(errorString); throw new PolicyException(errorString); } logger.info("Initializing BRMS Handler"); BrmsHandler brmsHandler = null; try { brmsHandler = factory.makeBrmsHandler(configFile); } catch (final PolicyException e) { String errorString = "Check your property file: " + e.getMessage(); logger.error(errorString); throw new PolicyException(errorString); } try { logger.info("Initializing policyEngine with Auto Notifications"); policyEngine = new PolicyEngine(CONFIGFILE, NotificationScheme.AUTO_ALL_NOTIFICATIONS, brmsHandler); } catch (final Exception e) { logger.error(XACMLErrorConstants.ERROR_UNKNOWN + "Error while Initializing Policy Engine " + e.getMessage(), e); } CountDownLatch latch = new CountDownLatch(1); final Runnable runnable = () -> { try { latch.await(); } catch (final InterruptedException e) { logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Thread Exception " + e.getMessage()); Thread.currentThread().interrupt(); } }; final Thread thread = factory.makeThread(runnable); thread.start(); }
BrmsGateway { public static void main(final String[] args) throws Exception { String configFile = CONFIGFILE; if (args.length == 1) { configFile = args[0]; } else if (args.length > 1) { String errorString = "usage: " + BrmsGateway.class.getCanonicalName() + " [configFile]"; logger.error(errorString); throw new PolicyException(errorString); } logger.info("Initializing BRMS Handler"); BrmsHandler brmsHandler = null; try { brmsHandler = factory.makeBrmsHandler(configFile); } catch (final PolicyException e) { String errorString = "Check your property file: " + e.getMessage(); logger.error(errorString); throw new PolicyException(errorString); } try { logger.info("Initializing policyEngine with Auto Notifications"); policyEngine = new PolicyEngine(CONFIGFILE, NotificationScheme.AUTO_ALL_NOTIFICATIONS, brmsHandler); } catch (final Exception e) { logger.error(XACMLErrorConstants.ERROR_UNKNOWN + "Error while Initializing Policy Engine " + e.getMessage(), e); } CountDownLatch latch = new CountDownLatch(1); final Runnable runnable = () -> { try { latch.await(); } catch (final InterruptedException e) { logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Thread Exception " + e.getMessage()); Thread.currentThread().interrupt(); } }; final Thread thread = factory.makeThread(runnable); thread.start(); } }
BrmsGateway { public static void main(final String[] args) throws Exception { String configFile = CONFIGFILE; if (args.length == 1) { configFile = args[0]; } else if (args.length > 1) { String errorString = "usage: " + BrmsGateway.class.getCanonicalName() + " [configFile]"; logger.error(errorString); throw new PolicyException(errorString); } logger.info("Initializing BRMS Handler"); BrmsHandler brmsHandler = null; try { brmsHandler = factory.makeBrmsHandler(configFile); } catch (final PolicyException e) { String errorString = "Check your property file: " + e.getMessage(); logger.error(errorString); throw new PolicyException(errorString); } try { logger.info("Initializing policyEngine with Auto Notifications"); policyEngine = new PolicyEngine(CONFIGFILE, NotificationScheme.AUTO_ALL_NOTIFICATIONS, brmsHandler); } catch (final Exception e) { logger.error(XACMLErrorConstants.ERROR_UNKNOWN + "Error while Initializing Policy Engine " + e.getMessage(), e); } CountDownLatch latch = new CountDownLatch(1); final Runnable runnable = () -> { try { latch.await(); } catch (final InterruptedException e) { logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Thread Exception " + e.getMessage()); Thread.currentThread().interrupt(); } }; final Thread thread = factory.makeThread(runnable); thread.start(); } private  BrmsGateway(); }
BrmsGateway { public static void main(final String[] args) throws Exception { String configFile = CONFIGFILE; if (args.length == 1) { configFile = args[0]; } else if (args.length > 1) { String errorString = "usage: " + BrmsGateway.class.getCanonicalName() + " [configFile]"; logger.error(errorString); throw new PolicyException(errorString); } logger.info("Initializing BRMS Handler"); BrmsHandler brmsHandler = null; try { brmsHandler = factory.makeBrmsHandler(configFile); } catch (final PolicyException e) { String errorString = "Check your property file: " + e.getMessage(); logger.error(errorString); throw new PolicyException(errorString); } try { logger.info("Initializing policyEngine with Auto Notifications"); policyEngine = new PolicyEngine(CONFIGFILE, NotificationScheme.AUTO_ALL_NOTIFICATIONS, brmsHandler); } catch (final Exception e) { logger.error(XACMLErrorConstants.ERROR_UNKNOWN + "Error while Initializing Policy Engine " + e.getMessage(), e); } CountDownLatch latch = new CountDownLatch(1); final Runnable runnable = () -> { try { latch.await(); } catch (final InterruptedException e) { logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Thread Exception " + e.getMessage()); Thread.currentThread().interrupt(); } }; final Thread thread = factory.makeThread(runnable); thread.start(); } private  BrmsGateway(); static void main(final String[] args); static PolicyEngine getPolicyEngine(); }
BrmsGateway { public static void main(final String[] args) throws Exception { String configFile = CONFIGFILE; if (args.length == 1) { configFile = args[0]; } else if (args.length > 1) { String errorString = "usage: " + BrmsGateway.class.getCanonicalName() + " [configFile]"; logger.error(errorString); throw new PolicyException(errorString); } logger.info("Initializing BRMS Handler"); BrmsHandler brmsHandler = null; try { brmsHandler = factory.makeBrmsHandler(configFile); } catch (final PolicyException e) { String errorString = "Check your property file: " + e.getMessage(); logger.error(errorString); throw new PolicyException(errorString); } try { logger.info("Initializing policyEngine with Auto Notifications"); policyEngine = new PolicyEngine(CONFIGFILE, NotificationScheme.AUTO_ALL_NOTIFICATIONS, brmsHandler); } catch (final Exception e) { logger.error(XACMLErrorConstants.ERROR_UNKNOWN + "Error while Initializing Policy Engine " + e.getMessage(), e); } CountDownLatch latch = new CountDownLatch(1); final Runnable runnable = () -> { try { latch.await(); } catch (final InterruptedException e) { logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Thread Exception " + e.getMessage()); Thread.currentThread().interrupt(); } }; final Thread thread = factory.makeThread(runnable); thread.start(); } private  BrmsGateway(); static void main(final String[] args); static PolicyEngine getPolicyEngine();  }