-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for passphraseEnvVar and passphraseCmdLine in DBConnectio…
…n and IndexRebuild
- Loading branch information
Showing
41 changed files
with
5,933 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,13 +25,15 @@ | |
import org.apache.tools.ant.types.Environment; | ||
|
||
/** | ||
* Class for creating Progress databases | ||
* IndexRebuild task | ||
* | ||
* @author <a href="mailto:[email protected]">Gilles QUERRET </a> | ||
*/ | ||
public class PCTIndexRebuild extends PCT { | ||
private File dbDir = null; | ||
private String dbName = null; | ||
private String passphraseEnvVar = null; | ||
private String passphraseCmdLine = null; | ||
private File outputLog = null; | ||
private List<IndexNode> indexes = new ArrayList<>(); | ||
private String cpInternal = null; | ||
|
@@ -55,6 +57,14 @@ public void setOutputLog(File outputLog) { | |
this.outputLog = outputLog; | ||
} | ||
|
||
public void setPassphraseEnvVar(String passphrase) { | ||
this.passphraseEnvVar = passphrase; | ||
} | ||
|
||
public void setPassphraseCmdLine(String passphraseCmdLine) { | ||
this.passphraseCmdLine = passphraseCmdLine; | ||
} | ||
|
||
/** | ||
* Internal code page (-cpinternal attribute) | ||
*/ | ||
|
@@ -89,6 +99,8 @@ public void execute() { | |
} | ||
if (indexes.isEmpty()) | ||
throw new BuildException("Index list can't be empty"); | ||
if ((passphraseCmdLine != null) && (passphraseEnvVar != null)) | ||
throw new BuildException("Unable to define passphraseCmdLine and passphraseEnvVar"); | ||
|
||
// Update dbDir if not defined | ||
if (dbDir == null) { | ||
|
@@ -150,12 +162,22 @@ private ExecTask idxBuildCmdLine() { | |
exec.createArg().setValue("-cpinternal"); | ||
exec.createArg().setValue(cpInternal); | ||
} | ||
exec.setInputString(generateInputString()); | ||
|
||
Environment.Variable var = new Environment.Variable(); | ||
var.setKey("DLC"); //$NON-NLS-1$ | ||
var.setValue(getDlcHome().toString()); | ||
exec.addEnv(var); | ||
if ((passphraseEnvVar != null) || (passphraseCmdLine != null)) { | ||
exec.createArg().setValue("-Passphrase"); | ||
if (passphraseEnvVar != null) { | ||
exec.setInputString(System.getenv(passphraseEnvVar) + System.lineSeparator() + generateInputString()); | ||
} else { | ||
exec.setInputString(getPassphraseFromCmdLine(passphraseCmdLine) + System.lineSeparator() + generateInputString()); | ||
} | ||
} else { | ||
exec.setInputString(generateInputString()); | ||
} | ||
|
||
Environment.Variable envVar = new Environment.Variable(); | ||
envVar.setKey("DLC"); //$NON-NLS-1$ | ||
envVar.setValue(getDlcHome().toString()); | ||
exec.addEnv(envVar); | ||
|
||
return exec; | ||
} | ||
|
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
Oops, something went wrong.