JenkinsTransport.JenkinsProjectManager.Initialize C# (CSharp) Method

Initialize() public method

Sets the Configuration for this server manager
public Initialize ( ThoughtWorks.CruiseControl.CCTrayLib.Configuration.BuildServer server, string projectName, Settings settings ) : void
server ThoughtWorks.CruiseControl.CCTrayLib.Configuration.BuildServer the BuildServer configuration
projectName string the project name
settings Settings the Settings
return void
        public void Initialize(BuildServer server, string projectName, Settings settings)
        {
            Configuration = server;
            ProjectName = projectName;
            Settings = settings;
            AuthorizationInformation = Settings.AuthorizationInformation;

            Api = _jenkinsApiFactory.Create(Settings.Server, AuthorizationInformation, _webRequestFactory);
        }

Same methods

JenkinsProjectManager::Initialize ( ThoughtWorks.CruiseControl.CCTrayLib.Configuration.BuildServer server, string projectName, string settings ) : void

Usage Example

        // This is called once for every project that has been added to the user's CCtray instance
        //  Add each one to an internal property to be used when we get the server manager
        public ICruiseProjectManager RetrieveProjectManager(string projectName)
        {
            var manager = new JenkinsProjectManager(WebRequestFactory, JenkinsApiFactory);

            // Use factory to get reference to singleton ServerManager
            var serverManager = (IJenkinsServerManager)RetrieveServerManager();

            // Add this project to the server manager if it does not exist
            if (!serverManager.ProjectsAndCurrentStatus.ContainsKey(projectName))
            {
                serverManager.ProjectsAndCurrentStatus.Add(projectName, null);
            }

            // If this project does not have a status get it now as we need the WebURL
            if (serverManager.ProjectsAndCurrentStatus[projectName] == null)
            {
                try
                {
                    serverManager.GetCruiseServerSnapshotEx();

                    if (serverManager.ProjectsAndCurrentStatus.ContainsKey(projectName) &&
                        serverManager.ProjectsAndCurrentStatus[projectName] != null &&
                        !String.IsNullOrEmpty(serverManager.ProjectsAndCurrentStatus[projectName].WebURL))
                    {
                        manager.WebURL = new Uri(serverManager.ProjectsAndCurrentStatus[projectName].WebURL);
                    }
                    else
                    {
                        // Really can't support nested jobs without knowning the exact WebURL for the project !!
                    }
                }
                catch (WebException ex)
                {
                    DialogService.Show(ex.Message);
                }
            }

            manager.Initialize(Configuration, projectName, Settings);

            return(manager);
        }
All Usage Examples Of JenkinsTransport.JenkinsProjectManager::Initialize