1 package org
.argeo
.slc
.detached
;
3 import java
.util
.Properties
;
5 /** An answer returned by the detached server. Always related to a request. */
6 public class DetachedAnswer
implements DetachedCommunication
{
7 static final long serialVersionUID
= 1l;
9 public final static int UNKOWN
= -1;
10 public final static int PROCESSED
= 0;
11 public final static int ERROR
= 1;
12 public final static int SKIPPED
= 2;
13 public final static int CLOSED_SESSION
= 10;
15 private Properties properties
= new Properties();
16 private int status
= UNKOWN
;
20 public DetachedAnswer() {
24 public DetachedAnswer(DetachedRequest request
) {
25 uuid
= request
.getUuid();
28 public DetachedAnswer(DetachedRequest request
, String message
) {
34 public Properties
getProperties() {
38 public void setProperties(Properties outputParameters
) {
39 this.properties
= outputParameters
;
42 public int getStatus() {
46 public void setStatus(int outputStatus
) {
47 this.status
= outputStatus
;
50 public String
getLog() {
54 public void setLog(String log
) {
58 public void addToLog(String msg
) {
59 this.log
= new StringBuffer(this.log
).append(msg
).toString();
62 /** The unique identifier of this answer. */
63 public String
getUuid() {
67 public void setUuid(String uuid
) {
71 public String
getStatusAsString() {
72 return convertStatus(getStatus());
75 public static String
convertStatus(int status
) {
86 return "CLOSED_SESSION";
88 throw new DetachedException("Unkown status " + status
);
92 public String
toString() {
93 StringBuffer buf
= new StringBuffer(getClass().getName());
94 buf
.append('#').append(uuid
);
95 buf
.append(" status=").append(convertStatus(status
));
96 buf
.append(" properties=").append(properties
);
97 buf
.append(" log=").append(log
);
98 return buf
.toString();