![]() |
filechampion4j 0.9.8.3
File validation library for Java
|
Public Member Functions | |
CliPluginHelper (StepConfig singleStepConfig) | |
Map< String, Map< String, String > > | execute (String fileExtension, byte[] fileContent) |
Private Member Functions | |
void | logFine (String message) |
void | logWarn (String message) |
Map< String, String > | extractResponsePatterns (String results) |
void | prepEndpoint (String filePath, byte[] fileContent) |
String | timedProcessExecution (String command) throws IOException, InterruptedException, NullPointerException |
Path | saveFileToTempDir (String fileExtension, byte[] originalFile) |
Boolean | deleteTempDir (Path tempFilePath) |
String | calculateChecksum (byte[] fileBytes, String checksumAlgorithm) |
Private Attributes | |
StepConfig | singleStepConfig |
int | timeout |
String | errString = "Error: " |
String | endpoint |
String | responseConfig |
StringBuilder | logMessage = new StringBuilder() |
Static Private Attributes | |
static final Logger | LOGGER = Logger.getLogger(CliPluginHelper.class.getName()) |
CliPluginHelper class is used to execute CLI commands Defined in the FileChampion Plugins. The class is responsible for injecting file path/content/hash into the CLI command, execute the command, and process the results.
Definition at line 30 of file CliPluginHelper.java.
dev.filechampion.filechampion4j.CliPluginHelper.CliPluginHelper | ( | StepConfig | singleStepConfig | ) |
Constructor for CliPluginHelper
singleStepConfig | (StepConfig) - the step configuration |
Definition at line 53 of file CliPluginHelper.java.
References dev.filechampion.filechampion4j.PluginsHelper.StepConfig.getEndpoint(), dev.filechampion.filechampion4j.PluginsHelper.StepConfig.getName(), dev.filechampion.filechampion4j.PluginsHelper.StepConfig.getResponse(), dev.filechampion.filechampion4j.PluginsHelper.StepConfig.getTimeout(), dev.filechampion.filechampion4j.CliPluginHelper.logFine(), dev.filechampion.filechampion4j.CliPluginHelper.logMessage, and dev.filechampion.filechampion4j.CliPluginHelper.singleStepConfig.
|
private |
Calculate the checksum of the file
fileBytes | (byte[]) the file bytes of the file being validated |
Definition at line 293 of file CliPluginHelper.java.
References dev.filechampion.filechampion4j.CalculateChecksum.getChecksum().
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.prepEndpoint().
|
private |
Deletes the temporary directory
tempFilePath | (Path) - the path to the temporary directory |
Definition at line 275 of file CliPluginHelper.java.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.execute().
Map< String, Map< String, String > > dev.filechampion.filechampion4j.CliPluginHelper.execute | ( | String | fileExtension, |
byte[] | fileContent | ||
) |
Executes the CLI command
fileExtension | (String) - the file extension |
fileContent | (byte[]) - the file content |
Definition at line 68 of file CliPluginHelper.java.
References dev.filechampion.filechampion4j.CliPluginHelper.deleteTempDir(), dev.filechampion.filechampion4j.CliPluginHelper.endpoint, dev.filechampion.filechampion4j.CliPluginHelper.errString, dev.filechampion.filechampion4j.CliPluginHelper.extractResponsePatterns(), dev.filechampion.filechampion4j.PluginsHelper.StepConfig.getName(), dev.filechampion.filechampion4j.CliPluginHelper.logFine(), dev.filechampion.filechampion4j.CliPluginHelper.logMessage, dev.filechampion.filechampion4j.CliPluginHelper.prepEndpoint(), dev.filechampion.filechampion4j.CliPluginHelper.responseConfig, dev.filechampion.filechampion4j.CliPluginHelper.saveFileToTempDir(), dev.filechampion.filechampion4j.CliPluginHelper.singleStepConfig, and dev.filechampion.filechampion4j.CliPluginHelper.timedProcessExecution().
|
private |
Extracts the response patterns from the results
results | (String) - the results |
Definition at line 116 of file CliPluginHelper.java.
References dev.filechampion.filechampion4j.CliPluginHelper.logFine(), dev.filechampion.filechampion4j.CliPluginHelper.logMessage, and dev.filechampion.filechampion4j.CliPluginHelper.responseConfig.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.execute().
|
private |
Definition at line 38 of file CliPluginHelper.java.
References dev.filechampion.filechampion4j.CliPluginHelper.LOGGER.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.CliPluginHelper(), dev.filechampion.filechampion4j.CliPluginHelper.execute(), dev.filechampion.filechampion4j.CliPluginHelper.extractResponsePatterns(), and dev.filechampion.filechampion4j.CliPluginHelper.timedProcessExecution().
|
private |
Definition at line 43 of file CliPluginHelper.java.
References dev.filechampion.filechampion4j.CliPluginHelper.LOGGER.
|
private |
Prepares the endpoint command by replacing the placeholders with the actual values
filePath | (String) - the path to the file |
fileContent | (byte[]) - the file content |
Definition at line 173 of file CliPluginHelper.java.
References dev.filechampion.filechampion4j.CliPluginHelper.calculateChecksum(), and dev.filechampion.filechampion4j.CliPluginHelper.endpoint.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.execute().
|
private |
Saves the file to a temporary directory
fileExtension | (String) - the file extension |
originalFile | (byte[]) - the file content |
Definition at line 255 of file CliPluginHelper.java.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.execute().
|
private |
Executes the CLI command with a timeout
command | (String) - the command to execute |
IOException | |
InterruptedException | |
NullPointerException |
Definition at line 192 of file CliPluginHelper.java.
References dev.filechampion.filechampion4j.CliPluginHelper.logFine(), and dev.filechampion.filechampion4j.CliPluginHelper.logMessage.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.execute().
|
private |
Definition at line 34 of file CliPluginHelper.java.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.execute(), and dev.filechampion.filechampion4j.CliPluginHelper.prepEndpoint().
|
private |
Definition at line 33 of file CliPluginHelper.java.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.execute().
|
staticprivate |
Definition at line 37 of file CliPluginHelper.java.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.logFine(), and dev.filechampion.filechampion4j.CliPluginHelper.logWarn().
|
private |
Definition at line 36 of file CliPluginHelper.java.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.CliPluginHelper(), dev.filechampion.filechampion4j.CliPluginHelper.execute(), dev.filechampion.filechampion4j.CliPluginHelper.extractResponsePatterns(), and dev.filechampion.filechampion4j.CliPluginHelper.timedProcessExecution().
|
private |
Definition at line 35 of file CliPluginHelper.java.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.execute(), and dev.filechampion.filechampion4j.CliPluginHelper.extractResponsePatterns().
|
private |
Definition at line 31 of file CliPluginHelper.java.
Referenced by dev.filechampion.filechampion4j.CliPluginHelper.CliPluginHelper(), and dev.filechampion.filechampion4j.CliPluginHelper.execute().
|
private |
Definition at line 32 of file CliPluginHelper.java.