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

Chore/declaration push down #14205

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
26 changes: 26 additions & 0 deletions modules/spring-config/api-changes.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
{
"4.10.0": {
"revapi": {
"differences": {
"differences": [
{
"ignore": true,
"code": "java.class.removed",
"old": "class org.mule.runtime.config.api.SpringXmlConfigurationBuilderFactory",
"justification": "W-17774312: Move ArtifactDeclaration uses from spring-config to tooling-support"
},
{
"ignore": true,
"code": "java.method.removed",
"old": "method <T> java.util.Optional<org.mule.runtime.metadata.api.dsl.DslElementModel<T>> org.mule.runtime.config.api.dsl.model.DslElementModelFactory::create(org.mule.runtime.dsl.api.component.config.ComponentConfiguration)",
"justification": "W-17774312: Move ArtifactDeclaration uses from spring-config to tooling-support"
},
{
"ignore": true,
"code": "java.class.removed",
"old": "interface org.mule.runtime.config.api.dsl.model.XmlDslElementModelConverter",
"justification": "W-17774312: Move ArtifactDeclaration uses from spring-config to tooling-support"
}
]
}
}
},
"4.7.0": {
"revapi": {
"differences": {
Expand Down
11 changes: 11 additions & 0 deletions modules/spring-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
--add-exports=org.mule.runtime.artifact.ast.dependency.graph/org.mule.runtime.ast.graph.internal=org.mule.runtime.spring.config
--add-exports=org.mule.runtime.spring.config/org.mule.runtime.config.dsl.model=ALL-UNNAMED
--add-exports=org.mule.runtime.core/org.mule.runtime.core.internal.store=ALL-UNNAMED
--add-exports=org.mule.runtime.artifact.ast/org.mule.runtime.ast.internal.builder=ALL-UNNAMED
--add-exports=org.mule.runtime.artifact.ast/org.mule.runtime.ast.internal.builder.adapter=ALL-UNNAMED
--add-exports=org.mule.runtime.artifact.ast/org.mule.runtime.ast.internal.dsl=ALL-UNNAMED
--add-exports=org.mule.runtime.artifact.ast/org.mule.runtime.ast.internal.error=ALL-UNNAMED
--add-exports=org.mule.runtime.artifact.ast/org.mule.runtime.ast.internal.model=ALL-UNNAMED
--add-exports=org.mule.runtime.artifact.ast/org.mule.runtime.ast.internal.param=ALL-UNNAMED
--add-opens=org.mule.runtime.core/org.mule.runtime.core.internal.el.function=ALL-UNNAMED
--add-opens=org.mule.runtime.core/org.mule.runtime.core.internal.processor.strategy=ALL-UNNAMED
${surefire.test.unit.open.args}
Expand Down Expand Up @@ -250,6 +256,11 @@
<artifactId>mule-dwb-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.runtime</groupId>
<artifactId>mule-artifact-ast-serialization</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion modules/spring-config/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
spring.beans;
exports org.mule.runtime.config.internal.context.lazy to
org.mule.runtime.tooling.support;
exports org.mule.runtime.config.internal.dsl to
org.mule.runtime.tooling.support;
exports org.mule.runtime.config.internal.dsl.processor to
org.mule.runtime.core,
spring.beans;
Expand All @@ -125,11 +127,14 @@
exports org.mule.runtime.config.internal.lazy to
spring.beans;
exports org.mule.runtime.config.internal.model to
org.mule.runtime.extensions.xml.support;
org.mule.runtime.extensions.xml.support,
org.mule.runtime.tooling.support;
exports org.mule.runtime.config.internal.processor to
spring.beans;

uses org.mule.runtime.config.internal.model.ApplicationModelAstPostProcessor;
uses org.mule.runtime.config.api.dsl.ArtifactDeclarationXmlSerializer;
uses org.mule.runtime.config.api.dsl.model.DslElementModelFactory;
uses org.mule.runtime.config.api.dsl.model.properties.ConfigurationPropertiesProviderFactory;

opens org.mule.runtime.config.api.dsl to
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
package org.mule.runtime.config.api.dsl;

import org.mule.api.annotation.NoImplement;
import org.mule.runtime.app.declaration.api.ArtifactDeclaration;
import org.mule.runtime.config.internal.dsl.model.DefaultArtifactDeclarationXmlSerializer;
import org.mule.runtime.api.dsl.DslResolvingContext;
import org.mule.runtime.api.meta.model.ExtensionModel;
import org.mule.runtime.app.declaration.api.ArtifactDeclaration;

import java.io.InputStream;
import java.util.ServiceLoader;

import org.w3c.dom.Document;

Expand All @@ -22,8 +22,10 @@
* XML configuration file into an {@link ArtifactDeclaration} representation.
*
* @since 4.0
* @deprecated Use mule-artifact-ast instead.
*/
@NoImplement
@Deprecated(forRemoval = true, since = "4.10")
public interface ArtifactDeclarationXmlSerializer {

/**
Expand All @@ -34,9 +36,15 @@ public interface ArtifactDeclarationXmlSerializer {
* @return an instance of the default implementation of the {@link ArtifactDeclarationXmlSerializer}
*/
static ArtifactDeclarationXmlSerializer getDefault(DslResolvingContext context) {
return new DefaultArtifactDeclarationXmlSerializer(context);
final var defaultArtifactDeclarationXmlSerializer =
ServiceLoader.load(ArtifactDeclarationXmlSerializer.class, ArtifactDeclarationXmlSerializer.class.getClassLoader())
.findFirst().get();
defaultArtifactDeclarationXmlSerializer.setContext(context);
return defaultArtifactDeclarationXmlSerializer;
}

void setContext(DslResolvingContext context);

/**
* Serializes an {@link ArtifactDeclaration} into an XML {@link Document}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@
import org.mule.runtime.api.meta.model.source.SourceModel;
import org.mule.runtime.app.declaration.api.ElementDeclaration;
import org.mule.runtime.ast.api.ComponentAst;
import org.mule.runtime.config.internal.dsl.model.DefaultDslElementModelFactory;
import org.mule.runtime.dsl.api.component.config.ComponentConfiguration;
import org.mule.runtime.metadata.api.dsl.DslElementModel;

import java.util.Optional;
import java.util.ServiceLoader;

/**
* Provides the {@link DslElementModel} of any {@link ComponentConfiguration} within the context of the available application
* plugins, provided for each instance of this {@link DslElementModelFactory}
*
* @since 4.0
* @deprecated Use mule-artifact-ast instead.
*/
@NoImplement
@Deprecated(forRemoval = true, since = "4.10")
public interface DslElementModelFactory {

/**
Expand All @@ -40,9 +42,14 @@ public interface DslElementModelFactory {
* @return a default implementation of the {@link DslElementModelFactory}
*/
static DslElementModelFactory getDefault(DslResolvingContext context) {
return new DefaultDslElementModelFactory(context);
final var dslElementModelFactory =
ServiceLoader.load(DslElementModelFactory.class, DslElementModelFactory.class.getClassLoader()).findFirst().get();
dslElementModelFactory.setContext(context);
return dslElementModelFactory;
}

void setContext(DslResolvingContext context);

/**
* Resolves the {@link DslElementModel} for the given {@link ElementDeclaration}, providing an element with all the required
* information for representing this {@code elementDeclaration} element in the DSL and binding it to its {@link ExtensionModel
Expand All @@ -60,27 +67,6 @@ static DslElementModelFactory getDefault(DslResolvingContext context) {
*/
<T> Optional<DslElementModel<T>> create(ElementDeclaration elementDeclaration);

/**
* Resolves the {@link DslElementModel} for the given {@link ComponentConfiguration applicationElement}, providing an element
* with all the required information for representing this {@code applicationElement} element in the DSL and binding it to its
* {@link ExtensionModel model} component or {@link MetadataType}. This resolution can only be performed from DSL
* top-level-elements, which have global representations in the {@link ExtensionModel}, so this method will return an
* {@link Optional#empty} result if the given {@code applicationElement} does not identify either a {@link ConfigurationModel},
* {@link OperationModel}, {@link SourceModel} or an {@link ObjectType} than can be expressed as an explicit top level element.
*
* @param componentConfiguration the {@link ComponentConfiguration} for which its {@link DslElementModel} representation is
* required.
* @param <T> the expected model type of the {@link DslElementModel element}
* @return a {@link DslElementModel} representation of the {@link ComponentConfiguration} if one is possible to be built based
* on the {@link ExtensionModel extensions} provided as resolution context, or {@link Optional#empty} if no
* {@link DslElementModel} could be created for the given {@code applicationElement} with the current extensions
* context.
*
* @deprecated Use {@link #create(ComponentAst)} instead.
*/
@Deprecated
<T> Optional<DslElementModel<T>> create(ComponentConfiguration componentConfiguration);

/**
* Resolves the {@link DslElementModel} for the given {@link ComponentAst applicationElement}, providing an element with all the
* required information for representing this {@code applicationElement} element in the DSL and binding it to its
Expand Down
Loading