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
00045 public abstract class AbstractCommand implements Element {
00050 final static long serialVersionUID = 1L;
00051
00052
00053 protected int commandType;
00054
00055 protected int cmdId = 0;
00056
00057 public AbstractCommand (int commandType) {
00058 this.commandType = commandType;
00059 }
00060
00061 public int getElementType() {
00062 return commandType;
00063 }
00064
00065 public int getCmdId() {
00066 return cmdId;
00067 }
00068
00069 public boolean hasCommmandId() {
00070 return true;
00071 }
00072
00073 public String toString() {
00074 return "cmdId : " + String.valueOf(cmdId) + " type : " + commandType;
00075 }
00076
00077
00078
00079 public boolean hasCommandId() {
00080 return true;
00081 }
00082
00083 public void setCmdId (int cmdId) {
00084 this.cmdId = cmdId;
00085 }
00086
00087 public void setElementType(int elementType) {
00088 this.commandType = elementType;
00089 }
00090
00091 public void setCredentialData (String data) {
00092
00093 }
00094
00095 public void setCredentialMeta (String meta){
00096
00097 }
00098
00099 public void setSource(String source){
00100
00101 }
00102
00103 public void setSourceSessionID(long sessionID){
00104
00105 }
00106
00107 public void setTarget (String target){
00108
00109 }
00110
00111 public void setMetaInformation (String meta){
00112
00113 }
00114
00115 public void setCmdRef (int cmdRef){
00116 }
00117
00118 public void setSourceRef(String source){
00119
00120 }
00121
00122 public void setTargetRef(String target){
00123
00124 }
00125
00126 public void setData (String data){
00127
00128 }
00129
00130
00131 public void writeBeginTag(StringBuffer buffer) {
00132 MessageFactory.writeBeginTagForElement(buffer, commandType);
00133 }
00134
00135 public void writeContent(StringBuffer buffer) {
00136 if (cmdId != 0) {
00137 MessageFactory.writeElement(buffer, MessageFactory.TAG_CMDID, String.valueOf(cmdId));
00138 buffer.append("\n");
00139 }
00140 }
00141
00142 public void writeEndTag(StringBuffer buffer) {
00143 MessageFactory.writeEndTagForElement(buffer, commandType);
00144 buffer.append("\n");
00145 }
00146
00147 }