home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / CHIPHEFT062001.ISO / browser / nc32lyc / comm.z / java40.jar / netscape / softupdate / UninstallObject.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-08-15  |  2.4 KB  |  65 lines

  1. package netscape.softupdate;
  2.  
  3. import java.text.MessageFormat;
  4. import netscape.security.AppletSecurity;
  5. import netscape.security.PrivilegeManager;
  6. import netscape.security.Target;
  7.  
  8. class UninstallObject extends InstallObject {
  9.    private String regName;
  10.    private String userName;
  11.  
  12.    UninstallObject(SoftwareUpdate var1, String var2) throws SoftUpdateException {
  13.       super(var1);
  14.       this.regName = var2;
  15.       if (this.regName != null && this.regName.length() != 0) {
  16.          PrivilegeManager var3 = AppletSecurity.getPrivilegeManager();
  17.          Target var4 = Target.findTarget("Impersonator");
  18.          var3.enablePrivilege(var4);
  19.          Target var5 = Target.findTarget("SoftwareInstall");
  20.          var3.enablePrivilege(var5, super.softUpdate.GetPrincipal());
  21.          this.userName = VersionRegistry.getUninstallUserName(this.regName);
  22.          if (this.userName == null) {
  23.             throw new SoftUpdateException("", -213);
  24.          }
  25.       } else {
  26.          throw new SoftUpdateException("", -208);
  27.       }
  28.    }
  29.  
  30.    protected void Complete() throws SoftUpdateException {
  31.       PrivilegeManager var3 = AppletSecurity.getPrivilegeManager();
  32.       Target var4 = Target.findTarget("Impersonator");
  33.       var3.enablePrivilege(var4);
  34.       Target var2 = Target.findTarget("SoftwareInstall");
  35.       var3.enablePrivilege(var2, super.softUpdate.GetPrincipal());
  36.       int var1 = this.NativeComplete(this.regName);
  37.       var3.revertPrivilege(var2);
  38.       if (var1 != 0) {
  39.          var1 = -223;
  40.          throw new SoftUpdateException(Strings.error_Unexpected() + this.regName, var1);
  41.       }
  42.    }
  43.  
  44.    protected void Prepare() throws SoftUpdateException {
  45.    }
  46.  
  47.    protected void Abort() {
  48.    }
  49.  
  50.    private native int NativeComplete(String var1) throws SoftUpdateException;
  51.  
  52.    public String toString() {
  53.       Object[] var1 = new Object[]{this.userName};
  54.       return MessageFormat.format(Strings.details_Uninstall(), var1);
  55.    }
  56.  
  57.    protected boolean CanUninstall() {
  58.       return false;
  59.    }
  60.  
  61.    protected boolean RegisterPackageNode() {
  62.       return false;
  63.    }
  64. }
  65.