src/main/java/net/wasdev/wlp/common/plugins/util/InstallFeatureUtil.java
@SuppressWarnings("unchecked")
    public void installFeatures(boolean isAcceptLicense, List<String> featuresToInstall) throws PluginExecutionException {
        List<File> jsonRepos = new ArrayList<File>(downloadedJsons);
        debug("JSON repos: " + jsonRepos);
        info("Installing features: " + featuresToInstall);
        
        // override license acceptance if installing only Open Liberty features
        boolean acceptLicenseMapValue = isOnlyOpenLibertyFeatures(featuresToInstall) ? true : isAcceptLicense;

        try {
            Map<String, Object> mapBasedInstallKernel = createMapBasedInstallKernelInstance(installDirectory);
            mapBasedInstallKernel.put("install.local.esa", true);
            mapBasedInstallKernel.put("single.json.file", jsonRepos);
            mapBasedInstallKernel.put("features.to.resolve", featuresToInstall);
            mapBasedInstallKernel.put("license.accept", acceptLicenseMapValue);

            if (isDebugEnabled()) {
                mapBasedInstallKernel.put("debug", Level.FINEST);
            }

            Collection<?> resolvedFeatures = (Collection<?>) mapBasedInstallKernel.get("action.result");
            if (resolvedFeatures == null) {
                debug("action.exception.stacktrace: "+mapBasedInstallKernel.get("action.exception.stacktrace"));
                String exceptionMessage = (String) mapBasedInstallKernel.get("action.error.message");
                throw new PluginExecutionException(exceptionMessage);
            } else if (resolvedFeatures.isEmpty()) {
                debug("action.exception.stacktrace: "+mapBasedInstallKernel.get("action.exception.stacktrace"));
                String exceptionMessage = (String) mapBasedInstallKernel.get("action.error.message");
                if (exceptionMessage == null) {
                    debug("resolvedFeatures was empty but the install kernel did not issue any messages");
                    info("The features are already installed, so no action is needed.");
                    return;
                } else if (exceptionMessage.contains("CWWKF1250I")) {
                    info(exceptionMessage);
                    info("The features are already installed, so no action is needed.");
                    return;
                } else {
                    throw new PluginExecutionException(exceptionMessage);
                }
            }
            Collection<File> artifacts = downloadEsas(resolvedFeatures);

            StringBuilder installedFeaturesBuilder = new StringBuilder();
            Collection<String> actionReturnResult = new ArrayList<String>();
            for (File esaFile: artifacts ){
                mapBasedInstallKernel.put("license.accept", acceptLicenseMapValue);
                mapBasedInstallKernel.put("action.install", esaFile);
                if (to != null) {
                    mapBasedInstallKernel.put("to.extension", to);
                    debug("Installing to extension: " + to);
                }
                Integer ac = (Integer) mapBasedInstallKernel.get("action.result");
                debug("action.result: "+ac);
                debug("action.error.message: "+mapBasedInstallKernel.get("action.error.message"));
                if (mapBasedInstallKernel.get("action.error.message") != null) {
                    debug("action.exception.stacktrace: "+mapBasedInstallKernel.get("action.exception.stacktrace"));
                    String exceptionMessage = (String) mapBasedInstallKernel.get("action.error.message");
                    debug(exceptionMessage);
                    throw new PluginExecutionException(exceptionMessage);
                } else if (mapBasedInstallKernel.get("action.install.result") != null) {
                    actionReturnResult.addAll((Collection<String>) mapBasedInstallKernel.get("action.install.result"));
                }
            }
            for (String installResult : actionReturnResult) {
                installedFeaturesBuilder.append(installResult).append(" ");
            }
            productInfoValidate();
            info("The following features have been installed: " + installedFeaturesBuilder.toString());
        } catch (PrivilegedActionException e) {
            throw new PluginExecutionException("Could not load the jar " + installJarFile.getAbsolutePath(), e);
        }
    }
