Ejemplo n.º 1
0
  /**
   * Install a suite.
   *
   * @param selectedSuite index into the installList
   */
  private void installSuite(int selectedSuite) {
    MIDletStateHandler midletStateHandler = MIDletStateHandler.getMidletStateHandler();
    MIDletSuite midletSuite = midletStateHandler.getMIDletSuite();
    SuiteDownloadInfo suite;
    String displayName;

    suite = (SuiteDownloadInfo) installList.elementAt(selectedSuite);

    midletSuite.setTempProperty(null, "arg-0", "I");
    midletSuite.setTempProperty(null, "arg-1", suite.url);
    midletSuite.setTempProperty(null, "arg-2", suite.label);

    displayName = Resource.getString(ResourceConstants.INSTALL_APPLICATION);
    try {
      midletStateHandler.startMIDlet("com.sun.midp.installer.GraphicalInstaller", displayName);
      /*
       * Give the create MIDlet notification 1 second to get to
       * AMS.
       */
      Thread.sleep(1000);
      notifyDestroyed();
    } catch (Exception ex) {
      StringBuffer sb = new StringBuffer();

      sb.append(displayName);
      sb.append("\n");
      sb.append(Resource.getString(ResourceConstants.ERROR));
      sb.append(": ");
      sb.append(ex.toString());

      Alert a =
          new Alert(
              Resource.getString(ResourceConstants.AMS_CANNOT_START),
              sb.toString(),
              null,
              AlertType.ERROR);
      a.setTimeout(Alert.FOREVER);
      display.setCurrent(a, urlTextBox);
    }
  }
Ejemplo n.º 2
0
  /**
   * Queues the last suite to run when there is not a next Suite to run. This value will be
   * persistent until it is used. Not used in MVM mode.
   *
   * @param id ID of an installed suite
   * @param midlet class name of MIDlet to invoke
   * @exception SecurityException if the caller does not have permission to manage midlets
   */
  public static void setLastSuiteToRun(int id, String midlet, String arg0, String arg1) {

    MIDletSuite midletSuite = MIDletStateHandler.getMidletStateHandler().getMIDletSuite();

    // if a MIDlet suite is not scheduled, assume the JAM is calling.
    if (midletSuite != null) {
      midletSuite.checkIfPermissionAllowed(Permissions.AMS);
    }

    lastMidletSuiteToRun = id;
    lastMidletToRun = midlet;
    arg0ForLastMidlet = arg0;
    arg1ForLastMidlet = arg1;
  }
  /** Creates environment objects needed to AMS task */
  protected void createSuiteEnvironment() {
    foregroundController = this;

    lcduiEnvironment =
        new LCDUIEnvironmentForCDC(
            internalSecurityToken, eventQueue, isolateId, foregroundController);
    foregroundEventProducer = new CdcForegroundEventProducer(eventQueue);

    // creates display container, needs foregroundController
    super.createSuiteEnvironment();

    midletStateHandler = MIDletStateHandler.getMidletStateHandler();

    MIDletSuiteStorage mss = MIDletSuiteStorage.getMIDletSuiteStorage(internalSecurityToken);

    midletStateHandler.initMIDletStateHandler(
        internalSecurityToken, this, new CdcMIDletLoader(mss), this);

    MidletSuiteContainer msc = new MidletSuiteContainer(mss);

    RmsEnvironment.init(internalSecurityToken, msc);
  }