public StartupParams(IAuthProvider provider, IPathManager pathManager, ICustomNodeManager customNodeManager) { this.authProvider = provider; this.pathManager = pathManager; this.customNodeManager = customNodeManager; }
internal PublishModel(IAuthProvider dynamoAuthenticationProvider, ICustomNodeManager dynamoCustomNodeManager) { // Here we throw exceptions if any of the required static fields are not set // This prevents these exceptions from being thrown in the static constructor. if (String.IsNullOrWhiteSpace(serverUrl)) { throw new Exception(Resources.ServerNotFoundMessage); } if (String.IsNullOrWhiteSpace(page)) { throw new Exception(Resources.PageErrorMessage); } if (String.IsNullOrWhiteSpace(managerURL)) { throw new Exception(Resources.ManagerErrorMessage); } authenticationProvider = dynamoAuthenticationProvider; customNodeManager = dynamoCustomNodeManager; serverResponceRegex = new Regex(Resources.WorkspacesSendSucceededServerResponse, RegexOptions.IgnoreCase); State = UploadState.Uninitialized; }
/// <summary> /// Get all of the dependencies from a workspace /// </summary> /// <param name="workspace">The workspace to read the dependencies from</param> /// <param name="customNodeManager">A custom node manager to look up dependencies</param> /// <returns>A WorkspaceDependencies object containing the workspace and its CustomNodeWorkspaceModel dependencies</returns> public static WorkspaceDependencies Collect(HomeWorkspaceModel workspace, ICustomNodeManager customNodeManager) { if (workspace == null) throw new ArgumentNullException("workspace"); if (customNodeManager == null) throw new ArgumentNullException("customNodeManager"); // collect all dependencies var dependencies = new HashSet<CustomNodeDefinition>(); foreach (var node in workspace.Nodes.OfType<Function>()) { dependencies.Add(node.Definition); foreach (var dep in node.Definition.Dependencies) { dependencies.Add(dep); } } var customNodeWorkspaces = new List<ICustomNodeWorkspaceModel>(); foreach (var dependency in dependencies) { ICustomNodeWorkspaceModel customNodeWs; var workspaceExists = customNodeManager.TryGetFunctionWorkspace(dependency.FunctionId, false, out customNodeWs); if (!workspaceExists) { throw new InvalidOperationException(String.Format(Resources.CustomNodeDefinitionNotFoundErrorMessage, dependency.FunctionName)); } if (!customNodeWorkspaces.Contains(customNodeWs)) { customNodeWorkspaces.Add(customNodeWs); } } return new WorkspaceDependencies(workspace, customNodeWorkspaces); }
internal PublishModel(IAuthProvider dynamoAuthenticationProvider, ICustomNodeManager dynamoCustomNodeManager) { // Open the configuration file using the dll location. var config = ConfigurationManager.OpenExeConfiguration(this.GetType().Assembly.Location); // Get the appSettings section. var appSettings = (AppSettingsSection)config.GetSection("appSettings"); serverUrl = appSettings.Settings["ServerUrl"].Value; if (String.IsNullOrWhiteSpace(serverUrl)) { throw new Exception(Resources.ServerNotFoundMessage); } page = appSettings.Settings["Page"].Value; if (String.IsNullOrWhiteSpace(page)) { throw new Exception(Resources.PageErrorMessage); } managerURL = appSettings.Settings["ManagerPage"].Value; if (String.IsNullOrWhiteSpace(managerURL)) { throw new Exception(Resources.ManagerErrorMessage); } authenticationProvider = dynamoAuthenticationProvider; customNodeManager = dynamoCustomNodeManager; serverResponceRegex = new Regex(Resources.WorkspacesSendSucceededServerResponse, RegexOptions.IgnoreCase); State = UploadState.Uninitialized; }
public StartupParams(IAuthProvider provider, IPathManager pathManager, ILibraryLoader libraryLoader, ICustomNodeManager customNodeManager, Version dynamoVersion) { this.authProvider = provider; this.pathManager = pathManager; this.libraryLoader = libraryLoader; this.customNodeManager = customNodeManager; this.dynamoVersion = dynamoVersion; }
/// <summary> /// Initializes a new instance of the <see cref="StartupParams"/> class. /// </summary> /// <param name="provider"><see cref="IAuthProvider"/> for DynamoModel</param> /// <param name="pathManager"><see cref="IPathManager"/> for DynamoModel</param> /// <param name="libraryLoader"><see cref="ILibraryLoader"/> for DynamoModel</param> /// <param name="customNodeManager"><see cref="ICustomNodeManager"/> for DynamoModel</param> /// <param name="dynamoVersion"><see cref="Version"/> for DynamoModel</param> /// <param name="preferences"><see cref="IPreferences"/> for DynamoModel</param> public StartupParams(IPathManager pathManager, ILibraryLoader libraryLoader, ICustomNodeManager customNodeManager, Version dynamoVersion, IPreferences preferences) { this.pathManager = pathManager; this.libraryLoader = libraryLoader; this.customNodeManager = customNodeManager; this.dynamoVersion = dynamoVersion; this.preferences = preferences; }
/// <summary> /// Initializes a new instance of the <see cref="StartupParams"/> class. /// </summary> /// <param name="provider"><see cref="IAuthProvider"/> for DynamoModel</param> /// <param name="pathManager"><see cref="IPathManager"/> for DynamoModel</param> /// <param name="libraryLoader"><see cref="ILibraryLoader"/> for DynamoModel</param> /// <param name="customNodeManager"><see cref="ICustomNodeManager"/> for DynamoModel</param> /// <param name="dynamoVersion"><see cref="Version"/> for DynamoModel</param> /// <param name="preferences"><see cref="IPreferences"/> for DynamoModel</param> /// <param name="linterManager"><see cref="LinterManager"/> for DynamoModel></param> public StartupParams(IAuthProvider provider, IPathManager pathManager, ILibraryLoader libraryLoader, ICustomNodeManager customNodeManager, Version dynamoVersion, IPreferences preferences, LinterManager linterManager) { this.authProvider = provider; this.pathManager = pathManager; this.libraryLoader = libraryLoader; this.customNodeManager = customNodeManager; this.dynamoVersion = dynamoVersion; this.preferences = preferences; this.linterManager = linterManager; }
internal PublishModel(IAuthProvider dynamoAuthenticationProvider, ICustomNodeManager dynamoCustomNodeManager) { // Open the configuration file using the dll location. var config = ConfigurationManager.OpenExeConfiguration(this.GetType().Assembly.Location); // Get the appSettings section. var appSettings = (AppSettingsSection)config.GetSection("appSettings"); serverUrl = appSettings.Settings["ServerUrl"].Value; if (String.IsNullOrWhiteSpace(serverUrl)) throw new Exception(Resource.ServerErrorMessage); port = appSettings.Settings["Port"].Value; if (String.IsNullOrWhiteSpace(port)) throw new Exception(Resource.PortErrorMessage); page = appSettings.Settings["Page"].Value; if (String.IsNullOrWhiteSpace(page)) throw new Exception(Resource.PageErrorMessage); authenticationProvider = dynamoAuthenticationProvider; customNodeManager = dynamoCustomNodeManager; }
internal CustomNodePathRemapper(ICustomNodeManager customNodeManager, bool isTestMode) { this.customNodeManager = customNodeManager; this.isTestMode = isTestMode; }
internal GraphPythonDependencies(IWorkspaceModel workspaceModel, ICustomNodeManager customNodeManager) { this.workspace = workspaceModel; this.customNodeManager = customNodeManager; }
/// <summary> /// This recursive function returns true if any of the custom nodes in the input list has an IronPython dependency. /// Any custom nodes in the input list traversed during evalution have their dependencies cached in <see cref="CustomNodePythonDependencyMap"/>. /// Custom nodes are found to depend on IronPython if the parent custom node or any of its child custom nodes contain an IronPython dependency. /// </summary> /// <param name="customNodes">The custom nodes to evaluate.</param> /// <param name="customNodeManager">The custom node manager.</param> /// <returns>True if any IronPython depencies are found, false otherwise.</returns> private static bool CustomNodesHaveIronPythonDependency(IEnumerable <Function> customNodes, ICustomNodeManager customNodeManager) { var hasIronPythonDependency = false; foreach (var customNode in customNodes) { if (!customNodeManager.TryGetFunctionWorkspace(customNode.FunctionSignature, false, out ICustomNodeWorkspaceModel customNodeWS)) { continue; } // If a custom node workspace is already checked for IronPython dependencies, // check the CustomNodePythonDependency dictionary instead of processing it again. if (CustomNodePythonDependencyMap.TryGetValue(customNodeWS.CustomNodeId, out CNPythonDependencyType dependency)) { if (dependency == CNPythonDependencyType.DirectDependency || dependency == CNPythonDependencyType.NestedDependency) { hasIronPythonDependency = true; } continue; } var hasPythonNodesInCustomNodeWorkspace = customNodeWS.Nodes.Any(n => IsIronPythonNode(n)); if (hasPythonNodesInCustomNodeWorkspace) { CustomNodePythonDependencyMap.Add(customNodeWS.CustomNodeId, CNPythonDependencyType.DirectDependency); hasIronPythonDependency = true; } else { CustomNodePythonDependencyMap.Add(customNodeWS.CustomNodeId, CNPythonDependencyType.NoDependency); } // Recursively check for IronPython dependencies in the nested custom nodes. var nestedCustomNodes = customNodeWS.Nodes.OfType <Function>(); if (nestedCustomNodes.Any()) { hasPythonNodesInCustomNodeWorkspace = CustomNodesHaveIronPythonDependency(nestedCustomNodes, customNodeManager); // If a custom node contains an IronPython dependency in its sub-tree, // update its corresponding value to 'NestedDependency' in CustomNodePythonDependency. if (hasPythonNodesInCustomNodeWorkspace && CustomNodePythonDependencyMap[customNodeWS.CustomNodeId] != CNPythonDependencyType.DirectDependency) { CustomNodePythonDependencyMap[customNodeWS.CustomNodeId] = CNPythonDependencyType.NestedDependency; hasIronPythonDependency = true; } } } return(hasIronPythonDependency); }
internal PublishModel(IAuthProvider provider, ICustomNodeManager manager, IWorkspaceStorageClient client) : this(provider, manager) { reachClient = client; }
internal PublishModel(IAuthProvider dynamoAuthenticationProvider, ICustomNodeManager dynamoCustomNodeManager) { // Here we throw exceptions if any of the required static fields are not set // This prevents these exceptions from being thrown in the static constructor. if (String.IsNullOrWhiteSpace(serverUrl)) throw new Exception(Resources.ServerNotFoundMessage); if (String.IsNullOrWhiteSpace(page)) throw new Exception(Resources.PageErrorMessage); if (String.IsNullOrWhiteSpace(managerURL)) throw new Exception(Resources.ManagerErrorMessage); authenticationProvider = dynamoAuthenticationProvider; customNodeManager = dynamoCustomNodeManager; serverResponceRegex = new Regex(Resources.WorkspacesSendSucceededServerResponse, RegexOptions.IgnoreCase); State = UploadState.Uninitialized; }
/// <summary> /// Get all of the dependencies from a workspace /// </summary> /// <param name="workspace">The workspace to read the dependencies from</param> /// <param name="customNodeManager">A custom node manager to look up dependencies</param> /// <returns>A WorkspaceDependencies object containing the workspace and its CustomNodeWorkspaceModel dependencies</returns> public static WorkspaceDependencies Collect(HomeWorkspaceModel workspace, ICustomNodeManager customNodeManager) { if (workspace == null) { throw new ArgumentNullException("workspace"); } if (customNodeManager == null) { throw new ArgumentNullException("customNodeManager"); } // collect all dependencies var dependencies = new HashSet <CustomNodeDefinition>(); foreach (var node in workspace.Nodes.OfType <Function>()) { dependencies.Add(node.Definition); foreach (var dep in node.Definition.Dependencies) { dependencies.Add(dep); } } var customNodeWorkspaces = new List <ICustomNodeWorkspaceModel>(); foreach (var dependency in dependencies) { ICustomNodeWorkspaceModel customNodeWs; var workspaceExists = customNodeManager.TryGetFunctionWorkspace(dependency.FunctionId, false, out customNodeWs); if (!workspaceExists) { throw new InvalidOperationException(String.Format(Resources.CustomNodeDefinitionNotFoundErrorMessage, dependency.FunctionName)); } if (!customNodeWorkspaces.Contains(customNodeWs)) { customNodeWorkspaces.Add(customNodeWs); } } return(new WorkspaceDependencies(workspace, customNodeWorkspaces)); }
internal PublishModel(IAuthProvider dynamoAuthenticationProvider, ICustomNodeManager dynamoCustomNodeManager) { // Open the configuration file using the dll location. var config = ConfigurationManager.OpenExeConfiguration(this.GetType().Assembly.Location); // Get the appSettings section. var appSettings = (AppSettingsSection)config.GetSection("appSettings"); serverUrl = appSettings.Settings["ServerUrl"].Value; if (String.IsNullOrWhiteSpace(serverUrl)) throw new Exception(Resources.ServerNotFoundMessage); page = appSettings.Settings["Page"].Value; if (String.IsNullOrWhiteSpace(page)) throw new Exception(Resources.PageErrorMessage); managerURL = appSettings.Settings["ManagerPage"].Value; if (String.IsNullOrWhiteSpace(managerURL)) throw new Exception(Resources.ManagerErrorMessage); authenticationProvider = dynamoAuthenticationProvider; customNodeManager = dynamoCustomNodeManager; serverResponceRegex = new Regex(Resources.WorkspacesSendSucceededServerResponse, RegexOptions.IgnoreCase); State = UploadState.Uninitialized; }