1 23 package org.objectweb.joram.shared.client; 24 25 import java.io.Externalizable ; 26 import java.io.InputStream ; 27 import java.io.OutputStream ; 28 import java.io.IOException ; 29 30 import org.objectweb.joram.shared.stream.Streamable; 31 import org.objectweb.joram.shared.stream.StreamUtil; 32 import org.objectweb.joram.shared.excepts.MomException; 33 34 38 public final class MomExceptionReply extends AbstractJmsReply { 39 public static final int MomException = 1; 40 public static final int AccessException = 2; 41 public static final int DestinationException = 3; 42 public static final int MessageException = 4; 43 public static final int MessageROException = 5; 44 public static final int MessageValueException = 6; 45 public static final int RequestException = 7; 46 public static final int SelectorException = 8; 47 public static final int StateException = 9; 48 49 public static final int HBCloseConnection = 99999; 51 52 53 private int type; 54 55 56 public int getType() { 57 return type; 58 } 59 60 61 private String message; 62 63 public String getMessage() { 64 return message; 65 } 66 67 protected int getClassId() { 68 return MOM_EXCEPTION_REPLY; 69 } 70 71 77 public MomExceptionReply(int correlationId, MomException exc) { 78 super(correlationId); 79 this.type = exc.getType(); 80 this.message = exc.getMessage(); 81 } 82 83 88 public MomExceptionReply(MomException exc) { 89 this.type = exc.getType(); 90 this.message = exc.getMessage(); 91 } 92 93 96 public MomExceptionReply() {} 97 98 public void toString(StringBuffer strbuf) { 99 super.toString(strbuf); 100 strbuf.append(",momExceptType=").append(type); 101 strbuf.append(",momExceptMessage=").append(message); 102 strbuf.append(')'); 103 } 104 105 108 109 115 public void writeTo(OutputStream os) throws IOException { 116 super.writeTo(os); 117 StreamUtil.writeTo(type, os); 118 StreamUtil.writeTo(message, os); 119 } 120 121 127 public void readFrom(InputStream is) throws IOException { 128 super.readFrom(is); 129 type = StreamUtil.readIntFrom(is); 130 message = StreamUtil.readStringFrom(is); 131 } 132 } 133 | Popular Tags |