public class Copy extends AbstractCommand
If md5 is set then the copy command will be validated only if the target file has the same md5 as the one specified in the command.
The Copy command has as inverse either Delete either another Copy command. If the file was copied without overwriting then Delete is the inverse (with a md5 set to the one of the copied file). If the file was overwritten then the inverse of Copy command is another copy command with the md5 to the one of the copied file and the overwrite flag to true. The file to copy will be the backup of the overwritten file.
Modifier and Type | Field and Description |
---|---|
protected boolean |
append |
protected File |
file
The source file.
|
static String |
ID |
protected static String |
LAUNCHER_CHANGED_PROPERTY |
protected static String |
LAUNCHER_JAR |
protected static org.apache.commons.logging.Log |
log |
protected String |
md5 |
protected boolean |
overwrite |
protected boolean |
removeOnExit |
protected File |
tofile
The target file.
|
fail, guardVars, id, ignore
Modifier | Constructor and Description |
---|---|
|
Copy() |
|
Copy(File file,
File tofile,
String md5,
boolean overwrite) |
|
Copy(File file,
File tofile,
String md5,
boolean overwrite,
boolean removeOnExit) |
protected |
Copy(String id) |
protected |
Copy(String id,
File file,
File tofile,
String md5,
boolean overwrite,
boolean removeOnExit) |
Modifier and Type | Method and Description |
---|---|
protected org.nuxeo.connect.update.task.Command |
doCopy(org.nuxeo.connect.update.task.Task task,
Map<String,String> prefs,
File fileToCopy,
File dst,
boolean doOverwrite) |
protected org.nuxeo.connect.update.task.Command |
doRun(org.nuxeo.connect.update.task.Task task,
Map<String,String> prefs)
Override to implement command actions
|
protected void |
doValidate(org.nuxeo.connect.update.task.Task task,
org.nuxeo.connect.update.ValidationStatus status)
Override to implement validation.
|
protected String |
getContentToCopy(File fileToCopy,
Map<String,String> prefs)
Override in subclass to parameterize content.
|
protected String |
getContentToCopy(Map<String,String> prefs)
Deprecated.
Since 5.5, use
getContentToCopy(File, Map) . This method is missing the fileToCopy reference.
Using file is leading to errors. |
void |
readFrom(Element element)
Must be implemented to initialize the command arguments from an XML fragment.
|
void |
writeTo(org.nuxeo.connect.update.xml.XmlWriter writer) |
getId, ignore, initialize, isPostInstall, run, setFail, setIgnore, setPackageUpdateService, validate
protected static final org.apache.commons.logging.Log log
public static final String ID
protected static final String LAUNCHER_JAR
protected static final String LAUNCHER_CHANGED_PROPERTY
protected boolean overwrite
protected boolean removeOnExit
protected boolean append
public Copy()
protected org.nuxeo.connect.update.task.Command doRun(org.nuxeo.connect.update.task.Task task, Map<String,String> prefs) throws org.nuxeo.connect.update.PackageException
AbstractCommand
doRun
in class AbstractCommand
org.nuxeo.connect.update.PackageException
protected org.nuxeo.connect.update.task.Command doCopy(org.nuxeo.connect.update.task.Task task, Map<String,String> prefs, File fileToCopy, File dst, boolean doOverwrite) throws org.nuxeo.connect.update.PackageException
doOverwrite
- org.nuxeo.connect.update.PackageException
protected String getContentToCopy(File fileToCopy, Map<String,String> prefs) throws org.nuxeo.connect.update.PackageException
prefs
- append
parameter to determine if returned content is
replacing or appending to destination file.org.nuxeo.connect.update.PackageException
@Deprecated protected String getContentToCopy(Map<String,String> prefs) throws org.nuxeo.connect.update.PackageException
getContentToCopy(File, Map)
. This method is missing the fileToCopy reference.
Using file
is leading to errors.org.nuxeo.connect.update.PackageException
protected void doValidate(org.nuxeo.connect.update.task.Task task, org.nuxeo.connect.update.ValidationStatus status) throws org.nuxeo.connect.update.PackageException
AbstractCommand
doValidate
in class AbstractCommand
task
- The task being validatedstatus
- Use ValidationStatus.addError(String)
or ValidationStatus.addWarning(String)
to
provide validation error/warning messagesorg.nuxeo.connect.update.PackageException
public void readFrom(Element element) throws org.nuxeo.connect.update.PackageException
AbstractCommand
readFrom
in class AbstractCommand
org.nuxeo.connect.update.PackageException
public void writeTo(org.nuxeo.connect.update.xml.XmlWriter writer)
Copyright © 2019 Nuxeo. All rights reserved.