javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java
branchRCL_3
changeset 24 6c158198356e
parent 17 0fd27995241b
child 25 ae942d28ec0e
equal deleted inserted replaced
23:e5618cc85d74 24:6c158198356e
    97      * Return value which indicates that installer must not exit with
    97      * Return value which indicates that installer must not exit with
    98      * System.exit(). This return value is only used for internally.
    98      * System.exit(). This return value is only used for internally.
    99      */
    99      */
   100     static final int RET_NO_SYSTEM_EXIT = 100;
   100     static final int RET_NO_SYSTEM_EXIT = 100;
   101 
   101 
       
   102     /** Id for installer cancel Comms message. */
       
   103     private static final int INSTALLER_CANCEL_MESSAGE_ID = 603;
       
   104     /** Id for installer cancel Comms response message. */
       
   105     private static final int INSTALLER_CANCEL_RESPONSE_MESSAGE_ID = 604;
       
   106 
   102     // ThreadDumper instance.
   107     // ThreadDumper instance.
   103     private static ThreadDumper iThreadDumper = null;
   108     private static ThreadDumper iThreadDumper = null;
   104 
   109 
   105     // Installer CommsServer.
   110     // Installer CommsServer.
   106     private static CommsServerEndpoint iInstallerServer = null;
   111     private static CommsServerEndpoint iInstallerServer = null;
   321         {
   326         {
   322             Log.log("JAVA_BIN_ROOT=" + javaBinRoot);
   327             Log.log("JAVA_BIN_ROOT=" + javaBinRoot);
   323         }
   328         }
   324 
   329 
   325         StartUpTrace.doTrace("Installer.mainWithResult " + aArgs[0] + " begins");
   330         StartUpTrace.doTrace("Installer.mainWithResult " + aArgs[0] + " begins");
   326         StringBuffer buf = new StringBuffer("Java install process started with command: ");
   331         StringBuffer buf = new StringBuffer("Java install process started with command:");
   327         for (int i = 0; i < aArgs.length; i++)
   332         for (int i = 0; i < aArgs.length; i++)
   328         {
   333         {
   329             buf.append(" ").append(aArgs[i]);
   334             buf.append(" ").append(aArgs[i]);
   330         }
   335         }
   331         Log.logInfoPrd(buf.toString());
   336         Log.logInfoPrd(buf.toString());
   334         int exitCode = ERR_NONE;
   339         int exitCode = ERR_NONE;
   335         Args args = new Args(aArgs);
   340         Args args = new Args(aArgs);
   336 
   341 
   337         if (iThreadDumper != null)
   342         if (iThreadDumper != null)
   338         {
   343         {
   339             iThreadDumper.startTimer(10*60*1000); // 10 mins
   344             iThreadDumper.startTimer(5*60*1000); // 5 mins
   340         }
   345         }
   341 
   346 
   342         try
   347         try
   343         {
   348         {
   344             // Do IntegrityService rollback every time installer is started.
   349             // Do IntegrityService rollback every time installer is started.
   536         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
   541         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
   537                   GetAttributes());
   542                   GetAttributes());
   538         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
   543         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
   539                   GetFromStorage());
   544                   GetFromStorage());
   540         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
   545         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
       
   546                   SelectUids()); // Select suite uid and application uids.
       
   547         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
   541                   StartProgressNotifications());
   548                   StartProgressNotifications());
   542         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
       
   543                   SelectUids()); // Select suite uid and application uids.
       
   544         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
   549         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
   545                   AuthenticateJad()); // This must be the first security
   550                   AuthenticateJad()); // This must be the first security
   546         // related step.
   551         // related step.
   547         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
   552         table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
   548                   GrantJadPermissions()); // Permission granting must be
   553                   GrantJadPermissions()); // Permission granting must be
  1233             "  -skipjarcheck                 Skip application package scanning.\n"+
  1238             "  -skipjarcheck                 Skip application package scanning.\n"+
  1234             "  -skipotastatus                Skip OTA status handling.\n"+
  1239             "  -skipotastatus                Skip OTA status handling.\n"+
  1235             "  -commsresult=endpoint         In the end of operation, send\n"+
  1240             "  -commsresult=endpoint         In the end of operation, send\n"+
  1236             "                                InstallerResultMessage to specified comms\n"+
  1241             "                                InstallerResultMessage to specified comms\n"+
  1237             "                                endpoint.\n"+
  1242             "                                endpoint.\n"+
       
  1243             "  -base64=base64options         Comma separated list of base64 encoded\n"+
       
  1244             "                                options.\n"+
  1238             "\n"+
  1245             "\n"+
  1239             "Either -jad or -jar must be specified, other options are optional.\n";
  1246             "Either -jad or -jar must be specified, other options are optional.\n";
  1240 
  1247 
  1241         String uninstallCmd =
  1248         String uninstallCmd =
  1242             "Uninstalls Java application suite.\n"+
  1249             "Uninstalls Java application suite.\n"+
  1262             "                                anything. This option is for debugging\n"+
  1269             "                                anything. This option is for debugging\n"+
  1263             "                                purposes only.\n"+
  1270             "                                purposes only.\n"+
  1264             "  -captainmsgs=yes|no           If set to no, JavaInstaller will not send\n"+
  1271             "  -captainmsgs=yes|no           If set to no, JavaInstaller will not send\n"+
  1265             "                                any messages to JavaCaptain during\n"+
  1272             "                                any messages to JavaCaptain during\n"+
  1266             "                                uninstallation. Default is yes.\n"+
  1273             "                                uninstallation. Default is yes.\n"+
       
  1274             "  -resetpreinstall              Reset preinstall state.\n"+
  1267             "  -skipotastatus                Skip OTA status handling.\n"+
  1275             "  -skipotastatus                Skip OTA status handling.\n"+
  1268             "  -commsresult=endpoint         In the end of operation, send\n"+
  1276             "  -commsresult=endpoint         In the end of operation, send\n"+
  1269             "                                InstallerResultMessage to specified comms\n"+
  1277             "                                InstallerResultMessage to specified comms\n"+
  1270             "                                endpoint.\n"+
  1278             "                                endpoint.\n"+
       
  1279             "  -base64=base64options         Comma separated list of base64 encoded\n"+
       
  1280             "                                options.\n"+
  1271             "\n"+
  1281             "\n"+
  1272             "The -uid option must be specified, other options are optional.\n";
  1282             "The -uid option must be specified, other options are optional.\n";
  1273 
  1283 
  1274         String uninstallAllCmd =
  1284         String uninstallAllCmd =
  1275             "Uninstalls all installed Java application suites.\n"+
  1285             "Uninstalls all installed Java application suites.\n"+
  1464                 int result = ERR_GENERAL;
  1474                 int result = ERR_GENERAL;
  1465                 Log.log("InstallerListener received " + aMessage);
  1475                 Log.log("InstallerListener received " + aMessage);
  1466                 if (aMessage.hasPermission(CommsPermission.INSTALL_APPLICATION))
  1476                 if (aMessage.hasPermission(CommsPermission.INSTALL_APPLICATION))
  1467                 {
  1477                 {
  1468                     int msgId = aMessage.getMessageId();
  1478                     int msgId = aMessage.getMessageId();
  1469                     if (msgId == 603)
  1479                     if (msgId == INSTALLER_CANCEL_MESSAGE_ID)
  1470                     {
  1480                     {
  1471                         Installer.cancel();
  1481                         Installer.cancel();
  1472                         result = ERR_NONE;
  1482                         result = ERR_NONE;
  1473                     }
  1483                     }
  1474                 }
  1484                 }
  1477                     Log.logWarning("InstallerListener received message " +
  1487                     Log.logWarning("InstallerListener received message " +
  1478                                    "with no INSTALL_APPLICATION permission");
  1488                                    "with no INSTALL_APPLICATION permission");
  1479                 }
  1489                 }
  1480                 CommsMessage response = new CommsMessage();
  1490                 CommsMessage response = new CommsMessage();
  1481                 response.replyTo(aMessage);
  1491                 response.replyTo(aMessage);
  1482                 response.setMessageId(604);
  1492                 response.setMessageId(INSTALLER_CANCEL_RESPONSE_MESSAGE_ID);
  1483                 response.write(result);
  1493                 response.write(result);
  1484                 iInstallerServer.send(response);
  1494                 iInstallerServer.send(response);
  1485                 Log.log("InstallerListener sent " + response);
  1495                 Log.log("InstallerListener sent " + response);
  1486             }
  1496             }
  1487             catch (Throwable t)
  1497             catch (Throwable t)