diff --git a/src/java/com/phenix/pct/PCTConnection.java b/src/java/com/phenix/pct/PCTConnection.java
index 071e6843e..7e1897b11 100755
--- a/src/java/com/phenix/pct/PCTConnection.java
+++ b/src/java/com/phenix/pct/PCTConnection.java
@@ -30,7 +30,7 @@
import java.util.Map;
/**
- * Object to add a database connection to a PCTRun task
+ * Represent a database connection in PCT tasks
*
* @author Gilles QUERRET
*/
@@ -49,8 +49,7 @@ public class PCTConnection extends DataType {
private File paramFile = null;
private Boolean singleUser = null;
private Boolean readOnly = null;
- private String passphrase = null;
- private Map aliases = null;
+ private Map aliases = new HashMap<>();
private List options = null;
/**
@@ -174,13 +173,6 @@ public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
}
- /**
- * If true, append -Passphrase to connection string
- */
- public void setPassphrase(String passphrase) {
- this.passphrase = passphrase;
- }
-
/**
* If true, opens the database in single-user mode
*
@@ -198,7 +190,7 @@ public void addOption(PCTRunOption option) {
}
/**
- * Adds an alias to the current DB connection.
+ * Add an alias to the current DB connection.
*
* The previous method's name (addPCTAlias) was changed when I switched from Vector to HashMap
* as a container for PCTAlias. When using addPCTAlias, you enter the method with a newly
@@ -212,10 +204,6 @@ public void addConfiguredPCTAlias(PCTAlias alias) {
}
public void addConfiguredAlias(PCTAlias alias) {
- if (this.aliases == null) {
- aliases = new HashMap<>();
- }
-
if (aliases.put(alias.getName(), alias) != null)
throw new BuildException(MessageFormat.format(
Messages.getString("PCTConnection.0"), alias.getName())); //$NON-NLS-1$
@@ -226,7 +214,7 @@ protected PCTConnection getRef() {
}
/**
- * Checks if aliases defined
+ * Check if aliases defined
*
* @return True if aliases defined for this database connection
*/
@@ -236,7 +224,7 @@ public boolean hasAliases() {
}
/**
- * Checks if an alias is defined
+ * Check if an alias is defined
*
* @param aliasName String
* @return True if alias defined for this database connection
@@ -247,7 +235,7 @@ public boolean hasNamedAlias(String aliasName) {
}
/**
- * Returns an ordered list of connection parameters
+ * Return a list of connection parameters
*
* @return List of String
* @throws BuildException Something went wrong (dbName or paramFile not defined)
@@ -298,7 +286,6 @@ public List getConnectParametersList() {
list.remove("-1");
}
}
-
if (cacheFile != null) {
list.add("-cache"); //$NON-NLS-1$
@@ -320,21 +307,14 @@ public List getConnectParametersList() {
list.add(hostName);
}
- if (readOnly != null ) {
+ if (readOnly != null) {
if (readOnly) {
list.add("-RO");
- }
- else
- {
+ } else {
list.remove("-RO");
}
}
- if (passphrase != null) {
- list.add("-KeyStorePassPhrase");
- list.add(passphrase);
- }
-
if ((userName != null) && (userName.trim().length() > 0)) {
list.add("-U"); //$NON-NLS-1$
list.add(userName);
@@ -359,7 +339,7 @@ public List getConnectParametersList() {
}
/**
- * Returns a string which could be used by a CONNECT statement or directly in a _progres or
+ * Return a string which could be used by a CONNECT statement or directly in a _progres or
* prowin32 command line
*
* @return Connection string
@@ -375,9 +355,9 @@ public String createConnectString() {
}
/**
- * Returns a string which could be used to connect a database from a background worker Pipe
- * separated list, first entry is connection string, followed by aliases. Aliases are comma
- * separated list, first entry is alias name, second is 1 if NO-ERROR, 0 w/o no-error
+ * Return a string which could be used to connect a database from a background worker. Pipe
+ * separated list, first entry is connection string, followed by aliases. Aliases are
+ * comma-separated lists, first entry is alias name, second is 1 if NO-ERROR, 0 w/o no-error
*
* @return Connection string
*/
@@ -406,16 +386,14 @@ public void createArguments(ExecTask task) {
}
/**
- * Returns defined aliases for a database connection
+ * Return defined aliases for a database connection
*
* @return Collection
*/
public Collection getAliases() {
Map map = new HashMap<>();
- if (aliases != null) {
- for (String str : aliases.keySet()) {
- map.put(str, aliases.get(str));
- }
+ for (Map.Entry entry : aliases.entrySet()) {
+ map.put(entry.getKey(), entry.getValue());
}
if (isReference()) {
for (PCTAlias alias : getRef().getAliases()) {
@@ -427,7 +405,7 @@ public Collection getAliases() {
}
/**
- * Returns database name
+ * Return database name
*
* @return String
*/