|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.Task | +--org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut
Checks out files from a specific StarTeam server, project, view, and
folder.
This program logs in to a StarTeam server and opens up the specified
project and view. Then, it searches through that view for the given
folder (or, if you prefer, it uses the root folder). Beginning with
that folder and optionally continuing recursivesly, AntStarTeamCheckOut
compares each file with your include and exclude filters and checks it
out only if appropriate.
Checked out files go to a directory you specify under the subfolder
named for the default StarTeam path to the view. That is, if you
entered /home/cpovirk/work as the target folder, your project was named
"OurProject," the given view was named "TestView," and that view is
stored by default at "C:\projects\Test," your files would be checked
out to /home/cpovirk/work/Test." I avoided using the project name in
the path because you may want to keep several versions of the same
project on your computer, and I didn't want to use the view name, as
there may be many "Test" or "Version 1.0" views, for example. This
system's success, of course, depends on what you set the default path
to in StarTeam.
You can set AntStarTeamCheckOut to verbose or quiet mode. Also, it has
a safeguard against overwriting the files on your computer: If the
target directory you specify already exists, the program will throw a
BuildException. To override the exception, set force
to
true.
This program makes use of functions from the StarTeam API. As a result
AntStarTeamCheckOut is available only to licensed users of StarTeam and
requires the StarTeam SDK to function. You must have
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.
Field Summary | |
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_FORCESETTING
By default, force is set to "false" through this field. |
static java.lang.String |
DEFAULT_INCLUDESETTING
This constant sets the filter to include all files. |
static java.lang.String |
DEFAULT_RECURSIONSETTING
DEFAULT_RECURSIONSETTING contains the normal setting --
true -- for recursion. |
static java.lang.String |
DEFAULT_VERBOSESETTING
This field is used in setting verbose to "false", the
default. |
Fields inherited from class org.apache.tools.ant.Task |
description, location, project, target, taskName, taskType, wrapper |
Constructor Summary | |
AntStarTeamCheckOut()
|
Method Summary | |
void |
execute()
Do the execution. |
protected java.lang.String |
formatForDisplay(org.apache.tools.ant.taskdefs.optional.scm.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. |
java.lang.String |
getForce()
Gets the force attribute. |
boolean |
getForceAsBoolean()
Gets the force attribute as a boolean value. |
java.lang.String |
getIncludes()
Gets the patterns from the include filter. |
java.lang.String |
getPassword()
Gets the password attribute. |
protected org.apache.tools.ant.taskdefs.optional.scm.Property |
getPrimaryDescriptor(org.apache.tools.ant.taskdefs.optional.scm.Type t)
Get the primary descriptor of the given item type. |
java.lang.String |
getProjectName()
Gets the projectName attribute. |
java.lang.String |
getRecursion()
Gets the recursion attribute, which tells
AntStarTeamCheckOut whether to search subfolders when checking out
files. |
boolean |
getRecursionAsBoolean()
Gets the recursion attribute as a boolean value. |
protected org.apache.tools.ant.taskdefs.optional.scm.Property |
getSecondaryDescriptor(org.apache.tools.ant.taskdefs.optional.scm.Type t)
Get the secondary descriptor of the given item type. |
protected org.apache.tools.ant.taskdefs.optional.scm.Server |
getServer()
Creates and logs in to a StarTeam server. |
java.lang.String |
getServerName()
Gets the serverName attribute. |
java.lang.String |
getServerPort()
Gets the serverPort attribute. |
int |
getServerPortAsInt()
Gets the serverPort attribute as an integer. |
java.lang.String |
getTargetFolder()
Gets the targetFolder attribute. |
java.lang.String |
getUsername()
Gets the username attribute. |
java.lang.String |
getVerbose()
Gets the verbose attribute. |
boolean |
getVerboseAsBoolean()
Gets the verbose attribute as a boolean value. |
java.lang.String |
getViewName()
Gets the viewName attribute. |
protected void |
runFolder(org.apache.tools.ant.taskdefs.optional.scm.Server s,
com.starbase.starteam.Project p,
org.apache.tools.ant.taskdefs.optional.scm.View v,
org.apache.tools.ant.taskdefs.optional.scm.Type t,
org.apache.tools.ant.taskdefs.optional.scm.Folder f)
Searches for files in the given folder. |
protected void |
runItem(org.apache.tools.ant.taskdefs.optional.scm.Server s,
com.starbase.starteam.Project p,
org.apache.tools.ant.taskdefs.optional.scm.View v,
org.apache.tools.ant.taskdefs.optional.scm.Type t,
org.apache.tools.ant.taskdefs.optional.scm.Folder f,
org.apache.tools.ant.taskdefs.optional.scm.Item item)
Check out one file if it matches the include filter but not the exclude filter. |
protected void |
runProject(org.apache.tools.ant.taskdefs.optional.scm.Server s,
com.starbase.starteam.Project p)
Searches for the given view in the project. |
protected void |
runServer(org.apache.tools.ant.taskdefs.optional.scm.Server s)
Searches for the specified project on the server. |
protected void |
runType(org.apache.tools.ant.taskdefs.optional.scm.Server s,
com.starbase.starteam.Project p,
org.apache.tools.ant.taskdefs.optional.scm.View v,
org.apache.tools.ant.taskdefs.optional.scm.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(java.lang.String 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(java.lang.String recursion)
Turns recursion on or off. |
void |
setServerName(java.lang.String serverName)
Sets the serverName attribute to the given value. |
void |
setServerPort(java.lang.String serverPort)
Sets the serverPort attribute to the given value. |
void |
setTargetFolder(java.lang.String targetFolder)
Sets the targetFolder attribute to the given value. |
void |
setUsername(java.lang.String username)
Sets the username attribute to the given value. |
void |
setVerbose(java.lang.String verbose)
Sets the verbose attribute to the given value. |
void |
setViewName(java.lang.String viewName)
Sets the viewName attribute to the given value. |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DEFAULT_FORCESETTING
force
is set to "false" through this field.
If you set force
to "true," AntStarTeamCheckOut will
overwrite files in the target directory. If the target directory does
not exist, the force
setting does nothing. Note that
DEFAULT_FORCESETTING
and force
are strings,
not boolean values. See the links below for more information.getForce()
,
getForceAsBoolean()
,
setForce(String force)
public static final java.lang.String DEFAULT_VERBOSESETTING
verbose
to "false", the
default. If verbose
is true, AntStarTeamCheckOut will
display file and directory names as it checks files out. The default
setting displays only a total. Note that
DEFAULT_VERBOSESETTING
and verbose
are
strings, not boolean values. See the links below for more
information.getVerbose()
,
getVerboseAsBoolean()
,
setVerbose(String verbose)
public static final java.lang.String DEFAULT_RECURSIONSETTING
DEFAULT_RECURSIONSETTING
contains the normal setting --
true -- for recursion. Thus, if you do not
setRecursion("false")
somewhere in your program,
AntStarTeamCheckOut will check files out from all subfolders as well
as from the given folder.getRecursion()
,
setRecursion(String recursion)
public static final java.lang.String DEFAULT_INCLUDESETTING
setIncludes("*")
.getIncludes()
,
setIncludes(String includes)
public static final java.lang.String DEFAULT_EXCLUDESETTING
setExcludes(null)
.getExcludes()
,
setExcludes(String excludes)
public static final java.lang.String DEFAULT_FOLDERSETTING
getFolderName()
,
setFolderName(String folderName)
Constructor Detail |
public AntStarTeamCheckOut()
Method Detail |
public void execute() throws BuildException
execute
in class Task
BuildException
- protected org.apache.tools.ant.taskdefs.optional.scm.Server getServer()
protected void runServer(org.apache.tools.ant.taskdefs.optional.scm.Server s)
s
- A StarTeam server.protected void runProject(org.apache.tools.ant.taskdefs.optional.scm.Server s, com.starbase.starteam.Project p)
s
- A StarTeam server.p
- A valid project on the given server.protected void runType(org.apache.tools.ant.taskdefs.optional.scm.Server s, com.starbase.starteam.Project p, org.apache.tools.ant.taskdefs.optional.scm.View v, org.apache.tools.ant.taskdefs.optional.scm.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(org.apache.tools.ant.taskdefs.optional.scm.Server s, com.starbase.starteam.Project p, org.apache.tools.ant.taskdefs.optional.scm.View v, org.apache.tools.ant.taskdefs.optional.scm.Type t, org.apache.tools.ant.taskdefs.optional.scm.Folder f)
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.protected void runItem(org.apache.tools.ant.taskdefs.optional.scm.Server s, com.starbase.starteam.Project p, org.apache.tools.ant.taskdefs.optional.scm.View v, org.apache.tools.ant.taskdefs.optional.scm.Type t, org.apache.tools.ant.taskdefs.optional.scm.Folder f, org.apache.tools.ant.taskdefs.optional.scm.Item item)
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.protected org.apache.tools.ant.taskdefs.optional.scm.Property getPrimaryDescriptor(org.apache.tools.ant.taskdefs.optional.scm.Type t)
t
- An item type. At this point it will always be "file".protected org.apache.tools.ant.taskdefs.optional.scm.Property getSecondaryDescriptor(org.apache.tools.ant.taskdefs.optional.scm.Type t)
t
- An item type. At this point it will always be "file".protected java.lang.String formatForDisplay(org.apache.tools.ant.taskdefs.optional.scm.Property p, java.lang.Object value)
p
- An item property to format.value
- 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(java.lang.String 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 java.lang.String getServerPort()
serverPort
attribute.getServerPortAsInt()
,
setServerPort(String serverPort)
public int getServerPortAsInt()
serverPort
attribute as an integer.getServerPort()
,
setServerPort(String serverPort)
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.target
- 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(java.lang.String force)
force
attribute to the given value.force
- A string containing "true" or "false" that tells the
application whether to continue if the target directory
exists. If force
is true,
AntStarTeamCheckOut will overwrite 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.DEFAULT_FORCESETTING
,
getForce()
,
getForceAsBoolean()
public java.lang.String getForce()
force
attribute.force
is true, AntStarTeamCheckOut will
overwrite files in the target directory. If it is false and
the target directory exists, AntStarTeamCheckOut will exit
with a warning. If the target directory does not exist, this
setting has no effect. The default setting is false.DEFAULT_FORCESETTING
,
getForceAsBoolean()
,
setForce(String force)
public boolean getForceAsBoolean()
force
attribute as a boolean value.DEFAULT_FORCESETTING
,
getForce()
,
setForce(String force)
public void setRecursion(java.lang.String recursion)
verbose
- A string containing "true" or "false." If it is true,
the default, subfolders are searched recursively for
files to check out. Otherwise, only files specified
by folderName
are scanned.DEFAULT_RECURSIONSETTING
,
getRecursion()
,
getRecursionAsBoolean()
public java.lang.String getRecursion()
recursion
attribute, which tells
AntStarTeamCheckOut whether to search subfolders when checking out
files.recursion
is "true" or
"false."DEFAULT_RECURSIONSETTING
,
getRecursionAsBoolean()
,
setRecursion(String recursion)
public boolean getRecursionAsBoolean()
recursion
attribute as a boolean value.folderName
will be scanned for files to check out.DEFAULT_RECURSIONSETTING
,
getRecursion()
,
setRecursion(String recursion)
public void setVerbose(java.lang.String verbose)
verbose
attribute to the given value.verbose
- A string containing "true" or "false" to tell
AntStarTeamCheckOut whether to display files as they
are checked out. By default it is false, so the
program only displays the total number of files unless
you override this default.DEFAULT_FORCESETTING
,
getForce()
,
getForceAsBoolean()
public java.lang.String getVerbose()
verbose
attribute.DEFAULT_VERBOSESETTING
,
getVerboseAsBoolean()
,
setVerbose(String verbose)
public boolean getVerboseAsBoolean()
verbose
attribute as a boolean value.DEFAULT_VERBOSESETTING
,
getVerbose()
,
setVerbose(String verbose)
public void setIncludes(java.lang.String includes)
DirectoryScanner
's
match
method, so here are the patterns straight from the
Ant source code:
match
is a private member, so I cannot access it from
this program.
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:
match
is a private member, so I cannot access it from
this program.
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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |