|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
SkySyncObserver |
Class Summary | |
---|---|
SkySync |
SkySync is a cross-platform API that provides SAP interfacing and data cacheing capabilities.
The majority of the API functionality is exposed through static (class) methods on a single class, which is implemented as follows on the various supported platforms:
PLATFORM | EXPOSED AS |
BlackBerry | Java Class: au.com.skytechnologies.vti.SkySync |
iPhone | Objective-C Class: SkySync |
The methods exposed in the API tend to fall into 3 major categories:
1. Engine level methods that have no specific operand, or which affect
the engine as a whole.
2. Data object level methods that operate against a single "data object"
(in the SkyMobile meaning of that term). Generally speaking, these methods
revolve around management of the data synchronization process.
3. Table level methods that operate against a single table. Because
SkyMobile data objects are composed of a hierarchy of tables, these are
separate and distinct from methods which operate at the data object level,
and generally revolve around accessing, retrieving, and updating actual
data.
THREADING
SkySync is fully threadsafe. It is however important to note that, although SkySync can be safely used by multiple threads simultaneously, it is not safe to simultaneously use SkySync from two separate processes. Doing so will cause contention against the data store that cannot be properly managed.
ARGUMENT TYPES
Due to the technology mix in use (i.e. JavaScript and LUA within KonyOne, binding to Java and Objective-C within SkySync), the SkySync API predominantly uses only simple building blocks to pass information backwards and forwards. This largely precludes any use of custom classes being sent or returned as arguments to the API. Arguments are largely restricted to the following:
Primitive data types (int, float, double, etc)
Strings/NSStrings
Dynamic arrays (Vectors/NSArrays)
Key/value dictionaries (Hashtables/NSDictionaries)
OBSERVERS
SkySync methods which may potentially block the calling thread will always execute asychronously in a separate thread. The caller will receive control back from such API calls immediately. In order to respond to/track the progress of such calls, an observer mechanism is provided. An implementation of the SkySyncObserver interface must be provided at the time any such call is made, and it will receive callback notifications containing information about the outcome of the call.
RETURN CODES
Some short-lived SkySync API calls return an integer return value. Except where otherwise noted, the general convention for these values is as follows:
- A zero indicates success.
- A negative value indicates an error of some kind.
- Positive return code values may occur during some specific API calls.
Generally these will be situations where a negative return code makes no
sense, since negative return codes are reserved for errors.
CONDITION SETS
A number of the API functions specify condition sets for selection of targetting of data. These will take the form of Vectors containing a series of key/operator/value specifications (in the form of strings). Thus, for example, the following SQL where condition:
select * from PO_ITEM where PO_NUMBER = '001048' and STATUS = 'X'
Could be set up by the following code to prepare a conditions set:
Vector conditions = new Vector();
conditions.addElement("PO_NUMBER = 001048");
conditions.addElement("STATUS = X");
Where something other than an equality test is desired, the following operators may be used in place of the equals (=) operator. These are broadly similar in functionality to their SQL equivalents.
=, ==, EQ | Equal to |
=*, ==*, EQ* | Equal to (case insensitive) |
!=, <>, NE | Not equal to |
!=*, <>*, NE* | Not equal to (case insensitive) |
<, LT | Less than |
<*, LT* | Less than (case insensitive) |
<=, LE | Less than or equal to |
<=*, LE* | Less than or equal to (case insensitive) |
>, GT | Greater than |
>*, GT* | Greater than (case insensitive) |
>=, GE | Greater than or equal to |
>=*, GE* | Greater than or equal to (case insensitive) |
LIKE | Pattern match |
LIKE* | Pattern match (case insensitive) |
UNLIKE | Pattern exclusion |
UNLIKE* | Pattern exclusion (case insensitive) |
IN | List inclusion check against a comma-separated list |
IN* | List inclusion check against a comma-separated list (case insensitive) |
Thus, for example, the following SQL "where" condition:
select * from PO_ITEM where PO_NUMBER = '001048' and UPPER(STATUS) != 'X'
Could be set up as follows:
Vector conditions = new Vector();
conditions.addElement("PO_NUMBER = 001048");
conditions.addElement("STATUS !=* X");
If the conditions represent a "match any" (SQL "OR" operator) scenario rather than a "match all" (SQL "AND" operator) scenario, then the special value "OR" (on its own) should be added to the condition list. Where the "OR" value has been added to the vector, then a match on any of the conditions will cause a row to qualify for processing. Thus, for example, the following SQL "where" condition:
select * from PO_ITEM where PO_NUMBER = '001048' or STATUS != 'X'
Could be set up by the following code:
Vector conditions = new Vector();
conditions.addElement("OR");
conditions.addElement("PO_NUMBER = 001048");
conditions.addElement("STATUS != X");
Finally, condition sets may be nested. This allows for intermixing of AND/OR conditions. This is achieved by placing one condition set as a value inside another condition set. Thus, for example, the following SQL "where" condition:
select * from PO_ITEM where PO_NUMBER = '001048' and (STATUS = 'X' or
STATUS = 'Y')
Could be set up by the following code:
Vector subClause = new Vector();
subClause.addElement("OR");
subClause.addElement("STATUS = X");
subClause.addElement("STATUS = Y");
Vector conditions = new Vector();
conditions.addElement("PO_NUMBER = 001048");
conditions.addElement(subClause);
Note that a condition set argument may be null (nil) or empty, in which case all records on the given table are considered to have been targetted.
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |