use of org.mule.runtime.module.extension.internal.runtime.resolver.MapValueResolver in project mule by mulesoft.
the class OAuthConnectionProviderObjectBuilder method getInitialOAuthConfig.
private OAuthConfig getInitialOAuthConfig() throws MuleException {
CoreEvent initialiserEvent = null;
try {
initialiserEvent = getInitialiserEvent(muleContext);
MapValueResolver mapResolver = staticOnly((MapValueResolver) resolverSet.getResolvers().get(OAUTH_AUTHORIZATION_CODE_GROUP_NAME));
AuthCodeConfig authCodeConfig = buildAuthCodeConfig(mapResolver.resolve(from(initialiserEvent)));
Optional<OAuthObjectStoreConfig> storeConfig = buildOAuthObjectStoreConfig(initialiserEvent);
mapResolver = staticOnly((MapValueResolver) resolverSet.getResolvers().get(OAUTH_CALLBACK_GROUP_NAME));
OAuthCallbackConfig callbackConfig = buildOAuthCallbackConfig(mapResolver.resolve(from(initialiserEvent)));
return new OAuthConfig(ownerConfigName, authCodeConfig, callbackConfig, storeConfig, grantType, getCustomParameters(initialiserEvent), callbackValues);
} finally {
if (initialiserEvent != null) {
((BaseEventContext) initialiserEvent.getContext()).success();
}
}
}
use of org.mule.runtime.module.extension.internal.runtime.resolver.MapValueResolver in project mule by mulesoft.
the class OAuthConnectionProviderObjectBuilder method staticOnly.
private MapValueResolver staticOnly(MapValueResolver resolver) throws MuleException {
List<ValueResolver> staticKeyResolvers = new ArrayList<>(resolver.getKeyResolvers().size());
List<ValueResolver> staticValueResolvers = new ArrayList<>(resolver.getValueResolvers().size());
Iterator<ValueResolver> keyResolvers = resolver.getKeyResolvers().iterator();
Iterator<ValueResolver> valueResolvers = resolver.getValueResolvers().iterator();
while (keyResolvers.hasNext() && valueResolvers.hasNext()) {
ValueResolver keyResolver = keyResolvers.next();
ValueResolver valueResolver = valueResolvers.next();
if (!keyResolver.isDynamic() && !valueResolver.isDynamic()) {
staticKeyResolvers.add(keyResolver);
staticValueResolvers.add(valueResolver);
}
}
MapValueResolver result = new MapValueResolver(HashMap.class, staticKeyResolvers, staticValueResolvers, getReflectionCache(), muleContext);
initialiseIfNeeded(result, muleContext);
return result;
}
Aggregations