Fields Summary |
---|
static final int | FIELD_IDContent Handler fields indexes.
Used with functions: @link findHandler(), @link getValues() and |
static final int | FIELD_TYPESHandler ID |
static final int | FIELD_SUFFIXESTypes supported by a handler |
static final int | FIELD_ACTIONSby a handler |
static final int | FIELD_LOCALESby a handler |
static final int | FIELD_ACTION_MAPby a handler |
static final int | FIELD_ACCESSESHandler action map |
static final int | FIELD_COUNTAccess list |
static final int | SEARCH_EXACTSearch flags for @link getHandler() method. |
static final int | SEARCH_PREFIXSearch by exact match with ID |
private static final int | FLAG_ERRORHandler flags constants.
They should match according enums in jsr211_registry.h |
private static final int | LAUNCH_OKOK, handler started |
private static final int | LAUNCH_OK_SHOULD_EXITOK, handler started or is ready to start, invoking app should exit. |
private static final int | LAUNCH_ERR_NOTSUPPORTEDERROR, not supported |
private static final int | LAUNCH_ERR_NO_HANDLERERROR, no requested handler |
private static final int | LAUNCH_ERR_NO_INVOCATIONERROR, no invocation queued for requested handler |
private static final int | LAUNCH_ERRORcommon error |
private static com.sun.midp.security.SecurityToken | classSecurityTokenThis class has a different security domain than the MIDlet suite |
private static RegistryStore | storeSingleton instance. Worker for the class static methods. |
Methods Summary |
---|
private static ContentHandlerImpl | deserializeCH(java.lang.String str)Restores ContentHandler main fields (ID, suite_ID, class_name and flag)
from serialized form to ContentHandlerImpl object.
ContentHandlerImpl ch = null;
while (str != null && str.length() > 0) {
String id;
String class_name;
int beg = 0, end;
end = str.indexOf('\n", beg);
if (end == -1) {
break; // no 1-st delimiter
}
id = str.substring(beg, end);
if (id.length() == 0) {
break; // ID is significant field
}
beg = end+1;
end = str.indexOf('\n", beg);
if (end == -1 || str.length() != end + 4) {
break; // no 2-nd delimiter or wrong length of the string
}
class_name = str.substring(beg, end++);
ch = new ContentHandlerImpl();
ch.ID = id;
ch.classname = class_name;
ch.storageId = str.charAt(end++);
ch.storageId <<= 16;
ch.storageId |= str.charAt(end++);
ch.registrationMethod = str.charAt(end);
break;
}
return ch;
|
private static ContentHandlerImpl[] | deserializeCHArray(java.lang.String str)Restores ContentHandlerImpl array from serialized form.
String[] strs;
ContentHandlerImpl[] arr;
strs = deserializeStrArray(str);
arr = new ContentHandlerImpl[strs.length];
for (int i = 0; i < strs.length; i++) {
arr[i] = deserializeCH(strs[i]);
}
return arr;
|
private static java.lang.String[] | deserializeStrArray(java.lang.String str)Transforms serialized form to array of Strings.
Serialization format is the same as ContentHandlerImpl
used.
int n; // array length
String[] arr; // result array
n = (str == null || str.length() == 0)? 0: (int)str.charAt(0);
arr = new String[n];
if (n > 0) {
int len; // String len
int pos; // current position
pos = 1;
for (int i = 0; i < n; i++) {
len = (int)str.charAt(pos++);
arr[i] = str.substring(pos, pos+len);
pos += len;
}
}
return arr;
|
private native void | finalize()Cleanup native resources.
|
static ContentHandlerImpl[] | findConflicted(java.lang.String testID)Tests ID value for registering handler accordingly with JSR claim:
Each content handler is uniquely identified by an ID. ...
The ID MUST NOT be equal to any other registered handler ID.
Every other ID MUST NOT be a prefix of this ID.
The ID MUST NOT be a prefix of any other registered ID.
return findHandler(null, FIELD_ID, testID);
|
static ContentHandlerImpl[] | findHandler(java.lang.String callerId, int searchBy, java.lang.String value)Searchs coontent handlers by searchable fields values. As specified in
JSR 211 API:
Only content handlers that this application is allowed to
access will be included. (in result).
/* Check value for null */
value.length();
String res = store.findHandler0(callerId, searchBy, value);
return deserializeCHArray(res);
|
private native java.lang.String | findHandler0(java.lang.String callerId, int searchBy, java.lang.String value)Native implementation of findHandler .
|
static ContentHandlerImpl[] | forSuite(int suiteId)The special finder for exploring handlers registered by the given suite.
String res = store.forSuite0(suiteId);
return deserializeCHArray(res);
|
private native java.lang.String | forSuite0(int suiteId)Native implementation of findBySuite .
|
static java.lang.String[] | getArrayField(java.lang.String handlerId, int fieldId)Returns array field
String res = store.loadFieldValues0(handlerId, fieldId);
return deserializeStrArray(res);
|
static ContentHandlerImpl | getByURL(java.lang.String callerId, java.lang.String url, java.lang.String action)Returns content handler suitable for URL.
return deserializeCH(store.getByURL0(callerId, url, action));
|
private native java.lang.String | getByURL0(java.lang.String callerId, java.lang.String url, java.lang.String action)Returns content handler suitable for URL.
|
static ContentHandlerImpl | getHandler(java.lang.String callerId, java.lang.String id, int searchMode)Creates and loads handler's data.
if (id.length() == 0) {
return null;
}
return deserializeCH(store.getHandler0(callerId, id, searchMode));
|
static ContentHandlerImpl | getHandler(int suiteId, java.lang.String classname)The special finder for acquiring handler by its suite and class name.
ContentHandlerImpl[] arr = forSuite(suiteId);
ContentHandlerImpl handler = null;
if (classname.length() == 0)
throw new IllegalArgumentException("classname can't be emty");
if (arr != null) {
for (int i = 0; i < arr.length; i++) {
if (classname.equals(arr[i].classname)) {
handler = arr[i];
break;
}
}
}
return handler;
|
private native java.lang.String | getHandler0(java.lang.String callerId, java.lang.String id, int mode)Loads content handler data.
|
static java.lang.String[] | getValues(java.lang.String callerId, int searchBy)Returns all stored in the Registry values for specified field.
String res = store.getValues0(callerId, searchBy);
return deserializeStrArray(res);
|
private native java.lang.String | getValues0(java.lang.String callerId, int searchBy)Native implementation of getValues .
|
private native boolean | init()Initialize persistence storage.
|
static boolean | launch(ContentHandlerImpl handler)Starts native content handler.
int result = store.launch0(handler.getID());
if (result < 0) {
throw new ContentHandlerException(
"Unable to launch platform handler",
ContentHandlerException.NO_REGISTERED_HANDLER);
}
return (result == LAUNCH_OK_SHOULD_EXIT);
|
private native int | launch0(java.lang.String handlerId)Starts native content handler.
|
private native java.lang.String | loadFieldValues0(java.lang.String handlerId, int fieldId)Loads values for array fields.
|
static boolean | register(ContentHandlerImpl contentHandler)Registers given content handler.
return store.register0(contentHandler);
|
private native boolean | register0(ContentHandlerImpl contentHandler)Registers given content handler.
|
static void | setSecurityToken(com.sun.midp.security.SecurityToken token)Sets the security token used for priveleged operations.
The token may only be set once.
if (classSecurityToken != null) {
throw new SecurityException();
}
classSecurityToken = token;
|
static boolean | unregister(java.lang.String handlerId)Unregisters content handler specified by its ID.
return store.unregister0(handlerId);
|
private native boolean | unregister0(java.lang.String handlerId)Unregisters content handler specified by its ID.
|