📄 whiteboardprotocol.java
字号:
package connex.plugins.whiteboard;
import net.jxta.endpoint.Message;
import net.jxta.endpoint.StringMessageElement;
import connex.core.Presence.PresenceService;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class WhiteboardProtocol {
protected static String version = "ConneX_Whiteboard_v0.1";
/* Message types*/
protected static final String shapeMessage = "shapeMessage";
protected static final String clearMessage = "clearMessage";
protected static final String removeMessage = "removeMessage";
protected static final String lockMessage = "lockMessage";
protected static final String synchoronizeMessage = "synchoronizeMessage";
/*
* WhiteboardService also defines it own protocol. Requests arrive as a JXTA
* Message with the following elements:
*/
//Protocol header
protected static final String nameSpace = "ConneXWhiteboard";
protected static final String versionTag = version;
protected static final String membIDTag = "memberID";
protected static final String membNameTag = "membName";
protected static final String typeTag = "type";
//protocol data
protected static final String shapeTag = "shapeTag";
protected static final String shapeIDTag = "shapeIDTag";
/**
* Create the Message Header
* @param type String
* @return Message
*/
protected static Message createMessage(String type) {
Message msg = new Message();
/* version */
msg.addMessageElement(WhiteboardProtocol.nameSpace,
new
StringMessageElement(
versionTag,
version, null));
/* MemberID*/
msg.addMessageElement(WhiteboardProtocol.nameSpace,
new
StringMessageElement(
membIDTag,
PresenceService.getInstance().
getmOwnPeerAdv().getPeerID().
toString(), null));
/* MemberName*/
msg.addMessageElement(nameSpace,
new
StringMessageElement(membNameTag
,
PresenceService.getInstance().
getmOwnPprofileAdv().getName(), null));
/* type */
msg.addMessageElement(WhiteboardProtocol.nameSpace,
new
StringMessageElement(typeTag,
type, null));
return msg;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -