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
00028
00036 public class Command extends RequestCommand implements Element {
00041 final static long serialVersionUID = 1L;
00042
00043
00044
00045
00046 protected String target;
00047 protected long sessionID=-1;
00048
00049 protected String source;
00050
00051 protected Command (int commandType) {
00052 super(commandType);
00053 }
00054
00055 public Command(int commandType, String source, String target) {
00056 super(commandType);
00057 this.source = source;
00058 this.target = target;
00059 }
00060
00061
00062 public String getTarget () {
00063 return target;
00064 }
00065
00066 public String getSource() {
00067 return source;
00068 }
00069
00074 public long getSourceSessionID() {
00075 return sessionID;
00076 }
00077
00078 public void setSource(String source) {
00079 this.source = source;
00080 }
00081
00082 public void setTarget (String target) {
00083 this.target = target;
00084 }
00085
00086 public void setSourceSessionID(long sessionid) {
00087 this.sessionID = sessionid;
00088 }
00089
00090
00091 public String toString() {
00092 return super.toString() + " source : " + source + " target : " + target+" sessionID "+sessionID;
00093 }
00094
00095
00096 public void writeContent(StringBuffer buffer) {
00097 super.writeContent(buffer);
00098 if (source != null) {
00099 MessageFactory.writeSource(buffer, source, sessionID);
00100 buffer.append("\n");
00101 }
00102 if (target != null) {
00103 MessageFactory.writeTarget(buffer, target);
00104 buffer.append("\n");
00105 }
00106 }
00107
00108
00109 }