Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into undx/TCOMP-2759-Include-milesto…
Browse files Browse the repository at this point in the history
…nes-in-changelog

# Conflicts:
#	documentation/src/main/java/org/talend/runtime/documentation/Generator.java
  • Loading branch information
undx committed Jul 4, 2024
2 parents e71f1cc + e15d056 commit bb9bab8
Show file tree
Hide file tree
Showing 74 changed files with 155 additions and 188 deletions.
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<groupId>org.talend.sdk.component</groupId>
<artifactId>component-bom</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Component BOM</name>
<description>Talend Component Kit</description>
Expand Down
2 changes: 1 addition & 1 deletion component-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-form/component-form-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-form</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-form-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-form/component-form-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-form</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-form-model</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-form/component-uispec-mapper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-form</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-uispec-mapper</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-form/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-form</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-runtime-beam/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-beam</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-runtime-design-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-design-extension</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-runtime-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-impl</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-runtime-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-manager</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime-testing</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-beam-junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime-testing</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-http-junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime-testing</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-junit-base</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-runtime-testing/component-runtime-junit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime-testing</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime-testing</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-testing-spark</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-runtime-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-testing</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-server-parent/component-server-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-server-parent</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-server-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-server-parent/component-server-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-server-parent</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-server-model</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-server-parent/component-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-server-parent</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>extensions</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-server-extension-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-server-parent/extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-server-parent</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>extensions</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-server-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-server-parent</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-spi</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-starter-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-starter-server</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion component-studio/component-runtime-di/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-studio</artifactId>
<version>1.65.0M4-SNAPSHOT</version>
<version>1.65.0M6-SNAPSHOT</version>
</parent>

<artifactId>component-runtime-di</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
import static org.talend.sdk.component.api.exception.DiscoverSchemaException.HandleErrorWith.EXECUTE_MOCK_JOB;
import static org.talend.sdk.component.api.record.SchemaProperty.IS_KEY;
import static org.talend.sdk.component.api.record.SchemaProperty.PATTERN;
import static org.talend.sdk.component.api.record.SchemaProperty.SCALE;
Expand Down Expand Up @@ -160,8 +159,9 @@ private void initClass2JavaTypeMap() {
}
}

private DiscoverSchemaException transformException(final Exception e) {
private DiscoverSchemaException handleException(final Exception e) throws Exception {
DiscoverSchemaException discoverSchemaException;
log.error(ERROR_THROUGH_ACTION, e);
if (e instanceof DiscoverSchemaException) {
discoverSchemaException = DiscoverSchemaException.class.cast(e);
} else if (e instanceof ComponentException) {
Expand All @@ -170,12 +170,6 @@ private DiscoverSchemaException transformException(final Exception e) {
discoverSchemaException = new DiscoverSchemaException(e.getMessage(), e.getStackTrace(),
DiscoverSchemaException.HandleErrorWith.EXCEPTION);
}
return discoverSchemaException;
}

private DiscoverSchemaException handleException(final Exception e) throws Exception {
log.error(ERROR_THROUGH_ACTION, e);
final DiscoverSchemaException discoverSchemaException = transformException(e);
try (final Jsonb jsonb = JsonbBuilder.create()) {
jsonb.toJson(discoverSchemaException, out);
}
Expand All @@ -194,27 +188,22 @@ public void guessInputComponentSchema(final Schema schema) throws Exception {
} catch (Exception e) {
throw handleException(e);
}
throw handleException(new Exception(ERROR_NO_AVAILABLE_SCHEMA_FOUND));
throw new Exception(ERROR_NO_AVAILABLE_SCHEMA_FOUND);
}

public void guessComponentSchema(final Schema incomingSchema, final String outgoingBranch,
final Boolean isStartOfJob) throws Exception {
try {
executeDiscoverSchemaExtendedAction(incomingSchema, outgoingBranch);
return;
} catch (Exception e) {
// Case when a processor is the start of a studio job
if (isStartOfJob) {
try {
final DiscoverSchemaException dse = transformException(e);
if (EXECUTE_MOCK_JOB.equals(dse.getPossibleHandleErrorWith())) {
throw handleException(dse);
}
guessOutputComponentSchemaThroughResult();
} catch (Exception er) {
throw handleException(e);
}
guessOutputComponentSchemaThroughResult();
return;
} else {
throw handleException(e);
log.error(ERROR_INSTANCE_SCHEMA, e);
throw e;
}
}
}
Expand All @@ -224,29 +213,33 @@ public void guessComponentSchema(final Schema incomingSchema, final String outgo
}

private void executeDiscoverSchemaExtendedAction(final Schema schema, final String branch) throws Exception {
final Collection<ServiceMeta> services = getPluginServices();
ServiceMeta.ActionMeta actionRef = services
.stream()
.flatMap(s -> s.getActions().stream())
.filter(a -> a.getFamily().equals(family) &&
a.getType().equals(SCHEMA_EXTENDED_TYPE) &&
componentName.equals(a.getAction()))
.findFirst()
.orElse(null);
// did not find action named like componentName, trying to find one matching action...
if (actionRef == null) {
actionRef = services
try {
final Collection<ServiceMeta> services = getPluginServices();
ServiceMeta.ActionMeta actionRef = services
.stream()
.flatMap(s -> s.getActions().stream())
.filter(a -> a.getFamily().equals(family) && a.getType().equals(SCHEMA_EXTENDED_TYPE))
.filter(a -> a.getFamily().equals(family) &&
a.getType().equals(SCHEMA_EXTENDED_TYPE) &&
componentName.equals(a.getAction()))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException(
"No action " + family + "#" + SCHEMA_EXTENDED_TYPE));
}
final Object schemaResult =
actionRef.getInvoker().apply(buildActionConfig(actionRef, configuration, schema, branch));
if (schemaResult instanceof Schema) {
fromSchema(Schema.class.cast(schemaResult));
.orElse(null);
// did not find action named like componentName, trying to find one matching action...
if (actionRef == null) {
actionRef = services
.stream()
.flatMap(s -> s.getActions().stream())
.filter(a -> a.getFamily().equals(family) && a.getType().equals(SCHEMA_EXTENDED_TYPE))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException(
"No action " + family + "#" + SCHEMA_EXTENDED_TYPE));
}
final Object schemaResult =
actionRef.getInvoker().apply(buildActionConfig(actionRef, configuration, schema, branch));
if (schemaResult instanceof Schema && fromSchema(Schema.class.cast(schemaResult))) {
return;
}
} catch (Exception e) {
throw handleException(e);
}
}

Expand Down Expand Up @@ -456,11 +449,12 @@ public boolean guessSchemaThroughAction(final Schema schema) {
}

private Collection<ServiceMeta> getPluginServices() {
return componentManager
final Collection<ServiceMeta> services = componentManager
.findPlugin(plugin)
.orElseThrow(() -> new IllegalArgumentException(NO_COMPONENT + plugin))
.get(ContainerComponentRegistry.class)
.getServices();
return services;
}

private boolean fromSchema(final Schema schema) {
Expand Down Expand Up @@ -607,14 +601,16 @@ private void guessOutputComponentSchemaThroughResult() throws Exception {
fromOutputEmitterPojo(processorComponent, "FLOW");
return;
}
if (row != null) {
guessSchemaThroughResult(row);
if (row != null && guessSchemaThroughResult(row)) {
return;
}
} finally {
try {
processor.stop();
} catch (RuntimeException re) {
// nop
if (processor != null) {
try {
processor.stop();
} catch (RuntimeException re) {
// nop
}
}
}
}
Expand Down
Loading

0 comments on commit bb9bab8

Please sign in to comment.