-
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.
refactor defaults file error handling to use factory pattern
- Loading branch information
1 parent
3ee3ddc
commit df092f3
Showing
5 changed files
with
55 additions
and
13 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
9 changes: 9 additions & 0 deletions
9
...se-standard/src/main/java/liquibase/integration/commandline/DefaultsFileErrorHandler.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,9 @@ | ||
package liquibase.integration.commandline; | ||
|
||
import liquibase.plugin.Plugin; | ||
|
||
public interface DefaultsFileErrorHandler extends Plugin { | ||
void fileNotFound(String defaultsFileConfigValue); | ||
|
||
int getPriority(); | ||
} |
19 changes: 19 additions & 0 deletions
19
...dard/src/main/java/liquibase/integration/commandline/DefaultsFileErrorHandlerFactory.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,19 @@ | ||
package liquibase.integration.commandline; | ||
|
||
import liquibase.plugin.AbstractPluginFactory; | ||
|
||
public class DefaultsFileErrorHandlerFactory extends AbstractPluginFactory<DefaultsFileErrorHandler> { | ||
@Override | ||
protected Class<DefaultsFileErrorHandler> getPluginClass() { | ||
return DefaultsFileErrorHandler.class; | ||
} | ||
|
||
@Override | ||
protected int getPriority(DefaultsFileErrorHandler obj, Object... args) { | ||
return obj.getPriority(); | ||
} | ||
|
||
public DefaultsFileErrorHandler getDefaultsFileErrorHandler() { | ||
return getPlugin(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ard/src/main/java/liquibase/integration/commandline/StandardDefaultsFileErrorHandler.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,16 @@ | ||
package liquibase.integration.commandline; | ||
|
||
public class StandardDefaultsFileErrorHandler implements DefaultsFileErrorHandler{ | ||
|
||
|
||
@Override | ||
public void fileNotFound(String defaultsFileConfigValue) { | ||
//can't use UI since it's not configured correctly yet | ||
System.err.println("Could not find defaults file " + defaultsFileConfigValue); | ||
} | ||
|
||
@Override | ||
public int getPriority() { | ||
return PRIORITY_DEFAULT; | ||
} | ||
} |