當前位置: 首頁>>代碼示例>>Java>>正文


Java RegistryDefaultHandler.getInstance方法代碼示例

本文整理匯總了Java中com.izforge.izpack.util.os.RegistryDefaultHandler.getInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java RegistryDefaultHandler.getInstance方法的具體用法?Java RegistryDefaultHandler.getInstance怎麽用?Java RegistryDefaultHandler.getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.izforge.izpack.util.os.RegistryDefaultHandler的用法示例。


在下文中一共展示了RegistryDefaultHandler.getInstance方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isRegistered

import com.izforge.izpack.util.os.RegistryDefaultHandler; //導入方法依賴的package包/類
/**
 * Returns wether the handled application is already registered or not. The validation will be
 * made only on systems which contains a registry (Windows).
 *
 * @return wether the handled application is already registered or not
 */
protected boolean isRegistered()
{
    boolean retval = false;
    try
    {
        // Get the default registry handler.
        RegistryHandler rh = RegistryDefaultHandler.getInstance();
        if (rh != null)
        {
            rh.verify(idata);
            retval = rh.isProductRegistered();

        }
        // else we are on a os which has no registry or the
        // needed dll was not bound to this installation. In
        // both cases we forget the "already exist" check.

    }
    catch (Exception e)
    { // Will only be happen if registry handler is good, but an
        // exception at performing was thrown. This is an error...
        e.printStackTrace();
    }
    return (retval);
}
 
開發者ID:OpenNMS,項目名稱:installer,代碼行數:32,代碼來源:CheckedHelloPanel.java

示例2: performKeySetting

import com.izforge.izpack.util.os.RegistryDefaultHandler; //導入方法依賴的package包/類
/**
 * Perform the setting of one key.
 *
 * @param regEntry    element which contains the description of the key to be created
 * @param substitutor variable substitutor to be used for revising the regEntry contents
 */
private void performKeySetting(IXMLElement regEntry, VariableSubstitutor substitutor)
        throws Exception
{
    String keypath = getSpecHelper().getRequiredAttribute(regEntry, REG_KEYPATH);
    keypath = substitutor.substitute(keypath, null);
    String root = getSpecHelper().getRequiredAttribute(regEntry, REG_ROOT);
    int rootId = resolveRoot(regEntry, root, substitutor);
    RegistryHandler rh = RegistryDefaultHandler.getInstance();
    if (rh == null)
    {
        return;
    }
    rh.setRoot(rootId);
    if (!rh.keyExist(keypath))
    {
        rh.createKey(keypath);
    }
}
 
開發者ID:OpenNMS,項目名稱:installer,代碼行數:25,代碼來源:RegistryInstallerListener.java

示例3: panelActivate

