text:
package org.ovirt.engine.ui.uicommonweb.models.vms;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.ovirt.engine.core.common.action.ChangeDiskCommandParameters;
import org.ovirt.engine.core.common.action.HibernateVmParameters;
import org.ovirt.engine.core.common.action.RunVmParams;
import org.ovirt.engine.core.common.action.SetVmTicketParameters;
import org.ovirt.engine.core.common.action.ShutdownVmParameters;
import org.ovirt.engine.core.common.action.VdcActionParametersBase;
import org.ovirt.engine.core.common.action.VdcActionType;
import org.ovirt.engine.core.common.action.VdcReturnValueBase;
import org.ovirt.engine.core.common.action.VmOperationParameterBase;
import org.ovirt.engine.core.common.businessentities.DisplayType;
import org.ovirt.engine.core.common.businessentities.RepoFileMetaData;
import org.ovirt.engine.core.common.businessentities.UsbPolicy;
import org.ovirt.engine.core.common.businessentities.VDS;
import org.ovirt.engine.core.common.businessentities.VM;
import org.ovirt.engine.core.common.businessentities.VMStatus;
import org.ovirt.engine.core.common.businessentities.storage_domains;
import org.ovirt.engine.core.common.config.Config;
import org.ovirt.engine.core.common.queries.ConfigurationValues;
import org.ovirt.engine.core.common.queries.GetAllImagesListByStoragePoolIdParameters;
import org.ovirt.engine.core.common.queries.GetConfigurationValueParameters;
import org.ovirt.engine.core.common.queries.GetVdsByVdsIdParameters;
import org.ovirt.engine.core.common.queries.VdcQueryParametersBase;
import org.ovirt.engine.core.common.queries.VdcQueryReturnValue;
import org.ovirt.engine.core.common.queries.VdcQueryType;
import org.ovirt.engine.core.common.queries.VdsIdParametersBase;
import org.ovirt.engine.core.compat.Event;
import org.ovirt.engine.core.compat.EventArgs;
import org.ovirt.engine.core.compat.EventDefinition;
import org.ovirt.engine.core.compat.StringHelper;
import org.ovirt.engine.ui.frontend.AsyncQuery;
import org.ovirt.engine.ui.frontend.Frontend;
import org.ovirt.engine.ui.frontend.INewAsyncCallback;
import org.ovirt.engine.ui.uicommonweb.DataProvider;
import org.ovirt.engine.ui.uicommonweb.TypeResolver;
import org.ovirt.engine.ui.uicommonweb.UICommand;
import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider;
import org.ovirt.engine.ui.uicompat.ConstantsManager;
import org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult;
import org.ovirt.engine.ui.uicompat.FrontendMultipleQueryAsyncResult;
import org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback;
import org.ovirt.engine.ui.uicompat.IFrontendMultipleQueryAsyncCallback;

public class SpiceConsoleModel extends ConsoleModel implements IFrontendMultipleQueryAsyncCallback
{

    public static EventDefinition SpiceDisconnectedEventDefinition;
    public static EventDefinition SpiceConnectedEventDefinition;
    public static EventDefinition SpiceMenuItemSelectedEventDefinition;
    public static EventDefinition UsbAutoShareChangedEventDefinition;
    public static EventDefinition wanColorDepthChangedEventDefinition;
    public static EventDefinition wanDisableEffectsChangeEventDefinition;

    private SpiceMenu menu;
    private ISpice privatespice;

    public ISpice getspice()
    {
        return privatespice;
    }

    public void setspice(ISpice value)
    {
        privatespice = value;
    }

    static
    {
        SpiceDisconnectedEventDefinition = new EventDefinition("SpiceDisconnected", SpiceConsoleModel.class); //$NON-NLS-1$
        SpiceConnectedEventDefinition = new EventDefinition("SpiceConnected", SpiceConsoleModel.class); //$NON-NLS-1$
        SpiceMenuItemSelectedEventDefinition = new EventDefinition("SpiceMenuItemSelected", SpiceConsoleModel.class); //$NON-NLS-1$
        UsbAutoShareChangedEventDefinition = new EventDefinition("UsbAutoShareChanged", SpiceConsoleModel.class); //$NON-NLS-1$
        wanColorDepthChangedEventDefinition = new EventDefinition("ColorDepthChanged", SpiceConsoleModel.class); //$NON-NLS-1$
        wanDisableEffectsChangeEventDefinition = new EventDefinition("DisableEffectsChange", SpiceConsoleModel.class); //$NON-NLS-1$
    }

