public void execute(INotification notification) { ChunkRequest request = (ChunkRequest) notification.getBody(); SecureFacade facade = SecureFacade.getInstance(); OutboundFileProxy proxy = (OutboundFileProxy) facade.retrieveProxy( OutboundFileProxy.OUTBOUND_FILE_PROXY_PREFIX + request.getRelativePath()); Set<Long> chunkRequestIDs = request.getChunkRequests(); Set<Chunk> chunkResponse = new HashSet<Chunk>(); for (Long l : chunkRequestIDs) { try { Chunk c = proxy.getChunk(l); chunkResponse.add(c); } catch (Exception e) { logger.error("Couldn't get chunk", e); } } ChunkResponse response = new ChunkResponse(chunkResponse, request.getRelativePath()); OutboundProxy outboundProxy = (OutboundProxy) facade.retrieveProxy("Outbound Proxy"); Message message = new Message(MessageType.RESPONSE_CHUNK, response); try { outboundProxy.sendMessage(message); } catch (IOException e) { logger.error("Could not send message", e); } }
public void handleNotification(INotification note) { String name = note.getName(); if (name == SeqNotifications.TEMPO_UPDATED) { getView().updateTempo((Float) note.getBody()); } else if (name == SeqNotifications.PLAYBACK_CHANGED) { getView().updatePlayButtonState((SequencerEnums.Playback) note.getBody()); } else if (note.getName() == SeqNotifications.RESOLUTION_UPDATED) { getView().updateResolution((Integer) note.getBody()); } else if (name == SeqNotifications.MIDI_DEVICES_UPDATED) { getView().updateMidiDevices((MidiDevice.Info[]) note.getBody()); } else if (name == SeqNotifications.MIDI_OUT_DEVICE_OPENED) { getView().setMidiOutDevice((MidiDevice.Info) note.getBody()); } else if (name == SeqNotifications.MIDI_OUT_DEVICE_ENABLED) { getView().updateMidiOutEnabled((Boolean) note.getBody()); } else if (name == SeqNotifications.OSC_DEVICE_ENABLED) { getView().updateOscEnabled((Boolean) note.getBody()); } else if (name == SeqNotifications.OSC_PORT_UPDATED) { getView().updateOscPort((Integer) note.getBody()); } }
@Override public void handleNotification(INotification notification) { switch (notification.getName()) { case ApplicationConstants.MEDIATOR_INIT: DataSourcesProxy proxy = (DataSourcesProxy) getFacade().retrieveProxy(CyclistNames.DATA_SOURCES_PROXY); _ds = proxy.getDefaultSimulationDataStream(); if (_ds != null) { getViewComponent().setWaiting(true); getViewComponent().itemsProperty().bind(_ds.getFacilities()); } break; case ApplicationConstants.DEFAULT_SIMULATION_SOURCE: _ds = (SimulationDataStream) notification.getBody(); getViewComponent().setWaiting(true); getViewComponent().itemsProperty().bind(_ds.getFacilities()); break; } ; }