System.out.println("\t3. Use a Dummy client");
System.out.println("\tq. Quit the application");
System.out.print("Enter you choice: ");
final GenericXmlApplicationContext context = new GenericXmlApplicationContext();
while (true) {
final String input = scanner.nextLine();
if("1".equals(input.trim())) {
context.getEnvironment().setActiveProfiles("default");
break;
} else if("2".equals(input.trim())) {
context.getEnvironment().setActiveProfiles("jetty");
break;
} else if("3".equals(input.trim())) {
context.getEnvironment().setActiveProfiles("dummy");
break;
} else if("q".equals(input.trim())) {
System.out.println("Exiting application...bye.");
System.exit(0);
} else {
System.out.println("Invalid choice\n\n");
System.out.print("Enter you choice: ");
}
}
context.load("classpath:META-INF/spring/integration/*-context.xml");
context.registerShutdownHook();
context.refresh();
final ConnectionBroker connectionBroker = context.getBean(ConnectionBroker.class);
if (LOGGER.isInfoEnabled()) {
LOGGER.info("\n========================================================="
+ "\n "
+ "\n Please press 'q + Enter' to quit the application. "
+ "\n For statistical information press 'i + Enter'. "
+ "\n "
+ "\n In your browser open: "
+ "\n file:///.../src/main/webapp/index.html "
+ "\n=========================================================" );
}
while (true) {
final String input = scanner.nextLine();
if("q".equals(input.trim())) {
break;
}
else if("i".equals(input.trim())) {
LOGGER.info("\n========================================================="
+ "\n "
+ "\n Number of connected clients: " + connectionBroker.connectedClients()
+ "\n "
+ "\n=========================================================" );
}
}
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Exiting application...bye.");
}
context.close();
System.exit(0);
}