@SuppressWarnings("unchecked")
    public void installFeatures(boolean isAcceptLicense, List<String> featuresToInstall) throws PluginExecutionException {
        List<File> jsonRepos = new ArrayList<File>(downloadedJsons);
        debug("JSON repos: " + jsonRepos);
        info("Installing features: " + featuresToInstall);
        
        // override license acceptance if installing only Open Liberty features
        boolean acceptLicenseMapValue = isOnlyOpenLibertyFeatures(featuresToInstall) ? true : isAcceptLicense;

        try {
            Map<String, Object> mapBasedInstallKernel = createMapBasedInstallKernelInstance(installDirectory);
            mapBasedInstallKernel.put("install.local.esa", true);
            mapBasedInstallKernel.put("single.json.file", jsonRepos);
            mapBasedInstallKernel.put("features.to.resolve", featuresToInstall);
            mapBasedInstallKernel.put("license.accept", acceptLicenseMapValue);

            if (isDebugEnabled()) {
                mapBasedInstallKernel.put("debug", Level.FINEST);
            }

            Collection<?> resolvedFeatures = (Collection<?>) mapBasedInstallKernel.get("action.result");
            if (resolvedFeatures == null) {
                debug("action.exception.stacktrace: "+mapBasedInstallKernel.get("action.exception.stacktrace"));
                String exceptionMessage = (String) mapBasedInstallKernel.get("action.error.message");
                throw new PluginExecutionException(exceptionMessage);
            } else if (resolvedFeatures.isEmpty()) {
                debug("action.exception.stacktrace: "+mapBasedInstallKernel.get("action.exception.stacktrace"));
                String exceptionMessage = (String) mapBasedInstallKernel.get("action.error.message");
                if (exceptionMessage == null) {
                    debug("resolvedFeatures was empty but the install kernel did not issue any messages");
                    info("The features are already installed, so no action is needed.");
                    return;
                } else if (exceptionMessage.contains("CWWKF1250I")) {
                    info(exceptionMessage);
                    info("The features are already installed, so no action is needed.");
                    return;
                } else {
                    throw new PluginExecutionException(exceptionMessage);
                }
            }
            Collection<File> artifacts = downloadEsas(resolvedFeatures);

            StringBuilder installedFeaturesBuilder = new StringBuilder();
            Collection<String> actionReturnResult = new ArrayList<String>();
            for (File esaFile: artifacts ){
                mapBasedInstallKernel.put("license.accept", acceptLicenseMapValue);
                mapBasedInstallKernel.put("action.install", esaFile);
                if (to != null) {
                    mapBasedInstallKernel.put("to.extension", to);
                    debug("Installing to extension: " + to);
                }
                Integer ac = (Integer) mapBasedInstallKernel.get("action.result");
                debug("action.result: "+ac);
                debug("action.error.message: "+mapBasedInstallKernel.get("action.error.message"));
                if (mapBasedInstallKernel.get("action.error.message") != null) {
                    debug("action.exception.stacktrace: "+mapBasedInstallKernel.get("action.exception.stacktrace"));
                    String exceptionMessage = (String) mapBasedInstallKernel.get("action.error.message");
                    debug(exceptionMessage);
                    throw new PluginExecutionException(exceptionMessage);
                } else if (mapBasedInstallKernel.get("action.install.result") != null) {
                    actionReturnResult.addAll((Collection<String>) mapBasedInstallKernel.get("action.install.result"));
                }
            }
            for (String installResult : actionReturnResult) {
                installedFeaturesBuilder.append(installResult).append(" ");
            }
            productInfoValidate();
            info("The following features have been installed: " + installedFeaturesBuilder.toString());
        } catch (PrivilegedActionException e) {
            throw new PluginExecutionException("Could not load the jar " + installJarFile.getAbsolutePath(), e);
        }
    }
