Skip to content

Commit

Permalink
Merge pull request #2095 from AvintisSolutions/feature/WSO2-212
Browse files Browse the repository at this point in the history
Adding parameters to delay file processing in specific cases
  • Loading branch information
arunans23 authored Aug 22, 2024
2 parents a1f4160 + 4670804 commit ac4ebd5
Show file tree
Hide file tree
Showing 3 changed files with 265 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public final class VFSConstants {
public static final String TRANSPORT_FILE_LOCKING_ENABLED = "enable";
public static final String TRANSPORT_FILE_LOCKING_DISABLED = "disable";

public static final String TRANSPORT_CHECK_SIZE_INTERVAL = "transport.vfs.CheckSizeInterval";
public static final String TRANSPORT_CHECK_SIZE_IGNORE_EMPTY = "transport.vfs.CheckSizeIgnoreEmpty";

/**
* This parameter is used decide whether the resolving hostname IP of URIs are done at deployment or dynamically.
* At usage default id 'false' which lead hostname resolution at deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public class PollTableEntry extends AbstractPollTableEntry {
/** moved file will have this formatted timestamp prefix */
private DateFormat moveTimestampFormat;

/** containing the time in [ms] between the size check on files (to avoid reading files which are currently written) */
private String checkSizeInterval = null;
/** does the checkSize Lock mechanisme take empty files or not, default = false */
private String checkSizeIgnoreEmpty = "false";


private boolean streaming;

private int maxRetryCount;
Expand Down Expand Up @@ -311,6 +317,30 @@ private void setMoveAfterFailure(String moveAfterFailure) throws AxisFault {
}
}

public void setCheckSizeInterval(String checkSizeInterval) {
this.checkSizeInterval = checkSizeInterval;
}

public String getCheckSizeInterval() {
return checkSizeInterval;
}

public boolean hasCheckSizeInterval() {
return (checkSizeInterval != null && checkSizeInterval.length() > 0);
}

public void setCheckSizeIgnoreEmpty(String checkSizeIgnoreEmpty) {
this.checkSizeIgnoreEmpty = checkSizeIgnoreEmpty;
}

public String getCheckSizeIgnoreEmpty() {
return checkSizeIgnoreEmpty;
}

public boolean isCheckSizeIgnoreEmpty() {
return "true".equals(checkSizeIgnoreEmpty);
}

public boolean isStreaming() {
return streaming;
}
Expand Down Expand Up @@ -609,6 +639,17 @@ protected boolean loadConfigurationsFromService(ParameterInclude params) throws
Map<String, String> schemeFileOptions = VFSUtils.parseSchemeFileOptions(fileURI, params);
setVfsSchemeProperties(schemeFileOptions);

//get check size intervall for locking
String checkSizeIntervalString = ParamUtils.getOptionalParam(params, VFSConstants.TRANSPORT_CHECK_SIZE_INTERVAL);
setCheckSizeInterval(checkSizeIntervalString);

//get check size ignore emtpy for locking
String checkSizeIgnoreEmptyString = ParamUtils.getOptionalParam(params, VFSConstants.TRANSPORT_CHECK_SIZE_IGNORE_EMPTY);
//set parameter only if it is set, default value is true
if (checkSizeIgnoreEmptyString != null) {
setCheckSizeIgnoreEmpty(checkSizeIgnoreEmptyString);
}

String strStreaming = ParamUtils.getOptionalParam(params, VFSConstants.STREAMING);
if (strStreaming != null) {
streaming = Boolean.parseBoolean(strStreaming);
Expand Down
Loading

0 comments on commit ac4ebd5

Please sign in to comment.