import com.izforge.izpack.util.os.RegistryDefaultHandler; //導入方法依賴的package包/類
public void panelActivate()
{
    if (abortInstallation)
    {
        parent.lockNextButton();
        try
        {
            if (multipleInstall())
            {
                setUniqueUninstallKey();
                abortInstallation = false;
                parent.unlockNextButton();
            }
        }
        catch (Exception e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
    RegistryHandler rh = RegistryDefaultHandler.getInstance();
    if (rh != null)
    {
        idata.setVariable("UNINSTALL_NAME", rh.getUninstallName());
    }
}
 
開發者ID:OpenNMS,項目名稱:installer,代碼行數:28,代碼來源:CheckedHelloPanel.java

示例4: cleanUp

import com.izforge.izpack.util.os.RegistryDefaultHandler; //導入方法依賴的package包/類
/**
   * Remove all registry entries on failed installation
   */
  public void cleanUp()
  {
// installation was not successful now rewind all registry changes
      if (AutomatedInstallData.getInstance().installSuccess || registryModificationLog == null || registryModificationLog.size() < 1)
      {
          return;
      }
      RegistryHandler registryHandler = RegistryDefaultHandler.getInstance();
      try
      {
          if (registryHandler == null)
          {
              return;
          }
          if (registryHandler == null)
          {
              return;
          }
          registryHandler.activateLogging();
          registryHandler.setLoggingInfo(registryModificationLog);
          registryHandler.rewind();
      }
      catch (Exception e)
      {
          e.printStackTrace();
      }
  }
 
開發者ID:OpenNMS,項目名稱:installer,代碼行數:31,代碼來源:RegistryInstallerListener.java

示例5: initializeRegistryHandler

import com.izforge.izpack.util.os.RegistryDefaultHandler; //導入方法依賴的package包/類
private void initializeRegistryHandler(AutomatedInstallData idata) throws Exception
{
    RegistryHandler rh = RegistryDefaultHandler.getInstance();
    if (rh == null)
    {
        return;
    }
    rh.verify(idata);
    getSpecHelper().readSpec(SPEC_FILE_NAME);
}
 
開發者ID:OpenNMS,項目名稱:installer,代碼行數:11,代碼來源:RegistryInstallerListener.java

示例6: setUniqueUninstallKey

import com.izforge.izpack.util.os.RegistryDefaultHandler; //導入方法依賴的package包/類
/**
 * @throws Exception
 */
private void setUniqueUninstallKey() throws Exception
{
    // Let us play a little bit with the regstry again...
    // Now we search for an unique uninstall key.
    // First we need a handler. There is no overhead at a
    // secound call of getInstance, therefore we do not buffer
    // the handler in this class.
    RegistryHandler rh = RegistryDefaultHandler.getInstance();
    int oldVal = rh.getRoot(); // Only for security...
    // We know, that the product is already installed, else we
    // would not in this method. First we get the
    // "default" uninstall key.
    if (oldVal > 100) // Only to inhibit warnings about local variable never read.
    {
        return;
    }
    String uninstallName = rh.getUninstallName();
    int uninstallModifier = 1;
    while (true)
    {
        if (uninstallName == null)
        {
            break; // Should never be...
        }
        // Now we define a new uninstall name.
        String newUninstallName = uninstallName + "(" + Integer.toString(uninstallModifier)
                + ")";
        // Then we "create" the reg key with it.
        String keyName = RegistryHandler.UNINSTALL_ROOT + newUninstallName;
        rh.setRoot(HKEY_LOCAL_MACHINE);
        if (!rh.keyExist(keyName))
        { // That's the name for which we searched.
            // Change the uninstall name in the reg helper.
            rh.setUninstallName(newUninstallName);
            // Now let us inform the user.
            emitNotification(parent.langpack
                    .getString("CheckedHelloPanel.infoOverUninstallKey")
                    + newUninstallName);
            // Now a little hack if the registry spec file contains
            // the pack "UninstallStuff".
            break;
        }
        uninstallModifier++;
    }
}
 
開發者ID:OpenNMS,項目名稱:installer,代碼行數:49,代碼來源:CheckedHelloPanel.java

示例7: afterPacks

import com.izforge.izpack.util.os.RegistryDefaultHandler; //導入方法依賴的package包/類
public void afterPacks(AutomatedInstallData idata, AbstractUIProgressHandler handler)
        throws Exception
{
    try
    {
    	// Register for cleanup
    	Housekeeper.getInstance().registerForCleanup(this);
    	
        // Start logging
        RegistryHandler rh = RegistryDefaultHandler.getInstance();
        if (rh == null)
        {
            return;
        }
        IXMLElement uninstallerPack = null;
        // No interrupt desired after writing registry entries.
        Unpacker.setDiscardInterrupt(true);
        rh.activateLogging();

        if (getSpecHelper().getSpec() != null)
        {
            VariableSubstitutor substitutor = new VariableSubstitutor(idata.getVariables());
            Iterator iter = idata.selectedPacks.iterator();
            // Get the special pack "UninstallStuff" which contains values
            // for the uninstaller entry.
            uninstallerPack = getSpecHelper().getPackForName("UninstallStuff");
            performPack(uninstallerPack, substitutor);

            // Now perform the selected packs.
            while (iter != null && iter.hasNext())
            {
                // Resolve data for current pack.
                IXMLElement pack = getSpecHelper().getPackForName(((Pack) iter.next()).name);
                performPack(pack, substitutor);

            }
        }
        String uninstallSuffix = idata.getVariable("UninstallKeySuffix");
        if (uninstallSuffix != null)
        {
            rh.setUninstallName(rh.getUninstallName() + " " + uninstallSuffix);
        }
        // Generate uninstaller key automatically if not defined in spec.
        if (uninstallerPack == null)
        {
            rh.registerUninstallKey();
        }
        // Get the logging info from the registry class and put it into
        // the uninstaller. The RegistryUninstallerListener loads that data
        // and rewind the made entries.
        // This is the common way to transport informations from an
        // installer CustomAction to the corresponding uninstaller
        // CustomAction.
        List<Object> info = rh.getLoggingInfo();
        if (info != null)
        {
            UninstallData.getInstance().addAdditionalData("registryEntries", info);
        }
        // Remember all registry info to rewind registry modifications in case of failed installation
        registryModificationLog = info;
    }
    catch (Exception e)
    {
        if (e instanceof NativeLibException)
        {
            throw new WrappedNativeLibException(e);
        }
        else
        {
            throw e;
        }
    }
}
 
開發者ID:OpenNMS,項目名稱:installer,代碼行數:74,代碼來源:RegistryInstallerListener.java


注:本文中的com.izforge.izpack.util.os.RegistryDefaultHandler.getInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。