1 18 19 20 package sync4j.framework.core; 21 22 32 public final class Status 33 extends ResponseCommand 34 implements java.io.Serializable { 35 36 38 public static String COMMAND_NAME = "Status"; 39 40 42 private Chal chal; 43 private Data data; 44 private String cmd ; 45 46 48 51 protected Status() {} 52 53 70 public Status( 71 final CmdID cmdID , 72 final String msgRef , 73 final String cmdRef , 74 final String cmd , 75 final TargetRef[] targetRefs, 76 final SourceRef[] sourceRefs, 77 final Cred cred , 78 final Chal chal , 79 final Data data , 80 final Item[] items ) { 81 super( 82 cmdID, 83 msgRef, 84 cmdRef, 85 targetRefs, 86 sourceRefs, 87 items 88 ); 89 90 setCred(cred); 91 setData(data); 92 setCmd(cmd); 93 94 this.chal = chal; 95 } 96 97 115 public Status( 116 final CmdID cmdID , 117 final String msgRef , 118 final String cmdRef , 119 final String cmd , 120 final TargetRef targetRef, 121 final SourceRef sourceRef, 122 final Cred cred , 123 final Chal chal , 124 final Data data , 125 final Item[] items ) { 126 this( 127 cmdID, 128 msgRef, 129 cmdRef, 130 cmd, 131 (targetRef == null) ? null : new TargetRef[] { targetRef }, 132 (sourceRef == null) ? null : new SourceRef[] { sourceRef }, 133 cred, 134 chal, 135 data, 136 items 137 ); 138 } 139 140 142 148 public Chal getChal() { 149 return chal; 150 } 151 152 157 public void setChal(Chal chal) { 158 this.chal = chal; 159 } 160 161 167 public Data getData() { 168 return data; 169 } 170 171 178 public void setData(Data data) { 179 if (data == null) { 180 throw new IllegalArgumentException ("data cannot be null"); 181 } 182 this.data = data; 183 } 184 185 190 public String getCmd() { 191 return cmd; 192 } 193 194 201 public void setCmd(String cmd) { 202 if (cmd == null) { 203 throw new IllegalArgumentException ("cmd cannot be null"); 204 } 205 this.cmd = cmd; 206 } 207 208 213 public int getStatusCode() { 214 return Integer.parseInt(data.getData()); 215 } 216 217 222 public String getName() { 223 return Status.COMMAND_NAME; 224 } 225 } 226 | Popular Tags |