Java Doc for AntStarTeamCheckOut.java in  » Build » ANT » org » apache » tools » ant » taskdefs » optional » scm » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Build » ANT » org.apache.tools.ant.taskdefs.optional.scm 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.tools.ant.Task
   org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut

AntStarTeamCheckOut
public class AntStarTeamCheckOut extends org.apache.tools.ant.Task (Code)
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.
version:
   1.0
See Also:    StarBase Web Site


Field Summary
final public static  StringDEFAULT_EXCLUDESETTING
     This disables the exclude filter by default.
final public static  StringDEFAULT_FOLDERSETTING
     The default folder to search; the root folder.
final public static  StringDEFAULT_INCLUDESETTING
     This constant sets the filter to include all files.


Method Summary
protected  voidcheckParameters()
     Check if the attributes/elements are correct.
public  voidexecute()
     Do the execution.
protected  StringformatForDisplay(Property p, Object value)
     Formats a property value for display to the user.
Parameters:
  p - An item property to format.
Parameters:
  value - the object to format.
public  StringgetExcludes()
     Gets the patterns from the exclude filter.
public  StringgetFolderName()
     Gets the folderName attribute. The subfolder from which to check out files.
public  booleangetForce()
     Gets the force attribute.
public  StringgetIncludes()
     Gets the patterns from the include filter.
public  StringgetPassword()
     Gets the password attribute.
protected  PropertygetPrimaryDescriptor(Type t)
     Get the primary descriptor of the given item type.
public  StringgetProjectName()
     Gets the projectName attribute.
public  booleangetRecursion()
     Gets the recursion attribute, which tells AntStarTeamCheckOut whether to search subfolders when checking out files.
protected  PropertygetSecondaryDescriptor(Type t)
     Get the secondary descriptor of the given item type.
protected  ServergetServer()
     Creates and logs in to a StarTeam server.
public  StringgetServerName()
     Gets the serverName attribute.
public  intgetServerPort()
     Gets the serverPort attribute.
public  StringgetTargetFolder()
     Gets the targetFolder attribute.
public  booleangetTargetFolderAbsolute()
    
public  StringgetUsername()
     Gets the username attribute.
public  booleangetVerbose()
     Gets the verbose attribute.
public  StringgetViewName()
     Gets the viewName attribute.
protected  booleanmatchPatterns(String patterns, String pName)
     Convenient method to see if a string match a one pattern in given set of space-separated patterns.
Parameters:
  patterns - the space-separated list of patterns.
Parameters:
  pName - the name to look for matching.
