public class AntStarTeamCheckOut extends Task
force
to
true.
starteam-sdk.jar
in your classpath to run this program.
For more information about the StarTeam API and how to license it, see
the link below.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_EXCLUDESETTING
This disables the exclude filter by default.
|
static java.lang.String |
DEFAULT_FOLDERSETTING
The default folder to search; the root folder.
|
static java.lang.String |
DEFAULT_INCLUDESETTING
This constant sets the filter to include all files.
|
description, location, project
Constructor and Description |
---|
AntStarTeamCheckOut() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkParameters()
Check if the attributes/elements are correct.
|
void |
execute()
Do the execution.
|
protected java.lang.String |
formatForDisplay(Property p,
java.lang.Object value)
Formats a property value for display to the user.
|
java.lang.String |
getExcludes()
Gets the patterns from the exclude filter.
|
java.lang.String |
getFolderName()
Gets the
folderName attribute. |
boolean |
getForce()
Gets the
force attribute. |
java.lang.String |
getIncludes()
Gets the patterns from the include filter.
|
java.lang.String |
getPassword()
Gets the
password attribute. |
protected Property |
getPrimaryDescriptor(Type t)
Get the primary descriptor of the given item type.
|
java.lang.String |
getProjectName()
Gets the
projectName attribute. |
boolean |
getRecursion()
Gets the
recursion attribute, which tells
AntStarTeamCheckOut whether to search subfolders when checking out
files. |
protected Property |
getSecondaryDescriptor(Type t)
Get the secondary descriptor of the given item type.
|
protected Server |
getServer()
Creates and logs in to a StarTeam server.
|
java.lang.String |
getServerName()
Gets the
serverName attribute. |
int |
getServerPort()
Gets the
serverPort attribute. |
java.lang.String |
getTargetFolder()
Gets the
targetFolder attribute. |
boolean |
getTargetFolderAbsolute()
returns whether the StarTeam default path is factored into calculated
target path locations (false) or whether targetFolder is an absolute
mapping to the root folder named by folderName
|
java.lang.String |
getUsername()
Gets the
username attribute. |
boolean |
getVerbose()
Gets the
verbose attribute. |
java.lang.String |
getViewName()
Gets the
viewName attribute. |
protected boolean |
matchPatterns(java.lang.String patterns,
java.lang.String pName)
Convenient method to see if a string match a one pattern in given set
of space-separated patterns.
|
protected void |
runFolder(Server s,
com.starbase.starteam.Project p,
View v,
Type t,
Folder f,
java.io.File tgt)
Searches for files in the given folder.
|
protected void |
runItem(Server s,
com.starbase.starteam.Project p,
View v,
Type t,
Folder f,
Item item,
java.io.File tgt)
Check out one file if it matches the include filter but not the exclude
filter.
|
protected void |
runProject(Server s,
com.starbase.starteam.Project p)
Searches for the given view in the project.
|
protected void |
runServer(Server s)
Searches for the specified project on the server.
|
protected void |
runType(Server s,
com.starbase.starteam.Project p,
View v,
Type t)
Searches for folders in the given view.
|
void |
setExcludes(java.lang.String excludes)
Sets the exclude filter.
|
void |
setFolderName(java.lang.String folderName)
Sets the
folderName attribute to the given value. |
void |
setForce(boolean force)
Sets the
force attribute to the given value. |
void |
setIncludes(java.lang.String includes)
Sets the include filter.
|
void |
setPassword(java.lang.String password)
Sets the
password attribute to the given value. |
void |
setProjectName(java.lang.String projectName)
Sets the
projectName attribute to the given value. |
void |
setRecursion(boolean recursion)
Turns recursion on or off.
|
void |
setServerName(java.lang.String serverName)
Sets the
serverName attribute to the given value. |
void |
setServerPort(int serverPort)
Sets the
serverPort attribute to the given value. |
void |
setTargetFolder(java.lang.String targetFolder)
Sets the
targetFolder attribute to the given value. |
void |
setTargetFolderAbsolute(boolean targetFolderAbsolute)
sets the property that indicates whether or not the Star Team "default
folder" is to be used when calculation paths for items on the target
(false) or if targetFolder is an absolute mapping to the root folder
named by foldername.
|
void |
setUsername(java.lang.String username)
Sets the
username attribute to the given value. |
void |
setVerbose(boolean verbose)
Sets the
verbose attribute to the given value. |
void |
setViewName(java.lang.String viewName)
Sets the
viewName attribute to the given value. |
protected boolean |
shouldCheckout(java.lang.String pName)
Look if the file should be checked out.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
public static final java.lang.String DEFAULT_INCLUDESETTING
setIncludes("*")
.public static final java.lang.String DEFAULT_EXCLUDESETTING
setExcludes(null)
.getExcludes()
,
setExcludes(String excludes)
public static final java.lang.String DEFAULT_FOLDERSETTING
protected void checkParameters() throws BuildException
BuildException
- if there was a problem.public void execute() throws BuildException
execute
in class Task
BuildException
- if there was a problem.protected Server getServer()
protected void runServer(Server s)
s
- A StarTeam server.protected void runProject(Server s, com.starbase.starteam.Project p)
s
- A StarTeam server.p
- A valid project on the given server.protected void runType(Server s, com.starbase.starteam.Project p, View v, Type t)
s
- A StarTeam server.p
- A valid project on the server.v
- A view name from the specified project.t
- An item type which is currently always "file".protected void runFolder(Server s, com.starbase.starteam.Project p, View v, Type t, Folder f, java.io.File tgt)
s
- A StarTeam server.p
- A valid project on the server.v
- A view name from the specified project.t
- An item type which is currently always "file".f
- The folder to search.tgt
- Target folder on local machineprotected void runItem(Server s, com.starbase.starteam.Project p, View v, Type t, Folder f, Item item, java.io.File tgt)
s
- A StarTeam server.p
- A valid project on the server.v
- A view name from the specified project.t
- An item type which is currently always "file".f
- The folder the file is localed in.item
- The file to check out.tgt
- target folder on local machineprotected boolean shouldCheckout(java.lang.String pName)
pName
- the item name to look for being included.protected boolean matchPatterns(java.lang.String patterns, java.lang.String pName)
patterns
- the space-separated list of patterns.pName
- the name to look for matching.protected Property getPrimaryDescriptor(Type t)
t
- An item type. At this point it will always be "file".protected Property getSecondaryDescriptor(Type t)
t
- An item type. At this point it will always be "file".protected java.lang.String formatForDisplay(Property p, java.lang.Object value)
p
- An item property to format.value
- the object to format.public void setServerName(java.lang.String serverName)
serverName
attribute to the given value.serverName
- The name of the server you wish to connect to.getServerName()
public java.lang.String getServerName()
serverName
attribute.setServerName(String serverName)
public void setServerPort(int serverPort)
serverPort
attribute to the given value. The
given value must be a valid integer, but it must be a string object.serverPort
- A string containing the port on the StarTeam server
to use.getServerPort()
public int getServerPort()
serverPort
attribute.setServerPort(int)
public void setProjectName(java.lang.String projectName)
projectName
attribute to the given value.projectName
- The StarTeam project to search.getProjectName()
public java.lang.String getProjectName()
projectName
attribute.setProjectName(String projectName)
public void setViewName(java.lang.String viewName)
viewName
attribute to the given value.viewName
- The view to find the specified folder in.getViewName()
public java.lang.String getViewName()
viewName
attribute.setViewName(String viewName)
public void setFolderName(java.lang.String folderName)
folderName
attribute to the given value. To
search the root folder, use a slash or backslash, or simply don't set a
folder at all.folderName
- The subfolder from which to check out files.getFolderName()
public java.lang.String getFolderName()
folderName
attribute.setFolderName(String folderName)
public void setUsername(java.lang.String username)
username
attribute to the given value.username
- Your username for the specified StarTeam server.getUsername()
public java.lang.String getUsername()
username
attribute.setUsername(String username)
public void setPassword(java.lang.String password)
password
attribute to the given value.password
- Your password for the specified StarTeam server.getPassword()
public java.lang.String getPassword()
password
attribute.setPassword(String password)
public void setTargetFolder(java.lang.String targetFolder)
targetFolder
attribute to the given value.targetFolder
- The target path on the local machine to check out to.getTargetFolder()
public java.lang.String getTargetFolder()
targetFolder
attribute.setTargetFolder(String targetFolder)
public void setForce(boolean force)
force
attribute to the given value.force
- if true, it overwrites files in the target directory. By
default it set to false as a safeguard. Note that if the target
directory does not exist, this setting has no effect.getForce()
public boolean getForce()
force
attribute.setForce(boolean)
public void setRecursion(boolean recursion)
recursion
- if it is true, the default, subfolders are searched
recursively for files to check out. Otherwise, only files
specified by folderName
are scanned.getRecursion()
public boolean getRecursion()
recursion
attribute, which tells
AntStarTeamCheckOut whether to search subfolders when checking out
files.setRecursion(boolean)
public void setVerbose(boolean verbose)
verbose
attribute to the given value.verbose
- whether to display all files as it checks them out. By
default it is false, so the program only displays the total number
of files unless you override this default.getVerbose()
public boolean getVerbose()
verbose
attribute.setVerbose(boolean verbose)
public void setIncludes(java.lang.String includes)
DirectoryScanner
's match
method, so here are the patterns straight from the Ant source code:
setIncludes("*.java *.class");
Finally, note that filters have no effect on the directories
that are scanned; you could not check out files from directories with
names beginning only with "build," for instance. Of course, you could
limit AntStarTeamCheckOut to a particular folder and its subfolders
with the setFolderName(String folderName)
command. includes
- A string of filter patterns to include. Separate the
patterns by spaces.getIncludes()
,
setExcludes(String excludes)
,
getExcludes()
public java.lang.String getIncludes()
setIncludes(String includes)
,
setExcludes(String excludes)
,
getExcludes()
public void setExcludes(java.lang.String excludes)
DirectoryScanner
's match
method, so here are the patterns straight from the Ant source code:
setExcludes("*.XML *.HTML");
Finally, note that filters have no effect on the directories
that are scanned; you could not skip over all files in directories
whose names begin with "project," for instance. excludes
- A string of filter patterns to exclude. Separate the
patterns by spaces.setIncludes(String includes)
,
getIncludes()
,
getExcludes()
public java.lang.String getExcludes()
setExcludes(String excludes)
,
setIncludes(String includes)
,
getIncludes()
public boolean getTargetFolderAbsolute()
setTargetFolderAbsolute(boolean)
public void setTargetFolderAbsolute(boolean targetFolderAbsolute)
targetFolderAbsolute
- true if the absolute mapping is to
be used. false (the default) if the "default folder" is
to be factored in.getTargetFolderAbsolute()