当前位置: 首页>>代码示例>>Java>>正文


Java Registry.getProducts方法代码示例

本文整理汇总了Java中org.netbeans.installer.product.Registry.getProducts方法的典型用法代码示例。如果您正苦于以下问题:Java Registry.getProducts方法的具体用法?Java Registry.getProducts怎么用?Java Registry.getProducts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.installer.product.Registry的用法示例。


在下文中一共展示了Registry.getProducts方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJavaBundledAndInstalled

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
private File getJavaBundledAndInstalled() {
    try {
        Registry bundledRegistry = new Registry();
        final String bundledRegistryUri = System.getProperty(
                Registry.BUNDLED_PRODUCT_REGISTRY_URI_PROPERTY);

        bundledRegistry.loadProductRegistry(
                (bundledRegistryUri != null) ? bundledRegistryUri : Registry.DEFAULT_BUNDLED_PRODUCT_REGISTRY_URI);

        // iterate over bundled JDKs to check whether they are already installed
        for (Product bundledJdk : bundledRegistry.getProducts(JDK_PRODUCT_UID)) {
            Product globalJdk = Registry.getInstance().getProduct(
                    JDK_PRODUCT_UID,
                    bundledJdk.getVersion());

            if (globalJdk != null) {
                final File jdkLoc = globalJdk.getStatus().equals(Status.INSTALLED) ? globalJdk.getInstallationLocation() : JavaUtils.findJDKHome(globalJdk.getVersion());

                if (jdkLoc != null && jdkLocations.contains(jdkLoc)) {
                    return jdkLoc;
                }

            }
        }

    } catch (InitializationException e) {
        LogManager.log("Cannot load bundled registry", e);
    }

    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:JdkLocationPanel.java

示例2: generateBundles

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
public void generateBundles(String[] registryNames) throws ManagerException {
    try {
        final List<File> files = new ArrayList<File>();
        for (String name: registryNames) {
            if (registries.get(name) == null) {
                addRegistry(name);
            }
            
            files.add(new File(registries.get(name), REGISTRY_XML));
        }
        
        for (Platform platform: Platform.values()) {
            final Registry registry = new Registry();
            
            registry.setLocalDirectory(NBI);
            registry.setFinishHandler(new DummyFinishHandler());
            for (File file: files) {
                registry.loadProductRegistry(file);
            }
            
            final List<Product> products = registry.getProducts(platform);
            
            for (int i = 1; i <= products.size(); i++) {
                Product[] combination = new Product[i];
                
                iterate(platform, registryNames, registry, combination, 0, products, 0);
            }
        }
    } catch (InitializationException e) {
        throw new ManagerException("Cannot generate bundles", e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:ManagerBean.java

示例3: execute

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
public void execute() {
    LogManager.logEntry("getting all installation data");
    final Registry registry = Registry.getInstance();
    final List<Product> products = registry.getProductsToInstall();
    final int percentageChunk = Progress.COMPLETE / products.size();
    final int percentageLeak = Progress.COMPLETE % products.size();
    
    overallProgress = new CompositeProgress();
    overallProgress.setPercentage(percentageLeak);
    overallProgress.synchronizeDetails(true);
    
    getWizardUi().setProgress(overallProgress);
    for (int i = 0; i < products.size(); i++) {
        // get the handle of the current item
        final Product product = products.get(i);
        
        // initiate the progress for the current element
        currentProgress = new Progress();
        
        overallProgress.addChild(currentProgress, percentageChunk);
        try {
            String prop = product.getRegistryType() == RegistryType.REMOTE ?
                PROGRESS_TITLE_REMOTE_PROPERTY :
                PROGRESS_TITLE_LOCAL_PROPERTY;
            String overallProgressTitle = StringUtils.format(
                    getProperty(prop), product.getDisplayName());
            overallProgress.setTitle(overallProgressTitle);
            
            product.downloadData(currentProgress);
            
            // check for cancel status
            if (isCanceled()) return;
            
            // sleep a little so that the user can perceive that something
            // is happening
            SystemUtils.sleep(200);
        }  catch (DownloadException e) {
            // wrap the download exception with a more user-friendly one
            InstallationException error = new InstallationException(
                     StringUtils.format(
                    getProperty(DOWNLOAD_FAILED_EXCEPTION_PROPERTY),
                    product.getDisplayName()), e);
            
            // adjust the product's status and save this error - it will
            // be reused later at the PostInstallSummary
            product.setStatus(Status.NOT_INSTALLED);
            product.setInstallationError(error);
            
            // since the installation data for the current product failed to
            // be downloaded, we should cancel the installation of the products
            // that may require this one
            for(Product dependent: registry.getProducts()) {
                if ((dependent.getStatus()  == Status.TO_BE_INSTALLED) &&
                        registry.satisfiesRequirement(product, dependent)) {
                   String exString = StringUtils.format(
                            getProperty(DEPENDENT_FAILED_EXCEPTION_PROPERTY),
                            dependent.getDisplayName(),
                            product.getDisplayName());
                    
                    final InstallationException dependentError =
                            new InstallationException(exString, error);
                    
                    dependent.setStatus(Status.NOT_INSTALLED);
                    dependent.setInstallationError(dependentError);
                    
                    products.remove(dependent);
                }
            }
            
            // finally notify the user of what has happened
            LogManager.log(ErrorLevel.ERROR, error);
        }
    }
    LogManager.logExit("... finished getting of the installation data");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:76,代码来源:DownloadInstallationDataAction.java

示例4: execute

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
public void execute() {
    final Registry registry = Registry.getInstance();
    final List<Product> products = registry.getProductsToInstall();
    final int percentageChunk = Progress.COMPLETE / products.size();
    final int percentageLeak  = Progress.COMPLETE % products.size();
    
    overallProgress = new CompositeProgress();
    overallProgress.setPercentage(percentageLeak);
    overallProgress.synchronizeDetails(true);
    
    getWizardUi().setProgress(overallProgress);
    for (int i = 0; i < products.size(); i++) {
        // get the handle of the current item
        final Product product = products.get(i);
        
        // initiate the progress for the current element
        currentProgress = new Progress();
        
        overallProgress.addChild(currentProgress, percentageChunk);
        try {
            String prop = product.getRegistryType() == RegistryType.REMOTE ?
                PROGRESS_TITLE_REMOTE_PROPERTY :
                PROGRESS_TITLE_LOCAL_PROPERTY;
            String overallProgressTitle = StringUtils.format(
                    getProperty(prop), product.getDisplayName());
            
            overallProgress.setTitle(overallProgressTitle);
            
            product.downloadLogic(currentProgress);
            
            // ensure that the current progress has reached the complete state
            // (sometimes it just does not happen and we're left over with 99%)
            currentProgress.setPercentage(Progress.COMPLETE);
            
            // check for cancel status
            if (isCanceled()) return;
            
            // sleep a little so that the user can perceive that something
            // is happening
            SystemUtils.sleep(200);
        } catch (DownloadException e) {
            // wrap the download exception with a more user-friendly one
            final InstallationException error = new InstallationException(
                    StringUtils.format(
                    getProperty(DOWNLOAD_FAILED_EXCEPTION_PROPERTY),
                    product.getDisplayName()), e);
            
            // adjust the product's status and save this error - it will
            // be reused later at the PostInstallSummary
            product.setStatus(Status.NOT_INSTALLED);
            product.setInstallationError(error);
            
            // since the configuration logic for the current product failed to
            // be downloaded, we should cancel the installation of the products
            // that may require this one
            for(Product dependent: registry.getProducts()) {
                if ((dependent.getStatus()  == Status.TO_BE_INSTALLED) &&
                        registry.satisfiesRequirement(product, dependent)) {
                    String exString = StringUtils.format(
                            getProperty(DEPENDENT_FAILED_EXCEPTION_PROPERTY),
                            dependent.getDisplayName(),
                            product.getDisplayName());
                    
                    final InstallationException dependentError =
                            new InstallationException(exString, error);
                    
                    dependent.setStatus(Status.NOT_INSTALLED);
                    dependent.setInstallationError(dependentError);
                    
                    products.remove(dependent);
                }
            }
            
            // finally notify the user of what has happened
            ErrorManager.notify(ErrorLevel.ERROR, error);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:79,代码来源:DownloadConfigurationLogicAction.java

示例5: execute

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
@Override
public void execute() {
    LogManager.logIndent("Start products uninstallation");
    final Registry registry = Registry.getInstance();
    final List<Product> products = registry.getProductsToUninstall();
    final int percentageChunk = Progress.COMPLETE / products.size();
    final int percentageLeak = Progress.COMPLETE % products.size();
    
    overallProgress = new CompositeProgress();
    overallProgress.setPercentage(percentageLeak);
    overallProgress.synchronizeDetails(true);
    
    getWizardUi().setProgress(overallProgress);
    for (Product product : products) {         
        // initiate the progress for the current element
        currentProgress = new Progress();
        
        overallProgress.addChild(currentProgress, percentageChunk);
        overallProgress.setTitle(StringUtils.format(
                getProperty(PROGRESS_UNINSTALL_TITLE_PROPERTY),
                product.getDisplayName()));
        try {
            product.uninstall(currentProgress);
            
            // sleep a little so that the user can perceive that something
            // is happening
            SystemUtils.sleep(200);
        }  catch (UninstallationException e) {
            // do not override already set exit code
            if (System.getProperties().get(Installer.EXIT_CODE_PROPERTY) == null) {
                 System.getProperties().put(Installer.EXIT_CODE_PROPERTY, 
                         new Integer(UNINSTALLATION_ERROR_CODE));
            }
            // adjust the component's status and save this error - it will
            // be reused later at the PostInstallSummary
            product.setStatus(Status.INSTALLED);
            product.setUninstallationError(e);
            
            // since the product failed to uninstall  - we should remove
            // the components it depends on from our plans to uninstall
            for(Product requirement : registry.getProducts()) {
                if ((requirement.getStatus() == Status.TO_BE_UNINSTALLED) &&
                        registry.satisfiesRequirement(requirement, product)) {
                    UninstallationException requirementError =
                            new UninstallationException(
                            StringUtils.format(
                            getProperty(PROGRESS_UNINSTALL_TITLE_PROPERTY),
                            requirement.getDisplayName(),
                            product.getDisplayName()), e);
                    
                    requirement.setStatus(Status.INSTALLED);
                    requirement.setUninstallationError(requirementError);
                    
                    products.remove(requirement);
                }
            }
            
            // finally notify the user of what has happened
            ErrorManager.notify(ErrorLevel.ERROR, e);
        }
    }
    LogManager.logUnindent("... finished products uninstallation");
            
    LogManager.logUnindent("... starting updates and plugins uninstallation");        
    try {
        // delete updated files and downloaded plugins in installation folder
        FileUtils.deleteFiles(new ArrayList<File>(UninstallUtils.getFilesToDeteleAfterUninstallation()));            
        
        // delete all empty folders in installation directory                          
        FileUtils.deleteFiles(UninstallUtils.getEmptyFolders());
    } catch (IOException ex) {
        LogManager.log(ex);
    }
    LogManager.logUnindent("... finished updates and plugins uninstallation");        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:76,代码来源:UninstallAction.java

示例6: initialize

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
@Override
protected void initialize() {
    final Registry registry = Registry.getInstance();
    
    final boolean errorsEncountered =
            registry.getProducts(FAILED_TO_INSTALL).size() > 0 &&
            registry.getProducts(FAILED_TO_UNINSTALL).size() > 0;
    
    if (errorsEncountered) {
        messagePane.setContentType(component.getProperty(MESSAGE_ERRORS_CONTENT_TYPE_PROPERTY));
        messagePane.setText(component.getProperty(MESSAGE_ERRORS_TEXT_PROPERTY));
    } else {
        messagePane.setContentType(component.getProperty(MESSAGE_SUCCESS_CONTENT_TYPE_PROPERTY));
        messagePane.setText(component.getProperty(MESSAGE_SUCCESS_TEXT_PROPERTY));
    }
    
    List<Product> components;
    
    components = registry.getProducts(INSTALLED_SUCCESSFULLY);
    if (components.size() > 0) {
        successfullyBundledComponentsLabel.setVisible(true);
        successfullyBundledComponentsPane.setVisible(true);
        
        successfullyBundledComponentsLabel.setText(component.getProperty(SUCCESSFULLY_BUNDLED_COMPONENTS_LABEL_TEXT_PROPERTY));
        successfullyBundledComponentsPane.setContentType(component.getProperty(SUCCESSFULLY_BUNDLED_COMPONENTS_CONTENT_TYPE_PROPERTY));
        successfullyBundledComponentsPane.setText(StringUtils.format(component.getProperty(SUCCESSFULLY_BUNDLED_COMPONENTS_TEXT_PROPERTY), StringUtils.asString(components, component.getProperty(COMPONENTS_LIST_SEPARATOR_PROPERTY))));
    } else {
        successfullyBundledComponentsLabel.setVisible(false);
        successfullyBundledComponentsPane.setVisible(false);
    }
    
    components = registry.getProducts(FAILED_TO_INSTALL);
    if (components.size() > 0) {
        componentsFailedToBundleLabel.setVisible(true);
        componentsFailedToBundlePane.setVisible(true);
        
        componentsFailedToBundleLabel.setText(component.getProperty(COMPONENTS_FAILED_TO_BUNDLE_LABEL_TEXT_PROPERTY));
        componentsFailedToBundlePane.setContentType(component.getProperty(COMPONENTS_FAILED_TO_BUNDLE_CONTENT_TYPE_PROPERTY));
        componentsFailedToBundlePane.setText(StringUtils.format(component.getProperty(COMPONENTS_FAILED_TO_BUNDLE_TEXT_PROPERTY), StringUtils.asString(components, component.getProperty(COMPONENTS_LIST_SEPARATOR_PROPERTY))));
    } else {
        componentsFailedToBundleLabel.setVisible(false);
        componentsFailedToBundlePane.setVisible(false);
    }
    
    viewLogButton.setText(component.getProperty(VIEW_LOG_BUTTON_TEXT_PROPERTY));
    sendLogButton.setText(component.getProperty(SEND_LOG_BUTTON_TEXT_PROPERTY));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:48,代码来源:PostCreateBundleSummaryPanel.java

示例7: initialize

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
protected void initialize() {
    final Registry registry = Registry.getInstance();
    final List<Product> successfulInstall = registry.getProducts(INSTALLED_SUCCESSFULLY);
    final List<Product> warningInstall = registry.getProducts(INSTALLED_WITH_WARNINGS);
    final List<Product> errorInstall = registry.getProducts(FAILED_TO_INSTALL);

    final List<Product> successfulUninstall = registry.getProducts(UNINSTALLED_SUCCESSFULLY);
    final List<Product> warningUninstall = registry.getProducts(UNINSTALLED_WITH_WARNINGS);
    final List<Product> errorUninstall = registry.getProducts(FAILED_TO_UNINSTALL);

    if (errorInstall.size() > 0) {
        messagePaneInstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_ERRORS_PROPERTY));
        messagePaneInstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_ERRORS_PROPERTY),
                errorInstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else if (warningInstall.size() > 0) {
        messagePaneInstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_WARNINGS_PROPERTY));
        messagePaneInstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_WARNINGS_PROPERTY),
                warningInstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else if (successfulInstall.size() > 0) {
        messagePaneInstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_SUCCESS_PROPERTY));
        messagePaneInstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_SUCCESS_PROPERTY),
                successfulInstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else {
        messagePaneInstall.setVisible(false);
    }

    messagePaneFinish.setVisible(true);
    messagePaneFinish.setContentType(DEFAULT_MESSAGE_FINISH_PROCESS_CONTENT_TYPE);
    messagePaneFinish.setText(DEFAULT_MESSAGE_FINISH_PROCESS);

    if (errorUninstall.size() > 0) {
        messagePaneUninstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_ERRORS_UNINSTALL_PROPERTY));
        messagePaneUninstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_ERRORS_UNINSTALL_PROPERTY),
                errorUninstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else if (warningUninstall.size() > 0) {
        messagePaneUninstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_WARNINGS_UNINSTALL_PROPERTY));
        messagePaneUninstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_WARNINGS_UNINSTALL_PROPERTY),
                warningUninstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else if (successfulUninstall.size() > 0) {
        messagePaneUninstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_SUCCESS_UNINSTALL_PROPERTY));
        messagePaneUninstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_SUCCESS_UNINSTALL_PROPERTY),
                successfulUninstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else {
        messagePaneUninstall.setVisible(false);
    }

    

    final List<Product> products = new LinkedList<Product>();
    products.addAll(successfulInstall);
    products.addAll(warningInstall);
    runAppNow.setSelected(false);
    if (!products.isEmpty()) {
        runAppNow.setText(StringUtils.format(DEFAULT_MESSAGE_LAUNCH_APPLICATION_NOW,
                products.get(0).getDisplayName()));
        runAppNow.doClick();
        app = products.get(0);
    } else {                
        runAppNow.setVisible(false);
    }


}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:76,代码来源:PostInstallSummaryPanel.java

