|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.funambol.syncml.spds.SyncMLFormatter
public class SyncMLFormatter
This class represents a formatter for SyncML. A formatter is intented to generate SyncML messages starting from an abstract representation of the same message. In this current implementation the formatter is not yet connected to the abstract implementation and it performs a sort of low level formatting where the bit and pieces of a message are printed together to form the outgoing message. The current implementation supports only plain XML but the class aims at supporting WBXML at some point.
Constructor Summary | |
---|---|
SyncMLFormatter()
|
Method Summary | |
---|---|
java.lang.String |
formatAlerts(java.lang.String cmdId,
int syncMode,
long nextAnchor,
long lastAnchor,
int sourceSyncMode,
java.lang.String sourceName,
java.lang.String sourceUri,
SyncFilter filter,
int maxDataSize)
Contructs the alerts for the given source. |
java.lang.String |
formatAlertStatus(SyncMLStatus status,
long nextAnchor)
Prepare a status code in response to the server's alert. |
java.lang.String |
formatCmdId(int cmdId)
Format the CmdID tag |
java.lang.String |
formatCmdId(java.lang.String cmdId)
Format the CmdID tag |
java.lang.String |
formatCredentials(java.lang.String token,
boolean md5)
Format credentials into a <Cred> tag |
java.lang.String |
formatEndAddCommand()
Format the syncml add command (end) |
java.lang.String |
formatEndDeleteCommand()
Format the syncml delete command (end) |
java.lang.String |
formatEndItem()
Format the syncml end of an item element |
java.lang.String |
formatEndMeta()
Format the syncml end of a meta element |
java.lang.String |
formatEndReplaceCommand()
Format the syncml replace command (end) |
java.lang.String |
formatEndSync()
Format the syncml sync end tag |
java.lang.String |
formatEndSyncBody()
Format the syncml end sync body |
java.lang.String |
formatEndSyncML()
Format the syncml end tag |
java.lang.String |
formatFinal()
Format the syncml final tag |
java.lang.String |
formatGetDeviceInfo(java.lang.String cmdId)
Format a request to the server for its device capabilities |
java.lang.String |
formatItemData(java.lang.String data)
Format an item data. |
java.lang.String |
formatItemDelete(java.lang.String key)
This method formats an Item tag for delete commands |
java.lang.String |
formatItemFormat(java.lang.String format)
Get the format string to add to the outgoing message. |
java.lang.String |
formatItemLuid(java.lang.String luid)
Format an item luid. |
java.lang.String |
formatItemParent(java.lang.String parent)
Format an item parent. |
java.lang.String |
formatItemSize(long size)
Format an item size. |
java.lang.String |
formatItemStatus(SyncMLStatus status)
Format a status in response to a server command. |
java.lang.String |
formatItemType(java.lang.String type)
Format an item type. |
java.lang.String |
formatMappings(java.lang.String nextCmdId,
java.lang.String sourceName,
java.lang.String sourceUri,
java.util.Hashtable mappings)
Format a mapping message. |
java.lang.String |
formatMaxMsgSize(int maxMsgSize)
Format the max message size |
java.lang.String |
formatMoreData()
Format a "more data" element |
java.lang.String |
formatPutDeviceInfo(java.lang.String cmdId,
DeviceConfig devInf,
java.lang.String sourceName,
java.lang.String sourceType)
Constructs the |
java.lang.String |
formatResultsDeviceInfo(java.lang.String nextCmdId,
java.lang.String msgIDget,
java.lang.String cmdIDget,
java.lang.String sourceName,
java.lang.String sourceType,
DeviceConfig devInf)
Used to build the part of the SyncML modification message containing the device sync capabilities ( |
java.lang.String |
formatStartAddCommand()
Format the syncml add command (start) |
java.lang.String |
formatStartDeleteCommand()
Format the syncml delete command (start) |
java.lang.String |
formatStartItem()
Format the syncml start of an item element |
java.lang.String |
formatStartMeta()
Format the syncml start of a meta element |
java.lang.String |
formatStartReplaceCommand()
Format the syncml replace command (start) |
java.lang.String |
formatStartSync()
Format the syncml sync start tag |
java.lang.String |
formatStartSyncBody()
Format the syncml start sync body |
java.lang.String |
formatStartSyncML()
Format the syncml start tag |
java.lang.String |
formatSyncHdrStatus(SyncMLStatus status)
Prepare a status code in response to the server's sync hdr command |
java.lang.String |
formatSyncHeader(java.lang.String sessionid,
java.lang.String msgid,
java.lang.String src,
java.lang.String username,
java.lang.String tgt,
java.lang.String tags)
Prepare a SyncML Message header. |
java.lang.String |
formatSyncTagPreamble(java.lang.String nextCmdId,
java.lang.String sourceName,
java.lang.String sourceUri)
Format the sync tag preamble. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SyncMLFormatter()
Method Detail |
---|
public java.lang.String formatSyncHeader(java.lang.String sessionid, java.lang.String msgid, java.lang.String src, java.lang.String username, java.lang.String tgt, java.lang.String tags)
sessionid
- the session id to use.msgid
- the message id to use.src
- the source uriusername
- the username to be used as loc name in the source tagtgt
- the target uritags
- other SyncML tags to insert in the header.
(e.g. <Cred> or <Meta>).public java.lang.String formatSyncHdrStatus(SyncMLStatus status)
cmdId
- the command idmsgIdRef
- the message id refdeviceId
- the target refserverUrl
- the source ref
public java.lang.String formatAlertStatus(SyncMLStatus status, long nextAnchor)
cmdId
- the command idmsgIdRef
- the message id refdeviceId
- the target refserverUrl
- the source ref
public java.lang.String formatAlerts(java.lang.String cmdId, int syncMode, long nextAnchor, long lastAnchor, int sourceSyncMode, java.lang.String sourceName, java.lang.String sourceUri, SyncFilter filter, int maxDataSize)
src
- SyncSourcesyncMode
-
public java.lang.String formatCredentials(java.lang.String token, boolean md5)
token
- the authentication tokenmd5
- true if the credentials are md5
public java.lang.String formatMaxMsgSize(int maxMsgSize)
maxMsgSize
- the max message size
public java.lang.String formatStartSyncML()
public java.lang.String formatStartSyncBody()
public java.lang.String formatFinal()
public java.lang.String formatEndSyncBody()
public java.lang.String formatEndSyncML()
public java.lang.String formatPutDeviceInfo(java.lang.String cmdId, DeviceConfig devInf, java.lang.String sourceName, java.lang.String sourceType)
devInf
- A reference to the current device configuration (DeviceConfig
)
public java.lang.String formatResultsDeviceInfo(java.lang.String nextCmdId, java.lang.String msgIDget, java.lang.String cmdIDget, java.lang.String sourceName, java.lang.String sourceType, DeviceConfig devInf)
devInf
- A reference to the current device configuration (DeviceConfig
)
public java.lang.String formatMappings(java.lang.String nextCmdId, java.lang.String sourceName, java.lang.String sourceUri, java.util.Hashtable mappings)
nextCmdId
- the next command idsourceName
- is the source namesourceUri
- is the source URImappings
- is an hashtable of strings where the key is the LUID and
the value is the GUID
public java.lang.String formatItemStatus(SyncMLStatus status)
status
- is the status representation
public java.lang.String formatSyncTagPreamble(java.lang.String nextCmdId, java.lang.String sourceName, java.lang.String sourceUri)
nextCmdId
- is the next command idsourceName
- is the local source urisourceUri
- is the remote source uri
public java.lang.String formatStartSync()
public java.lang.String formatEndSync()
public java.lang.String formatItemDelete(java.lang.String key)
key
- is the item key
public java.lang.String formatStartAddCommand()
public java.lang.String formatEndAddCommand()
public java.lang.String formatStartReplaceCommand()
public java.lang.String formatEndReplaceCommand()
public java.lang.String formatStartDeleteCommand()
public java.lang.String formatEndDeleteCommand()
public java.lang.String formatCmdId(java.lang.String cmdId)
cmId
- the cmdID value
public java.lang.String formatCmdId(int cmdId)
cmId
- the cmdID value
public java.lang.String formatStartItem()
public java.lang.String formatEndItem()
public java.lang.String formatItemType(java.lang.String type)
type
- the item's type
public java.lang.String formatItemSize(long size)
size
- is the item's size
public java.lang.String formatStartMeta()
public java.lang.String formatEndMeta()
public java.lang.String formatItemLuid(java.lang.String luid)
public java.lang.String formatItemParent(java.lang.String parent)
public java.lang.String formatItemData(java.lang.String data)
public java.lang.String formatMoreData()
public java.lang.String formatItemFormat(java.lang.String format)
public java.lang.String formatGetDeviceInfo(java.lang.String cmdId)
cmdId
- is the command id
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |