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 public final static int STATUS_OK_RESTART_APPLICATION = 1004;
00061
00062
00063
00064 protected int status;
00065
00066 protected Status () {
00067 super(Element.STATUS);
00068 }
00069
00070 public Status(int cmdRef, int status) {
00071 super(AbstractCommand.STATUS, cmdRef);
00072 this.status = status;
00073 }
00074
00075 public int getStatus() {
00076 return status;
00077 }
00078
00079 public String toString() {
00080 return super.toString() + "status : " + status ;
00081 }
00082
00083
00084 public boolean isAtomic() {
00085 return true;
00086 }
00087
00088 public void setData (String data) {
00089 if ((data != null) && (data.length() != 0))
00090 this.status = Integer.parseInt(data);
00091 }
00092
00093 public void writeContent(StringBuffer buffer) {
00094 super.writeContent(buffer);
00095 MessageFactory.writeElement(buffer, MessageFactory.TAG_DATA, String.valueOf(status));
00096 buffer.append("\n");
00097 }
00098
00099 }