コード例 #1
0
        /// <summary>
        /// All tasks will call on this method to connect to StarTeam and open the view for processing.
        /// </summary>
        /// <returns>the a view to be used for processing.</returns>
        /// <seealso cref="createSnapshotView"/>
        protected internal virtual InterOpStarTeam.StView openView()
        {
            InterOpStarTeam.StStarTeamFinderStatics starTeamFinder = new InterOpStarTeam.StStarTeamFinderStatics();
            InterOpStarTeam.StView view = starTeamFinder.openView(this.url);

            if (null == view)
            {
                throw new BuildException("Cannot find view" + this.url + " in repository()", Location);
            }

            InterOpStarTeam.StView snapshot = createSnapshotView(view);
            _server = snapshot.Server;
            return(snapshot);
        }
コード例 #2
0
        /// <summary>
        /// Does the work of opening the supplied Starteam view and calling
        /// the <see cref="visit"/> method setting the pattern in motion to perform the task.
        /// </summary>
        protected override void ExecuteTask()
        {
            _filesAffected = 0;
            testPreconditions();

            InterOpStarTeam.StView snapshot = openView();
            try {
                InterOpStarTeam.StStarTeamFinderStatics starTeamFinder = new InterOpStarTeam.StStarTeamFinderStatics();
                InterOpStarTeam.StFolder starTeamRootFolder            = starTeamFinder.findFolder(snapshot.RootFolder, _rootStarTeamFolder);

                // set the local folder.
                FileInfo localrootfolder;

                if (null == starTeamRootFolder)
                {
                    throw new BuildException("Unable to find root folder in repository.", Location);
                }
                if (null == _rootLocalFolder)
                {
                    // use Star Team's default
                    try {
                        localrootfolder = new FileInfo(starTeamRootFolder.Path);
                    }
                    catch (Exception e) {
                        throw new BuildException(string.Format("Could not get handle to root folder ({0}) found.", starTeamRootFolder.Path), Location, e);
                    }
                }
                else
                {
                    // force StarTeam to use our folder
                    try {
                        Log(Level.Info, "Overriding local folder to '{0}'", _rootLocalFolder);
                        localrootfolder = new FileInfo(_rootLocalFolder);
                    } catch (Exception e) {
                        throw new BuildException(string.Format("Could not get handle to root folder '{0}'.",
                                                               starTeamRootFolder.Path), Location, e);
                    }
                }

                // Inspect everything in the root folder and then recursively
                visit(starTeamRootFolder, localrootfolder);
                Log(Level.Info, "{0} files affected", _filesAffected.ToString());
            } catch (System.Exception e) {
                throw new BuildException(e.Message, Location, e);
            }
        }
コード例 #3
0
ファイル: StarTeamTask.cs プロジェクト: kiprainey/nantcontrib
        /// <summary>
        /// All tasks will call on this method to connect to StarTeam and open the view for processing.  
        /// </summary>
        /// <returns>the a view to be used for processing.</returns>
        /// <seealso cref="createSnapshotView"/>
        protected internal virtual InterOpStarTeam.StView openView() {
            InterOpStarTeam.StStarTeamFinderStatics starTeamFinder = new InterOpStarTeam.StStarTeamFinderStatics();
            InterOpStarTeam.StView view = starTeamFinder.openView(this.url);

            if (null == view) {
                throw new BuildException("Cannot find view" + this.url + " in repository()",Location);
            }

            InterOpStarTeam.StView snapshot = createSnapshotView(view);
            _server = snapshot.Server;
            return snapshot;
        }
コード例 #4
0
        /// <summary>
        /// Does the work of opening the supplied Starteam view and calling 
        /// the <see cref="visit"/> method setting the pattern in motion to perform the task.
        /// </summary>
        protected override void ExecuteTask() {
            _filesAffected = 0;
            testPreconditions();

            InterOpStarTeam.StView snapshot = openView();
            try {
                InterOpStarTeam.StStarTeamFinderStatics starTeamFinder = new InterOpStarTeam.StStarTeamFinderStatics();
                InterOpStarTeam.StFolder starTeamRootFolder = starTeamFinder.findFolder(snapshot.RootFolder, _rootStarTeamFolder);

                // set the local folder.
                FileInfo localrootfolder;

                if (null == starTeamRootFolder) {
                    throw new BuildException("Unable to find root folder in repository.",Location);
                }
                if (null == _rootLocalFolder) {
                    // use Star Team's default
                    try {
                        localrootfolder = new FileInfo(starTeamRootFolder.Path);
                    }
                    catch(Exception e) {
                        throw new BuildException(string.Format("Could not get handle to root folder ({0}) found.",starTeamRootFolder.Path),Location,e);
                    }
                } else {
                    // force StarTeam to use our folder
                    try {
                        Log(Level.Info, "Overriding local folder to '{0}'", _rootLocalFolder);
                        localrootfolder = new FileInfo(_rootLocalFolder);
                    } catch(Exception e) {
                        throw new BuildException(string.Format("Could not get handle to root folder '{0}'.",
                            starTeamRootFolder.Path), Location, e);
                    }
                }

                // Inspect everything in the root folder and then recursively
                visit(starTeamRootFolder, localrootfolder);
                Log(Level.Info, "{0} files affected", _filesAffected.ToString());
            } catch (System.Exception e) {
                throw new BuildException(e.Message, Location, e);
            }
        }