public void DisplayRefreshSlaveStatus() { //this needs to walk the connections and add all the connected computers. MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); if (commandServer == null) { return; } ArrayList slavesArray = commandServer.GetRegisteredSlaves(); foreach (Object item in slavesArray) { MOG_Command connection = (MOG_Command)item; if (connection.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_None) { // Find item ListViewItem lItem = LocateListViewItem(mainForm.lviewMonitor, connection.GetNetworkID()); if (lItem != null) { if (string.Compare(lItem.SubItems[(int)MONITOR_TABS.INFORMATION].Text, "Idle") != 0) { lItem.SubItems[(int)MONITOR_TABS.INFORMATION].Text = "Idle"; } } } } }
public void GetCommandSnapShot() { // Clear our existing list mainForm.CommandspendingListView.Items.Clear(); // Obtain the server MOG_CommandServerCS server = (MOG_CommandServerCS)(MOG_ControllerSystem.GetCommandManager()); if (server != null) { // Get all the pending commands ArrayList commands = server.GetAllPendingCommands(); foreach (MOG_Command command in commands) { ListViewItem item = new ListViewItem(); item.Text = command.ToString(); item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename()); item.SubItems.Add(command.GetComputerName()); item.SubItems.Add(command.GetComputerIP()); item.SubItems.Add(command.GetNetworkID().ToString()); item.SubItems.Add(command.GetCommandID().ToString()); item.SubItems.Add(command.GetCommandTimeStamp()); item.SubItems.Add(command.GetComputerName()); item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename()); item.ForeColor = Color.Black; item.ImageIndex = GetImageIndex(command.GetCommandType()); item.Name = command.GetCommandID().ToString(); // Add the new item mainForm.CommandspendingListView.Items.Add(item); } } }
public void Initialize() { MOG_CommandServerCS server = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); mainForm.LocksListView.Items.Clear(); ArrayList activeWriteLocks = new ArrayList(server.GetActiveWriteLocks()); foreach (MOG_Command myLock in activeWriteLocks) { ListViewItem item = InitNewLockItem(myLock); if (item != null) { mainForm.LocksListView.Items.Add(item); } } ArrayList activeReadLocks = new ArrayList(server.GetActiveReadLocks()); foreach (MOG_Command myLock in activeReadLocks) { ListViewItem item = InitNewLockItem(myLock); if (item != null) { mainForm.LocksListView.Items.Add(item); } } mainForm.LocksRequestLocksListView.Items.Clear(); }
internal bool ConfirmLicense(MOG_Command pCommand) { bool bLicense = false; // Check if we are a client? MOG_CommandServerCS commandServer = (MOG_CommandServerCS)(MOG_ControllerSystem.GetCommandManager()); if (commandServer != null) { // Check if this client is already registered? if (commandServer.LocateClientByID(pCommand.GetNetworkID()) != null) { // JohnRen - Bummer, we can't check this because they may have just expired and now be legitamately running on the 4 connections // // Now double check the date of this command to ensure it hasn't expired // DateTime commandDate = MOG_Time.GetDateTimeFromTimeStamp(pCommand.GetCommandTimeStamp()); // if (!mTimeBomb.HasExpired(commandDate)) // { // Indicate this client is licensed bLicense = true; // } } else { // Let's try to obtain a license if (CanObtainLicense(pCommand)) { // Indicate this client got a license bLicense = true; } } } return(bLicense); }
public static bool Init_Server(string configFilename, string name) { MOG_Main.SetName(name); // Make sure we have a valid config filename? if (configFilename.Length == 0) { configFilename = MOG_Main.BuildDefaultConfigFile(); } // Check our bootup precautions if (MOG_Main.CheckInitPrecautions(configFilename)) { // Initialize MOG_REPORT for the server MOG_Time time = new MOG_Time(); // MOG is really stable now so I am shutting off the log files so things will run faster // MOG_Prompt.SetMode(MOG_PROMPT_MODE_TYPE.MOG_PROMPT_FILE); MOG_Report.SetLogFileName(String.Concat(Application.StartupPath, "\\Logs\\Server\\Server.", time.FormatString(String.Concat("{Day.2}", "-", "{Month.2}", "-", "{Year.2}", " ", "{Hour.2}", ".", "{Minute.2}", "{ampm}")), ".log")); // Create a new system MOG_CommandServerCS server = new MOG_CommandServerCS(); return(MOG_ControllerSystemCS.InitializeServer(configFilename, server)); } return(false); }
private void RefreshLists() { // get connection lists MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); if (commandServer == null) { return; } this.slaveList = commandServer.GetRegisteredSlaves(); this.clientList = commandServer.GetRegisteredClients(); this.editorList = commandServer.GetRegisteredEditors(); this.serverList = new ArrayList(); // build server's "command" MOG_Command command = new MOG_Command(); command.SetComputerName(MOG_ControllerSystem.GetComputerName()); command.SetComputerIP(MOG_ControllerSystem.GetComputerIP()); command.SetNetworkID(1); command.SetCommandType(0); command.SetDescription(""); this.serverList.Add(command); }
ArrayList GetAllCurrentLicenses() { // Check if we are a client? MOG_CommandServerCS commandServer = (MOG_CommandServerCS)(MOG_ControllerSystem.GetCommandManager()); if (commandServer != null) { return(commandServer.GetRegisteredClients()); } return(null); }
public string GetClientStatusDescription(MOG_Command command) { MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); // Describe the current command of this connection string description = ""; // Check if we have a ProjectName specified? if (command.GetProject().Length > 0) { // Add on our ProjectName description += "PROJECT: " + command.GetProject(); } // Check if we have a ProjectName specified? if (command.GetBranch().Length > 0) { // Add on our ProjectName description += " BRANCH: " + command.GetBranch(); } // Check if we have a UserName specified? if (command.GetUserName().Length > 0) { // Add on our ProjectName description += " USER: "******" TAB: " + viewsCommand.GetTab(); } // Check if we have a Platform specified? if (viewsCommand.GetPlatform().Length > 0) { description += " PLATFORM: " + viewsCommand.GetPlatform(); } // Check if we have a Tab specified? if (viewsCommand.GetUserName().Length > 0) { description += " INBOX: " + viewsCommand.GetUserName(); } } return(description); }
internal MOG_ServerJobManager(MOG_CommandServerCS pServerCommandManager) { mServerCommandManager = pServerCommandManager; mAvailableSlaves = new ArrayList(); mActiveSlaves = new ArrayList(); mRequestedSlaveNames = new ArrayList(); mAutoLaunchedSlaveNames = new ArrayList(); mManagedSlavesMax = 0; mNextNoSlaveReportTime = DateTime.Now; mNextSlaveRequstTime = DateTime.Now; mNextSlaveReleaseTime = DateTime.Now; mActiveJobs = new HybridDictionary(); mJobOrder = new ArrayList(); }
public static bool InitializeServer(string configFilename, MOG_CommandServerCS server) { MOG_ControllerSystem.InitializeSystem(configFilename, server); MOG_System system = MOG_ControllerSystem.GetSystem(); if (system != null) { // Initialize the server mode? MOG_ControllerSystem.SetSystemMode(MOG_SystemMode.MOG_SystemMode_Server); // Recover saved locks from database if (!server.GetDatabaseLocks()) { // Display the broadcasted message MOG_Prompt.PromptMessage("Database Connection Failed", "Unable to recover persistant locks from the database.", Environment.StackTrace); } return(true); } return(false); }
public void DisplayUpdateExistingConnections() { //first let's kill the existing ones. foreach (ListViewItem item in mainForm.lviewMonitor.Items) { mainForm.lviewMonitor.Items.Remove(item); } //this needs to walk the connections and add all the connected computers. MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); if (commandServer == null) { return; } ArrayList slavesArray = new ArrayList(commandServer.GetRegisteredSlaves()); ArrayList clientsArray = new ArrayList(commandServer.GetRegisteredClients()); ArrayList editorsArray = new ArrayList(commandServer.GetRegisteredEditors()); //show the server first. DislayAddConnection(MOG_ControllerSystem.GetComputerName(), MOG_ControllerSystem.GetComputerIP(), 1, 0, ""); foreach (Object item in clientsArray) { MOG_Command connection = (MOG_Command)item; // Describe the current command of this connection string description = FilterDesiredCommand(connection); if (description != null) { DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient, description); } } foreach (Object item in editorsArray) { MOG_Command connection = (MOG_Command)item; // Describe the current command of this connection string description = FilterDesiredCommand(connection); if (description != null) { DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor, description); } } foreach (Object item in slavesArray) { MOG_Command connection = (MOG_Command)item; string description; // Check if this Slave is actively assigned anything? MOG_Command workingCommand = connection.GetCommand(); if (workingCommand == null) { // Describe the current command of this connection description = FilterDesiredCommand(connection); } else { // Describe the current command of this connection's command description = FilterDesiredCommand(workingCommand); } if (description != null) { DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave, description); } } }
public string FilterDesiredCommand(MOG_Command command) { MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); // Describe the current command of this connection string description = ""; // Check if this command was assigned to a slave? MOG_Command slave; if (command.GetAssignedSlaveID() != 0) { // Attempt to find the registered slave associated with this command? slave = commandServer.LocateRegisteredSlaveByID(command.GetAssignedSlaveID()); } else { // Attempt to find the registered slave associated with this command? slave = commandServer.LocateRegisteredSlaveByID(command.GetNetworkID()); } // Check if we found a matching slave? if (slave != null) { // Update the status of this slave based on the command info switch (command.GetCommandType()) { // Reset the description to Idle? case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewUpdate: case MOG_COMMAND_TYPE.MOG_COMMAND_Complete: case MOG_COMMAND_TYPE.MOG_COMMAND_Postpone: case MOG_COMMAND_TYPE.MOG_COMMAND_Failed: // Always revert the slave into "Idle"... description = "Idle"; break; default: // Build the generic command description description = GetGenericCommandDescription(command); break; } // Since we know this was assigned to a slave, return what ever description we generated return(description); } // Attempt to find the registered editor by this command's computer name? MOG_Command editor = commandServer.LocateAssociatedEditorByClientID(command.GetNetworkID()); if (editor != null) { switch (command.GetCommandType()) { // Only allow the Following commands to build a unique description case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageRebuild: // Build the generic command description description = GetGenericCommandDescription(command); break; default: // Always revert the editor into "Idle"... description = "Idle"; break; } // Since we know this was assigned to ab editor, return what ever description we generated return(description); } // Attempt to find the registered client associated with this command? MOG_Command client = commandServer.LocateClientByID(command.GetNetworkID()); if (client != null) { // Use the RegisteredClient as the command so we get the standard description... description = GetClientStatusDescription(client); return(description); } // Always default everything to "Idle"... description = "Idle"; return(description); }
bool CanObtainLicense(MOG_Command pCommand) { bool bLicense = false; // Get our server command manager? MOG_CommandServerCS commandServer = (MOG_CommandServerCS)(MOG_ControllerSystem.GetCommandManager()); if (commandServer != null) { // This client is not accounted for, check the license file to see if he can fit into the current situation if (EnsureValidLicense()) { // We have a license file if (!mTimeBomb.IsValidMacAddress()) { //The Mac address is bad String message = String.Concat("This MOG Server's machine hasn't been properly licensed.\n", "You will be limited to 2 client connections.\n", "Contact Mogware to transfer this license."); MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message); commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast); } else { // Since the Mac address is ok, what about the expiration? DateTime commandDate = MOG_Time.GetDateTimeFromTimeStamp(pCommand.GetCommandTimeStamp()); if (mTimeBomb.HasExpired() || mTimeBomb.HasExpired(commandDate)) { //Oh man this license file is expired String message = String.Concat("The MOG Server has been unable to renew the MOG License.\n", "You will be limited to 2 client connections.\n", "Please make sure the MOG Server machine has internet access."); MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message); commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast); } // Check if we are going to expire soon? else if (mTimeBomb.WillExpireSoon()) { // Inform the user of our impending doom String message = String.Concat("The MOG Server has been unable to renew the MOG License.\n", "EXPIRATION DATE: ", mTimeBomb.GetExpireDate().ToString(), "\n", "Please make sure the MOG Server machine has internet access."); MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message); commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast); } } } else { // There is no license file at all String message = String.Concat("You're using an unlicensed server.\n", "You will be limited to 2 client connections.\n", "Licensing can be performed in the ServerManager."); MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message); commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast); } // Call this to see if any more clients can be licensed if (IsLicenseAvailable()) { bLicense = true; } else { // Notify client of failed command request string message = String.Concat("No more available licenses on the server.\n\n", "This client cannot be launched until another client is closed.\n", "Additional seats can be licensed in the ServerManager."); MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message); commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast); } } return(bLicense); }
public string GetDetailedCommandDescription(MOG_Command command) { MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); // Describe the current command of this connection string description = ""; // Check if this command is a MOG_COMMAND_RegisterClient? // Check if this command is a MOG_COMMAND_RegisterEditor? switch (command.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_LoginProject: case MOG_COMMAND_TYPE.MOG_COMMAND_LoginUser: case MOG_COMMAND_TYPE.MOG_COMMAND_ActiveViews: // Indicate the LoginProject if (command.GetProject() != null && command.GetProject().Length > 0) { if (description.Length > 0) { description = String.Concat(description, ", "); } description = String.Concat(description, command.GetProject()); } // Indicate the LoginUser if (command.GetUserName() != null && command.GetUserName().Length > 0) { if (description.Length > 0) { description = String.Concat(description, ", "); } description = String.Concat(description, command.GetUserName()); } // Attempt to locate the current view settings for this client MOG_Command viewsCommand = commandServer.LocateActiveViewByID(command.GetNetworkID()); if (viewsCommand != null) { // Attempt to show the ActiveTab if (viewsCommand.GetTab() != null && viewsCommand.GetTab().Length > 0) { if (description.Length > 0) { description = String.Concat(description, ", "); } description = String.Concat(description, viewsCommand.GetTab()); } // Attempt to show the ActivePlatform if (viewsCommand.GetPlatform() != null && viewsCommand.GetPlatform().Length > 0) { if (description.Length > 0) { description = String.Concat(description, ", "); } description = String.Concat(description, viewsCommand.GetPlatform()); } // Attempt to show the ActiveUser if (viewsCommand.GetUserName() != null && viewsCommand.GetUserName().Length > 0) { if (description.Length > 0) { description = String.Concat(description, ", "); } description = String.Concat(description, viewsCommand.GetUserName()); } } return(description); } description = command.ToString(); // If there is an Asset associated with the command?, show it as well if (command.GetAssetFilename().GetFilename().Length != 0) { if (command.GetAssetFilename().GetUserName().Length > 0) { description = String.Concat(description, " for ", command.GetAssetFilename().GetUserName()); if (command.GetAssetFilename().GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_SlaveTask) { string temp; int start, len; temp = command.GetAssetFilename().GetPath(); start = command.GetAssetFilename().GetBoxPath().Length + 1; len = temp.LastIndexOf("\\") - start; if (start > 0 && len != -1) { temp = temp.Substring(start, len); description = String.Concat(description, " - ", temp); } } else { description = String.Concat(description, " - ", command.GetAssetFilename().GetFilename()); } } } return(description); }
public string FilterDesiredCommand(MOG_Command command) { MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); bool match = false; // Describe the current command of this connection string description = ""; // Since we haven't found our match yet, keep looking... if (!match) { MOG_Command slave; // Check if this command was assigned to a slave? if (command.GetAssignedSlaveID() != 0) { // Attempt to find the registered slave associated with this command? slave = commandServer.LocateRegisteredSlaveByID(command.GetAssignedSlaveID()); } else { // Attempt to find the registered slave associated with this command? slave = commandServer.LocateRegisteredSlaveByID(command.GetNetworkID()); } // Check if we found a matching slave? if (slave != null) { switch (command.GetCommandType()) { // Only allow the Following commands to build a unique description case MOG_COMMAND_TYPE.MOG_COMMAND_AssetRipRequest: case MOG_COMMAND_TYPE.MOG_COMMAND_AssetProcessed: case MOG_COMMAND_TYPE.MOG_COMMAND_SlaveTask: case MOG_COMMAND_TYPE.MOG_COMMAND_ReinstanceAssetRevision: case MOG_COMMAND_TYPE.MOG_COMMAND_Bless: case MOG_COMMAND_TYPE.MOG_COMMAND_Post: case MOG_COMMAND_TYPE.MOG_COMMAND_Archive: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_RemoveAssetFromProject: case MOG_COMMAND_TYPE.MOG_COMMAND_BuildFull: case MOG_COMMAND_TYPE.MOG_COMMAND_Build: match = true; break; case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewUpdate: case MOG_COMMAND_TYPE.MOG_COMMAND_Complete: // Always revert the slave into "Idle"... description = "Idle"; return(description); default: // Don't change the existing description... description = "Unknown - " + command.ToString(); return(description); } } } // Since we haven't found our match yet, keep looking... if (!match) { // Attempt to find the registered slave associated with this command? MOG_Command editor = commandServer.LocateAssociatedEditorByClientID(command.GetNetworkID()); if (editor != null) { switch (command.GetCommandType()) { // Only allow the Following commands to build a unique description case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageRebuild: match = true; break; default: // Use the RegisteredClient as the command so we get the standard description... description = GetDetailedCommandDescription(editor); return(description); } } } // Since we haven't found our match yet, keep looking... if (!match) { // Attempt to find the registered client associated with this command? MOG_Command client = commandServer.LocateClientByID(command.GetNetworkID()); if (client != null) { switch (command.GetCommandType()) { // Only allow the Following commands to build a unique description case MOG_COMMAND_TYPE.MOG_COMMAND_AssetRipRequest: case MOG_COMMAND_TYPE.MOG_COMMAND_AssetProcessed: case MOG_COMMAND_TYPE.MOG_COMMAND_SlaveTask: case MOG_COMMAND_TYPE.MOG_COMMAND_ReinstanceAssetRevision: case MOG_COMMAND_TYPE.MOG_COMMAND_Bless: case MOG_COMMAND_TYPE.MOG_COMMAND_Post: case MOG_COMMAND_TYPE.MOG_COMMAND_Archive: case MOG_COMMAND_TYPE.MOG_COMMAND_RemoveAssetFromProject: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageMerge: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageRebuild: case MOG_COMMAND_TYPE.MOG_COMMAND_BuildFull: //case MOG_COMMAND_TYPE.MOG_COMMAND_Build: break; default: // Use the RegisteredClient as the command so we get the standard description... description = GetDetailedCommandDescription(client); return(description); } } } // Use the RegisteredClient as the command so we get the standard description... description = GetDetailedCommandDescription(command); return(description); }