-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use PathHandler for writing log files, which allows using S3 and othe…
…r extensions (DAT-11515) (#3339) Create log files using the PathHandler interfaces. Add support for different OpenOptions for resources, like appending and truncating existing files.
- Loading branch information
1 parent
b5ce942
commit a244353
Showing
18 changed files
with
148 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
liquibase-core/src/main/java/liquibase/resource/OpenOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package liquibase.resource; | ||
|
||
/** | ||
* Defines the options for opening {@link Resource}s in Liquibase. | ||
*/ | ||
public class OpenOptions { | ||
private boolean truncate; | ||
private boolean createIfNeeded; | ||
|
||
/** | ||
* Use default options of truncate = true, createIfNeeded = true; | ||
*/ | ||
public OpenOptions() { | ||
this.truncate = true; | ||
this.createIfNeeded = true; | ||
} | ||
|
||
/** | ||
* Should an existing file be truncated when opened. Both this and {@link #isAppend()} | ||
* are automatically kept in sync with each other. | ||
*/ | ||
public boolean isTruncate() { | ||
return truncate; | ||
} | ||
|
||
public OpenOptions setTruncate(boolean truncate) { | ||
this.truncate = truncate; | ||
return this; | ||
} | ||
|
||
/** | ||
* Should an existing file be appended to when opened. Both this and {@link #isTruncate()} | ||
* are automatically kept in sync with each other. | ||
*/ | ||
public boolean isAppend() { | ||
return !isTruncate(); | ||
} | ||
|
||
public OpenOptions setAppend(boolean append) { | ||
this.truncate = !append; | ||
return this; | ||
} | ||
|
||
/** | ||
* If true, create the resource if it does not exist. If false, do not create the resource. | ||
*/ | ||
public boolean isCreateIfNeeded() { | ||
return createIfNeeded; | ||
} | ||
|
||
public OpenOptions setCreateIfNeeded(boolean createIfNeeded) { | ||
this.createIfNeeded = createIfNeeded; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.