[Beepcore-java-commits] CVS: beepcore-java/src/org/beepcore/beep/core Channel.java,1.34,1.35 Channel
Status: Beta
Brought to you by:
huston
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core In directory sc8-pr-cvs1:/tmp/cvs-serv21592/src/org/beepcore/beep/core Modified Files: Channel.java ChannelImpl.java Session.java TuningProfile.java SessionImpl.java Removed Files: MessageListener.java Log Message: Removed MessageListener Index: Channel.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Channel.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** Channel.java 7 Nov 2003 17:39:21 -0000 1.34 --- Channel.java 1 Jan 2004 19:12:51 -0000 1.35 *************** *** 66,84 **** /** - * Sets the <code>MessageListener</code> for this channel. - * - * @param listener - * @return The previous MessageListener or null if none was set. - * @deprecated - */ - public MessageListener setMessageListener(MessageListener listener); - - /** - * Returns the message listener for this channel. - * @deprecated - */ - public MessageListener getMessageListener(); - - /** * Returns the <code>RequestHandler</code> registered with this channel. */ --- 66,69 ---- Index: ChannelImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/ChannelImpl.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** ChannelImpl.java 7 Nov 2003 17:39:21 -0000 1.10 --- ChannelImpl.java 1 Jan 2004 19:12:51 -0000 1.11 *************** *** 278,308 **** /** - * Sets the <code>MessageListener</code> for this channel. - * - * @param ml - * @return The previous MessageListener or null if none was set. - */ - public MessageListener setMessageListener(MessageListener ml) - { - MessageListener tmp = getMessageListener(); - - this.handler = new MessageListenerAdapter(ml); - - return tmp; - } - - /** - * Returns the message listener for this channel. - */ - public MessageListener getMessageListener() - { - if (!(this.handler instanceof MessageListenerAdapter)) { - return null; - } - - return ((MessageListenerAdapter)this.handler).getMessageListener(); - } - - /** * Returns the <code>RequestHandler</code> registered with this channel. */ --- 278,281 ---- *************** *** 1119,1153 **** } - static class MessageListenerAdapter implements RequestHandler { - MessageListenerAdapter(MessageListener listener) { - this.listener = listener; - } - - public void receiveMSG(MessageMSG message) { - try { - listener.receiveMSG(message); - } catch (BEEPError e) { - try { - message.sendERR(e); - } catch (BEEPException e2) { - log.error("Error sending ERR", e2); - } - } catch (AbortChannelException e) { - try { - message.getChannel().close(); - } catch (BEEPException e2) { - log.error("Error closing channel", e2); - } - } - } - - public MessageListener getMessageListener() { - return this.listener; - } - - private Log log = LogFactory.getLog(this.getClass()); - private MessageListener listener; - } - private static class DefaultMSGHandler implements RequestHandler { public void receiveMSG(MessageMSG message) { --- 1092,1095 ---- *************** *** 1164,1168 **** private Log log = LogFactory.getLog(this.getClass()); - private MessageListener listener; } } --- 1106,1109 ---- Index: Session.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Session.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** Session.java 18 Nov 2003 14:03:07 -0000 1.37 --- Session.java 1 Jan 2004 19:12:51 -0000 1.38 *************** *** 149,174 **** * Sends a request to start a new Channel on this Session for the * specified profile. This version of <code>startChannel</code> allows a - * <code>MessageListener</code> to be specified to be registered once the - * Channel is started. This is useful for profiles that are peer-to-peer in - * nature. - * - * @param profile The URI of the profile for the new Channel. - * @param listener A <code>MessageListener</code> to receive MSG messages - * sent by the remote peer of this Session. - * - * @throws BEEPError Thrown if the remote peer is unable or refuses to - * start a new Channel for the requested profile. - * @throws BEEPException Thrown for errors other than those defined by - * the BEEP protocol (e.g. the Session is not in a - * state to create a new Channel). - * @see MessageListener - * @deprecated - */ - public Channel startChannel(String profile, MessageListener listener) - throws BEEPException, BEEPError; - - /** - * Sends a request to start a new Channel on this Session for the - * specified profile. This version of <code>startChannel</code> allows a * <code>RequestHandler</code> to be specified to be registered once the * Channel is started. This is useful for profiles that are peer-to-peer in --- 149,152 ---- *************** *** 217,249 **** * Sends a request to start a new Channel on this Session for the * specified profile. This version of <code>startChannel</code> allows a - * <code>MessageListener</code> to be specified to be registered once the - * Channel is started. This is useful for profiles that are peer-to-peer in - * nature. - * - * @param profile The URI of the profile for the new Channel. - * @param base64Encoding Indicates whether or not <code>data</code> is - * base64 encoded. <code>data</code> must be base64 - * encoded if it is not valid XML CDATA. - * @param data An initial request to be sent piggyback'd along with the - * request to start the Channel. This request can be at most - * 4K in size. - * @param listener A <code>MessageListener</code> to receive MSG messages - * sent by the remote peer of this Session. - * - * @throws BEEPError Thrown if the remote peer is unable or refuses to - * start a new Channel for the requested profile. - * @throws BEEPException Thrown for errors other than those defined by - * the BEEP protocol (e.g. the Session is not in a - * state to create a new Channel). - * @see MessageListener - * @deprecated - */ - public Channel startChannel(String profile, boolean base64Encoding, - String data, MessageListener listener) - throws BEEPException, BEEPError; - - /** - * Sends a request to start a new Channel on this Session for the - * specified profile. This version of <code>startChannel</code> allows a * <code>RequestHandler</code> to be specified to be registered once the * Channel is started. --- 195,198 ---- *************** *** 261,283 **** public Channel startChannel(StartChannelProfile profile, RequestHandler handler) throws BEEPException, BEEPError; - - /** - * Sends a start channel request using the given list of profiles. - * - * @param profiles A collection of <code>StartChannelProfile</code>(s). - * @param listener A <code>MessageListener</code> to receive MSG messages - * sent by the remote peer of this Session. - * - * @throws BEEPError Thrown if the remote peer is unable or refuses to - * start a new Channel for the requested profile. - * @throws BEEPException Thrown for errors other than those defined by - * the BEEP protocol (e.g. the Session is not in a - * state to create a new Channel). - * @see StartChannelProfile - * @see MessageListener - * @deprecated - */ - public Channel startChannel(Collection profiles, MessageListener listener) - throws BEEPException, BEEPError; /** --- 210,213 ---- Index: TuningProfile.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/TuningProfile.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** TuningProfile.java 18 Nov 2003 14:03:08 -0000 1.12 --- TuningProfile.java 1 Jan 2004 19:12:51 -0000 1.13 *************** *** 248,252 **** public Channel startChannel(Session session, String profile, boolean base64Encoding, String data, ! MessageListener listener) throws BEEPException, BEEPError { --- 248,252 ---- public Channel startChannel(Session session, String profile, boolean base64Encoding, String data, ! RequestHandler handler) throws BEEPException, BEEPError { *************** *** 257,261 **** l.add(p); ! return ((SessionImpl)session).startChannelRequest(l, listener, true); } } --- 257,261 ---- l.add(p); ! return ((SessionImpl)session).startChannelRequest(l, handler, true); } } Index: SessionImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/SessionImpl.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** SessionImpl.java 1 Jan 2004 16:45:56 -0000 1.15 --- SessionImpl.java 1 Jan 2004 19:12:51 -0000 1.16 *************** *** 178,182 **** zero = ChannelImpl.createChannelZero(this, greetingListener, ! new ChannelImpl.MessageListenerAdapter(new ChannelZeroListener())); channels.put(CHANNEL_ZERO, zero); --- 178,182 ---- zero = ChannelImpl.createChannelZero(this, greetingListener, ! new ChannelZeroListener()); channels.put(CHANNEL_ZERO, zero); *************** *** 229,233 **** zero = ChannelImpl.createChannelZero(this, greetingListener, ! new ChannelImpl.MessageListenerAdapter(new ChannelZeroListener())); channels.put(CHANNEL_ZERO, zero); --- 229,233 ---- zero = ChannelImpl.createChannelZero(this, greetingListener, ! new ChannelZeroListener()); channels.put(CHANNEL_ZERO, zero); *************** *** 430,444 **** } - public Channel startChannel(String profile, MessageListener listener) - throws BEEPException, BEEPError - { - StartChannelProfile p = new StartChannelProfile(profile); - LinkedList l = new LinkedList(); - - l.add(p); - - return startChannelRequest(l, listener, false); - } - public Channel startChannel(String profile, RequestHandler handler) throws BEEPException, BEEPError --- 430,433 ---- *************** *** 461,477 **** } - public Channel startChannel(String profile, boolean base64Encoding, - String data, MessageListener listener) - throws BEEPException, BEEPError - { - StartChannelProfile p = new StartChannelProfile(profile, - base64Encoding, data); - LinkedList l = new LinkedList(); - - l.add(p); - - return startChannelRequest(l, listener, false); - } - public Channel startChannel(StartChannelProfile profile, RequestHandler handler) throws BEEPException, BEEPError --- 450,453 ---- *************** *** 484,502 **** } - public Channel startChannel(Collection profiles, MessageListener listener) - throws BEEPException, BEEPError - { - return startChannelRequest(profiles, listener, false); - } - - Channel startChannelRequest(Collection profiles, MessageListener listener, - boolean tuning) - throws BEEPException, BEEPError - { - return startChannelRequest(profiles, - listener == null ? null : new ChannelImpl.MessageListenerAdapter(listener), - tuning); - } - public Channel startChannel(Collection profiles, RequestHandler handler) throws BEEPException, BEEPError --- 460,463 ---- *************** *** 1381,1388 **** } ! private class ChannelZeroListener implements MessageListener { ! public void receiveMSG(Message message) ! throws BEEPError, AbortChannelException { Element topElement; --- 1342,1360 ---- } ! private class ChannelZeroListener implements RequestHandler { ! ! public void receiveMSG(MessageMSG message) { ! try { ! processMSG(message); ! } catch (BEEPError e) { ! try { ! message.sendERR(e); ! } catch (BEEPException e2) { ! log.error("Error sending ERR", e2); ! } ! } ! } ! public void processMSG(MessageMSG message) throws BEEPError { Element topElement; --- MessageListener.java DELETED --- |