/** * Tell the program manager to create the program with uri specified by the message. * * @param message The sent message * @return The program manager's response, containing socket information */ protected ResponseMessage handleCreateProgram(CreateProgramMessage message) { return programManager.createProgram( message.getMessageID(), message.getCellID(), message.getProgramURI(), message.getInitialPlaybackSpeed()); }
/** * Pass the given message on to the program manager in an appropriate way, depending on the * message class. * * @param message The message to pass on */ @Override public void handleMessage(final Message message) { new Thread( new Runnable() { public void run() { // Create program if (message instanceof CreateProgramMessage) { ResponseMessage response = handleCreateProgram((CreateProgramMessage) message); send(response); } // Change program playback speed else if (message instanceof ProgramPlaybackSpeedChangeMessage) { handlePlaybackSpeedChange((ProgramPlaybackSpeedChangeMessage) message); } // Mouse click else if (message instanceof MouseClickMessage) { handleMouseClick((MouseClickMessage) message); } // Wonderland event else if (message instanceof CMUEventResponseMessage) { handleWonderlandEvent((CMUEventResponseMessage) message); } // Delete program else if (message instanceof DeleteProgramMessage) { handleDeleteProgram((DeleteProgramMessage) message); } // Update event list else if (message instanceof EventListUpdateMessage) { handleEventListUpdate((EventListUpdateMessage) message); } // Unrecognized message else { Logger.getLogger(ProgramConnection.class.getName()) .log(Level.SEVERE, "Unknown message: " + message); } } }, "Respond to message: " + message) .start(); }