@@ -0,0 +1,3275 @@
+package org.ovirt.engine.core.bll.hostdeploy;%0A%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.Collection;%0Aimport java.util.List;%0Aimport java.util.concurrent.Callable;%0A%0Aimport org.apache.commons.lang.StringUtils;%0Aimport org.ovirt.engine.core.common.businessentities.VDS;%0Aimport org.ovirt.otopi.constants.Confirms;%0Aimport org.ovirt.otopi.dialog.Event;%0Aimport org.ovirt.ovirt_host_mgmt.constants.Const;%0Aimport org.ovirt.ovirt_host_mgmt.constants.PackagesEnv;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Apublic class VdsMgmtPackages extends VdsDeployBase %7B%0A%0A    private static final Logger log = LoggerFactory.getLogger(VdsMgmtPackages.class);%0A%0A    private boolean _checkOnly;%0A    private String%5B%5D _packages;%0A    private String%5B%5D _packagesInfo;%0A%0A    private final List%3CCallable%3CBoolean%3E%3E _deployCustomizationDialog = Arrays.asList(%0A        new Callable%3CBoolean%3E() %7B public Boolean call() throws Exception %7B%0A            _parser.cliEnvironmentSet(%0A                PackagesEnv.UPDATE_MODE,%0A                _checkOnly ? Const.PACKAGES_UPDATE_MODE_CHECK_UPDATE : Const.PACKAGES_UPDATE_MODE_UPDATE%0A            );%0A            return true;%0A        %7D%7D,%0A        new Callable%3CBoolean%3E() %7B public Boolean call() throws Exception %7B%0A            _parser.cliEnvironmentSet(%0A                PackagesEnv.PACKAGES,%0A                _packages%0A            );%0A            return true;%0A        %7D%7D%0A    );%0A%0A    // BUG: Arrays.asList() cannot handle single element correctly%0A    private final List%3CCallable%3CBoolean%3E%3E _deployTerminationDialog = new ArrayList%3CCallable%3CBoolean%3E%3E() %7B%7B add(%0A        new Callable%3CBoolean%3E() %7B public Boolean call() throws Exception %7B%0A            _packagesInfo = (String%5B%5D)_parser.cliEnvironmentGet(%0A                PackagesEnv.PACKAGES_INFO%0A            );%0A            if (_packagesInfo.length %3E 0) %7B%0A                _messages.post(%0A                    InstallerMessages.Severity.INFO,%0A                    String.format(%22Available packages for update: %25s%22, StringUtils.join(_packagesInfo, %22,%22))%0A                );%0A            %7D%0A            return true;%0A        %7D%7D%0A    );%7D%7D;%0A%0A    protected boolean processEvent(Event.Base bevent) throws IOException %7B%0A        boolean unknown = true;%0A%0A        if (bevent instanceof Event.Confirm) %7B%0A            Event.Confirm event = (Event.Confirm)bevent;%0A%0A            if (Confirms.GPG_KEY.equals(event.what)) %7B%0A                _messages.post(InstallerMessages.Severity.WARNING, event.description);%0A                event.reply = true;%0A                unknown = false;%0A            %7D%0A        %7D%0A%0A        return unknown;%0A    %7D%0A%0A    public VdsMgmtPackages(VDS vds, boolean checkOnly) %7B%0A        super(%22host-mgmt%22, %22ovirt-host-mgmt%22, vds);%0A%0A        _checkOnly = checkOnly;%0A%0A        addCustomizationDialog(_deployCustomizationDialog);%0A        addCustomizationDialog(CUSTOMIZATION_DIALOG_EPILOG);%0A        addTerminationDialog(TERMINATION_DIALOG_PROLOG);%0A        addTerminationDialog(_deployTerminationDialog);%0A        addTerminationDialog(TERMINATION_DIALOG_EPILOG);%0A    %7D%0A%0A    public void setPackages(Collection%3CString%3E packages) %7B%0A        _packages = packages.toArray(new String%5B0%5D);%0A    %7D%0A%0A    public Collection%3CString%3E getUpdates() %7B%0A        return Arrays.asList(_packagesInfo);%0A    %7D%0A%0A%7D%0A

introduce host package management