CVS: beepcore-java/src/org/beepcore/beep/core ChannelImpl.java,NONE,1.1 SessionImpl.java,NONE,1.1 Channel.java,1.31,1.32 InputDataStream.java,1.4,1.5 Message.java,1.9,1.10 Session.java,1.33,1.34 TuningProfile.java,1.8,1.9 MessageMSG.java,1.8,1.9 Frame.java,1.19,1.20 OutputDataStream.java,1.4,1.5

Huston Franklin <[email protected]> Mon, 21 Apr 2003 08:09:14 -0700
Newsgroups gmane.network.beep.beepcore.java.cvs
Message-ID <[email protected]>
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core
In directory sc8-pr-cvs1:/tmp/cvs-serv30052/src/org/beepcore/beep/core

Modified Files:
	Channel.java InputDataStream.java Message.java Session.java 
	TuningProfile.java MessageMSG.java Frame.java 
	OutputDataStream.java 
Added Files:
	ChannelImpl.java SessionImpl.java 
Log Message:
The first pass of interface cleanup.

--- NEW FILE: ChannelImpl.java ---
/*
 * ChannelImpl.java  $Revision$ $Date$
 *
 * Copyright (c) 2001 Invisible Worlds, Inc.  All rights reserved.
 * Copyright (c) 2001-2003 Huston Franklin.  All rights reserved.
 *
 * The contents of this file are subject to the Blocks Public License (the
 * "License"); You may not use this file except in compliance with the License.
 *
 * You may obtain a copy of the License at http://www.beepcore.org/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 */
package org.beepcore.beep.core;

[...1072 lines suppressed...]
    public void setStartData(String data)
    {
        startData = data;
    }

    /**
     * Used to get data that can be piggybacked on
     * a profile reply to a start channel request
     * (or any other scenario we choose)
     *
     * Could be called by users, profile implementors etc.
     * to fetch data off a profile response.
     *
     * @return String the attached data, if any
     */
    public String getStartData()
    {
        return startData;
    }
}

--- NEW FILE: SessionImpl.java ---
/*
 * Session.java  $Revision: 1.32 $ $Date: 2002/10/05 15:29:24 $
 *
 * Copyright (c) 2001 Invisible Worlds, Inc.  All rights reserved.
 * Copyright (c) 2001,2002 Huston Franklin.  All rights reserved.
 * Copyright (c) 2002 Kevin Kress.  All rights reserved.
 *
 * The contents of this file are subject to the Blocks Public License (the
 * "License"); You may not use this file except in compliance with the License.
 *
 * You may obtain a copy of the License at http://www.beepcore.org/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 */
package org.beepcore.beep.core;
[...1972 lines suppressed...]
                      "no longer active.");
        }

        private Log log = LogFactory.getLog(this.getClass());
    }

    static class ABORTED_SessionOperations implements SessionOperations {
        public void changeState(SessionImpl s, int newState) throws BEEPException {
            throw new BEEPException("Illegal session state transition");
        }

        public void postFrame(SessionImpl s, Frame f) throws BEEPException {
            // If we're in an error state
            log.debug("Dropping a frame because the Session state is " +
                      "no longer active.");
        }

        private Log log = LogFactory.getLog(this.getClass());
    }
}

Index: Channel.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Channel.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** Channel.java	7 Mar 2003 13:01:54 -0000	1.31
--- Channel.java	21 Apr 2003 15:09:10 -0000	1.32
***************
*** 2,7 ****
   * Channel.java  $Revision$ $Date$
   *
!  * Copyright (c) 2001 Invisible Worlds, Inc.  All rights reserved.
!  * Copyright (c) 2001,2002 Huston Franklin.  All rights reserved.
   *
   * The contents of this file are subject to the Blocks Public License (the
--- 2,6 ----
   * Channel.java  $Revision$ $Date$
   *
!  * Copyright (c) 2003 Huston Franklin.  All rights reserved.
[...1149 lines suppressed...]
!      * to fetch data off a profile response.
!      *
!      * @return String the attached data, if any
!      */
!     public String getStartData()
!     {
!         return startData;
!     }
  }
--- 90,99 ----
      public MessageStatus sendMSG(OutputDataStream stream,
                                   ReplyListener replyListener)
!             throws BEEPException;
  
!     public void setStartData(String data);
  
!     public String getStartData();
  
!     public String getProfile();
  }

Index: InputDataStream.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/InputDataStream.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** InputDataStream.java	7 Sep 2002 14:59:30 -0000	1.4
--- InputDataStream.java	21 Apr 2003 15:09:10 -0000	1.5
***************
*** 54,58 ****
       *                Channel to update the receive window.
       */