    public SpiceConsoleModel()
    {
        setTitle(ConstantsManager.getInstance().getConstants().spiceTitle());

        setspice((ISpice) TypeResolver.getInstance().Resolve(ISpice.class));

        configureSpice();

        getspice().getConnectedEvent().addListener(this);
    }

    private void configureSpice() {
        getConfigurator().Configure(getspice());
    }

    @Override
    protected void Connect()
    {
        if (getEntity() != null)
        {
            getLogger().Debug("Connecting to Spice console..."); //$NON-NLS-1$
            if (!getspice().getIsInstalled())
            {
                getLogger().Info("Spice client is not installed."); //$NON-NLS-1$
                getspice().Install();
                return;
            }

            // Check a spice version.
            if (getConfigurator().getIsAdmin()
                    && getspice().getCurrentVersion().compareTo(getspice().getDesiredVersion()) < 0)
            {
                getLogger().Info("Spice client version is not as desired (" + getspice().getDesiredVersion() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
                getspice().Install();
                return;
            }

            // Don't connect if there VM is not running on any host.
            if (getEntity().getrun_on_vds() == null)
            {
                return;
            }

            // If it is not windows or SPICE guest agent is not installed, make sure the WAN options are disabled.
            if (!getEntity().getvm_os().isWindows() || getEntity().getSpiceDriverVersion() == null) {
                getspice().setIsWanOptionsEnabled(false);
            }

            SendVmTicket();
        }
    }

    @Override
    public void eventRaised(Event ev, Object sender, EventArgs args)
    {
        super.eventRaised(ev, sender, args);

        if (ev.equals(getspice().getDisconnectedEvent()))
        {
            Spice_Disconnected(sender, (ErrorCodeEventArgs) args);
        }
        else if (ev.equals(getspice().getConnectedEvent()))
        {
            Spice_Connected(sender);
        }
        else if (ev.equals(getspice().getMenuItemSelectedEvent()))
        {
            Spice_MenuItemSelected(sender, (SpiceMenuItemEventArgs) args);
        }
    }

    private void Spice_MenuItemSelected(Object sender, SpiceMenuItemEventArgs e)
    {
        if (getEntity() != null)
        {
            // SpiceMenuCommandItem item = menu.Descendants()
            // .OfType<SpiceMenuCommandItem>()
            // .FirstOrDefault(a => a.Id == e.MenuItemId);
            SpiceMenuCommandItem item = null;
            for (SpiceMenuItem a : menu.Descendants())
            {
                if (a.getClass() == SpiceMenuCommandItem.class && a.getId() == e.getMenuItemId())
                {
                    item = (SpiceMenuCommandItem) a;
                    break;
                }
            }
            if (item != null)
            {
                if (StringHelper.stringsEqual(item.getCommandName(), CommandPlay))
                {
                    // use sysprep iff the vm is not initialized and vm has Win OS
                    boolean reinitialize =
                            !getEntity().getis_initialized() && DataProvider.IsWindowsOsType(getEntity().getvm_os());
                    RunVmParams tempVar = new RunVmParams(getEntity().getId());
                    tempVar.setRunAsStateless(getEntity().getis_stateless());
                    tempVar.setReinitialize(reinitialize);
                    Frontend.RunMultipleAction(VdcActionType.RunVm,
                            new ArrayList<VdcActionParametersBase>(Arrays.asList(new VdcActionParametersBase[] { tempVar })));

                }
                else if (StringHelper.stringsEqual(item.getCommandName(), CommandSuspend))
                {
                    Frontend.RunMultipleAction(VdcActionType.HibernateVm,
                            new ArrayList<VdcActionParametersBase>(Arrays.asList(new VdcActionParametersBase[] { new HibernateVmParameters(getEntity().getId()) })));

                }
                else if (StringHelper.stringsEqual(item.getCommandName(), CommandStop))
                {
                    Frontend.RunMultipleAction(VdcActionType.ShutdownVm,
                            new ArrayList<VdcActionParametersBase>(Arrays.asList(new VdcActionParametersBase[] { new ShutdownVmParameters(getEntity().getId(),
                                    true) })));

                }
                else if (StringHelper.stringsEqual(item.getCommandName(), CommandChangeCD))
                {
                    Frontend.RunMultipleAction(VdcActionType.ChangeDisk,
                            new ArrayList<VdcActionParametersBase>(Arrays.asList(new VdcActionParametersBase[] { new ChangeDiskCommandParameters(getEntity().getId(),
                                    StringHelper.stringsEqual(item.getText(), EjectLabel) ? "" : item.getText()) }))); //$NON-NLS-1$
                }
            }
        }
    }

    private void Spice_Disconnected(Object sender, ErrorCodeEventArgs e)
    {
        getspice().getDisconnectedEvent().removeListener(this);
        getspice().getMenuItemSelectedEvent().removeListener(this);

        setIsConnected(false);
        UpdateActionAvailability();

        if (e.getErrorCode() > 100)
        {
            getErrorEvent().raise(this, e);
        }
    }

    private void Spice_Connected(Object sender)
    {
        setIsConnected(true);
        UpdateActionAvailability();
    }

    private void Cancel()
    {
        setWindow(null);
    }

    @Override
    public void ExecuteCommand(UICommand command)
    {
        super.ExecuteCommand(command);

        if (StringHelper.stringsEqual(command.getName(), "Cancel")) //$NON-NLS-1$
        {
            Cancel();
        }
    }

    @Override
    protected void UpdateActionAvailability()
    {
        super.UpdateActionAvailability();

        getConnectCommand().setIsExecutionAllowed(getConfigurator().IsDisplayTypeSupported(DisplayType.qxl)
                && !getIsConnected() && getEntity() != null && getEntity().getdisplay_type() != DisplayType.vnc
                && IsVmConnectReady());
    }

    private void ExecuteQuery(final VM vm)
    {
        AsyncQuery _asyncQuery0 = new AsyncQuery();
        _asyncQuery0.setModel(this);

        _asyncQuery0.asyncCallback = new INewAsyncCallback() {
            @Override
            public void OnSuccess(Object model0, Object result0)
            {
                SpiceConsoleModel thisSpiceConsoleModel = (SpiceConsoleModel) model0;
                VM thisVm = thisSpiceConsoleModel.getEntity();

                storage_domains isoDomain = null;
                if (result0 != null)
                {
                    isoDomain = (storage_domains) result0;
                }

                ArrayList<VdcQueryType> queryTypeList = new ArrayList<VdcQueryType>();
                queryTypeList.add(VdcQueryType.GetVdsByVdsId);
                queryTypeList.add(VdcQueryType.GetConfigurationValue);
                queryTypeList.add(VdcQueryType.GetConfigurationValue);
                queryTypeList.add(VdcQueryType.GetConfigurationValue);
                queryTypeList.add(VdcQueryType.GetConfigurationValue);
                queryTypeList.add(VdcQueryType.GetVdsCertificateSubjectByVdsId);
                queryTypeList.add(VdcQueryType.GetCACertificate);
                queryTypeList.add(VdcQueryType.GetConfigurationValue);
                queryTypeList.add(VdcQueryType.GetConfigurationValue);

                ArrayList<VdcQueryParametersBase> parametersList =
                        new ArrayList<VdcQueryParametersBase>();
                parametersList.add(new GetVdsByVdsIdParameters(thisVm.getrun_on_vds().getValue()));
                parametersList.add(new GetConfigurationValueParameters(ConfigurationValues.SSLEnabled, Config.DefaultConfigurationVersion));
                parametersList.add(new GetConfigurationValueParameters(ConfigurationValues.CipherSuite, Config.DefaultConfigurationVersion));
                parametersList.add(new GetConfigurationValueParameters(ConfigurationValues.SpiceSecureChannels,
                        thisVm.getvds_group_compatibility_version().toString()));
                parametersList.add(new GetConfigurationValueParameters(ConfigurationValues.EnableSpiceRootCertificateValidation, Config.DefaultConfigurationVersion));
                parametersList.add(new GetVdsByVdsIdParameters(thisVm.getrun_on_vds().getValue()));
                parametersList.add(new VdcQueryParametersBase());
                parametersList.add(new GetConfigurationValueParameters(ConfigurationValues.SpiceToggleFullScreenKeys, Config.DefaultConfigurationVersion));
                parametersList.add(new GetConfigurationValueParameters(ConfigurationValues.SpiceReleaseCursorKeys, Config.DefaultConfigurationVersion));

                if (isoDomain != null)
                {
                    queryTypeList.add(VdcQueryType.GetAllIsoImagesListByStoragePoolId);

                    GetAllImagesListByStoragePoolIdParameters getIsoPamams =
                            new GetAllImagesListByStoragePoolIdParameters(vm.getstorage_pool_id());
                    parametersList.add(getIsoPamams);
                }

                Frontend.RunMultipleQueries(queryTypeList, parametersList, thisSpiceConsoleModel);
            }
        };

        AsyncDataProvider.GetIsoDomainByDataCenterId(_asyncQuery0, vm.getstorage_pool_id());
    }

    private String ticket;

    @Override
    public void Executed(FrontendMultipleQueryAsyncResult result)
    {
        List<VdcQueryReturnValue> returnValues = result.getReturnValues();

        boolean success = true;
        for (VdcQueryReturnValue returnValue : returnValues)
        {
            if (!returnValue.getSucceeded())
            {
                success = false;
                break;
            }
        }

        if (!success)
        {
            boolean enableSpiceRootCertificateValidation = (Boolean) result.getReturnValues().get(4).getReturnValue();
            VdcQueryReturnValue caCertificateReturnValue = result.getReturnValues().get(6);

            // If only the caCertificate query failed - ignore failure (goto OnSuccess)
            if (!caCertificateReturnValue.getSucceeded() && !enableSpiceRootCertificateValidation)
            {
                // Verify that all queries (except caCertificate) succeeded
                // If succeeded goto 'OnSuccess'; Otherwise, 'OnFailure'.
                for (VdcQueryReturnValue returnValue : returnValues)
                {
                    if (!returnValue.getSucceeded() && returnValue != caCertificateReturnValue)
                    {
                        return;
                    }
                }
            }
        }

        String cipherSuite = null;
        String spiceSecureChannels = null;

        boolean isSSLEnabled = (Boolean) returnValues.get(1).getReturnValue();
        if (isSSLEnabled)
        {
            cipherSuite = (String) returnValues.get(2).getReturnValue();
            spiceSecureChannels = (String) returnValues.get(3).getReturnValue();
        }

        String certificateSubject = ""; //$NON-NLS-1$
        String caCertificate = ""; //$NON-NLS-1$

        if ((Boolean) returnValues.get(4).getReturnValue())
        {
            certificateSubject = (String) returnValues.get(5).getReturnValue();
            caCertificate = (String) returnValues.get(6).getReturnValue();
        }

        getspice().setHost(getEntity().getdisplay_ip());
        getspice().setPort((getEntity().getdisplay() == null ? 0 : getEntity().getdisplay()));
        getspice().setPassword(ticket);
        getspice().setNumberOfMonitors(getEntity().getnum_of_monitors());
        getspice().setGuestHostName(getEntity().getvm_host().split("[ ]", -1)[0]); //$NON-NLS-1$
        if (getEntity().getdisplay_secure_port() != null)
        {
            getspice().setSecurePort(getEntity().getdisplay_secure_port());
        }
        if (!StringHelper.isNullOrEmpty(spiceSecureChannels))
        {
            getspice().setSslChanels(spiceSecureChannels);
        }
        if (!StringHelper.isNullOrEmpty(cipherSuite))
        {
            getspice().setCipherSuite(cipherSuite);
        }

        getspice().setHostSubject(certificateSubject);
        getspice().setTrustStore(caCertificate);

        String toggleFullScreenKeys = (String) returnValues.get(7).getReturnValue();
        String releaseCursorKeys = (String) returnValues.get(8).getReturnValue();
        String ctrlAltDel = "ctrl+alt+del"; //$NON-NLS-1$
        String ctrlAltEnd = "ctrl+alt+end"; //$NON-NLS-1$

        String toggleFullScreenKeysTranslated =
                DataProvider.GetComplexValueFromSpiceRedKeysResource((toggleFullScreenKeys != null) ? toggleFullScreenKeys
                        : "shift+f11"); //$NON-NLS-1$
        String releaseCursorKeysTranslated =
                DataProvider.GetComplexValueFromSpiceRedKeysResource((releaseCursorKeys != null) ? releaseCursorKeys
                        : "shift+f12"); //$NON-NLS-1$
        String ctrlAltDelTranslated = DataProvider.GetComplexValueFromSpiceRedKeysResource(ctrlAltDel);
        String ctrlAltEndTranslated = DataProvider.GetComplexValueFromSpiceRedKeysResource(ctrlAltEnd);

        getspice().setTitle(getEntity().getvm_name()
                + ":%d" //$NON-NLS-1$
                + (StringHelper.isNullOrEmpty(releaseCursorKeysTranslated) ? "" : (" - " + //$NON-NLS-1$ //$NON-NLS-2$
                        ConstantsManager.getInstance()
                                .getMessages()
                                .pressKeyToReleaseCursor(releaseCursorKeysTranslated))));

        // If 'AdminConsole' is true, send true; otherwise, false should be sent only for VMs with SPICE driver
        // installed.
        getspice().setAdminConsole(getConfigurator().getSpiceAdminConsole() ? true
                : getEntity().getSpiceDriverVersion() != null ? false : true);

        // Update 'UsbListenPort' value
        getspice().setUsbListenPort(getConfigurator().getIsUsbEnabled()
                && getEntity().getusb_policy() == UsbPolicy.ENABLED_LEGACY ? getConfigurator().getSpiceDefaultUsbPort()
                : getConfigurator().getSpiceDisableUsbListenPort());

        // At lease one of the hot-keys is not empty -> send it to SPICE:
        if (!StringHelper.isNullOrEmpty(releaseCursorKeys) || !StringHelper.isNullOrEmpty(toggleFullScreenKeys))
        {
            String comma =
                    (!StringHelper.isNullOrEmpty(releaseCursorKeys) && !StringHelper.isNullOrEmpty(toggleFullScreenKeys)) ? "," //$NON-NLS-1$
                            : ""; //$NON-NLS-1$

            String releaseCursorKeysParameter =
                    StringHelper.isNullOrEmpty(releaseCursorKeys) ? "" : "release-cursor=" + releaseCursorKeys; //$NON-NLS-1$ //$NON-NLS-2$

            String toggleFullScreenKeysParameter =
                    StringHelper.isNullOrEmpty(toggleFullScreenKeys) ? "" : "toggle-fullscreen=" + toggleFullScreenKeys; //$NON-NLS-1$ //$NON-NLS-2$

            getspice().setHotKey(releaseCursorKeysParameter + comma + toggleFullScreenKeysParameter);
        }

        getspice().setLocalizedStrings(new String[] {
                ConstantsManager.getInstance().getConstants().usb(),
                ConstantsManager.getInstance()
                        .getConstants()
                        .usbDevicesNoUsbdevicesClientSpiceUsbRedirectorNotInstalled() });

        // Create menu.
        int id = 1;
        menu = new SpiceMenu();

        menu.getItems().add(new SpiceMenuCommandItem(ID_SYS_MENU_SEND_CTRL_ALT_DEL, ConstantsManager.getInstance()
                .getConstants()
                .send()
                + " " + ctrlAltDelTranslated //$NON-NLS-1$
                + "\t" + ctrlAltEndTranslated, "")); //$NON-NLS-1$ //$NON-NLS-2$
        menu.getItems().add(new SpiceMenuCommandItem(ID_SYS_MENU_TOGGLE_FULL_SCREEN, ConstantsManager.getInstance()
                .getConstants()
                .toggleFullScreen()
                + "\t" //$NON-NLS-1$
                + toggleFullScreenKeysTranslated, "")); //$NON-NLS-1$

        SpiceMenuContainerItem specialKes =
                new SpiceMenuContainerItem(id, ConstantsManager.getInstance().getConstants().specialKeys());
        menu.getItems().add(specialKes);

        specialKes.getItems().add(new SpiceMenuCommandItem(ID_SYS_MENU_SEND_SHIFT_F11,
                toggleFullScreenKeysTranslated, "")); //$NON-NLS-1$
        specialKes.getItems()
                .add(new SpiceMenuCommandItem(ID_SYS_MENU_SEND_SHIFT_F12, releaseCursorKeysTranslated, "")); //$NON-NLS-1$
        specialKes.getItems().add(new SpiceMenuCommandItem(ID_SYS_MENU_SEND_CTRL_ALT_END,
                ctrlAltEndTranslated, "")); //$NON-NLS-1$
        menu.getItems().add(new SpiceMenuSeparatorItem(id));
        id++;

        SpiceMenuContainerItem changeCDItem =
                new SpiceMenuContainerItem(id, ConstantsManager.getInstance().getConstants().changeCd());
        id++;

        ArrayList<String> isos = new ArrayList<String>();

        if (returnValues.size() > 9)
        {
            ArrayList<RepoFileMetaData> repoList =
                    (ArrayList<RepoFileMetaData>) returnValues.get(9).getReturnValue();
            for (RepoFileMetaData RepoFileMetaData : repoList)
            {
                isos.add(RepoFileMetaData.getRepoFileName());
            }
        }

        isos =
                isos.size() > 0 ? isos
                        : new ArrayList<String>(Arrays.asList(new String[] { ConstantsManager.getInstance()
                                .getConstants()
                                .noCds() }));

        Collections.sort(isos);

        for (String fileName : isos)
        {
            changeCDItem.getItems().add(new SpiceMenuCommandItem(id, fileName, CommandChangeCD));
            id++;
        }
        changeCDItem.getItems().add(new SpiceMenuCommandItem(id, EjectLabel, CommandChangeCD));
        id++;

        menu.getItems().add(changeCDItem);
        menu.getItems().add(new SpiceMenuSeparatorItem(id));
        id++;
        menu.getItems().add(new SpiceMenuCommandItem(id, ConstantsManager.getInstance()
                .getConstants()
                .playSpiceConsole(), CommandPlay));
        id++;
        menu.getItems().add(new SpiceMenuCommandItem(id, ConstantsManager.getInstance()
                .getConstants()
                .suspendSpiceConsole(), CommandSuspend));
        id++;
        menu.getItems().add(new SpiceMenuCommandItem(id, ConstantsManager.getInstance()
                .getConstants()
                .stopSpiceConsole(), CommandStop));

        getspice().setMenu(menu.toString());

        getspice().setGuestID(getEntity().getId().toString());

        // Subscribe to events.
        getspice().getDisconnectedEvent().addListener(this);
        getspice().getMenuItemSelectedEvent().addListener(this);

        if (StringHelper.isNullOrEmpty(getEntity().getdisplay_ip())
                || StringHelper.stringsEqual(getEntity().getdisplay_ip(), "0")) //$NON-NLS-1$
        {
            determineIpAndConnect((VDS) returnValues.get(0).getReturnValue());
        }
        else
        {
            // Try to connect.
            SpiceConnect();
        }
    }

    private void determineIpAndConnect(VDS host) {
        if (host == null) {
            return;
        }

        AsyncQuery _asyncQuery = new AsyncQuery();
        _asyncQuery.setModel(this);
        _asyncQuery.asyncCallback = new INewAsyncCallback() {
            @Override
            public void OnSuccess(Object model, Object ReturnValue)
            {
                SpiceConsoleModel spiceConsoleModel = (SpiceConsoleModel) model;
                String address =
                        (String) ((VdcQueryReturnValue) ReturnValue).getReturnValue();
                spiceConsoleModel.getspice().setHost(address);
                spiceConsoleModel.SpiceConnect();
            }
        };

        Frontend.RunQuery(VdcQueryType.GetManagementInterfaceAddressByVdsId,
                new VdsIdParametersBase(host.getId()),
                _asyncQuery);
    }

    private void SendVmTicket()
    {
        // Create ticket for single sign on.
        Frontend.RunAction(VdcActionType.SetVmTicket, new SetVmTicketParameters(getEntity().getId(), null, 120),
                new IFrontendActionAsyncCallback() {
                    @Override
                    public void Executed(FrontendActionAsyncResult result) {

                        SpiceConsoleModel model = (SpiceConsoleModel) result.getState();
                        model.PostSendVmTicket(result.getReturnValue());

                    }
                }, this);
    }

    public void PostSendVmTicket(VdcReturnValueBase returnValue)
    {
        if (returnValue == null || !returnValue.getSucceeded())
        {
            return;
        }

        ticket = (String) returnValue.getActionReturnValue();

        // Only if the VM has agent and we connect through user-portal
        // we attempt to perform SSO (otherwise an error will be thrown)
        if (!getConfigurator().getIsAdmin() && getEntity().getGuestAgentVersion() != null
                && getEntity().getstatus() == VMStatus.Up)
        {
            getLogger().Info("SpiceConsoleManager::Connect: Attempting to perform SSO on Desktop " //$NON-NLS-1$
                    + getEntity().getvm_name());

            Frontend.RunAction(VdcActionType.VmLogon, new VmOperationParameterBase(getEntity().getId()),
                    new IFrontendActionAsyncCallback() {
                        @Override
                        public void Executed(FrontendActionAsyncResult result) {

                            SpiceConsoleModel model = (SpiceConsoleModel) result.getState();
                            VdcReturnValueBase returnValue1 = result.getReturnValue();
                            boolean success1 = returnValue1 != null && returnValue1.getSucceeded();
                            if (success1)
                            {
                                model.ExecuteQuery(getEntity());
                            }
                            else
                            {
                                String vmName = returnValue1 != null ? returnValue1.getDescription() : ""; //$NON-NLS-1$
                                model.getLogger()
                                        .Info("SpiceConsoleManager::Connect: Failed to perform SSO on Destkop " //$NON-NLS-1$
                                                + vmName + " continuing without SSO."); //$NON-NLS-1$
                            }

                        }
                    },
                    this);
        }
        else
        {
            ExecuteQuery(getEntity());
        }
    }

    public void SpiceConnect()
    {
        try
        {
            getspice().Connect();
        } catch (RuntimeException ex)
        {
            getLogger().Error("Exception on Spice connect", ex); //$NON-NLS-1$
        }
    }

    private static final String CommandStop = "Stop"; //$NON-NLS-1$
    private static final String CommandPlay = "Play"; //$NON-NLS-1$
    private static final String CommandSuspend = "Suspend"; //$NON-NLS-1$
    private static final String CommandChangeCD = "ChangeCD"; //$NON-NLS-1$

    private static final int ID_SYS_MENU_DISCONNECT = 0x1200;
    private static final int ID_SYS_MENU_SEND_CTRL_ALT_DEL = 0x1300;
    private static final int ID_SYS_MENU_TOGGLE_FULL_SCREEN = 0x1400;
    private static final int ID_SYS_MENU_SEND_SHIFT_F11 = 0x1500;
    private static final int ID_SYS_MENU_SEND_SHIFT_F12 = 0x1600;
    private static final int ID_SYS_MENU_SEND_CTRL_ALT_END = 0x1700;
    private static final int ID_SYS_MENU_USB_DEVICES = 0x1800;
}


Has Lyft capitalized on this yet?
It feels like it was just a couple years ago that our parents rang our cell phones to ask if we'd heard of this new thing called "Uber," and just months since they began pronouncing it right. And yet Martha Stewart only took her first Uber on Monday. "My very first Uber!" she wrote on Instagram. It's a cheery start to a tale of woe that Stewart hasn't known since her poncho-knitting days.
CORRECTION: This article previously stated Arianna Huffington once filled a board seat at Uber. She is still on the Uber board.


ILP members may borrow materials from the MIT Libraries through the ILP Interlibrary Loan service.
Materials will be delivered to the ILP company site via FedEx.
Items can be borrowed for up to 28 days.
ILP members are eligible for a 10% discount on PDF delivery of journal articles or conference papers from the MIT Libraries collections.
Request an article or conference paper.
The Online Computer Library Center (OCLC) is a cooperative library organization which includes the MIT Libraries and more than 160 other research libraries.
OCLC has a program which provides faculty members on-site access and borrowing privileges at member libraries.
Please contact Document Services in advance to enroll for library privileges.
Document Services is open by appointment only, between the hours of 9am-5pm, Monday-Friday.


text:
DONALD TRUMP'S Touching Gesture After Rally Caught On Video
By Patty McMurray | May 29, 2016
The Americans who've lost a loved one to an illegal alien are all but forgotten. You hear nothing from the main stream media about all of the crimes committed by people who come to America illegally.
Donald Trump has taken a special interest in the Americans who're part of The Remembrance Project.
It's a group dedicated to remembering their lost loved ones by doing what they can to prevent anyone else from having to go through what they have. We've had this group on our radar for some time now and highly recommend whatever support you could give them.
Can you imagine knowing your loved one would be alive had it not been for our lax border controls? Well, Donald Trump recognizes this and knows we need to do whatever we can to stop this.
Cell phone footage captured at Wednesday's campaign rally shows Donald Trump's touching and spontaneous interaction with a group of mothers who attended the rally and who lost their children to illegal alien violence.
The footage shows Trump kissing and signing posters of the mothers' deceased children after his rally in Anaheim, California.
Sabine Durden—whose 30-year-old son Dominic was murdered by an illegal alien who was driving without a license and who had two prior DUI charges—said that she "lost it" when Trump kissed her son's poster.
"It came from his heart," Durden said. "We were not in front of a big audience. He was on his way out of the building and we were off to the side… It was such a touching, and very genuine and tender moment and it shows what a kind, gentle and very caring man he is."
The footage also revealed the pandemonium after a Trump rally—with fans reaching over and around each other as Secret Service desperately tries to maintain control of the chaotic situation. It is in this context that Trump, despite the pressure to continue moving forward, stopped and interacted with the families.
The affectionate gesture draws a sharp contrast with the growing chaos outside the arena—where protesters were waving foreign flags, chanting obscenities, and violently confronting law enforcement. The irony is that these children are dead specifically because law enforcement was not allowed to do its job.
"He's our last hope for our country to ever recover," Durden said of Trump's candidacy.
Read more: Breitbart
22-Yr-Old Woman Accused Of Stealing Nancy Pelosi's Laptop Is On The Run…Former Boyfriend Claims She Wanted To Sell It to Russians
ANTI-COMPETITIVE PRACTICES: "We Are Going To Have To Figure out The OAN NEWSMAX Problem" CNN Says Conservative Groups Are "Like Isis", Calls On Cable Providers To Ban Conservative News Networks [VIDEO]

redpajama_set_name: RedPajamaCommonCrawl


"Remember, an idea is like a seed -- it can only turn into a tree if you kill all the birds that are trying to eat it."
I don't get it. What's a mom stick?
A parody of those stupid, useless but expensive products that companies try to convince first time moms that they need to buy, otherwise their kid will end up all screwed up.
Kind of like this one. That's a "Mom Stick", right there.
Ah. Yeah, that particular product seems pretty silly.
All those "learn while you sleep" deals use the gimjmick above.
life insurance for infants, purchased after being convinced by a sales agent that it's an investment, and their kid will probably never be able to go to college unless they purchase a policy now, that they can borrow against later.
"Miracle" blankets that cost $40+ each and don't do anything a $10 3-pack of receiving blankets can't do.
I love that quote there!
The saddest thing about The Onion is that far too often their jokes become reality. This one? I'm willing to bet that we'll see something similar in a few years.
her tone is genius, lol!!!
at first i thought mom stick meant something else. something QUITE else.
Warning loud auto playing video at link - Do not click if it's like almost midnight and your wife is sleeping in the next room after working a 12 hour shift.


text:
Govt rejects higher pay demand for about 100,000 personnel, upsets Army
Ex-info commissioner alleges legal intimidation of CIC by government
Countdown starts for the launch of GSAT-11 satellite that will boost net
It was initially planned for launch on May 25 and was rescheduled by ISRO, citing the need for additional technical checks
T E Narasimhan | Chennai Last Updated at December 4, 2018 16:53 IST
https://mybs.in/2VsDgOY
The countdown for the launch of GSAT-11, the heaviest satellite built by Indian space agency Isro, has commenced. The countdown began at 13:14 (IST) for the launch of GSAT-11 on-board Ariane-5 VA246 from Kourou Launch Zone, French Guiana, on Tuesday.
The launch is scheduled at 02:07 (IST) on December 5, 2018. The 5,854-kg satellite, almost double the biggest one built or launched by Isro to date, will be launched on European launch vehicle Ariane 5 ECA. The heavy-lift Ariane-5 vehicle would carry GEO-KOMPSAT-2A for the Korea Aerospace Research Institute (KARI), along with ...
First Published: Tue, December 04 2018. 16:53 IST
Gsat-11


text:
Core (IPA: /ˈkɔɹ/)
Core (n.)
A body of individuals; an assemblage.
A miner's underground working time or shift.
A Hebrew dry measure; a cor or homer.
The heart or inner part of a thing, as of a column, wall, rope, of a boil, etc.; especially, the central part of fruit, containing the kernels or seeds; as, the core of an apple or quince.
The center or inner part, as of an open space; as, the core of a square.
The most important part of a thing; the essence; as, the core of a subject.
The prtion of a mold which shapes the interior of a cylinder, tube, or other hollow casting, or which makes a hole in or through a casting; a part of the mold, made separate from and inserted in it, for shaping some part of the casting, the form of which is not determined by that of the pattern.
A disorder of sheep occasioned by worms in the liver.
The bony process which forms the central axis of the horns in many animals.
Core (v. t.)
To take out the core or inward parts of; as, to core an apple.
To form by means of a core, as a hole in a casting.
Core of a rope or cable
Term in game theory
Type of normal subgroup in group theory
Anatomy term for the body minus the limbs
Graph whose only homomorphisms are isomorphisms
Core Synonyms
Synonyms: []}
Congress Of Racial Equality, CORE
Gist, Essence, Effect, Burden
Meat, Sum, Heart And Soul, Center, Inwardness, Gist, Pith, Nub, Nitty-gritty, Heart, Essence, Marrow, Kernel, Substance
Nucleus, Core Group
Core (Last Name / Surname)
Core is the #8,631 most common last name / surname from the 2010 United States Census. The census reported that 3,810 people had that surname.
Core in Spanish
" 253. At the core of all well-founded belief, lies belief that is unfounded." - Ludwig Wittgenstein
" Believing hath a core of unbelieving." - Robert Williams Buchanan
"D.M.C .:Â I'm hard to the core Wicked and raw" - The Beavis and Butt-head Experience
"I am Conservative to the core of my being, as those who know me best will testify." - David Cameron
" Karol: Every single core in the world!" - Tales of Vesperia
Click for Synonyms of core on WikiThesaurus
Check domain name registration of core.com on NameReports