public void notify(EventListener eventListener) { this.eventManager.addListener(eventListener); }
public void fire(Event event) { for(EventListener listener: this.listeners) { listener.onEvent(event); } } }
public void onEvent(Event event) { Device device = (Device)event.getAttribute("new-device"); if(device != null) { this.newDeviceNotification(device); } } //---------------------------------------------------------------------------------------------------------
Event event = new Event(); event.setAttribute("mobile-bean-id", objectId); event.setAttribute("action", "update"); this.eventManager.fire(event); Event event = new Event(); event.setAttribute("mobile-bean-id", newId); event.setAttribute("action", "create"); this.eventManager.fire(event);
EventManager.getInstance().addListener(ChannelDaemon.this); isRegisteredForCacheInvalidationEvent = true;
Event event = new Event(); event.setAttribute("mobile-bean-id", id); event.setAttribute("action", "update"); this.eventManager.fire(event); Event event = new Event(); event.setAttribute("mobile-bean-id", id); event.setAttribute("action", "create"); this.eventManager.fire(event);
@Override public void onEvent(Event event) { Device device = (Device)event.getAttribute("new-device"); if(device != null) { log.debug("***************************************************************"); log.debug("Updating the device cache with a new device: "+this.channelRegistration.getUri()); log.debug("***************************************************************"); //add this device to the cache device = this.deviceController.read(device.getIdentifier()); this.allDevices.add(device); } else { //Check for a device-cache-invalidation event Boolean invalidateDeviceCache = (Boolean)event.getAttribute("invalidate-device-cache"); if(invalidateDeviceCache != null) { //A device cache invalidation event received log.debug("***************************************************************"); log.debug("Invalidating the device cache: "+this.channelRegistration.getUri()); log.debug("***************************************************************"); this.loadDevices(); } } }
this.eventManager.addListener(this);
Event event = new Event(); event.setAttribute("mobile-bean-id", beanId); event.setAttribute("action", "delete"); this.eventManager.fire(event);
@Override public void onEvent(Event event) { String recordId = (String) event.getAttribute("mobile-bean-id"); if (recordId == null) { return; String action = (String)event.getAttribute("action"); if (action.equalsIgnoreCase("create")) { if (!channelInfo.syncAfterCreate()) {
Event event = new Event(); event.setAttribute("new-device", device); this.eventManager.fire(event); Event event = new Event(); event.setAttribute("invalidate-device-cache", Boolean.TRUE); this.eventManager.fire(event);
String oid = (String) event.getAttribute("mobile-bean-id"); if (oid == null) { return; String action = (String)event.getAttribute("action"); if(!action.equalsIgnoreCase("update"))
String oid = (String) event.getAttribute("mobile-bean-id"); if (oid == null) { return; String action = (String)event.getAttribute("action"); if(!action.equalsIgnoreCase("delete"))
String oid = (String) event.getAttribute("mobile-bean-id"); if (oid == null) { return; String action = (String)event.getAttribute("action"); if(!action.equalsIgnoreCase("create"))