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
00039 public class RequestCommand extends AbstractCommand implements Element {
00044 final static long serialVersionUID = 1L;
00045
00046
00047
00048 protected String[] credential;
00049
00050 protected String metaInfo;
00051
00052 public RequestCommand (int commandType) {
00053 super(commandType);
00054 }
00055
00056 public void setCredential (String meta, String data) {
00057 credential = new String[2];
00058 credential[0] = meta;
00059 credential[1] = data;
00060 }
00061
00062 public void setCredentialMeta (String meta) {
00063 if (credential == null)
00064 credential = new String[2];
00065 credential[0] = meta;
00066 }
00067
00068 public void setCredentialData (String data) {
00069 if (credential == null)
00070 credential = new String[2];
00071 credential[1] = data;
00072 }
00073
00074 public String[] getCrendential() {
00075 return credential;
00076 }
00077
00078 public String getMetaInformation() {
00079 return metaInfo;
00080 }
00081
00082 public void setMetaInformation (String meta) {
00083 this.metaInfo = meta;
00084 }
00085
00086 public String toString() {
00087 String temp = super.toString() + " meta : " + metaInfo;
00088 if (credential != null)
00089 temp = temp + " cred : " + credential[0] + " " + credential[1];
00090 return temp;
00091 }
00092
00093
00094
00095 public void writeContent(StringBuffer buffer) {
00096 super.writeContent(buffer);
00097 if (credential != null) {
00098 MessageFactory.writeCredential(buffer, credential[0], credential[1]);
00099 buffer.append("\n");
00100 }
00101 if (metaInfo != null) {
00102 MessageFactory.writeElement(buffer, MessageFactory.TAG_META, metaInfo);
00103 buffer.append("\n");
00104 }
00105 }
00106
00107
00108 }