示例8: initialize

import org.netbeans.installer.product.Registry; //导入方法依赖的package包/类
protected void initialize() {
    final Registry registry = Registry.getInstance();
    final List<Product> successfulInstall = registry.getProducts(INSTALLED_SUCCESSFULLY);
    final List<Product> warningInstall = registry.getProducts(INSTALLED_WITH_WARNINGS);
    final List<Product> errorInstall = registry.getProducts(FAILED_TO_INSTALL);

    final List<Product> successfulUninstall = registry.getProducts(UNINSTALLED_SUCCESSFULLY);
    final List<Product> warningUninstall = registry.getProducts(UNINSTALLED_WITH_WARNINGS);
    final List<Product> errorUninstall = registry.getProducts(FAILED_TO_UNINSTALL);

    if (errorInstall.size() > 0) {
        messagePaneInstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_ERRORS_PROPERTY));
        messagePaneInstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_ERRORS_PROPERTY),
                errorInstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else if (warningInstall.size() > 0) {
        messagePaneInstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_WARNINGS_PROPERTY));
        messagePaneInstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_WARNINGS_PROPERTY),
                warningInstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else if (successfulInstall.size() > 0) {
        messagePaneInstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_SUCCESS_PROPERTY));
        messagePaneInstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_SUCCESS_PROPERTY),
                successfulInstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else {
        messagePaneInstall.setVisible(false);
    }

    messagePaneFinish.setVisible(true);
    messagePaneFinish.setContentType(DEFAULT_MESSAGE_FINISH_PROCESS_CONTENT_TYPE);
    messagePaneFinish.setText(DEFAULT_MESSAGE_FINISH_PROCESS);

    if (errorUninstall.size() > 0) {
        messagePaneUninstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_ERRORS_UNINSTALL_PROPERTY));
        messagePaneUninstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_ERRORS_UNINSTALL_PROPERTY),
                errorUninstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else if (warningUninstall.size() > 0) {
        messagePaneUninstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_WARNINGS_UNINSTALL_PROPERTY));
        messagePaneUninstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_WARNINGS_UNINSTALL_PROPERTY),
                warningUninstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else if (successfulUninstall.size() > 0) {
        messagePaneUninstall.setContentType(component.getProperty(MESSAGE_CONTENT_TYPE_SUCCESS_UNINSTALL_PROPERTY));
        messagePaneUninstall.setText(StringUtils.format(
                component.getProperty(MESSAGE_TEXT_SUCCESS_UNINSTALL_PROPERTY),
                successfulUninstall.get(0).getDisplayName(),
                LogManager.getLogFile()));
    } else {
        messagePaneUninstall.setVisible(false);
    }

    

    final List<Product> products = new LinkedList<Product>();
    products.addAll(successfulInstall);
    products.addAll(warningInstall);
    /* normen: remove app start
    runAppNow.setSelected(false);
    if (!products.isEmpty()) {
        runAppNow.setText(StringUtils.format(DEFAULT_MESSAGE_LAUNCH_APPLICATION_NOW,
                products.get(0).getDisplayName()));
        runAppNow.doClick();
        app = products.get(0);
    } else {                
        runAppNow.setVisible(false);
    }
    */


}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:78,代码来源:PostInstallSummaryPanel.java


注:本文中的org.netbeans.installer.product.Registry.getProducts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。