@ SuppressWarnings ( "unchecked" ) public void installFeatures ( boolean isAcceptLicense , List < String > featuresToInstall ) throws PluginExecutionException { List < File > jsonRepos = new ArrayList < File > ( downloadedJsons ) ; debug ( "JSON repos: " + jsonRepos ) ; info ( "Installing features: " + featuresToInstall ) ; // override license acceptance if installing only Open Liberty features boolean acceptLicenseMapValue = isOnlyOpenLibertyFeatures ( featuresToInstall ) ? true : isAcceptLicense ; try { Map < String , Object > mapBasedInstallKernel = createMapBasedInstallKernelInstance ( installDirectory ) ; mapBasedInstallKernel . put ( "install.local.esa" , true ) ; mapBasedInstallKernel . put ( "single.json.file" , jsonRepos ) ; mapBasedInstallKernel . put ( "features.to.resolve" , featuresToInstall ) ; mapBasedInstallKernel . put ( "license.accept" , acceptLicenseMapValue ) ; if ( isDebugEnabled ( ) ) { mapBasedInstallKernel . put ( "debug" , Level . FINEST ) ; } Collection < ? > resolvedFeatures = ( Collection < ? > ) mapBasedInstallKernel . get ( "action.result" ) ; if ( resolvedFeatures == null ) { debug ( "action.exception.stacktrace: " + mapBasedInstallKernel . get ( "action.exception.stacktrace" ) ) ; String exceptionMessage = ( String ) mapBasedInstallKernel . get ( "action.error.message" ) ; throw new PluginExecutionException ( exceptionMessage ) ; } else if ( resolvedFeatures . isEmpty ( ) ) { debug ( "action.exception.stacktrace: " + mapBasedInstallKernel . get ( "action.exception.stacktrace" ) ) ; String exceptionMessage = ( String ) mapBasedInstallKernel . get ( "action.error.message" ) ; if ( exceptionMessage == null ) { debug ( "resolvedFeatures was empty but the install kernel did not issue any messages" ) ; info ( "The features are already installed, so no action is needed." ) ; return ; } else if ( exceptionMessage . contains ( "CWWKF1250I" ) ) { info ( exceptionMessage ) ; info ( "The features are already installed, so no action is needed." ) ; return ; } else { throw new PluginExecutionException ( exceptionMessage ) ; } } Collection < File > artifacts = downloadEsas ( resolvedFeatures ) ; StringBuilder installedFeaturesBuilder = new StringBuilder ( ) ; Collection < String > actionReturnResult = new ArrayList < String > ( ) ; for ( File esaFile : artifacts ) { mapBasedInstallKernel . put ( "license.accept" , acceptLicenseMapValue ) ; mapBasedInstallKernel . put ( "action.install" , esaFile ) ; if ( to != null ) { mapBasedInstallKernel . put ( "to.extension" , to ) ; debug ( "Installing to extension: " + to ) ; } Integer ac = ( Integer ) mapBasedInstallKernel . get ( "action.result" ) ; debug ( "action.result: " + ac ) ; debug ( "action.error.message: " + mapBasedInstallKernel . get ( "action.error.message" ) ) ; if ( mapBasedInstallKernel . get ( "action.error.message" ) != null ) { debug ( "action.exception.stacktrace: " + mapBasedInstallKernel . get ( "action.exception.stacktrace" ) ) ; String exceptionMessage = ( String ) mapBasedInstallKernel . get ( "action.error.message" ) ; debug ( exceptionMessage ) ; throw new PluginExecutionException ( exceptionMessage ) ; } else if ( mapBasedInstallKernel . get ( "action.install.result" ) != null ) { actionReturnResult . addAll ( ( Collection < String > ) mapBasedInstallKernel . get ( "action.install.result" ) ) ; } } for ( String installResult : actionReturnResult ) { installedFeaturesBuilder . append ( installResult ) . append ( " " ) ; } productInfoValidate ( ) ; info ( "The following features have been installed: " + installedFeaturesBuilder . toString ( ) ) ; } catch ( PrivilegedActionException e ) { throw new PluginExecutionException ( "Could not load the jar " + installJarFile . getAbsolutePath ( ) , e ) ; } }
Resolve, download, and install features from a Maven repository. This
method calls the resolver with the given JSONs and feature list,
downloads the ESAs corresponding to the resolved features, then installs
those features.

@param jsonRepos
JSON files, each containing an array of metadata for all
features in a Liberty release.
@param featuresToInstall
The list of features to install.
@throws PluginExecutionException
if any of the features could not be installed
Resolve download and install features from a Maven repository . This method calls the resolver with the given JSONs and feature list downloads the ESAs corresponding to the resolved features then installs those features .