/// <summary> /// Creates a new PlanetLab manager node event arguments instance. /// </summary> /// <param name="state">The manager state.</param> /// <param name="node">The PlanetLab node.</param> /// <param name="command">The PlanetLab command.</param> /// <param name="set">The PlanetLab command parameter set.</param> public PlManagerCommandEventArgs(PlManagerState state, PlNode node, PlCommand command, int set) { this.State = state; this.Node = node; this.Command = command; this.Set = set; }
/// <summary> /// Creates a new PlanetLab manager node event arguments instance. /// </summary> /// <param name="state">The manager state.</param> /// <param name="node">The PlanetLab node.</param> /// <param name="command">The PlanetLab command.</param> /// <param name="set">The PlanetLab command parameter set.</param> /// <param name="exception">The command exception.</param> public PlManagerSubcommandEventArgs(PlManagerState state, PlNode node, PlCommand command, int set, Exception exception) { this.State = state; this.Node = node; this.Command = command; this.Set = set; this.Exception = exception; }
/// <summary> /// Creates a new PlanetLab manager node event arguments instance. /// </summary> /// <param name="state">The manager state.</param> /// <param name="node">The PlanetLab node.</param> /// <param name="command">The PlanetLab command.</param> /// <param name="set">The PlanetLab command parameter set.</param> /// <param name="success">The number of successful subcommands.</param> /// <param name="failed">The number of failed subcommands.</param> public PlManagerCommandEventArgs(PlManagerState state, PlNode node, PlCommand command, int set, int success, int failed) { this.State = state; this.Node = node; this.Command = command; this.Set = set; this.Success = success; this.Failed = failed; }
/// <summary> /// Adds the specified PlanetLab node to the pending state. /// </summary> /// <param name="node">The PlanetLab node.</param> internal void AddNode(PlNode node) { lock (this.sync) { // Create a new state for this node. PlManagerNodeState nodeState = new PlManagerNodeState(node); // Add the node to the nodes state list. this.nodeStates.Add(nodeState); // Add the state index to the list of pending nodes. this.pendingNodes.Add(this.nodeStates.Count - 1); } }
/// <summary> /// Creates a new PlanetLab manager node event arguments instance. /// </summary> /// <param name="state">The manager state.</param> /// <param name="node">The PlanetLab node.</param> /// <param name="exception">The exception.</param> public PlManagerNodeEventArgs(PlManagerState state, PlNode node, Exception exception) { this.State = state; this.Node = node; this.Exception = exception; }
/// <summary> /// Creates a new PlanetLab manager node event arguments instance. /// </summary> /// <param name="state">The manager state.</param> /// <param name="node">The PlanetLab node.</param> /// <param name="count">The number of commands to execute on the PlanetLab node.</param> public PlManagerNodeEventArgs(PlManagerState state, PlNode node, int count) { this.State = state; this.Node = node; this.Count = count; }
/// <summary> /// Creates a new PlanetLab manager node event arguments instance. /// </summary> /// <param name="state">The manager state.</param> /// <param name="node">The PlanetLab node.</param> public PlManagerNodeEventArgs(PlManagerState state, PlNode node) { this.State = state; this.Node = node; }
/// <summary> /// A method called when the console state has changed. /// </summary> /// <param name="node">The PlanetLab node.</param> /// <return>The list view item corresponding to the event.</return> private ListViewItem OnConsoleStateChanged(PlNode node) { // Get the list view item corresponding to the node. ListViewItem item = this.listViewNodes.Items.FirstOrDefault((ListViewItem it) => { // Get the node info. NodeInfo info = it.Tag as NodeInfo; // Return if the node info matches the node. return object.ReferenceEquals(info.Node, node); }); // If the item is not null. if (item != null) { // Get the node info. NodeInfo info = item.Tag as NodeInfo; // If the info does not have a console control, do nothing. if (null == info.ConsoleControl) return null; // Update the item status. item.SubItems[2].Text = info.ConsoleControl.State.ToString(); // If there are selected items and the item matches the selected item. if ((this.listViewNodes.SelectedItems.Count > 0) && (item == this.listViewNodes.SelectedItems[0])) { // Change the button enabled state. this.buttonConnect.Enabled = info.ConsoleControl.State == ControlSsh.ClientState.Disconnected; this.buttonDisconnect.Enabled = info.ConsoleControl.State == ControlSsh.ClientState.Connected; this.menuItemConnect.Enabled = info.ConsoleControl.State == ControlSsh.ClientState.Disconnected; this.menuItemDisconnect.Enabled = info.ConsoleControl.State == ControlSsh.ClientState.Connected; } } // Return the item. return item; }
/// <summary> /// Creates a new node info instance for the specified node. /// </summary> /// <param name="nodeId">The node identifier.</param> /// <param name="siteId">The site identifier.</param> /// <param name="node">The PlanetLab node.</param> /// <param name="site">The PlanetLab site.</param> /// <param name="marker">The map marker.</param> public NodeInfo(int nodeId, int? siteId, PlNode node, PlSite site, MapMarker marker) { this.NodeId = nodeId; this.SiteId = siteId; this.Node = node; this.Site = site; this.Marker = marker; }
/// <summary> /// Creates a new node info instance for the specified node. /// </summary> /// <param name="nodeId">The node identifier.</param> /// <param name="siteId">The site identifier.</param> /// <param name="node">The PlanetLab node.</param> /// <param name="site">The PlanetLab site.</param> public NodeInfo(int nodeId, int? siteId, PlNode node, PlSite site) { this.NodeId = nodeId; this.SiteId = siteId; this.Node = node; this.Site = site; }
/// <summary> /// Adds a node to the node list. /// </summary> /// <param name="node">The node.</param> private void OnAddNode(PlNode node) { // Create the list view item. ListViewItem item = new ListViewItem(new string[] { node.Id.HasValue ? node.Id.Value.ToString() : string.Empty, node.Hostname, node.BootState, node.Model, node.Version, node.DateCreated.HasValue ? node.DateCreated.Value.ToString() : string.Empty, node.LastUpdated.HasValue ? node.LastUpdated.Value.ToString() : string.Empty, node.NodeType }); item.ImageKey = ControlNodes.nodeImageKeys[(int)node.GetBootState()]; item.Tag = node; this.listViewNodes.Items.Add(item); // Add the node event handler. node.Changed += this.OnNodeChanged; }
// Public methods. /// <summary> /// Initialized the control with the specified crawler. /// </summary> /// <param name="crawler">The crawler.</param> /// <param name="config">The slice configuration.</param> /// <param name="node">The PlanetLab node.</param> public void Initialize(Crawler crawler, PlConfigSlice config, PlNode node) { // Set the crawler. this.crawler = crawler; // Set the slice configuration. this.config = config; // Set the node. this.node = node; // Set the title. this.panelConsole.Title = "Secure Shell Connection to {0}".FormatWith(node.Hostname); // Set the slice configuration event handlers. this.config.Changed += this.OnConfigurationChanged; this.config.Disposed += this.OnConfigurationChanged; // Set the node event handlers. this.node.Changed += this.OnConfigurationChanged; // Set the node hostname. this.labelHostname.Text = this.node.Hostname; // Get the crawler status. this.status = this.crawler.Status.GetHandler(this); this.status.Send(ApplicationStatus.StatusType.Normal, "Disconnected.", Resources.Server_16); // Enable the control. this.Enabled = true; }