Class PatchBuilderAdapter
- java.lang.Object
-
- jetbrains.buildServer.vcs.patches.PatchBuilderAdapter
-
- All Implemented Interfaces:
PatchBuilder
public class PatchBuilderAdapter extends Object implements PatchBuilder
-
-
Constructor Summary
Constructors Constructor Description PatchBuilderAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeOrCreateBinaryFile(File file, String fileMode, InputStream input, long length)
Invoke this method if some binary file content has been changed or binary file has been created in the next version as compared with the previous one.void
changeOrCreateTextFile(File localFile, String fileMode, InputStream input, long length, byte[] lineSeparator)
Invoke this method if some text file content has been changed or text file has been created in the next version as compared with the previous one.void
createBinaryFile(File relativeFile, String fileMode, InputStream input, long length)
Invoke this method if some binary file content has been created in the next version as compared with the previous one.void
createDirectory(File file)
Invoke this method if some directory has been created in the next version as compared with the previous one.void
createTextFile(File relativeFile, String fileMode, InputStream input, long length, byte[] lineSeparator)
Invoke this method if some text file has been created in the next version as compared with the previous one.void
deleteDirectory(File file, boolean deleteParentDirectoryIfEmpty)
Invoke this method if some directory has been deleted in the next version as compared with the previous one.void
deleteFile(File file, boolean deleteParentDirectoryIfEmpty)
Invoke this method if some file has been deleted in the next version as compared with the previous one.void
renameDirectory(File file, File newFile, boolean deleteParentDirectoryIfEmpty)
Invoke this method if some directory has been renamed in the next version as compared with the previous one.void
renameFile(File file, File newFile, boolean deleteParentDirectoryIfEmpty)
Invoke this method if some file has been renamed in the next version as compared with the previous one.void
setLastModified(File currentRelativeFile, long time)
Set last modified timestamp for filevoid
setWorkingDirectory(File workingDir, boolean createDirectory)
Allows you to switch on to the specified directory keeping old content of this directory.
-
-
-
Method Detail
-
deleteFile
public void deleteFile(@NotNull File file, boolean deleteParentDirectoryIfEmpty) throws IOException
Description copied from interface:PatchBuilder
Invoke this method if some file has been deleted in the next version as compared with the previous one.- Specified by:
deleteFile
in interfacePatchBuilder
- Parameters:
file
- file relative to the current working directory.deleteParentDirectoryIfEmpty
- pass true if you want patcher to delete parent directory if it became empty after the deletion.- Throws:
IOException
- thrown if patch collecting process failed.
-
changeOrCreateTextFile
public void changeOrCreateTextFile(@NotNull File localFile, String fileMode, @NotNull InputStream input, long length, byte[] lineSeparator) throws IOException
Description copied from interface:PatchBuilder
Invoke this method if some text file content has been changed or text file has been created in the next version as compared with the previous one.- Specified by:
changeOrCreateTextFile
in interfacePatchBuilder
- Parameters:
localFile
- file relative to the current working directoryfileMode
- file mode in the linux style. If it doesn't matter for you set it to null. Set this parameter to not null if its value changes something, for example, pass "ugo+x" if you want the file to be executable and null otherwise. It is performance issue because set file mode will create a lot of processes on the Linux.input
- input stream containing the file content. This stream is guaranteed to be utilized within the call. So it can be safely closed/destroyed right after the invocation.length
- length of the content.lineSeparator
- text content line separator. Set null if you want to use system dependant separators. Use "changeOrCreateBinaryFile" if you want file to keep existing separators.- Throws:
IOException
- thrown if patch collecting process failed.
-
changeOrCreateBinaryFile
public void changeOrCreateBinaryFile(@NotNull File file, String fileMode, @NotNull InputStream input, long length) throws IOException
Description copied from interface:PatchBuilder
Invoke this method if some binary file content has been changed or binary file has been created in the next version as compared with the previous one. This method can be used for text file also if you want to keep existing line separators inside the file.- Specified by:
changeOrCreateBinaryFile
in interfacePatchBuilder
- Parameters:
file
- file relative to the current working directory.fileMode
- file mode in the linux style. If it doesn't matter for you set it to null. Set this parameter to not null if its value changes something, for example, pass "ugo+x" if you want the file to be executable and null otherwise. It is performance issue because set file mode will create a lot of processes on the Linux.input
- input stream containing the file content. This stream is guaranteed to be utilized within the call. So it can be safely closed/destroyed right after the invocation.length
- length of the content.- Throws:
IOException
- thrown if patch collecting process failed.
-
deleteDirectory
public void deleteDirectory(@NotNull File file, boolean deleteParentDirectoryIfEmpty) throws IOException
Description copied from interface:PatchBuilder
Invoke this method if some directory has been deleted in the next version as compared with the previous one.- Specified by:
deleteDirectory
in interfacePatchBuilder
- Parameters:
file
- directory relative to the current working directory.deleteParentDirectoryIfEmpty
- pass true if you want patcher to delete parent directory if it became empty after the deletion.- Throws:
IOException
- thrown if patch collecting process failed.
-
createDirectory
public void createDirectory(@NotNull File file) throws IOException
Description copied from interface:PatchBuilder
Invoke this method if some directory has been created in the next version as compared with the previous one.- Specified by:
createDirectory
in interfacePatchBuilder
- Parameters:
file
- file relative to the current working directory.- Throws:
IOException
- thrown if patch collecting process failed.
-
createBinaryFile
public void createBinaryFile(@NotNull File relativeFile, String fileMode, @NotNull InputStream input, long length)
Description copied from interface:PatchBuilder
Invoke this method if some binary file content has been created in the next version as compared with the previous one. This method can be used for text file also if you want to keep existing line separators inside the file.- Specified by:
createBinaryFile
in interfacePatchBuilder
- Parameters:
relativeFile
- file relative to the current working directory.fileMode
- file mode in the linux style. If it doesn't matter for you set it to null. Set this parameter to not null if its value changes something, for example, pass "ugo+x" if you want the file to be executable and null otherwise. It is performance issue because set file mode will create a lot of processes on the Linux.input
- input stream containing the file content. This stream is guaranteed to be utilized within the call. So it can be safely closed/destroyed right after the invocation.length
- length of the content.
-
createTextFile
public void createTextFile(@NotNull File relativeFile, String fileMode, @NotNull InputStream input, long length, byte[] lineSeparator)
Description copied from interface:PatchBuilder
Invoke this method if some text file has been created in the next version as compared with the previous one.- Specified by:
createTextFile
in interfacePatchBuilder
- Parameters:
relativeFile
- file relative to the current working directoryfileMode
- file mode in the linux style. If it doesn't matter for you set it to null. Set this parameter to not null if its value changes something, for example, pass "ugo+x" if you want the file to be executable and null otherwise. It is performance issue because set file mode will create a lot of processes on the Linux.input
- input stream containing the file content. This stream is guaranteed to be utilized within the call. So it can be safely closed/destroyed right after the invocation.length
- length of the content.lineSeparator
- text content line separator. Set null if you want to use system dependant separators. Use "createBinaryFile" if you want file to keep existing separators.
-
setWorkingDirectory
public void setWorkingDirectory(@NotNull File workingDir, boolean createDirectory) throws IOException
Description copied from interface:PatchBuilder
Allows you to switch on to the specified directory keeping old content of this directory.- Specified by:
setWorkingDirectory
in interfacePatchBuilder
- Parameters:
workingDir
- new working directory. Path relative to the initial directory, not to the current one.createDirectory
- if directory should be created on file system if specified directory is absent.- Throws:
IOException
- thrown if patch collecting process failed.
-
renameFile
public void renameFile(@NotNull File file, @NotNull File newFile, boolean deleteParentDirectoryIfEmpty) throws IOException
Description copied from interface:PatchBuilder
Invoke this method if some file has been renamed in the next version as compared with the previous one.- Specified by:
renameFile
in interfacePatchBuilder
- Parameters:
file
- file relative to the current working directory.newFile
- new file locationdeleteParentDirectoryIfEmpty
- pass true if you want patcher to delete parent directory if it becomes empty after the deletion.- Throws:
IOException
- thrown if patch collecting process failed.
-
renameDirectory
public void renameDirectory(@NotNull File file, @NotNull File newFile, boolean deleteParentDirectoryIfEmpty) throws IOException
Description copied from interface:PatchBuilder
Invoke this method if some directory has been renamed in the next version as compared with the previous one.- Specified by:
renameDirectory
in interfacePatchBuilder
- Parameters:
file
- directory relative to the current working directory.newFile
- new directory locationdeleteParentDirectoryIfEmpty
- pass true if you want patcher to delete parent directory if it becomes empty after the deletion. @throws IOException- Throws:
IOException
- thrown if patch collecting process failed.
-
setLastModified
public void setLastModified(@NotNull File currentRelativeFile, long time) throws IOException
Description copied from interface:PatchBuilder
Set last modified timestamp for file- Specified by:
setLastModified
in interfacePatchBuilder
- Parameters:
currentRelativeFile
- relative filetime
- last modified timestamp- Throws:
IOException
- in case of error
-
-