AntXtras/Svn4Ant-1.1.0

com.idaremedia.svn4ant.client.solo
Class SvnCatTask

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended bycom.idaremedia.antx.AssertableTask
              extended bycom.idaremedia.svn4ant.TaskSkeleton
                  extended bycom.idaremedia.svn4ant.client.ClientTaskSkeleton
                      extended bycom.idaremedia.svn4ant.client.solo.BaseTask
                          extended bycom.idaremedia.svn4ant.client.solo.IncomingTask
                              extended bycom.idaremedia.svn4ant.client.solo.SvnCatTask
All Implemented Interfaces:
Cloneable, com.idaremedia.antx.apis.ProjectDependent, com.idaremedia.antx.parameters.RecoveryEnabled, com.idaremedia.antx.apis.ScriptLocatable, SvnOptions.All, SvnOptions.Base

public final class SvnCatTask
extends IncomingTask

Ant task for the "svn cat" subcommand. To save a single item's contents it is easiest to use the shortcut inlined parameters to define the source item. For multiple items, or to specify a post-download filter, you must use the nested <item> elements. For working copy-based sources, the default revision is the WORKING revision (the local edits); for repository based sources, the default revision is the HEAD revision. Use the 'revision' parameter (and optional peg revisions) to define other choices.

Example Usage:

   <svncat username="build" password="build-secret"
      from="svn://svn.lab/myproject/trunk/build/modulelist"/>

   <svncat username="build" password="build-secret"
      from="/nightlybuilds/myproject/build/modulelist" revision="${rev}"/>

   <svncat credential="repo" from="docs/README@${pegrev}"
      toproperty="readme.txt" keywords="no"/>

   <svncat workingcopy="${pristine.dir}/docs" revision="${rev}">
      <item from="README" tofile="${tmp}/README"/>
      <item from="LICENSE" tofile="${tmp}/LICENSE"/>
      <item from="RELEASENOTES,in" tofile="${tmp}/RELEASENOTES">
        <filterchain>
          <expandproperties/>
        </filterchain>
      </item>
   </svncat>

   <svncat credential="repo.dev" haltiferror="no" feedback="none">
      <item from="README" tovariable="readme.txt"/>
      <item from="CHANGELOG" tovariable="changelog.txt"/>
   </svncat>
 

Since:
JWare/Svn4Ant 0.1
Author:
ssmc, ©2006-2008 SSMC
Thread Safety:
single

Field Summary
 
Fields inherited from class com.idaremedia.svn4ant.client.solo.BaseTask
m_opts, m_revProperty
 
Fields inherited from class com.idaremedia.svn4ant.TaskSkeleton
m_rqlink
 
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
SvnCatTask()
          Initializes a new svncat command instance.
 
Method Summary
 void addConfiguredItem(ContentInstruction item)
          Adds a new item to this cat command.
 void execute()
          Tries to concatenate one or more items to the named output sinks.
protected  String getSubcommandCN()
          Returns "cat" always.
 void setAppend(boolean append)
          Tells this task to append captured information to an existing store.
 void setFrom(String urlOrWCpath)
          Sets the location of the item to be fetched.
 void setKeywords(boolean expand)
          Tells this command whether subversion should try expanding special keyword markers in text based files.
 void setRevision(String revid)
          Defines the source revision to concatenate.
 void setToFile(File tofile)
          Sets the file where this command saves item content.
 void setToProperty(String property)
          Sets the property where this command saves item content.
 void setToReference(String refid)
          Sets the project reference where this command saves item content.
 void setToVariable(String variable)
          Sets the variable where this command saves item content.
 void setWorkingCopy(String wcpath)
          Tells this command to get it's repository information from a local working copy instead of the named credential.
protected  void verifyCanExecute_(String calr)
          Ensures that any inlined shortcut item has all its required fields defined.
 
Methods inherited from class com.idaremedia.svn4ant.client.solo.IncomingTask
revision, revision, tickleWorkingCopy, updateCompleted
 
Methods inherited from class com.idaremedia.svn4ant.client.solo.BaseTask
finalUrl, finalUrl, force, ignoreexternals, linkVerboseFeedback, recurse, repositoryUrl, setAuthCache, setConfigDir, setCredential, setPassword, setRevisionProperty, setStrict, setUsername, strict, updateOnlyUrl, updateOnlyWorkingCopy, updateSearch, verifyWorkingCopyOrUrl, workingCopy
 
