/**
 * Gets location of the class path for the suite with the specified suiteId.
 *
 * Note that memory for the in/out parameter classPath is
 * allocated by the callee. The caller is responsible for
 * freeing it using pcsl_mem_free().
 *
 * @param suiteId The application suite ID
 * @param storageId storage ID, INTERNAL_STORAGE_ID for the internal storage
 * @param checkSuiteExists true if suite should be checked for existence or not
 * @param classPath The in/out parameter that contains returned class path
 * @return error code that should be one of the following:
 * <pre>
 *     ALL_OK, OUT_OF_MEMORY, NOT_FOUND,
 *     SUITE_CORRUPTED_ERROR, BAD_PARAMS
 * </pre>
 */
MIDPError
midp_suite_get_class_path(SuiteIdType suiteId,
                          StorageIdType storageId,
                          jboolean checkSuiteExists,
                          pcsl_string *classPath) {
    MIDPError status = ALL_OK;
    int suiteExistsOrNotChecked;

    if (checkSuiteExists) {
        status = midp_suite_exists(suiteId);
        suiteExistsOrNotChecked = (status == ALL_OK ||
                                   status == SUITE_CORRUPTED_ERROR);
    } else {
        /*
         * Don't need to check is the suite exist,
         * just construct the classpath for the given suite ID.
         */
        suiteExistsOrNotChecked = 1;
    }

    if (suiteExistsOrNotChecked) {
        status = get_class_path_impl(COMPONENT_REGULAR_SUITE, suiteId,
                                     UNUSED_COMPONENT_ID, storageId, classPath,
                                     &JAR_EXTENSION);
    } else {
        *classPath = PCSL_STRING_NULL;
    }

    return status;
}
/**
 * Gets location of the class path for the component
 * with the specified componentId.
 *
 * Note that memory for the in/out parameter classPath is
 * allocated by the callee. The caller is responsible for
 * freeing it using pcsl_mem_free().
 *
 * @param componentId The ID of the component
 * @param suiteId The application suite ID
 * @param storageId storage ID, INTERNAL_STORAGE_ID for the internal storage
 * @param checkComponentExists true if the component should be checked for
                               existence or not
 * @param pClassPath The in/out parameter that contains returned class path
 * @return error code that should be one of the following:
 * <pre>
 *     ALL_OK, OUT_OF_MEMORY, NOT_FOUND,
 *     SUITE_CORRUPTED_ERROR, BAD_PARAMS
 * </pre>
 */
MIDPError
midp_suite_get_component_class_path(ComponentIdType componentId,
                                    SuiteIdType suiteId,
                                    StorageIdType storageId,
                                    jboolean checkComponentExists,
                                    pcsl_string *pClassPath) {
    MIDPError status = ALL_OK;
    int componentExistsOrNotChecked;

    if (checkComponentExists) {
        status = midp_component_exists(componentId);
        componentExistsOrNotChecked = (status == ALL_OK ||
                                       status == SUITE_CORRUPTED_ERROR);
    } else {
        /*
         * Don't need to check is the component exist,
         * just construct the classpath for the given component ID.
         */
        componentExistsOrNotChecked = 1;
    }

    if (componentExistsOrNotChecked) {
        status = get_class_path_impl(COMPONENT_DYNAMIC, suiteId, componentId,
                                     storageId, pClassPath, &JAR_EXTENSION);
    } else {
        *pClassPath = PCSL_STRING_NULL;
    }

    return status;
}
示例#3
0
/**
 * Only for MONET--Gets the class path to binary application image
 * for the suite with the specified MIDlet suite id.
 *
 * It is different from "usual" class path in that class path points to a
 * jar file, while this binary application image path points to a MONET bundle.
 *
 * Note that memory for the in/out parameter classPath is
 * allocated by the callee. The caller is responsible for
 * freeing it using pcsl_mem_free().
 *
 * @param suiteId The application suite ID
 * @param storageId storage ID, INTERNAL_STORAGE_ID for the internal storage
 * @param checkSuiteExists true if suite should be checked for existence or not
 * @param classPath The in/out parameter that contains returned class path
 * @return  error code that should be one of the following:
 * <pre>
 *     ALL_OK, OUT_OF_MEMORY, NOT_FOUND,
 *     SUITE_CORRUPTED_ERROR, BAD_PARAMS
 * </pre>
*/
MIDPError
midp_suite_get_bin_app_path(SuiteIdType suiteId,
                            StorageIdType storageId,
                            pcsl_string *classPath) {
    return get_class_path_impl(suiteId, storageId, classPath,
                               &APP_IMAGE_EXTENSION);
}
/**
 * Only for MONET--Gets the class path to binary application image
 * for the suite with the specified MIDlet suite id.
 *
 * It is different from "usual" class path in that class path points to a
 * jar file, while this binary application image path points to a MONET bundle.
 *
 * Note that memory for the in/out parameter classPath is
 * allocated by the callee. The caller is responsible for
 * freeing it using pcsl_mem_free().
 *
 * @param suiteId The application suite ID
 * @param storageId storage ID, INTERNAL_STORAGE_ID for the internal storage
 * @param checkSuiteExists true if suite should be checked for existence or not
 * @param classPath The in/out parameter that contains returned class path
 * @return  error code that should be one of the following:
 * <pre>
 *     ALL_OK, OUT_OF_MEMORY, NOT_FOUND,
 *     SUITE_CORRUPTED_ERROR, BAD_PARAMS
 * </pre>
*/
MIDPError
midp_suite_get_bin_app_path(SuiteIdType suiteId,
                            StorageIdType storageId,
                            pcsl_string *classPath) {
    return get_class_path_impl(COMPONENT_REGULAR_SUITE, suiteId,
                               UNUSED_COMPONENT_ID, storageId, classPath,
                               &APP_IMAGE_EXTENSION);
}