!     InputDataStream(Channel channel)
      {
          this.channel = channel;
--- 54,58 ----
       *                Channel to update the receive window.
       */
!     InputDataStream(ChannelImpl channel)
      {
          this.channel = channel;
***************
*** 202,206 ****
      LinkedList buffers = new LinkedList();
      private int availableBytes = 0;
!     private Channel channel = null;
      private boolean closed = false;
      private boolean complete = false;
--- 202,206 ----
      LinkedList buffers = new LinkedList();
      private int availableBytes = 0;
!     private ChannelImpl channel = null;
      private boolean closed = false;
      private boolean complete = false;

Index: Message.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Message.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** Message.java	4 Oct 2002 04:01:00 -0000	1.9
--- Message.java	21 Apr 2003 15:09:10 -0000	1.10
***************
*** 69,73 ****
  
      /** <code>Channel</code> to which <code>Message</code> belongs. */
!     Channel channel;
  
      /** Message number of <code>Message</code>. */
--- 69,73 ----
  
      /** <code>Channel</code> to which <code>Message</code> belongs. */
!     ChannelImpl channel;
  
      /** Message number of <code>Message</code>. */
***************
*** 108,112 ****
       * @see Channel
       */
!     Message(Channel channel, int msgno, InputDataStream data, int messageType)
      {
          this.channel = channel;
--- 108,112 ----
       * @see Channel
       */
!     Message(ChannelImpl channel, int msgno, InputDataStream data, int messageType)
      {
          this.channel = channel;
***************
*** 129,133 ****
       * @see InputDataStream
       */
!     Message(Channel channel, int msgno, int ansno, InputDataStream data)
      {
          this(channel, msgno, data, MESSAGE_TYPE_ANS);
--- 129,133 ----
       * @see InputDataStream
       */
!     Message(ChannelImpl channel, int msgno, int ansno, InputDataStream data)
      {
          this(channel, msgno, data, MESSAGE_TYPE_ANS);

Index: Session.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Session.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -r1.33 -r1.34
*** Session.java	8 Mar 2003 16:39:18 -0000	1.33
--- Session.java	21 Apr 2003 15:09:10 -0000	1.34
***************
*** 2,8 ****
   * Session.java  $Revision$ $Date$
   *
!  * Copyright (c) 2001 Invisible Worlds, Inc.  All rights reserved.
!  * Copyright (c) 2001,2002 Huston Franklin.  All rights reserved.
!  * Copyright (c) 2002 Kevin Kress.  All rights reserved.
   *
   * The contents of this file are subject to the Blocks Public License (the
--- 2,6 ----
   * Session.java  $Revision$ $Date$
   *
[...2190 lines suppressed...]
!      *                        the BEEP protocol (e.g. the Session is not in a
!      *                        state to create a new Channel).
       * @see StartChannelProfile
       * @see MessageListener
       */
      public Channel startChannel(Collection profiles, MessageListener listener)
!         throws BEEPException, BEEPError;
  
  
      /**
       * This method is used to terminate the session when there is an
!      * non-recoverable error.
       *
       * @param reason
       *
       */
!     public void terminate(String reason);
  
!     public SessionTuningProperties getTuningProperties();
  }

Index: TuningProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/TuningProfile.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** TuningProfile.java	5 Oct 2002 15:29:47 -0000	1.8
--- TuningProfile.java	21 Apr 2003 15:09:10 -0000	1.9
***************
*** 101,109 ****
          log.debug("TuningProfile.begin");
  
!         Session session = channel.getSession();
  
          try {
              tuningChannels.add(channel);
!             session.sendProfile(profile, data, channel);
              session.disableIO();
          } catch (Exception x) {
--- 101,109 ----
          log.debug("TuningProfile.begin");
  
!         SessionImpl session = (SessionImpl)channel.getSession();
  
          try {
              tuningChannels.add(channel);
!             session.sendProfile(profile, data, (ChannelImpl)channel);
              session.disableIO();
          } catch (Exception x) {
***************
*** 114,118 ****
                                              "UnknownError" + x.getMessage());
  
!             session.sendProfile(profile, error.createErrorMessage(), channel);
              abort(error, channel);
          }
--- 114,119 ----
                                              "UnknownError" + x.getMessage());
  
!             session.sendProfile(profile, error.createErrorMessage(),
!                                 (ChannelImpl)channel);
              abort(error, channel);
          }
***************
*** 132,146 ****
       */
      public void complete(Channel channel,
!                          SessionCredential localCred,
!                          SessionCredential peerCred,
!                          SessionTuningProperties tuning,
!                          ProfileRegistry registry,
!                          Object argument)
!             throws BEEPException
      {
          try {
              log.debug("TuningProfile.complete");
  
!             Session s = channel.getSession();
  
              s.reset(localCred, peerCred, tuning, registry, argument);
--- 133,147 ----
       */
      public void complete(Channel channel,
!                           SessionCredential localCred,
!                           SessionCredential peerCred,
!                           SessionTuningProperties tuning,
!                           ProfileRegistry registry,
!                           Object argument)
!         throws BEEPException
      {
          try {
              log.debug("TuningProfile.complete");
  
!             SessionImpl s = (SessionImpl)channel.getSession();
  
              s.reset(localCred, peerCred, tuning, registry, argument);
***************
*** 163,167 ****
      protected static void disableIO(Session session)
      {
!         session.disableIO();
      }
  
--- 164,168 ----
      protected static void disableIO(Session session)
      {
!         ((SessionImpl)session).disableIO();
      }
  
***************
*** 175,179 ****
      protected static void enableIO(Session session)
      {
!         session.enableIO();
      }
  
--- 176,180 ----
      protected static void enableIO(Session session)
      {
!         ((SessionImpl)session).enableIO();
      }
  
***************
*** 189,193 ****
                                               SessionCredential credential)
      {
!         session.setLocalCredential(credential);
      }
  
--- 190,194 ----
                                               SessionCredential credential)
      {
!         ((SessionImpl)session).setLocalCredential(credential);
      }
  
***************
*** 203,207 ****
                                              SessionCredential credential)
      {
!         session.setPeerCredential(credential);
      }
  
--- 204,208 ----
                                              SessionCredential credential)
      {
!         ((SessionImpl)session).setPeerCredential(credential);
      }
  
***************
*** 226,230 ****
              throws BEEPException
      {
!         return session.reset(localCred, peerCred, tuning, registry, argument);
      }
  
--- 227,231 ----
              throws BEEPException
      {
!         return ((SessionImpl)session).reset(localCred, peerCred, tuning, registry, argument);
      }
  
***************
*** 242,249 ****
       */
      protected static void sendProfile(Session session, String uri, String data,
!                                       Channel channel)
              throws BEEPException
      {
!         session.sendProfile(uri, data, channel);
      }
  
--- 243,250 ----
       */
      protected static void sendProfile(Session session, String uri, String data,
!                                         Channel channel)
              throws BEEPException
      {
!         ((SessionImpl)session).sendProfile(uri, data, (ChannelImpl)channel);
      }
  
***************
*** 259,263 ****
          l.add(p);
  
!         return session.startChannelRequest(l, listener, true);
      }
  }
--- 260,264 ----
          l.add(p);
  
!         return ((SessionImpl)session).startChannelRequest(l, listener, true);
      }
  }

