public ICruiseProjectManager Create(CCTrayProject project, IDictionary <BuildServer, ICruiseServerManager> serverManagers)
        {
            BuildServer server = project.BuildServer;

            switch (server.Transport)
            {
            case BuildServerTransport.Remoting:
            {
                var client = GenerateRemotingClient(server);
                return(new RemotingCruiseProjectManager(client, project.ProjectName));
            }

            case BuildServerTransport.Extension:
                ITransportExtension extensionInstance = ExtensionHelpers.RetrieveExtension(server.ExtensionName);
                extensionInstance.Settings      = server.ExtensionSettings;
                extensionInstance.Configuration = server;
                return(extensionInstance.RetrieveProjectManager(project.ProjectName));

            default:
            {
                var client = GenerateHttpClient(server);
                return(new HttpCruiseProjectManager(client, project.ProjectName, serverManagers[server]));
            }
            }
        }
        public bool Login()
        {
            if (configuration.SecurityType != null)
            {
                if (sessionToken != null)
                {
                    Logout();
                }
                IAuthenticationMode authentication = ExtensionHelpers.RetrieveAuthenticationMode(configuration.SecurityType);
                authentication.Settings = configuration.SecuritySettings;

                var request = authentication.GenerateCredentials();
                if (manager.Login(request.Credentials))
                {
                    sessionToken = manager.SessionToken;
                }
                else
                {
                    sessionToken = null;
                }

                return(sessionToken != null);
            }
            else
            {
                return(true);
            }
        }
 public bool Login()
 {
     if (configuration.SecurityType != null)
     {
         Logout();
         IAuthenticationMode authentication = ExtensionHelpers.RetrieveAuthenticationMode(configuration.SecurityType);
         authentication.Settings = configuration.SecuritySettings;
         var isValid = manager.Login(authentication.GenerateCredentials().Credentials);
         return(isValid);
     }
     else
     {
         return(true);
     }
 }
        public ICruiseServerManager Create(BuildServer buildServer)
        {
            switch (buildServer.Transport)
            {
            case BuildServerTransport.Remoting:
            {
                var manager = GenerateRemotingClient(buildServer);
                return(new CachingCruiseServerManager(new RemotingCruiseServerManager(manager, buildServer)));
            }

            case BuildServerTransport.Extension:
                ITransportExtension extensionInstance = ExtensionHelpers.RetrieveExtension(buildServer.ExtensionName);
                extensionInstance.Settings      = buildServer.ExtensionSettings;
                extensionInstance.Configuration = buildServer;
                return(extensionInstance.RetrieveServerManager());

            default:
            {
                var manager = GenerateHttpClient(buildServer);
                return(new CachingCruiseServerManager(
                           new HttpCruiseServerManager(manager, buildServer)));
            }
            }
        }
 public ExtensionTransportProjectListRetriever(string extensionName)
 {
     this.extensionInstance = ExtensionHelpers.RetrieveExtension(extensionName);
 }