Skip to content

Commit

Permalink
PAYARA-1790 ensure environment variable, password alias and system pr…
Browse files Browse the repository at this point in the history
…operty replacement is possible when using glassfish-resources.xml
  • Loading branch information
smillidge committed Jun 25, 2017
1 parent ca89691 commit a83ecb9
Showing 1 changed file with 13 additions and 12 deletions.
Expand Up @@ -59,6 +59,7 @@
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.glassfish.config.support.TranslatedConfigView;

import static org.glassfish.resources.admin.cli.ResourceConstants.*;

Expand Down Expand Up @@ -782,7 +783,7 @@ private void generateJDBCConnectionPoolResource(Node nextKid, String scope) thro

if(datasourceNode != null){
String datasource = datasourceNode.getNodeValue();
jdbcConnPool.setAttribute(DATASOURCE_CLASS, datasource);
jdbcConnPool.setAttribute(DATASOURCE_CLASS, (String) TranslatedConfigView.getTranslatedValue(datasource));
}

if (validationclassnameNode != null){
Expand All @@ -792,23 +793,23 @@ private void generateJDBCConnectionPoolResource(Node nextKid, String scope) thro

if (nSteadyPoolSizeNode != null) {
String sSteadyPoolSize = nSteadyPoolSizeNode.getNodeValue();
jdbcConnPool.setAttribute(STEADY_POOL_SIZE, sSteadyPoolSize);
jdbcConnPool.setAttribute(STEADY_POOL_SIZE, (String) TranslatedConfigView.getTranslatedValue(sSteadyPoolSize));
}
if (nMaxPoolSizeNode != null) {
String sMaxPoolSize = nMaxPoolSizeNode.getNodeValue();
jdbcConnPool.setAttribute(MAX_POOL_SIZE, sMaxPoolSize);
jdbcConnPool.setAttribute(MAX_POOL_SIZE, (String) TranslatedConfigView.getTranslatedValue(sMaxPoolSize));
}
if (nMaxWaitTimeInMillisNode != null) {
String sMaxWaitTimeInMillis = nMaxWaitTimeInMillisNode.getNodeValue();
jdbcConnPool.setAttribute(MAX_WAIT_TIME_IN_MILLIS, sMaxWaitTimeInMillis);
jdbcConnPool.setAttribute(MAX_WAIT_TIME_IN_MILLIS, (String) TranslatedConfigView.getTranslatedValue(sMaxWaitTimeInMillis));
}
if (nPoolSizeQuantityNode != null) {
String sPoolSizeQuantity = nPoolSizeQuantityNode.getNodeValue();
jdbcConnPool.setAttribute(POOL_SIZE_QUANTITY, sPoolSizeQuantity);
jdbcConnPool.setAttribute(POOL_SIZE_QUANTITY, (String) TranslatedConfigView.getTranslatedValue(sPoolSizeQuantity));
}
if (nIdleTimeoutInSecNode != null) {
String sIdleTimeoutInSec = nIdleTimeoutInSecNode.getNodeValue();
jdbcConnPool.setAttribute(IDLE_TIME_OUT_IN_SECONDS, sIdleTimeoutInSec);
jdbcConnPool.setAttribute(IDLE_TIME_OUT_IN_SECONDS, (String) TranslatedConfigView.getTranslatedValue(sIdleTimeoutInSec));
}
if (nIsConnectionValidationRequiredNode != null) {
String sIsConnectionValidationRequired = nIsConnectionValidationRequiredNode.getNodeValue();
Expand All @@ -824,7 +825,7 @@ private void generateJDBCConnectionPoolResource(Node nextKid, String scope) thro
}
if (nValidationTableNameNode != null) {
String sValidationTableName = nValidationTableNameNode.getNodeValue();
jdbcConnPool.setAttribute(VALIDATION_TABLE_NAME, sValidationTableName);
jdbcConnPool.setAttribute(VALIDATION_TABLE_NAME, (String) TranslatedConfigView.getTranslatedValue(sValidationTableName));
}
if (nResType != null) {
String sResType = nResType.getNodeValue();
Expand Down Expand Up @@ -870,7 +871,7 @@ private void generateJDBCConnectionPoolResource(Node nextKid, String scope) thro
}
if (statementTimeoutNode != null) {
jdbcConnPool.setAttribute(STATEMENT_TIMEOUT_IN_SECONDS,
statementTimeoutNode.getNodeValue());
(String) TranslatedConfigView.getTranslatedValue(statementTimeoutNode.getNodeValue()));
}
if (lazyConnectionEnlistmentNode != null) {
jdbcConnPool.setAttribute(LAZY_CONNECTION_ENLISTMENT,
Expand Down Expand Up @@ -963,9 +964,9 @@ private void generateMailResource(Node nextKid, String scope) throws Exception
Node enabledNode = attributes.getNamedItem(ENABLED);

String jndiName = getScopedName(jndiNameNode.getNodeValue(), scope);
String host = hostNode.getNodeValue();
String user = userNode.getNodeValue();
String fromAddress = fromAddressNode.getNodeValue();
String host = (String) TranslatedConfigView.getTranslatedValue(hostNode.getNodeValue());
String user = (String) TranslatedConfigView.getTranslatedValue(userNode.getNodeValue());
String fromAddress = (String) TranslatedConfigView.getTranslatedValue(fromAddressNode.getNodeValue());

org.glassfish.resources.api.Resource mailResource = new org.glassfish.resources.api.Resource(org.glassfish.resources.api.Resource.MAIL_RESOURCE);

Expand Down Expand Up @@ -1101,7 +1102,7 @@ private void generatePropertyElement(Resource rs, NodeList children) throws Exce
if (nameNode != null && valueNode != null) {
boolean bDescFound = false;
String sName = nameNode.getNodeValue();
String sValue = valueNode.getNodeValue();
String sValue = (String) TranslatedConfigView.getTranslatedValue(valueNode.getNodeValue());
//get property description
// FIX ME: Ignoring the value for description for the
// time-being as there is no method available in
Expand Down

0 comments on commit a83ecb9

Please sign in to comment.