Methods inherited from class com.idaremedia.svn4ant.TaskSkeleton
getFailProperty, getFailVariable, getFeedbackLevel, isHaltIfError, problemOccured, problemOccured, setFailProperty, setFailVariable, setFeedback, setHaltIfError, toRequester
 
Methods inherited from class com.idaremedia.antx.AssertableTask
checkIfProperty_, checkIfReference_, cvlabel_, ensure_, getAntXMsg, getAntXMsg, getAntXMsg, getAntXMsg, getDefaultMsgLevel, getMsg, getMsg, getMsg, getMsgId, getReferencedObject, getUISM, getUISMArgs, ignoreProjectProperties, init, initonce, log, maybeConfigure, newMsgGetter, newMsgGetter, newMsgGetter, reconfigure, require_, setIgnoreProjectProperties, setMsgId, syncChildTargetIfNull, uistrs, unconfigure, unexpected_, verify_, verifyInProject_, verifyInTarget_
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, perform, 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
 
Methods inherited from interface com.idaremedia.svn4ant.client.SvnOptions.All
setFailProperty, setFailVariable, setFeedback
 
Methods inherited from interface com.idaremedia.antx.parameters.RecoveryEnabled
isHaltIfError, setHaltIfError
 
Methods inherited from interface com.idaremedia.antx.apis.ProjectDependent
getProject, setProject
 
Methods inherited from interface com.idaremedia.antx.apis.ScriptLocatable
getLocation
 

Constructor Detail

SvnCatTask

public SvnCatTask()
Initializes a new svncat command instance.

Method Detail

getSubcommandCN

protected String getSubcommandCN()
Returns "cat" always.

Specified by:
getSubcommandCN in class BaseTask
See Also:
SvnCommandName

addConfiguredItem

public void addConfiguredItem(ContentInstruction item)
Adds a new item to this cat command. Items are self-contained instructions that share the same repository connection (including credential).

Parameters:
item - the item to concatenate (non-null)
Throws:
org.apache.tools.ant.BuildException - if item is malformed (missing required 'from' field).
org.apache.tools.ant.BuildException - if a shortcut item is already defined.

setKeywords

public void setKeywords(boolean expand)
Tells this command whether subversion should try expanding special keyword markers in text based files. Defaults to "yes" if not set explicitly.

Parameters:
expand - false to disable keyword expansion.

setRevision

public void setRevision(String revid)
Defines the source revision to concatenate.

Parameters:
revid - the source revision (non-null)

setWorkingCopy

public void setWorkingCopy(String wcpath)
Tells this command to get it's repository information from a local working copy instead of the named credential. All nested items are assumed to be items relative to the working copy!

Parameters:
wcpath - path to the local working copy
Throws:
org.apache.tools.ant.BuildException - if named path is not a versioned directory.

setFrom

public void setFrom(String urlOrWCpath)
Sets the location of the item to be fetched. Incoming string is either a path to local working copy or a url to remote repository item.

Parameters:
urlOrWCpath - either a path to local working copy or a repository url
Throws:
org.apache.tools.ant.BuildException - if at least one nested item is already defined.

setToFile

public void setToFile(File tofile)
Sets the file where this command saves item content.

Parameters:
tofile - file into which all content saved (non-null)

setToProperty

public void setToProperty(String property)
Sets the property where this command saves item content.

Parameters:
property - name of property (non-null)

setToVariable

public void setToVariable(String variable)
Sets the variable where this command saves item content.

Parameters:
variable - name of variable (non-null)

setToReference

public void setToReference(String refid)
Sets the project reference where this command saves item content.

Parameters:
refid - name of project reference (non-null)

setAppend

public void setAppend(boolean append)
Tells this task to append captured information to an existing store.

Parameters:
append - true to append property content to existing store.

verifyCanExecute_

protected void verifyCanExecute_(String calr)
Ensures that any inlined shortcut item has all its required fields defined. Also if only a working copy is defined, there must be at least one nested <item> element.

Throws:
org.apache.tools.ant.BuildException - if inlined parameter missing 'from' field.

execute

public void execute()
Tries to concatenate one or more items to the named output sinks.

Throws:
org.apache.tools.ant.BuildException - if unable to download file contents and our haltiferror option is enabled.

AntXtras/Svn4Ant-1.1.0

Copyright (c) 2005-2008 Sandbox Software MC. All Rights Reserved.