00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 package org.openmobileis.synchro.openmsp.protocol;
00027
00036 public class Status extends ResponseCommand implements Element {
00041 final static long serialVersionUID = 1L;
00042
00043 public final static int STATUS_SYNC_IN_PROGRESS=101;
00044 public final static int STATUS_OK = 200;
00045 public final static int STATUS_NO_CONTENT = 204;
00046 public final static int STATUS_PARTIAL_CONTENT = 206;
00047 public final static int STATUS_WRONG_FORMAT = 400;
00048 public final static int STATUS_UNAUTHORIZED = 401;
00049 public final static int STATUS_NOT_FOUND = 404;
00050 public final static int STATUS_AUTHENTIFICATION_REQUIRED = 407;
00051 public final static int STATUS_TOO_LARGE = 413;
00052 public final static int STATUS_UNSUPPORTED_MEDIA = 415;
00053 public final static int STATUS_EXIST_TARGET = 418;
00054 public final static int STATUS_DEVICE_FULL = 420;
00055 public final static int STATUS_FAILED = 500;
00056 public final static int STATUS_COMMAND_NOT_IMPLEMENTED = 501;
00057 public final static int STATUS_SYNCHRO_CONFLIC = 1001;
00058 public final static int STATUS_HOST_UNKNOW = 1002;
00059 public final static int STATUS_WRONG_AUTHENTIFICATION = 1003;
00060
00061
00062
00063 protected int status;
00064
00065 protected Status () {
00066 super(Element.STATUS);
00067 }
00068
00069 public Status(int cmdRef, int status) {
00070 super(AbstractCommand.STATUS, cmdRef);
00071 this.status = status;
00072 }
00073
00074 public int getStatus() {
00075 return status;
00076 }
00077
00078 public String toString() {
00079 return super.toString() + "status : " + status ;
00080 }
00081
00082
00083 public boolean isAtomic() {
00084 return true;
00085 }
00086
00087 public void setData (String data) {
00088 if ((data != null) && (data.length() != 0))
00089 this.status = Integer.parseInt(data);
00090 }
00091
00092 public void writeContent(StringBuffer buffer) {
00093 super.writeContent(buffer);
00094 MessageFactory.writeElement(buffer, MessageFactory.TAG_DATA, String.valueOf(status));
00095 buffer.append("\n");
00096 }
00097
00098 }