@Override
public boolean performFinish() {
- return doUpdate();
- }
-
- private boolean doUpdate() {
if (!canFinish())
return false;
+ doUpdate();
+ return true;
+ }
+
+ private void doUpdate() {
try {
- boolean changed = true;
- changed &= AkbUiUtils.setJcrProperty(activeConnector,
+ boolean changed = false;
+ changed |= AkbUiUtils.setJcrProperty(activeConnector,
AkbNames.AKB_CONNECTOR_URL, PropertyType.STRING,
editConnectorPage.getUrl());
- changed &= AkbUiUtils.setJcrProperty(activeConnector,
+ changed |= AkbUiUtils.setJcrProperty(activeConnector,
AkbNames.AKB_CONNECTOR_USER, PropertyType.STRING,
editConnectorPage.getUser());
if (changed)
activeConnector.getSession().save();
- return changed;
+ // return changed;
} catch (RepositoryException re) {
throw new AkbException("Unable to update active connector", re);
}
public boolean canFinish() {
if (AkbJcrUtils.isEmptyString(editConnectorPage.getUrl())
|| AkbJcrUtils.isEmptyString(editConnectorPage.getUser()))
- return true;
- else
return false;
+ else
+ return true;
}
// //////////////////////
if (currNode.isNodeType(AkbTypes.AKB_CONNECTOR_ALIAS)) {
String connType = currNode.getProperty(AKB_CONNECTOR_TYPE)
.getString();
-
+
if (AkbJcrUtils.isEmptyString(connType))
// Cannot create an instance if the type is undefined
continue activeConns;
Node connectorNode = getActiveConnectorByAlias(activeEnv,
connectorAliasStr);
- String sqlQuery = node.getProperty(AKB_QUERY_TEXT).getString();
+ // Sanity check
+ if (connectorNode == null)
+ // should never happen
+ return null;
+ // FIXME hack to force saving of password in keyring on never
+ // used connector instance for active env
+ testConnector(connectorNode);
+ String sqlQuery = AkbJcrUtils.get(node, AKB_QUERY_TEXT);
String connectorUrl = AkbJcrUtils.get(connectorNode,
AKB_CONNECTOR_URL);
String connectorUser = AkbJcrUtils.get(connectorNode,
// Sanity check
if (AkbJcrUtils.isEmptyString(connectorUrl)
- || AkbJcrUtils.isEmptyString(connectorUser))
+ || AkbJcrUtils.isEmptyString(connectorUser)
+ || AkbJcrUtils.isEmptyString(sqlQuery))
return null;
String pwdPath = getPasswordPath(connectorNode);
public String executeCommand(Node activeEnv, Node node) {
try {
-
String connectorAliasStr = node.getProperty(AKB_USED_CONNECTOR)
.getString();
// in case of a template passed env can be null
if (activeEnv == null) {
activeEnv = AkbJcrUtils.getCurrentTemplate(node);
}
+
Node connectorNode = getActiveConnectorByAlias(activeEnv,
connectorAliasStr);
- String command = node.getProperty(AkbNames.AKB_COMMAND_TEXT)
- .getString();
+ // Sanity check
+ if (connectorNode == null)
+ // should never happen
+ return null;
+ // FIXME hack to force saving of password in keyring on never used
+ // connector instance for active env
+ testConnector(connectorNode);
+ String command = AkbJcrUtils.get(node, AKB_COMMAND_TEXT);
String connectorUrl = AkbJcrUtils.get(connectorNode,
AKB_CONNECTOR_URL);
String connectorUser = AkbJcrUtils.get(connectorNode,
// Sanity check
if (AkbJcrUtils.isEmptyString(connectorUrl)
- || AkbJcrUtils.isEmptyString(connectorUser))
+ || AkbJcrUtils.isEmptyString(connectorUser)
+ || AkbJcrUtils.isEmptyString(command))
return null;
String pwdPath = getPasswordPath(connectorNode);
Node connectorNode = getActiveConnectorByAlias(activeEnv,
connectorAliasStr);
+ // Sanity check
+ if (connectorNode == null)
+ // should never happen
+ return null;
+ // FIXME hack to force saving of password in keyring on never used
+ // connector instance for active env
+ testConnector(connectorNode);
+
// TODO do a proper scp
String connectorUrl = AkbJcrUtils.get(connectorNode,
AKB_CONNECTOR_URL);