Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package hudson.plugins.starteam;
  
  import static java.util.logging.Level.SEVERE;
  import hudson.Extension;
  import hudson.FilePath;
  import hudson.Launcher;
 import hudson.scm.SCM;
 
 import java.io.File;
 
 
StarTeam SCM plugin for Hudson. Add support for change log and synchronization between starteam repository and hudson's workspace. Add support for change log creation. Refactoring to use Extension annotation and to remove use of deprecated API.

Author(s):
Ilkka Laukkanen <ilkka.s.laukkanen@gmail.com>
Steve Favez <sfavez@verisign.com>
 
 public class StarTeamSCM extends SCM {

Singleton descriptor.
 
 
 	private final String user;
 	private final String passwd;
 	private final String projectname;
 	private final String viewname;
 	private final String foldername;
 	private final String hostname;
 	private final int port;
 	private final String labelname;
 	private final boolean promotionstate;
 
 	private final StarTeamViewSelector config;
 	
 	private static final Logger LOGGER = Logger.getLogger(StarTeamSCM.class.getName());

default stapler constructor.

Parameters:
hostname starteam host name.
port starteam port name
projectname name of the project
viewname name of the view
foldername parent folder name.
username the user name required to connect to starteam's server
password password required to connect to starteam's server
labelname label name used for polling view contents
promotionstate indication if label name is actual label name or a promotion state name
 
 	public StarTeamSCM(String hostnameint portString projectname,
 			String viewnameString foldernameString usernameString passwordString labelnameboolean promotionstate) {
 		this. = hostname;
 		this. = port;
 		this. = projectname;
 		this. = viewname;
 		this. = foldername;
 		this. = username;
 		this. = password;
 		this. = labelname;
 		this. = promotionstate;
 		StarTeamViewSelector result = null;
 		if ((this. != null) && (this..length() != 0))
 		{
 			try {
 				if (this.)
				{
					result = new StarTeamViewSelector(this.,"Promotion");
else {
					result = new StarTeamViewSelector(this.,"Label");
				}
catch (ParseException e) {
				result = null;
			}
		}
		this. = result;
	}
	/*
	 * @see hudson.scm.SCM#checkout(hudson.model.AbstractBuild, hudson.Launcher,
	 *      hudson.FilePath, hudson.model.BuildListener, java.io.File)
	 */
	public boolean checkout(AbstractBuild buildLauncher launcher,
	        FilePath workspaceBuildListener listenerFile changelogFile)
	    boolean status = false;
	    //create a FilePath to be able to create changelog file on a remote computer.
	    FilePath changeLogFilePath = new FilePathchangelogFile ) ;
	    // Create an actor to do the checkout, possibly on a remote machine
	            ,
	            changeLogFilePathlistenerbuildworkspace.isRemote());
	    if (workspace.act(co_actor)) {
	        // change log is written during checkout (only one pass for
	        // comparison)
	        status = true;
	    } else {
	        listener.getLogger().println("StarTeam checkout failed");
	        status = false;
	    }
	    return status;
	}
	/*
	 * (non-Javadoc)
	 *
	 * @see hudson.scm.SCM#createChangeLogParser()
	 */
	}
	/*
	 * (non-Javadoc)
	 *
	 * @see hudson.scm.SCM#getDescriptor()
	 */
		return ;
//		return (StarTeamSCMDescriptorImpl)super.getDescriptor();
	}
	/*
	 * (non-Javadoc)
	 *
	 * @see hudson.scm.SCM#pollChanges(hudson.model.AbstractProject,
	 *      hudson.Launcher, hudson.FilePath, hudson.model.TaskListener)
	 */
	public boolean pollChanges(final AbstractProject proj,
			final Launcher launcherfinal FilePath workspace,
			final TaskListener listenerthrows IOException,
		boolean status = false;
		AbstractBuild<?,?> lastBuild = (AbstractBuild<?, ?>) proj.getLastBuild();
		// Create an actor to do the polling, possibly on a remote machine
				listener,
				lastBuild);
		if (workspace.act(p_actor)) {
			status = true;
else {
			listener.getLogger().println("StarTeam polling shows no changes");
		}
		return status;
	}

Descriptor class for the SCM class.

Author(s):
Ilkka Laukkanen <ilkka.s.laukkanen@gmail.com>
	public static final class StarTeamSCMDescriptorImpl extends SCMDescriptor<StarTeamSCM> {
		private final Collection<StarTeamSCMscms = new ArrayList<StarTeamSCM>();
		private static final Logger LOGGER = Logger.getLogger(StarTeamSCMDescriptorImpl.class.getName());
			super(StarTeamSCM.classnull);
			load() ;
		}
		public String getDisplayName() {
			return "StarTeam";
		}
		public SCM newInstance(StaplerRequest reqJSONObject formData)
			// Go ahead and create the scm.. the bindParameters() method
			// takes the request and nabs all "starteam." -prefixed
			// parameters from it, then sets the scm instance's fields
			// according to those parameters.
			StarTeamSCM scm = null;
			try {
				scm = req.bindParameters(StarTeamSCM.class"starteam.");
				.add(scm);
catch (RuntimeException e) {
			    .log(e.getMessage(), e);
			}
			// We don't have working repo browsers yet...
			// scm.repositoryBrowser = RepositoryBrowsers.createInstance(
			// StarTeamRepositoryBrowser.class, req, "starteam.browser");
			return scm;
		}
		/*
		 * (non-Javadoc)
		 * 
		 * @see hudson.model.Descriptor#configure(org.kohsuke.stapler.StaplerRequest)
		 */
		public boolean configure(StaplerRequest reqJSONObject formDatathrows FormException {
			// This is used for the global configuration
			return true;
		}
	}

Get the hostname this SCM is using.

Returns:
The hostname.
	public String getHostname() {
		return ;
	}

Get the port number this SCM is using.

Returns:
The port.
	public int getPort() {
		return ;
	}

Get the project name this SCM is connected to.

Returns:
The project's name.
	public String getProjectname() {
		return ;
	}

Get the view name in the project this SCM uses.

Returns:
The name of the view.
	public String getViewname() {
		return ;
	}

Get the root folder name of our monitored workspace.

Returns:
The name of the folder.
	public String getFoldername() {
		return ;
	}

Get the username used to connect to starteam.

Returns:
The username.
	public String getUsername() {
		return ;
	}

Get the password used to connect to starteam.

Returns:
The password.
	public String getPassword() {
		return ;
	}

Get the label used to check out from starteam.

Returns:
The label.
	public String getLabelname() {
		return ;
	}

Is the label a promotion state name?

Returns:
True if the label name is actually a promotion state.
	public boolean isPromotionstate() {
	}
New to GrepCode? Check out our FAQ X