00001 /* 00002 * JORAM: Java(TM) Open Reliable Asynchronous Messaging 00003 * Copyright (C) 2001 - 2008 ScalAgent Distributed Technologies 00004 * Copyright (C) 1996 - 2000 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): ScalAgent Distributed Technologies 00023 */ 00024 package org.objectweb.joram.shared.client; 00025 00026 import java.io.InputStream; 00027 import java.io.OutputStream; 00028 import java.io.IOException; 00029 00030 import org.objectweb.joram.shared.stream.StreamUtil; 00031 00036 public abstract class AbstractJmsReply extends AbstractJmsMessage { 00038 protected int correlationId = -1; 00039 00041 public final void setCorrelationId(int correlationId) { 00042 this.correlationId = correlationId; 00043 } 00044 00046 public final int getCorrelationId() { 00047 return correlationId; 00048 } 00049 00053 public AbstractJmsReply() {} 00054 00060 public AbstractJmsReply(int correlationId) { 00061 this.correlationId = correlationId; 00062 } 00063 00064 public final String toString() { 00065 StringBuffer strbuf = new StringBuffer(); 00066 toString(strbuf); 00067 return strbuf.toString(); 00068 } 00069 00070 public void toString(StringBuffer strbuf) { 00071 strbuf.append('(').append(super.toString()); 00072 strbuf.append("correlationId=").append(correlationId); 00073 strbuf.append(')'); 00074 } 00075 00076 /* ***** ***** ***** ***** ***** 00077 * Streamable interface 00078 * ***** ***** ***** ***** ***** */ 00079 00086 public void writeTo(OutputStream os) throws IOException { 00087 StreamUtil.writeTo(correlationId, os); 00088 } 00089 00096 public void readFrom(InputStream is) throws IOException { 00097 correlationId = StreamUtil.readIntFrom(is); 00098 } 00099 }
1.5.0