protected  voidrunFolder(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  voidrunItem(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  voidrunProject(Server s, com.starbase.starteam.Project p)
     Searches for the given view in the project.
protected  voidrunServer(Server s)
     Searches for the specified project on the server.
protected  voidrunType(Server s, com.starbase.starteam.Project p, View v, Type t)
     Searches for folders in the given view.
public  voidsetExcludes(String excludes)
     Sets the exclude filter.
public  voidsetFolderName(String folderName)
     Sets the folderName attribute to the given value.
public  voidsetForce(boolean force)
     Sets the force attribute to the given value.
Parameters:
  force - if true, it overwrites files in the target directory.
public  voidsetIncludes(String includes)
     Sets the include filter.
public  voidsetPassword(String password)
     Sets the password attribute to the given value.
public  voidsetProjectName(String projectName)
     Sets the projectName attribute to the given value.
public  voidsetRecursion(boolean recursion)
     Turns recursion on or off.
Parameters:
  recursion - if it is true, the default, subfolders are searchedrecursively for files to check out.
public  voidsetServerName(String serverName)
     Sets the serverName attribute to the given value.
public  voidsetServerPort(int serverPort)
     Sets the serverPort attribute to the given value.
public  voidsetTargetFolder(String targetFolder)
     Sets the targetFolder attribute to the given value.
public  voidsetTargetFolderAbsolute(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.
Parameters:
  targetFolderAbsolute - true if the absolute mapping is tobe used.
public  voidsetUsername(String username)
     Sets the username attribute to the given value.
public  voidsetVerbose(boolean verbose)
     Sets the verbose attribute to the given value.
Parameters:
  verbose - whether to display all files as it checks them out.
public  voidsetViewName(String viewName)
     Sets the viewName attribute to the given value.
protected  booleanshouldCheckout(String pName)
     Look if the file should be checked out.

Field Detail
DEFAULT_EXCLUDESETTING
final public static String DEFAULT_EXCLUDESETTING(Code)
This disables the exclude filter by default. In other words, no files are excluded. This setting is equivalent to setExcludes(null) .
See Also:   AntStarTeamCheckOut.getExcludes()
See Also:   AntStarTeamCheckOut.setExcludes(String excludes)



DEFAULT_FOLDERSETTING
final public static String DEFAULT_FOLDERSETTING(Code)
The default folder to search; the root folder. Since AntStarTeamCheckOut searches subfolders, by default it processes an entire view.
See Also:   AntStarTeamCheckOut.getFolderName()
See Also:   AntStarTeamCheckOut.setFolderName(String folderName)



DEFAULT_INCLUDESETTING
final public static String DEFAULT_INCLUDESETTING(Code)
This constant sets the filter to include all files. This default has the same result as setIncludes("*").
See Also:   AntStarTeamCheckOut.getIncludes()
See Also:   AntStarTeamCheckOut.setIncludes(String includes)





Method Detail
checkParameters
protected void checkParameters() throws BuildException(Code)
Check if the attributes/elements are correct.
throws:
  BuildException - if there was a problem.



execute
public void execute() throws BuildException(Code)
Do the execution.
throws:
  BuildException - if there was a problem.



formatForDisplay
protected String formatForDisplay(Property p, Object value)(Code)
Formats a property value for display to the user.
Parameters:
  p - An item property to format.
Parameters:
  value - the object to format. A string containing the property, which is truncated to 35characters for display.



getExcludes
public String getExcludes()(Code)
Gets the patterns from the exclude filter. Rather that duplicate the details of AntStarTeanCheckOut's filtering here, refer to these links: A string of filter patterns separated by spaces.
See Also:   AntStarTeamCheckOut.setExcludes(String excludes)
See Also:   AntStarTeamCheckOut.setIncludes(String includes)
See Also:   AntStarTeamCheckOut.getIncludes()



getFolderName
public String getFolderName()(Code)
Gets the folderName attribute. The subfolder from which to check out files. All subfolderswill be searched, as well.
See Also:   AntStarTeamCheckOut.setFolderName(String folderName)



getForce
public boolean getForce()(Code)
Gets the force attribute. whether to continue if the target directory exists.
See Also:   AntStarTeamCheckOut.setForce(boolean)



getIncludes
public String getIncludes()(Code)
Gets the patterns from the include filter. Rather that duplicate the details of AntStarTeanCheckOut's filtering here, refer to these links: A string of filter patterns separated by spaces.
See Also:   AntStarTeamCheckOut.setIncludes(String includes)
See Also:   AntStarTeamCheckOut.setExcludes(String excludes)
See Also:   AntStarTeamCheckOut.getExcludes()



getPassword
public String getPassword()(Code)
Gets the password attribute. The password given by the user.
See Also:   AntStarTeamCheckOut.setPassword(String password)



getPrimaryDescriptor
protected Property getPrimaryDescriptor(Type t)(Code)
Get the primary descriptor of the given item type. Returns null if there isn't one. In practice, all item types have a primary descriptor.
Parameters:
  t - An item type. At this point it will always be "file". The specified item's primary descriptor.



getProjectName
public String getProjectName()(Code)
Gets the projectName attribute. The StarTeam project to search.
See Also:   AntStarTeamCheckOut.setProjectName(String projectName)



getRecursion
public boolean getRecursion()(Code)
Gets the recursion attribute, which tells AntStarTeamCheckOut whether to search subfolders when checking out files. whether to search subfolders when checking out files.
See Also:   AntStarTeamCheckOut.setRecursion(boolean)



getSecondaryDescriptor
protected Property getSecondaryDescriptor(Type t)(Code)
Get the secondary descriptor of the given item type. Returns null if there isn't one.
Parameters:
  t - An item type. At this point it will always be "file". The specified item's secondary descriptor. There may not be onefor every file.



getServer
protected Server getServer()(Code)
Creates and logs in to a StarTeam server. A StarTeam server.



getServerName
public String getServerName()(Code)
Gets the serverName attribute. The StarTeam server to log in to.
See Also:   AntStarTeamCheckOut.setServerName(String serverName)



getServerPort
public int getServerPort()(Code)
Gets the serverPort attribute. A string containing the port on the StarTeam server to use.
See Also:   AntStarTeamCheckOut.setServerPort(int)



getTargetFolder
public String getTargetFolder()(Code)
Gets the targetFolder attribute. The target path on the local machine to check out to.
See Also:   AntStarTeamCheckOut.setTargetFolder(String targetFolder)



getTargetFolderAbsolute
public boolean getTargetFolderAbsolute()(Code)
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 returns true if absolute mapping is used, false if it is notused.
See Also:   AntStarTeamCheckOut.setTargetFolderAbsolute(boolean)



getUsername
public String getUsername()(Code)
Gets the username attribute. The username given by the user.
See Also:   AntStarTeamCheckOut.setUsername(String username)



getVerbose
public boolean getVerbose()(Code)
Gets the verbose attribute. whether to display all files as it checks them out.
See Also:   AntStarTeamCheckOut.setVerbose(boolean verbose)



getViewName
public String getViewName()(Code)
Gets the viewName attribute. The view to find the specified folder in.
See Also:   AntStarTeamCheckOut.setViewName(String viewName)



matchPatterns
protected boolean matchPatterns(String patterns, String pName)(Code)
Convenient method to see if a string match a one pattern in given set of space-separated patterns.
Parameters:
  patterns - the space-separated list of patterns.
Parameters:
  pName - the name to look for matching. whether the name match at least one pattern.



runFolder
protected void runFolder(Server s, com.starbase.starteam.Project p, View v, Type t, Folder f, java.io.File tgt)(Code)
Searches for files in the given folder. This method is recursive and thus searches all subfolders.
Parameters:
  s - A StarTeam server.
Parameters:
  p - A valid project on the server.
Parameters:
  v - A view name from the specified project.
Parameters:
  t - An item type which is currently always "file".
Parameters:
  f - The folder to search.
Parameters:
  tgt - Target folder on local machine



runItem
protected void runItem(Server s, com.starbase.starteam.Project p, View v, Type t, Folder f, Item item, java.io.File tgt)(Code)
Check out one file if it matches the include filter but not the exclude filter.
Parameters:
  s - A StarTeam server.
Parameters:
  p - A valid project on the server.
Parameters:
  v - A view name from the specified project.
Parameters:
  t - An item type which is currently always "file".
Parameters:
  f - The folder the file is localed in.
Parameters:
  item - The file to check out.
Parameters:
  tgt - target folder on local machine



runProject
protected void runProject(Server s, com.starbase.starteam.Project p)(Code)
Searches for the given view in the project.
Parameters:
  s - A StarTeam server.
Parameters:
  p - A valid project on the given server.



runServer
protected void runServer(Server s)(Code)
Searches for the specified project on the server.
Parameters:
  s - A StarTeam server.



runType
protected void runType(Server s, com.starbase.starteam.Project p, View v, Type t)(Code)
Searches for folders in the given view.
Parameters:
  s - A StarTeam server.
Parameters:
  p - A valid project on the server.
Parameters:
  v - A view name from the specified project.
Parameters:
  t - An item type which is currently always "file".



setExcludes
public void setExcludes(String excludes)(Code)
Sets the exclude filter. When filtering files, AntStarTeamCheckOut uses an unmodified version of DirectoryScanner's match method, so here are the patterns straight from the Ant source code:

Matches a string against a pattern. The pattern contains two special characters:
'*' which means zero or more characters,
'?' which means one and only one character.

Separate multiple exlcude filters by spaces , not commas as Ant uses. For example, if you want to check out all files except .XML and .HTML files, you would put the following line in your 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.

Treatment of overlapping inlcudes and excludes: To give a simplistic example suppose that you set your include filter to "*.htm *.html" and your exclude filter to "index.*". What happens to index.html? AntStarTeamCheckOut will not check out index.html, as it matches an exclude filter ("index.*"), even though it matches the include filter, as well.

Please also read the following sections before using filters:
Parameters:
  excludes - A string of filter patterns to exclude. Separate thepatterns by spaces.
See Also:   AntStarTeamCheckOut.setIncludes(String includes)
See Also:   AntStarTeamCheckOut.getIncludes()
See Also:   AntStarTeamCheckOut.getExcludes()



setFolderName
public void setFolderName(String folderName)(Code)
Sets the 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.
Parameters:
  folderName - The subfolder from which to check out files.
See Also:   AntStarTeamCheckOut.getFolderName()



setForce
public void setForce(boolean force)(Code)
Sets the force attribute to the given value.
Parameters:
  force - if true, it overwrites files in the target directory. Bydefault it set to false as a safeguard. Note that if the targetdirectory does not exist, this setting has no effect.
See Also:   AntStarTeamCheckOut.getForce()



setIncludes
public void setIncludes(String includes)(Code)
Sets the include filter. When filtering files, AntStarTeamCheckOut uses an unmodified version of DirectoryScanner's match method, so here are the patterns straight from the Ant source code:

Matches a string against a pattern. The pattern contains two special characters:
'*' which means zero or more characters,
'?' which means one and only one character.

Separate multiple inlcude filters by spaces , not commas as Ant uses. For example, if you want to check out all .java and .class\ files, you would put the following line in your 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.

Treatment of overlapping inlcudes and excludes: To give a simplistic example suppose that you set your include filter to "*.htm *.html" and your exclude filter to "index.*". What happens to index.html? AntStarTeamCheckOut will not check out index.html, as it matches an exclude filter ("index.*"), even though it matches the include filter, as well.

Please also read the following sections before using filters:
Parameters:
  includes - A string of filter patterns to include. Separate thepatterns by spaces.
See Also:   AntStarTeamCheckOut.getIncludes()
See Also:   AntStarTeamCheckOut.setExcludes(String excludes)
See Also:   AntStarTeamCheckOut.getExcludes()



setPassword
public void setPassword(String password)(Code)
Sets the password attribute to the given value.
Parameters:
  password - Your password for the specified StarTeam server.
See Also:   AntStarTeamCheckOut.getPassword()



setProjectName
public void setProjectName(String projectName)(Code)
Sets the projectName attribute to the given value.
Parameters:
  projectName - The StarTeam project to search.
See Also:   AntStarTeamCheckOut.getProjectName()



setRecursion
public void setRecursion(boolean recursion)(Code)
Turns recursion on or off.
Parameters:
  recursion - if it is true, the default, subfolders are searchedrecursively for files to check out. Otherwise, only filesspecified by folderName are scanned.
See Also:   AntStarTeamCheckOut.getRecursion()



setServerName
public void setServerName(String serverName)(Code)
Sets the serverName attribute to the given value.
Parameters:
  serverName - The name of the server you wish to connect to.
See Also:   AntStarTeamCheckOut.getServerName()



setServerPort
public void setServerPort(int serverPort)(Code)
Sets the serverPort attribute to the given value. The given value must be a valid integer, but it must be a string object.
Parameters:
  serverPort - A string containing the port on the StarTeam serverto use.
See Also:   AntStarTeamCheckOut.getServerPort()



setTargetFolder
public void setTargetFolder(String targetFolder)(Code)
Sets the targetFolder attribute to the given value.
Parameters:
  targetFolder - The target path on the local machine to check out to.
See Also:   AntStarTeamCheckOut.getTargetFolder()



setTargetFolderAbsolute
public void setTargetFolderAbsolute(boolean targetFolderAbsolute)(Code)
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.
Parameters:
  targetFolderAbsolute - true if the absolute mapping is tobe used. false (the default) if the "default folder" isto be factored in.
See Also:   AntStarTeamCheckOut.getTargetFolderAbsolute()



setUsername
public void setUsername(String username)(Code)
Sets the username attribute to the given value.
Parameters:
  username - Your username for the specified StarTeam server.
See Also:   AntStarTeamCheckOut.getUsername()



setVerbose
public void setVerbose(boolean verbose)(Code)
Sets the verbose attribute to the given value.
Parameters:
  verbose - whether to display all files as it checks them out. Bydefault it is false, so the program only displays the total numberof files unless you override this default.
See Also:   AntStarTeamCheckOut.getVerbose()



setViewName
public void setViewName(String viewName)(Code)
Sets the viewName attribute to the given value.
Parameters:
  viewName - The view to find the specified folder in.
See Also:   AntStarTeamCheckOut.getViewName()



shouldCheckout
protected boolean shouldCheckout(String pName)(Code)
Look if the file should be checked out. Don't check it out if It fits no include filters and It fits an exclude filter.
Parameters:
  pName - the item name to look for being included. whether the file should be checked out or not.



Fields inherited from org.apache.tools.ant.Task
protected Target target(Code)(Java Doc)
protected String taskName(Code)(Java Doc)
protected String taskType(Code)(Java Doc)
protected RuntimeConfigurable wrapper(Code)(Java Doc)

Methods inherited from org.apache.tools.ant.Task
final public void bindToOwner(Task owner)(Code)(Java Doc)
public void execute() throws BuildException(Code)(Java Doc)
public Target getOwningTarget()(Code)(Java Doc)
public RuntimeConfigurable getRuntimeConfigurableWrapper()(Code)(Java Doc)
public String getTaskName()(Code)(Java Doc)
public String getTaskType()(Code)(Java Doc)
protected RuntimeConfigurable getWrapper()(Code)(Java Doc)
protected void handleErrorFlush(String output)(Code)(Java Doc)
protected void handleErrorOutput(String output)(Code)(Java Doc)
protected void handleFlush(String output)(Code)(Java Doc)
protected int handleInput(byte[] buffer, int offset, int length) throws IOException(Code)(Java Doc)
protected void handleOutput(String output)(Code)(Java Doc)
public void init() throws BuildException(Code)(Java Doc)
final protected boolean isInvalid()(Code)(Java Doc)
public void log(String msg)(Code)(Java Doc)
public void log(String msg, int msgLevel)(Code)(Java Doc)
public void log(Throwable t, int msgLevel)(Code)(Java Doc)
public void log(String msg, Throwable t, int msgLevel)(Code)(Java Doc)
public void maybeConfigure() throws BuildException(Code)(Java Doc)
final public void perform()(Code)(Java Doc)
public void reconfigure()(Code)(Java Doc)
public void setOwningTarget(Target target)(Code)(Java Doc)
public void setRuntimeConfigurableWrapper(RuntimeConfigurable wrapper)(Code)(Java Doc)
public void setTaskName(String name)(Code)(Java Doc)
public void setTaskType(String type)(Code)(Java Doc)

w__w_w__.__ja_v___a___2s.__c__om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.