.getParameters().get(GLOBAL_ELEMENT_NAME_ATTRIBUTE); connectionProviderDeclarer .withModelProperty(new TestConnectionGlobalElementModelProperty(testConnectionGlobalElementName)); });
private void parseOAuthGrantType(ConnectionProviderElement providerType, ConnectionProviderDeclarer providerDeclarer) { providerType.getAnnotation(AuthorizationCode.class).ifPresent(a -> { AuthorizationCodeGrantType grantType = new AuthorizationCodeGrantType(a.accessTokenUrl(), a.authorizationUrl(), a.accessTokenExpr(), a.expirationExpr(), a.refreshTokenExpr(), a.defaultScopes()); providerDeclarer.withModelProperty(new OAuthModelProperty(asList(grantType))); }); } }
ConnectionProviderDeclarer finalProviderDeclarer = providerDeclarer; providerType.getDeclaringClass().ifPresent(clazz -> finalProviderDeclarer .withModelProperty(new ConnectionProviderFactoryModelProperty(new DefaultConnectionProviderFactory<>(clazz, getExtensionClassLoader()))) .withModelProperty(new ImplementingTypeModelProperty(clazz))); .withModelProperty(new ConnectionTypeModelProperty(providerGenerics.get(0))) .withModelProperty(new ExtensionTypeDescriptorModelProperty(providerType));
/** * Declares a new connection provider for a configuration given a {@link SoapServiceProviderWrapper} declaration. * * @param configDeclarer the configuration declarer that will own the provider * @param provider a {@link SoapServiceProviderWrapper} that describes the {@link SoapServiceProvider} Type. * @param hasCustomTransports if declares custom transport or not. */ public void declare(ConfigurationDeclarer configDeclarer, SoapServiceProviderWrapper provider, boolean hasCustomTransports) { String description = provider.getDescription(); // Declares the Service Provider as a Connection Provider. ConnectionProviderDeclarer providerDeclarer = configDeclarer.withConnectionProvider(provider.getAlias()) .describedAs(description) .withModelProperty(new ConnectionTypeModelProperty(ForwardingSoapClient.class)) //TODO - MULE-14311 - Make loader work in compile time .withModelProperty(new ImplementingTypeModelProperty(provider.getDeclaringClass().get())) .withConnectionManagementType(POOLING) .supportsConnectivityTesting(provider.supportsConnectivityTesting()); ParameterDeclarationContext context = new ParameterDeclarationContext("Service Provider", providerDeclarer.getDeclaration()); parametersLoader.declare(providerDeclarer, provider.getParameters(), context); if (hasCustomTransports) { providerDeclarer.onParameterGroup(TRANSPORT_GROUP) .withRequiredParameter(TRANSPORT_PARAM) .withDisplayModel(DisplayModel.builder().displayName(TRANSPORT_GROUP).build()) .ofType(typeLoader.load(MessageDispatcherProvider.class)) .withLayout(LayoutModel.builder().order(1).tabName(TRANSPORT).build()) .withExpressionSupport(NOT_SUPPORTED); } }
private void parseOAuthGrantType(ConnectionProviderElement providerType, ConnectionProviderDeclarer providerDeclarer) { providerType.getAnnotation(AuthorizationCode.class).ifPresent(a -> { AuthorizationCodeGrantType grantType = new AuthorizationCodeGrantType(a.accessTokenUrl(), a.authorizationUrl(), a.accessTokenExpr(), a.expirationExpr(), a.refreshTokenExpr(), a.defaultScopes()); providerDeclarer.withModelProperty(new OAuthModelProperty(asList(grantType))); }); } }
ConnectionProviderDeclarer finalProviderDeclarer = providerDeclarer; providerType.getDeclaringClass().ifPresent(clazz -> finalProviderDeclarer .withModelProperty(new ConnectionProviderFactoryModelProperty(new DefaultConnectionProviderFactory<>(clazz, getExtensionClassLoader()))) .withModelProperty(new ImplementingTypeModelProperty(clazz))); .withModelProperty(new ConnectionTypeModelProperty(providerGenerics.get(0))) .withModelProperty(new ExtensionTypeDescriptorModelProperty(providerType));