com/scalagent/kjoram/comm/BrowseReply.java

00001 /*
00002  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
00003  * Copyright (C) 2001 - ScalAgent Distributed Technologies
00004  * Copyright (C) 1996 - Dyade
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  * 
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA.
00020  *
00021  * Initial developer(s): Frederic Maistre (INRIA)
00022  * Contributor(s): Nicolas Tachker (ScalAgent)
00023  */
00024 package com.scalagent.kjoram.comm;
00025 
00026 import com.scalagent.kjoram.messages.Message;
00027 
00028 import java.util.Vector;
00029 
00034 public class BrowseReply extends AbstractReply
00035 {
00037   private Message message = null;
00039   private Vector messages = null;
00040 
00041 
00047   public BrowseReply(BrowseRequest req)
00048   {
00049     super(req.getClientContext(), req.getRequestId());
00050   }
00051 
00052   
00054   public void addMessage(Message msg)
00055   {
00056     if (message == null && messages == null)
00057       message = msg;
00058     else {
00059       if (messages == null) {
00060         messages = new Vector();
00061         messages.addElement(message);
00062         message = null;
00063       }
00064       messages.addElement(msg);
00065     }
00066   }
00067 
00069   public Vector getMessages()
00070   {
00071     if (message != null) {
00072       Vector vec = new Vector();
00073       vec.addElement(message);
00074       return vec;
00075     }
00076     return messages;
00077   }
00078 } 

Generated on Tue Sep 16 16:14:23 2008 for joram by  doxygen 1.5.0