Index: MessageMSG.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/MessageMSG.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** MessageMSG.java	2 May 2002 02:42:11 -0000	1.8
--- MessageMSG.java	21 Apr 2003 15:09:10 -0000	1.9
***************
*** 30,34 ****
  class MessageMSG extends Message
  {
!     MessageMSG(Channel channel, int msgno, InputDataStream data) {
          super(channel, msgno, data, MESSAGE_TYPE_MSG);
      }
--- 30,34 ----
  class MessageMSG extends Message
  {
!     MessageMSG(ChannelImpl channel, int msgno, InputDataStream data) {
          super(channel, msgno, data, MESSAGE_TYPE_MSG);
      }

Index: Frame.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Frame.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** Frame.java	5 Oct 2002 15:26:51 -0000	1.19
--- Frame.java	21 Apr 2003 15:09:10 -0000	1.20
***************
*** 93,97 ****
  
      /** <code>Channel</code> to which <code>Frame</code> belongs. */
!     private Channel channel;
  
      /** Message number of <code>Frame</code>. */
--- 93,97 ----
  
      /** <code>Channel</code> to which <code>Frame</code> belongs. */
!     private ChannelImpl channel;
  
      /** Message number of <code>Frame</code>. */
***************
*** 124,128 ****
      private LinkedList payload = new LinkedList();
  
!     Frame(int messageType, Channel channel, int msgno, boolean last,
            long seqno, int size, int ansno)
      {
--- 124,128 ----
      private LinkedList payload = new LinkedList();
  
!     Frame(int messageType, ChannelImpl channel, int msgno, boolean last,
            long seqno, int size, int ansno)
      {
***************
*** 289,293 ****
      }
  
!     static Frame parseHeader(Session session, byte[] headerBuffer, int length)
          throws BEEPException
      {
--- 289,293 ----
      }
  
!     static Frame parseHeader(SessionImpl session, byte[] headerBuffer, int length)
          throws BEEPException
      {

Index: OutputDataStream.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/OutputDataStream.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** OutputDataStream.java	2 Sep 2002 13:44:42 -0000	1.4
--- OutputDataStream.java	21 Apr 2003 15:09:11 -0000	1.5
***************
*** 136,140 ****
      }
      
!     void setChannel(Channel channel) {
          this.channel = channel;
      }
--- 136,140 ----
      }
      
!     void setChannel(ChannelImpl channel) {
          this.channel = channel;
      }
***************
*** 146,149 ****
      private boolean headersSent = false;
      private int curOffset = 0;
!     private Channel channel = null;
  }
--- 146,149 ----
      private boolean headersSent = false;
      private int curOffset = 0;
!     private ChannelImpl channel = null;
  }



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf