Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providing support to read parameters from environment variables #2118

Merged
merged 3 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,15 @@ protected void buildDataSource(OMElement elem, AbstractDBMediator mediator) {
}

private void readLookupConfig(AbstractDBMediator mediator, OMElement pool) {
String dataSourceName = getValue(pool, DSNAME_Q);
mediator.setDataSourceName(dataSourceName);
String resolvedDataSourceName = ResolverFactory.getInstance().getResolver(getValue(pool, DSNAME_Q)).resolve();
mediator.setDataSourceName(resolvedDataSourceName);
saveElementConfig(pool, DSNAME_Q, mediator);

if (pool.getFirstChildWithName(ICCLASS_Q) != null) {
String resolvedInitialContextClass = ResolverFactory.getInstance()
.getResolver(getValue(pool, ICCLASS_Q)).resolve();
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, getValue(pool, ICCLASS_Q));
props.put(Context.INITIAL_CONTEXT_FACTORY, resolvedInitialContextClass);
props.put(Context.PROVIDER_URL, getValue(pool, URL_Q));
props.put(Context.SECURITY_PRINCIPAL, getValue(pool, USER_Q));
props.put(Context.SECURITY_CREDENTIALS, getValue(pool, PASS_Q));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,13 @@ public static ProxyService createProxy(OMElement elem, Properties properties) {
proxy.setPreservePolicy(preservePolicy.getAttributeValue());
}
if (wsdlEndpoint != null) {
proxy.setPublishWSDLEndpoint(wsdlEndpoint.getAttributeValue());
String resolvedWsdlEndpoint = ResolverFactory.getInstance()
.getResolver(wsdlEndpoint.getAttributeValue()).resolve();
proxy.setPublishWSDLEndpoint(resolvedWsdlEndpoint);
} else if (wsdlKey != null) {
proxy.setWSDLKey(wsdlKey.getAttributeValue());
String resolvedWsdlKey = ResolverFactory.getInstance()
.getResolver(wsdlKey.getAttributeValue()).resolve();
proxy.setWSDLKey(resolvedWsdlKey);
} else {
OMAttribute wsdlURI = wsdl.getAttribute(
new QName(XMLConfigConstants.NULL_NAMESPACE, "uri"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public Endpoint createEndpoint(OMElement endpointElement, boolean a, Properties
OMAttribute endpointTemplateAttribute = endpointElement.getAttribute(
new QName(XMLConfigConstants.NULL_NAMESPACE, "template"));
if (endpointTemplateAttribute != null) {
templateEndpoint.setTemplate(endpointTemplateAttribute.getAttributeValue());
String resolvedTemplate = ResolverFactory.getInstance()
.getResolver(endpointTemplateAttribute.getAttributeValue()).resolve();
templateEndpoint.setTemplate(resolvedTemplate);
} else {
handleException("Error loading the configuration from endpoint group, " +
templateEndpoint.getName() +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,16 @@ protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint,

// get the service name and port name. at this point we should not worry about
// the presence of those parameters. they are handled by corresponding WSDL builders.
String serviceName = wsdlElement.getAttributeValue(new QName("service"));
String portName = wsdlElement.getAttributeValue(new QName("port"));
String resolvedServiceName = ResolverFactory.getInstance()
.getResolver(wsdlElement.getAttributeValue(new QName("service"))).resolve();;
String resolvedPortName = ResolverFactory.getInstance()
.getResolver(wsdlElement.getAttributeValue(new QName("port"))).resolve();
// check if wsdl is supplied as a URI
String wsdlURI = wsdlElement.getAttributeValue(new QName("uri"));
// set serviceName and portName in the endpoint. it does not matter if these are
// null at this point. we are setting them only for serialization purpose.
wsdlEndpoint.setServiceName(serviceName);
wsdlEndpoint.setPortName(portName);
wsdlEndpoint.setServiceName(resolvedServiceName);
wsdlEndpoint.setPortName(resolvedPortName);

String noParsing = properties.getProperty(SKIP_WSDL_PARSING);

Expand All @@ -142,7 +144,7 @@ protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint,

new WSDL11EndpointBuilder().
populateEndpointDefinitionFromWSDL(endpoint,
wsdlURI.trim(), omElement, serviceName, portName);
wsdlURI.trim(), omElement, resolvedServiceName, resolvedPortName);

} else if (WSDL2Constants.WSDL_NAMESPACE.equals(nsUri)) {
//endpoint = new WSDL20EndpointBuilder().
Expand Down Expand Up @@ -181,7 +183,7 @@ protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint,
baseUri = baseUri + File.separator;
}
new WSDL11EndpointBuilder().populateEndpointDefinitionFromWSDL(endpoint,
baseUri, definitionElement, serviceName, portName);
baseUri, definitionElement, resolvedServiceName, resolvedPortName);
} else {
endpoint = new EndpointDefinition();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ public static TaskDescription createTaskDescription(OMElement el, OMNamespace ta
while (it.hasNext()) {
OMElement prop = (OMElement) it.next();
if (PropertyHelper.isStaticProperty(prop)) {
String value = prop.getAttributeValue(new QName("value"));
if (value != null) {
String resolvedValue = ResolverFactory.getInstance().getResolver(value).resolve();
prop.getAttribute(new QName("value")).setAttributeValue(resolvedValue);
}
taskDescription.setXmlProperty(prop);
} else {
handleException("Tasks does not support dynamic properties");
Expand Down
Loading