com/scalagent/kjoram/jms/SessAckRequest.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.jms;
00025 
00026 import java.util.Hashtable;
00027 import java.util.Enumeration;
00028 import java.util.Vector;
00029 
00034 public class SessAckRequest extends AbstractJmsRequest
00035 {
00037   private Vector ids;
00039   private boolean queueMode;
00040 
00049   public SessAckRequest(String targetName, Vector ids, boolean queueMode)
00050   {
00051     super(targetName);
00052     this.ids = ids;
00053     this.queueMode = queueMode;
00054   }
00055 
00059   public SessAckRequest() {
00060     ids = new Vector();
00061   }
00062 
00064   public void setIds(Vector ids)
00065   {
00066     this.ids = ids;
00067   }
00068 
00069   public void addId(String id) {
00070     ids.addElement(id);
00071   }
00072 
00074   public void setQueueMode(boolean queueMode)
00075   {
00076     this.queueMode = queueMode;
00077   }
00078 
00080   public Vector getIds()
00081   {
00082     return ids;
00083   }
00084 
00086   public boolean getQueueMode()
00087   {
00088     return queueMode;
00089   }
00090 
00091   public Hashtable soapCode() {
00092     Hashtable h = super.soapCode();
00093     h.put("queueMode",new Boolean(queueMode));
00094     // Coding and adding the messages into a array:
00095     int size = ids.size();
00096     if (size > 0) {
00097       Vector arrayId = new Vector();
00098       for (int i = 0; i<size; i++) {
00099         arrayId.insertElementAt((String) ids.elementAt(0),i);
00100         ids.removeElementAt(0);
00101       }
00102       if (arrayId != null)
00103         h.put("arrayId",arrayId);
00104     }
00105     return h;
00106   }
00107 
00108   public static Object soapDecode(Hashtable h) {
00109     SessAckRequest req = new SessAckRequest();
00110     req.setRequestId(((Integer) h.get("requestId")).intValue());
00111     req.setTarget((String) h.get("target"));
00112     req.setQueueMode(((Boolean) h.get("queueMode")).booleanValue());
00113     Vector arrayId = (Vector) h.get("arrayId");
00114     if (arrayId != null) {
00115       for (int i = 0; i<arrayId.size(); i++)
00116         req.addId((String) arrayId.elementAt(i));
00117     }
00118     return req;
00119   }
00120 }

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