Skip to content

Commit

Permalink
0003565: Add a new staging.dir parameter that controls the location of
Browse files Browse the repository at this point in the history
the staging area.
  • Loading branch information
chenson42 committed May 16, 2018
1 parent 32bee36 commit 24eb92e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
package org.jumpmind.symmetric;

import static org.apache.commons.lang.StringUtils.isBlank;
import static org.apache.commons.lang.StringUtils.isNotBlank;

import java.io.File;
Expand Down Expand Up @@ -381,20 +382,22 @@ protected IJobManager createJobManager() {

@Override
protected IStagingManager createStagingManager() {
String directory = parameterService.getTempDirectory();
String directory = parameterService.getString(ParameterConstants.STAGING_DIR);
if (isBlank(directory)) {
directory = parameterService.getTempDirectory();
}
String stagingManagerClassName = parameterService.getString(ParameterConstants.STAGING_MANAGER_CLASS);
if (stagingManagerClassName != null) {
try {
Constructor<?> cons = Class.forName(stagingManagerClassName).getConstructor(ISymmetricEngine.class, String.class);
return (IStagingManager) cons.newInstance(this, directory);
} catch (Exception e) {
throw new RuntimeException(e);
}
try {
Constructor<?> cons = Class.forName(stagingManagerClassName).getConstructor(ISymmetricEngine.class, String.class);
return (IStagingManager) cons.newInstance(this, directory);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

return new BatchStagingManager(this, directory);
}


@Override
protected IStatisticManager createStatisticManager() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ private ParameterConstants() {
public final static String UPDATE_SERVICE_CLASS = "update.service.class";

public final static String STAGING_MANAGER_CLASS = "staging.manager.class";

public final static String STAGING_DIR = "staging.dir";

public final static String STATISTIC_MANAGER_CLASS = "statistic.manager.class";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ public String getString(String key) {
}

public String getTempDirectory() {
String engineName = this.getEngineName();
String tmpDirBase = getString("java.io.tmpdir", System.getProperty("java.io.tmpdir"));
String engineName = this.getEngineName();
String tmpDirBase = getString("java.io.tmpdir", System.getProperty("java.io.tmpdir"));

if (StringUtils.trimToNull(engineName) == null) {
return tmpDirBase;
} else {
return tmpDirBase+File.separator+engineName;
}
if (StringUtils.trimToNull(engineName) == null) {
return tmpDirBase;
} else {
return tmpDirBase + File.separator + engineName;
}
}

protected abstract TypedProperties rereadApplicationParameters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2222,3 +2222,10 @@ treat.binary.as.lob.enabled=true
# Type: boolean
# Tags: other
right.trim.char.values=false


# This is the location the staging directory will be put. If it isn't set the staging directory will be located according to java.io.tmpdir.
#
# DatabaseOverridable: false
# Tags: init
staging.dir=

0 comments on commit 24eb92e

Please sign in to comment.