|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tools.ant.ProjectComponent org.apache.tools.ant.Task org.apache.tools.ant.taskdefs.optional.starteam.StarTeamTask org.apache.tools.ant.taskdefs.optional.starteam.TreeBasedTask
public abstract class TreeBasedTask
TreeBasedTask.java
This abstract class is the base for any tasks that are tree-based, that
is, for tasks which iterate over a tree of folders in StarTeam which
is reflected in a tree of folder the local machine.
This class provides the tree-iteration functionality. Derived classes
will implement their specific task functionality by the visitor pattern,
specifically by implementing the method
visit(Folder rootStarteamFolder, java.io.File rootLocalFolder)
Created: Sat Dec 15 16:55:19 2001
Nested Class Summary | |
---|---|
protected class |
TreeBasedTask.UnmatchedFileMap
This class implements a map of existing local files to possibly existing repository files. |
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_EXCLUDESETTING
This disables the exclude filter by default. |
static java.lang.String |
DEFAULT_INCLUDESETTING
This constant sets the filter to include all files. |
Fields inherited from class org.apache.tools.ant.Task |
---|
target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
description, location, project |
Constructor Summary | |
---|---|
TreeBasedTask()
|
Method Summary | |
---|---|
protected void |
_setAsOfDate(java.lang.String asOfDate)
non-public method callable only by derived classes that implement setAsOfDate (so that derived tasks that do not accept this parameter will fail if user attempts to use it. |
protected void |
_setAsOfDateFormat(java.lang.String asOfDateFormat)
non-public method callable only by derived classes that implement setAsOfDateFormat (so that derived tasks that do not accept this parameter will fail if user attempts to use it. |
protected void |
_setLabel(java.lang.String label)
protected function to allow subclasses to set the label (or not). |
void |
execute()
This method does the work of opening the supplied Starteam view and calling the visit() method to perform the task. |
protected java.lang.String |
getAsOfDate()
return the asOfDate entered by the user for internal use by derived classes. |
java.lang.String |
getExcludes()
Gets the patterns from the exclude filter. |
static java.lang.String |
getFullRepositoryPath(com.starbase.starteam.File remotefile)
Return the full repository path name of a file. |
protected int |
getIDofLabelInUse()
Get the id of the label in use. |
java.lang.String |
getIncludes()
Gets the patterns from the include filter. |
protected java.lang.String |
getLabel()
return the label passed to the task by the user as a string |
protected int |
getLabelID(com.starbase.starteam.View v)
Helper method calls on the StarTeam API to retrieve an ID number for the specified view, corresponding to this.label. |
protected com.starbase.starteam.Label |
getLabelInUse()
returns the label being used |
java.lang.String |
getRootLocalFolder()
Returns the local folder specified by the user, corresponding to the starteam folder for this operation or null if not specified. |
java.lang.String |
getRootStarteamFolder()
returns the root folder in the Starteam repository used for this operation |
protected com.starbase.starteam.View |
getViewConfiguredByDate(com.starbase.starteam.View raw)
If an asofDate parameter has been supplied by the user return a StarTeam view based on the configuration of the StarTeam view specified the user as of the date specified in the parameter. |
boolean |
isForced()
Get the value of forced. |
boolean |
isPreloadFileInformation()
Get the value of preloadFileInformation. |
boolean |
isRecursive()
Get the value of recursive. |
protected boolean |
isUsingRevisionLabel()
returns true if a label has been specified and it is a revision label. |
protected boolean |
isUsingViewLabel()
returns true if a label has been specified and it is a view label. |
protected void |
logAsOfDate()
show the asofDate in the log |
protected void |
logExcludes()
if excludes have been specified, emit the list to the log |
protected void |
logIncludes()
if excludes have been specified, emit the list to the log |
protected void |
logLabel()
show the label in the log and its type. |
protected abstract void |
logOperationDescription(com.starbase.starteam.Folder starteamrootFolder,
java.io.File targetrootFolder)
extenders should emit to the log an entry describing the parameters that will be used by this operation. |
protected boolean |
matchPatterns(java.lang.String patterns,
java.lang.String pName)
Convenience method to see if a string match a one pattern in given set of space-separated patterns. |
void |
setExcludes(java.lang.String excludes)
Declare files to exclude using standard excludes patterns; optional. |
void |
setForced(boolean v)
Flag to force actions regardless of the status that StarTeam is maintaining for the file; optional, default false. |
void |
setIncludes(java.lang.String includes)
Declare files to include using standard includes patterns; optional. |
void |
setPreloadFileInformation(boolean v)
Flag to set to preload file information from the server; optional, default true. |
void |
setRecursive(boolean v)
Flag to set to include files in subfolders in the operation; optional, default true. |
void |
setRootLocalFolder(java.lang.String rootLocalFolder)
Set the local folder that will be the root of the tree to which files are checked out; optional. |
void |
setRootStarteamFolder(java.lang.String rootStarteamFolder)
Set the root of the subtree in the StarTeam repository from which to work; optional. |
protected boolean |
shouldProcess(java.lang.String pName)
Look if the file should be processed by the task. |
protected abstract void |
testPreconditions()
Derived classes must override this method to define tests for any preconditons required by the task. |
protected abstract void |
visit(com.starbase.starteam.Folder rootStarteamFolder,
java.io.File rootLocalFolder)
Derived classes must override this class to define actual processing to be performed on each folder in the tree defined for the task |
Methods inherited from class org.apache.tools.ant.taskdefs.optional.starteam.StarTeamTask |
---|
createSnapshotView, disconnectFromServer, getPassword, getProjectname, getServer, getServername, getServerport, getTypeNames, getURL, getUserName, getUserName, getViewname, getViewURL, openView, setPassword, setProjectname, setServername, setServerport, setURL, setUserName, setViewname |
Methods inherited from class org.apache.tools.ant.Task |
---|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_INCLUDESETTING
setIncludes("*")
.
getIncludes()
,
setIncludes(String includes)
,
Constant Field Valuespublic static final java.lang.String DEFAULT_EXCLUDESETTING
setExcludes(null)
.
getExcludes()
,
setExcludes(String excludes)
Constructor Detail |
---|
public TreeBasedTask()
Method Detail |
---|
public void setRootStarteamFolder(java.lang.String rootStarteamFolder)
rootStarteamFolder
- the root folderpublic java.lang.String getRootStarteamFolder()
public void setRootLocalFolder(java.lang.String rootLocalFolder)
rootLocalFolder
- the local folder that will mirror
this.rootStarteamFolderpublic java.lang.String getRootLocalFolder()
public void setIncludes(java.lang.String includes)
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()
protected void logIncludes()
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()
protected void logExcludes()
protected void _setLabel(java.lang.String label)
label
- name of the StarTeam label to be setprotected void _setAsOfDate(java.lang.String asOfDate)
asOfDate
- asOfDate entered by user.protected void _setAsOfDateFormat(java.lang.String asOfDateFormat)
asOfDateFormat
- asOfDate format entered by user.protected java.lang.String getAsOfDate()
protected com.starbase.starteam.View getViewConfiguredByDate(com.starbase.starteam.View raw) throws BuildException
createSnapshotView
abstract method.
raw
- the raw view to be configured as of the supplied date
BuildException
- thrown if the date is not parsable by the default or
supplied format patterns.protected java.lang.String getLabel()
public boolean isRecursive()
public void setRecursive(boolean v)
v
- Value to assign to recursive.public boolean isPreloadFileInformation()
public void setPreloadFileInformation(boolean v)
v
- Value to assign to preloadFileInformation.public boolean isForced()
public void setForced(boolean v)
v
- Value to assign to forced.protected boolean isUsingViewLabel()
protected boolean isUsingRevisionLabel()
protected com.starbase.starteam.Label getLabelInUse()
protected void logLabel()
protected void logAsOfDate()
protected boolean shouldProcess(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 abstract void logOperationDescription(com.starbase.starteam.Folder starteamrootFolder, java.io.File targetrootFolder)
starteamrootFolder
- root folder in StarTeam for the operationtargetrootFolder
- root local folder for the operation (whether specified by the user or not.public final void execute() throws BuildException
visit()
method to perform the task.
Derived classes can customize the called methods
testPreconditions()
and visit()
.
execute
in class Task
BuildException
- if any error occurs in the processingtestPreconditions()
,
visit()
protected int getLabelID(com.starbase.starteam.View v) throws BuildException
v
- the View
in which to search for this.label
this.label
or -1 if
no label was provided.
BuildException
- if this.label
does not correspond
to any label in the supplied viewprotected int getIDofLabelInUse()
protected abstract void visit(com.starbase.starteam.Folder rootStarteamFolder, java.io.File rootLocalFolder) throws BuildException
rootStarteamFolder
- the StarTeam folderto be visitedrootLocalFolder
- the local mapping of rootStarteamFolder
BuildException
- on errorprotected abstract void testPreconditions() throws BuildException
BuildException
- throw if any fatal error exists in the
parameters supplied. If there is a non-fatal condition, just writing
to the log may be appropriate.execute()
public static java.lang.String getFullRepositoryPath(com.starbase.starteam.File remotefile)
remotefile
- the Star Team file whose path is to be returned
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |