hudson.plugins.starteam
Class StarTeamConnection

java.lang.Object
  extended by hudson.plugins.starteam.StarTeamConnection
All Implemented Interfaces:
java.io.Serializable

public class StarTeamConnection
extends java.lang.Object
implements java.io.Serializable

StarTeamActor is a class that implements connecting to a StarTeam repository, to a given project, view and folder. Add functionality allowing to delete non starteam file in folder while performing listing of all files. and to perform creation of changelog file during the checkout

Author:
Ilkka Laukkanen , Steve Favez
See Also:
Serialized Form

Constructor Summary
StarTeamConnection(java.lang.String hostName, int port, java.lang.String userName, java.lang.String password, java.lang.String projectName, java.lang.String viewName, java.lang.String folderName)
          Default constructor
 
Method Summary
 java.util.Date calculatePreviousDateWithTimeZoneCheck(java.util.Date aPreviousBuildDate, java.util.Date aCurrentBuildDate)
          synchronize last build date with starteam server timezone.
 void checkOut(java.util.Collection<com.starbase.starteam.File> filesToCheckOut, java.io.PrintStream logger)
          checkout the files from starteam
 void close()
          Close the connection.
 boolean equals(java.lang.Object object)
           
protected  void finalize()
           
 java.util.Map<java.lang.String,com.starbase.starteam.File> findAllFiles(java.io.File workspace, java.io.PrintStream logger, boolean clearNoStarteamFiles)
          return the list of all files for the current starteam connection.
 java.util.Collection<com.starbase.starteam.File> findChangedFiles(java.io.File workspace, java.io.PrintStream logger, java.util.Date fromDate)
          find all changed files in starteam since a given date.
 java.util.Collection<com.starbase.starteam.File> findChangedFiles(java.util.Map<java.lang.String,com.starbase.starteam.File> nowFiles, java.io.File workspace, java.io.PrintStream logger, java.util.Date fromDate)
          Find all changed files in starteam since a given date.
 com.starbase.util.OLEDate getServerTime()
           
 java.lang.String getUsername(int userId)
          Returns the name of the user on the StarTeam server with the specified id.
 int hashCode()
           
 void initialize()
          Initialize the connection.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StarTeamConnection

public StarTeamConnection(java.lang.String hostName,
                          int port,
                          java.lang.String userName,
                          java.lang.String password,
                          java.lang.String projectName,
                          java.lang.String viewName,
                          java.lang.String folderName)
Default constructor

Parameters:
hostName - the starteam server host / ip name
port - starteam server port
userName - user used to connect starteam server
password - user password to connect to starteam server
projectName - starteam project's name
viewName - starteam view's name
folderName - starteam folder's name
Method Detail

initialize

public void initialize()
                throws StarTeamSCMException
Initialize the connection. This means logging on to the server and finding the project, view and folder we want.

Throws:
StarTeamSCMException - if logging on fails.

checkOut

public void checkOut(java.util.Collection<com.starbase.starteam.File> filesToCheckOut,
                     java.io.PrintStream logger)
              throws java.io.IOException
checkout the files from starteam

Parameters:
filesToCheckOut -
Throws:
java.io.IOException - if checkout fails.

getUsername

public java.lang.String getUsername(int userId)
Returns the name of the user on the StarTeam server with the specified id. StarTeam stores user IDs as int values and this method will translate those into the actual user name.
This can be used, for example, with a StarTeam Item's Item.getModifiedBy() property, to determine the name of the user who made a modification to the item.

Parameters:
userId - the id of the user on the StarTeam Server
Returns:
the name of the user as provided by the StarTeam Server

getServerTime

public com.starbase.util.OLEDate getServerTime()

findAllFiles

public java.util.Map<java.lang.String,com.starbase.starteam.File> findAllFiles(java.io.File workspace,
                                                                               java.io.PrintStream logger,
                                                                               boolean clearNoStarteamFiles)
return the list of all files for the current starteam connection.

Parameters:
workspace - root of local folder
logger - logger used to log events
clearNoStarteamFiles - whether or not deleting local file / directory that are not in starteam.
Returns:
a map containing full file name and the corresponding starteam object file.

findChangedFiles

public java.util.Collection<com.starbase.starteam.File> findChangedFiles(java.io.File workspace,
                                                                         java.io.PrintStream logger,
                                                                         java.util.Date fromDate)
find all changed files in starteam since a given date. this method create a list of all current files. and then call the overloaded method with a list of current files.

Parameters:
workspace - local root directory.
logger - logger allowing to log event to the console.
fromDate - date of comparison.
Returns:
collection of modified starteam files.

findChangedFiles

public java.util.Collection<com.starbase.starteam.File> findChangedFiles(java.util.Map<java.lang.String,com.starbase.starteam.File> nowFiles,
                                                                         java.io.File workspace,
                                                                         java.io.PrintStream logger,
                                                                         java.util.Date fromDate)
Find all changed files in starteam since a given date.

Parameters:
nowFiles - list of all current starteam files.
workspace - local root directory.
logger - logger allowing to log event to the console.
fromDate - date of comparison.
Returns:
collection of modified starteam files.

calculatePreviousDateWithTimeZoneCheck

public java.util.Date calculatePreviousDateWithTimeZoneCheck(java.util.Date aPreviousBuildDate,
                                                             java.util.Date aCurrentBuildDate)
synchronize last build date with starteam server timezone.

Parameters:
aPreviousBuildDate - the previous Hudson's build date.
aCurrentBuildDate - hudson's current build date
Returns:
corresponding starteam previous build date.

close

public void close()
Close the connection.


finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2007-2010. All Rights Reserved.