use of org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty in project mule by mulesoft.
the class SoapServiceProviderDeclarer method declare.
/**
* 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)).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);
}
}
use of org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty in project mule by mulesoft.
the class JavaXmlDeclarationEnricherTestCase method enrich.
private XmlDslModel enrich(Class<?> type) {
extensionDeclarer.withModelProperty(new ImplementingTypeModelProperty(type));
declarationEnricher.enrich(new DefaultExtensionLoadingContext(extensionDeclarer, type.getClassLoader(), getDefault(emptySet())));
return extensionDeclarer.getDeclaration().getXmlDslModel();
}
use of org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty in project mule by mulesoft.
the class DefaultJavaModelLoaderDelegate method declare.
/**
* {@inheritDoc}
*/
@Override
public ExtensionDeclarer declare(ExtensionLoadingContext context) {
ExtensionDeclarer declarer = context.getExtensionDeclarer().named(extensionElement.getName()).onVersion(version).fromVendor(extensionElement.getVendor()).withCategory(extensionElement.getCategory()).withModelProperty(new ExtensionTypeDescriptorModelProperty(extensionElement));
// TODO MULE-14517: This workaround should be replaced for a better and more complete mechanism
context.getParameter("COMPILATION_MODE").ifPresent(m -> declarer.withModelProperty(new CompileTimeModelProperty()));
extensionElement.getDeclaringClass().ifPresent(extensionClass -> declarer.withModelProperty(new ImplementingTypeModelProperty(extensionClass)));
processLicenseRequirements(declarer);
parseExternalLibs(extensionElement, declarer);
addExceptionEnricher(extensionElement, declarer);
configLoaderDelegate.declareConfigurations(declarer, extensionElement);
connectionProviderModelLoaderDelegate.declareConnectionProviders(declarer, extensionElement);
if (!isEmpty(extensionElement.getConfigurations())) {
operationLoaderDelegate.declareOperations(declarer, declarer, null, extensionElement.getOperations(), false);
functionModelLoaderDelegate.declareFunctions(declarer, declarer, null, extensionElement.getFunctions());
extensionElement.getSources().forEach(source -> sourceModelLoaderDelegate.declareMessageSource(declarer, declarer, source, false));
}
return declarer;
}
use of org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method assertModelProperties.
protected void assertModelProperties(ExtensionDeclaration extensionDeclaration) {
ImplementingTypeModelProperty implementingTypeModelProperty = extensionDeclaration.getModelProperty(ImplementingTypeModelProperty.class).get();
assertThat(implementingTypeModelProperty, is(notNullValue()));
assertThat(HeisenbergExtension.class.isAssignableFrom(implementingTypeModelProperty.getType()), is(true));
}
use of org.mule.runtime.module.extension.internal.loader.java.property.ImplementingTypeModelProperty in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method assertTestModuleConnectionProviders.
private void assertTestModuleConnectionProviders(ExtensionDeclaration extensionDeclaration) throws Exception {
assertThat(extensionDeclaration.getConnectionProviders(), hasSize(2));
ConnectionProviderDeclaration connectionProvider = extensionDeclaration.getConnectionProviders().get(0);
assertThat(connectionProvider.getName(), is(DEFAULT_CONNECTION_PROVIDER_NAME));
List<ParameterDeclaration> parameters = connectionProvider.getAllParameters();
assertThat(parameters, hasSize(3));
assertParameter(parameters, "saulPhoneNumber", "", STRING_TYPE, false, SUPPORTED, SAUL_OFFICE_NUMBER);
ImplementingTypeModelProperty typeModelProperty = connectionProvider.getModelProperty(ImplementingTypeModelProperty.class).get();
assertThat(typeModelProperty.getType(), equalTo(HeisenbergConnectionProvider.class));
parameters = extensionDeclaration.getConnectionProviders().get(1).getAllParameters();
assertParameter(parameters, TLS_PARAMETER_NAME, "", toMetadataType(TlsContextFactory.class), true, NOT_SUPPORTED, null);
}
Aggregations