/** * The platform should invoke this function in platform context to start * Java. */ void javanotify_start(void) { int argc = 0; char *argv[MIDP_RUNMIDLET_MAXIMUM_ARGS]; javacall_result res; REPORT_INFO(LC_CORE, "javanotify_start() >>\n"); JVM_Initialize(); if (initialize_memory_slavemode() != JAVACALL_OK) { return; } argv[argc++] = "runMidlet"; argv[argc++] = "-1"; argv[argc++] = #if ENABLE_MULTIPLE_ISOLATES "com.sun.midp.appmanager.MVMManager"; #else "com.sun.midp.appmanager.Manager"; #endif /* if ENABLE_MULTIPLE_ISOLATES */ javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }
/** * A notification function for telling Java to perform installation of * a MIDlet * * If the given url is of the form http://www.sun.com/a/b/c/d.jad then * java will start a graphical installer will download the MIDlet * fom the internet. * If the given url is a file url (see below, file:///a/b/c/d.jar or * file:///a/b/c/d/jad) installation will be performed * in the backgroudn without launching the graphic installer application * * * @param url of MIDlet to install, can be either one of the following * 1. A full path to the jar file, of the following form file:///a/b/c/d.jar * 2. A full path to the JAD file, of the following form file:///a/b/c/d.jad * 3. An http url of jad file, of the following form, * http://www.sun.com/a/b/c/d.jad */ void javanotify_install_midlet(const char *httpUrl) { int length; int argc = 0; char *argv[MIDP_RUNMIDLET_MAXIMUM_ARGS]; javacall_result res; REPORT_INFO1(LC_CORE,"javanotify_install_midlet() >> httpUrl = %s\n", httpUrl); if (initialize_memory_slavemode() != JAVACALL_OK) { return; } argv[argc++] = "runMidlet"; argv[argc++] = "-1"; argv[argc++] = "com.sun.midp.installer.GraphicalInstaller"; argv[argc++] = "I"; length = strlen(httpUrl); if (length >= BINARY_BUFFER_MAX_LEN){ REPORT_ERROR(LC_AMS, "javanotify_install_midlet(): httpUrl is too long\n"); return; } memset(urlAddress, 0, BINARY_BUFFER_MAX_LEN); memcpy(urlAddress, httpUrl, length); argv[argc++] = urlAddress; javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }
/** * A notification function for telling Java to perform installation of * a MIDlet from filesystem, * * The installation will be performed in the background without launching * the graphic installer application. * * The given path is the full path to MIDlet's jad file or jad. * In case the MIDlet's jad file is specified, then * the MIDlet's jar file muts reside in the same directory as the jad * file. * * @param jadFilePath full path the jad (or jar) file which is of the form: * file://a/b/c/d.jad * @param jadFilePathLen length of the file path * @param userWasAsked a flag indicating whether the platform already asked * the user for permission to download and install the application * so there's no need to ask again and we can immediately install. */ void javanotify_install_midlet_from_filesystem(const javacall_utf16* jadFilePath, int jadFilePathLen, int userWasAsked) { int argc = 0; char *argv[MIDP_RUNMIDLET_MAXIMUM_ARGS]; javacall_result res; REPORT_INFO(LC_CORE, "javanotify_install_midlet_from_filesystem() >>\n"); JVM_Initialize(); if (initialize_memory_slavemode() != JAVACALL_OK) { return; } argv[argc++] = "runMidlet"; argv[argc++] = "-1"; argv[argc++] = "com.sun.midp.scriptutil.CommandLineInstaller"; argv[argc++] = "I"; if (jadFilePathLen >= BINARY_BUFFER_MAX_LEN){ REPORT_ERROR(LC_AMS, "javanotify_install_midlet_from_filesystem(): jadFilePathLen is too long"); return; } memset(urlAddress, 0, BINARY_BUFFER_MAX_LEN); unicodeToNative(jadFilePath, jadFilePathLen, (unsigned char *)urlAddress, BINARY_BUFFER_MAX_LEN); argv[argc++] = urlAddress; javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }
/** * The platform should invoke this function in platform context to start * the Java VM and run installed Java Content Handler. * * @param handlerID launched Content Handler ID * @param url Invocation parameter: URL * @param action optional Invocation parameter: Action * * @note allowed argument description can be obtained by '-help' value as arg1. */ void javanotify_start_handler(char* handlerID, char* url, char* action) { int argc = 0; char *argv[MIDP_RUNMIDLET_MAXIMUM_ARGS]; javacall_result res; REPORT_INFO3(LC_CORE,"javanotify_start_handler() >> %s %s %s\n", handlerID, url, action); if (initialize_memory_slavemode() != JAVACALL_OK) { return; } argv[argc++] = "runMidlet"; argv[argc++] = "-1"; argv[argc++] = "com.sun.midp.content.Invoker"; if (NULL != handlerID) { argv[argc++] = handlerID; if (NULL != url) { argv[argc++] = url; if (NULL != action) argv[argc++] = action; } } javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }
/** * The platform should invoke this function in platform context to start * the Java VM and run i3test framework. * * @param arg1 optional argument 1 * @param arg2 optional argument 2 * * @note allowed argument description can be obtained by '-help' value as arg1. */ void javanotify_start_i3test(char* arg1, char* arg2) { int argc = 0; char *argv[MIDP_RUNMIDLET_MAXIMUM_ARGS]; javacall_result res; REPORT_INFO2(LC_CORE,"javanotify_start_i3test() >> %s %s\n",arg1,arg2); JVM_Initialize(); if (initialize_memory_slavemode() != JAVACALL_OK) { return; } argv[argc++] = "runMidlet"; argv[argc++] = "-1"; argv[argc++] = "com.sun.midp.i3test.Framework"; if (NULL != arg1) { argv[argc++] = arg1; if (NULL != arg2) argv[argc++] = arg2; } javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }
/** * The platform should invoke this function in platform context to start * a specified MIDlet suite. * * @param suiteId the ID of the suite to start */ void javanotify_start_suite(char* suiteId) { int length; int argc = 0; char *argv[MIDP_RUNMIDLET_MAXIMUM_ARGS]; javacall_result res; REPORT_INFO(LC_CORE, "javanotify_start_suite() >>\n"); JVM_Initialize(); if (initialize_memory_slavemode() != JAVACALL_OK) { return; } length = strlen(suiteId); if (length >= BINARY_BUFFER_MAX_LEN) { REPORT_ERROR(LC_AMS, "javanotify_start_suite(): Incorrect suiteId parameter\n"); return; } memset(urlAddress, 0, BINARY_BUFFER_MAX_LEN); memcpy(urlAddress, suiteId, length); argv[argc++] = "runMidlet"; argv[argc++] = "-1"; argv[argc++] = "com.sun.midp.appmanager.MIDletSuiteLauncher"; argv[argc++] = urlAddress; javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }
/** * Entry point of the Javacall executable. * * @param argc number of arguments (1 means no arguments) * @param argv the arguments, argv[0] is the executable's name * * @return the exit value (1 if OK) */ javacall_result JavaTaskImpl(int argc, char* argv) { javacall_result res = runMidlet(argc, argv); javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_SHUTDOWN, (res == 1) ? JAVACALL_OK : JAVACALL_FAIL); return res; }
/** * The platform should invoke this function in platform context to start * the Java VM with arbitrary arguments. * * @param argc number of command-line arguments * @param argv array of command-line arguments * * @note This is a service function and it is introduced in the javacall * interface for debug purposes. Please DO NOT CALL this function without * being EXPLICITLY INSTRUCTED to do so. */ void javanotify_start_java_with_arbitrary_args(int argc, char* argv[]) { javacall_result res; REPORT_INFO(LC_CORE, "javanotify_start_java_with_arbitrary_args() >>\n"); if (argc > MIDP_RUNMIDLET_MAXIMUM_ARGS) { argc = MIDP_RUNMIDLET_MAXIMUM_ARGS; } if (initialize_memory_slavemode() != JAVACALL_OK) { return; } javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }
/** * A notification function for telling Java to perform installation of * a MIDlet with parameters * * If the given url is of the form http://www.sun.com/a/b/c/d.jad then * java will start a graphical installer will download the MIDlet * fom the internet. * If the given url is a file url (see below, file:///a/b/c/d.jar or * file:///a/b/c/d/jad) installation will be performed * in the backgroudn without launching the graphic installer application * * * @param url of MIDlet to install, can be either one of the following * 1. A full path to the jar file, of the following form file:///a/b/c/d.jar * 2. A full path to the JAD file, of the following form file:///a/b/c/d.jad * 3. An http url of jad file, of the following form, * http://www.sun.com/a/b/c/d.jad * @param silentInstall install the MIDlet without user interaction * @param forceUpdate install the MIDlet even if it already exist regardless * of version */ void javanotify_install_midlet_wparams(const char* httpUrl, int silentInstall, int forceUpdate) { int argc = 0; char *argv[MIDP_RUNMIDLET_MAXIMUM_ARGS]; javacall_result res; int length; REPORT_INFO2(LC_CORE,"javanotify_install_midlet_wparams() >> " "httpUrl = %s, silentInstall = %d\n", httpUrl, silentInstall); JVM_Initialize(); if (initialize_memory_slavemode() != JAVACALL_OK) { return; } argv[argc++] = "runMidlet"; argv[argc++] = "-1"; argv[argc++] = "com.sun.midp.installer.GraphicalInstaller"; if (silentInstall == 1) { if (forceUpdate == 1) { argv[argc++] = "FU"; } else { argv[argc++] = "FI"; } } else { argv[argc++] = "I"; } length = strlen(httpUrl); if (length >= BINARY_BUFFER_MAX_LEN) { REPORT_ERROR(LC_AMS, "javanotify_install_midlet_wparams(): httpUrl is too long"); return; } memset(urlAddress, 0, BINARY_BUFFER_MAX_LEN); memcpy(urlAddress, httpUrl, length); argv[argc++] = urlAddress; javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }
/** * The platform should invoke this function in platform context to start * Java in local context (not OTA). */ void javanotify_start_local(char* classname, char* descriptor, char* classpath, javacall_bool debug) { int argc = 0; char *argv[MIDP_RUNMIDLET_MAXIMUM_ARGS]; javacall_result res; REPORT_INFO2(LC_CORE,"javanotify_start_local() >> classname=%s, descriptor=%d \n", classname, descriptor); JVM_Initialize(); if (initialize_memory_slavemode() != JAVACALL_OK) { return; } argv[argc++] = "runMidlet"; argv[argc++] = "-1"; if (classname == NULL) { argv[argc++] = "internal"; } else { argv[argc++] = classname; } if (descriptor != NULL) { argv[argc++] = descriptor; } else { argv[argc++] = classpath; } if (classpath != NULL) { argv[argc++] = "-classpathext"; argv[argc++] = classpath; } javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }
/** * The platform should invoke this function in platform context to start * the Java VM and run TCK. * * @param url the http location of the TCK server * the url should be of the form: "http://host:port" * @param domain the TCK execution domain */ void javanotify_start_tck(char *tckUrl, javacall_lifecycle_tck_domain domain_type) { int length; int argc = 0; char *argv[MIDP_RUNMIDLET_MAXIMUM_ARGS]; javacall_result res; REPORT_INFO2(LC_CORE,"javanotify_start_tck() >> tckUrl=%s, domain_type=%d \n",tckUrl,domain_type); midp_thread_set_timeslice_proc(midp_slavemode_schedule_vm_timeslice); JVM_Initialize(); if (initialize_memory_slavemode() != JAVACALL_OK) { return; } argv[argc++] = "runMidlet"; argv[argc++] = "-1"; argv[argc++] = "com.sun.midp.installer.AutoTester"; length = strlen(tckUrl); if (length >= BINARY_BUFFER_MAX_LEN) { REPORT_ERROR(LC_AMS, "javanotify_start_tck(): tckUrl is too long"); return; } memset(urlAddress, 0, BINARY_BUFFER_MAX_LEN); memcpy(urlAddress, tckUrl, length); if (strcmp(urlAddress, "none") != 0) { argv[argc++] = urlAddress; } switch (domain_type) { case JAVACALL_LIFECYCLE_TCK_DOMAIN_UNTRUSTED: argv[argc] = "untrusted"; break; case JAVACALL_LIFECYCLE_TCK_DOMAIN_TRUSTED: argv[argc] = "trusted"; break; case JAVACALL_LIFECYCLE_TCK_DOMAIN_UNTRUSTED_MIN: argv[argc] = "minimum"; break; case JAVACALL_LIFECYCLE_TCK_DOMAIN_UNTRUSTED_MAX: argv[argc] = "maximum"; break; case JAVACALL_LIFECYCLE_TCK_DOMAIN_MANUFACTURER: argv[argc] = "manufacturer"; break; case JAVACALL_LIFECYCLE_TCK_DOMAIN_OPERATOR: argv[argc] = "operator"; break; case JAVACALL_LIFECYCLE_TCK_DOMAIN_IDENTIFIED: argv[argc] = "identified_third_party"; break; case JAVACALL_LIFECYCLE_TCK_DOMAIN_UNIDENTIFIED: argv[argc] = "unidentified_third_party"; break; default: REPORT_ERROR(LC_CORE, "javanotify_start_tck() [slave mode] Can not recognize TCK domain\n"); REPORT_ERROR1(LC_CORE, "TCK domain type is %d. System will now exit\n", domain_type); return; } argc++; javacall_lifecycle_state_changed(JAVACALL_LIFECYCLE_MIDLET_STARTED, JAVACALL_OK); res = runMidlet(argc, argv); }