com.perforce.p4java.ant.tasks
Class AddTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.perforce.p4java.ant.tasks.PerforceTask
              extended by com.perforce.p4java.ant.tasks.ServerTask
                  extended by com.perforce.p4java.ant.tasks.ClientTask
                      extended by com.perforce.p4java.ant.tasks.AddTask
All Implemented Interfaces:
java.lang.Cloneable

public class AddTask
extends ClientTask

Opens new files for adding to the depot. If the files exist on the client they are read to determine if they are text or binary. If the file type cannot be determined then it is assumed to be text.

See Also:
PerforceTask, ClientTask

Nested Class Summary
 
Nested classes/interfaces inherited from class com.perforce.p4java.ant.tasks.ServerTask
ServerTask.GlobalOption
 
Nested classes/interfaces inherited from class com.perforce.p4java.ant.tasks.PerforceTask
PerforceTask.Field, PerforceTask.File
 
Field Summary
protected  java.lang.String changelist
          If positive, the opened files are put into the pending changelist identified by changelistId (this changelist must have been previously created for this to succeed).
protected  java.lang.String fileType
          If null, it looks for a filetype using the name-to-type mapping table managed by 'p4 typemap'.
protected  boolean noUpdate
          If true, it lists what would be opened for add without actually changing any files or metadata.
protected  boolean useWildcards
          If true, filenames that contain wildcards are permitted.
 
Fields inherited from class com.perforce.p4java.ant.tasks.ClientTask
p4Client
 
Fields inherited from class com.perforce.p4java.ant.tasks.ServerTask
allHosts, commandOptions, globaloptions, hostName, P4_SERVER_PROTOCOL_PROPERTIES_FILE, P4_SERVER_USAGE_PROPERTIES_FILE, p4Server, programName, programVersion, protocolPropertiesFile, protocolProps, textLanguage, unsetClientName, unsetUserName, usagePropertiesFile, usageProps, workingDirectory
 
Fields inherited from class com.perforce.p4java.ant.tasks.PerforceTask
charset, client, failOnError, fields, FILE_TOKEN_REGEX_PATTERN, fileList, files, fileSpecs, LINE_PADDING, LINE_SEPARATOR, p4Messages, passwd, port, protocol, retFileSpecs, retStatusMessage, user
 
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
AddTask()
          Default constructor.
 
Method Summary
protected  void execP4Command()
          Execute the Perforce add command with file specs and options.
 void setChangelist(java.lang.String changelist)
          Sets the changelist.
 void setFileType(java.lang.String fileType)
          Sets the file type.
 void setNoUpdate(boolean noUpdate)
          Sets the no update.
 void setUseWildcards(boolean useWildcards)
          Sets the use wildcards.
 
Methods inherited from class com.perforce.p4java.ant.tasks.ClientTask
cleanupP4, getP4Client, initP4, setP4Client
 
Methods inherited from class com.perforce.p4java.ant.tasks.ServerTask
cleanupP4Server, createGlobalOption, getGlobalOptions, getP4Server, initP4Server, initP4ServerOptions, setAllHosts, setHostName, setP4Server, setProgramName, setProgramVersion, setProtocolPropertiesFile, setProtocolProps, setTextLanguage, setUnsetClientName, setUnsetUserName, setUsagePropertiesFile, setUsageProps, setWorkingDirectory
 
Methods inherited from class com.perforce.p4java.ant.tasks.PerforceTask
addFileset, createField, createFile, execute, getFields, getFiles, getFileSpecs, getRetFileSpecs, getRetStatusMessage, init, isEmpty, logChangelistSummaries, logChangelistSummary, logExtendedFileSpec, logExtendedFileSpecs, logFileDiff, logFileDiffs, logFileLineMatch, logFileLineMatches, logFileSpec, logFileSpecs, logFix, logFixes, logJob, logJobs, parseChangelist, setCharset, setClient, setFailOnError, setFiles, setPasswd, setPort, setProtocol, setUser
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, 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

changelist

protected java.lang.String changelist
If positive, the opened files are put into the pending changelist identified by changelistId (this changelist must have been previously created for this to succeed). If zero or negative, the file is opened in the 'default' (unnumbered) changelist.


noUpdate

protected boolean noUpdate
If true, it lists what would be opened for add without actually changing any files or metadata.


fileType

protected java.lang.String fileType
If null, it looks for a filetype using the name-to-type mapping table managed by 'p4 typemap'. It senses the filetype by examining the file's contents and execute permission bit. If non-null, the files are added as that filetype.


useWildcards

protected boolean useWildcards
If true, filenames that contain wildcards are permitted. Filenames added to the repository that contain these special wildcard characters '@', '#', '%' or '*' will have those characters formatted into ascii hexadecimal representation. The only way of referring to those files once added will be to use the formatted version, the local filesystem name will not be recognized.

Constructor Detail

AddTask

public AddTask()
Default constructor.

Method Detail

setNoUpdate

public void setNoUpdate(boolean noUpdate)
Sets the no update.

Parameters:
noUpdate - the new no update

setChangelist

public void setChangelist(java.lang.String changelist)
Sets the changelist.

Parameters:
changelist - the new changelist

setFileType

public void setFileType(java.lang.String fileType)
Sets the file type.

Parameters:
fileType - the new file type

setUseWildcards

public void setUseWildcards(boolean useWildcards)
Sets the use wildcards.

Parameters:
useWildcards - the new use wildcards

execP4Command

protected void execP4Command()
                      throws org.apache.tools.ant.BuildException
Execute the Perforce add command with file specs and options. Log the returned file specs.

Open one or more Perforce client workspace files for adding to the Perforce server.

Specified by:
execP4Command in class PerforceTask
Throws:
org.apache.tools.ant.BuildException - the build exception
See Also:
PerforceTask.execP4Command()


Copyright (c) 2010 Perforce Software. All rights reserved.