/** * Create a new i nstance of AuthenticationController. This is a singleton class. Access the only * existing instance by using {@link #getInstance()}. */ private AuthenticationController() { logger = LogController.getInstance().getLogger(AuthenticationController.class.getName()); config = JsonConfig.create(AuthenticationControllerSettings.class); CopyOnWriteArrayList<AuthenticationInfo> list = cleanup(config.getList()); if (list == null) { list = new CopyOnWriteArrayList<AuthenticationInfo>(); } this.list = list; ShutdownController.getInstance() .addShutdownEvent( new ShutdownEvent() { @Override public void onShutdown(final ShutdownRequest shutdownRequest) { config.setList(AuthenticationController.this.list); } @Override public long getMaxDuration() { return 0; } @Override public String toString() { return "ShutdownEvent: Save AuthController"; } }); }
public void add(AuthenticationInfo a) { if (a != null && list.addIfAbsent(a)) { config.setList(list); eventSender.fireEvent(new ChangeEvent(this)); } }
public void remove(java.util.List<AuthenticationInfo> selectedObjects) { if (selectedObjects != null && list.removeAll(selectedObjects)) { config.setList(list); eventSender.fireEvent(new ChangeEvent(this)); } }