From 7c98df42d0924d79d480fb4fbe9971755d4bb16a Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Fri, 21 Nov 2025 14:29:54 +0100 Subject: [PATCH 01/12] feat(QTDI-2134): dynamic dependencies - nested loading --- .../DynamicDependenciesConfiguration.java | 34 ++++++++++ .../runtime/manager/ComponentManager.java | 44 +++++++++---- .../runtime/manager/service/ResolverImpl.java | 2 +- .../runtime/manager/ComponentManagerTest.java | 16 ++++- .../manager/service/ResolverImplTest.java | 4 +- .../manager/xbean/NestedJarArchiveTest.java | 6 +- .../classloader/ConfigurableClassLoader.java | 64 ++++++++++++++++++- .../sdk/component/container/Container.java | 16 +++-- .../component/container/ContainerManager.java | 37 +++++++++-- ...DependencyListLocalRepositoryResolver.java | 15 ++--- .../ConfigurableClassLoaderTest.java | 8 +-- ...ndencyListLocalRepositoryResolverTest.java | 13 ++-- 12 files changed, 210 insertions(+), 49 deletions(-) create mode 100644 component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesConfiguration.java diff --git a/component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesConfiguration.java b/component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesConfiguration.java new file mode 100644 index 0000000000000..f7f01ec74d5b3 --- /dev/null +++ b/component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesConfiguration.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.api.configuration.type; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import org.talend.sdk.component.api.configuration.type.meta.ConfigurationType; +import org.talend.sdk.component.api.meta.Documentation; + +@Target(TYPE) +@Retention(RUNTIME) +@ConfigurationType("dynamicDependenciesConfiguration") +@Documentation("Mark a model (complex object) as being the configuration expected to compute dynamic dependencies.") +public @interface DynamicDependenciesConfiguration { + + String value() default "default"; +} \ No newline at end of file diff --git a/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java b/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java index 56957e149196f..5a613e2af5c0a 100644 --- a/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java +++ b/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java @@ -899,16 +899,31 @@ private void autoDiscoverPlugins0(final boolean callers, final boolean classpath // common for studio until job generation is updated to build a tcomp friendly bundle if (classpath && !Boolean.getBoolean("component.manager.classpath.skip")) { try { + final String markerValue = "TALEND-INF/dependencies.txt"; final Enumeration componentMarkers = - Thread.currentThread().getContextClassLoader().getResources("TALEND-INF/dependencies.txt"); + Thread.currentThread().getContextClassLoader().getResources(markerValue); while (componentMarkers.hasMoreElements()) { - File file = Files.toFile(componentMarkers.nextElement()); - if (file.getName().equals("dependencies.txt") && file.getParentFile() != null - && file.getParentFile().getName().equals("TALEND-INF")) { - file = file.getParentFile().getParentFile(); - } - if (!hasPlugin(container.buildAutoIdFromName(file.getName()))) { - addPlugin(file.getAbsolutePath()); + final URL marker = componentMarkers.nextElement(); + File file = Files.toFile(marker); + if (file != null) { + if (file.getName().equals("dependencies.txt") && file.getParentFile() != null + && file.getParentFile().getName().equals("TALEND-INF")) { + file = file.getParentFile().getParentFile(); + } + if (!hasPlugin(container.buildAutoIdFromName(file.getName()))) { + addPlugin(file.getAbsolutePath()); + } + } else { + // lookup nested jar + if (marker != null && "jar".equals(marker.getProtocol())) { + final String urlFile = marker.getFile(); + final String jarPath = urlFile.substring(0, urlFile.lastIndexOf("!")); + final String relativePath = jarPath.substring(jarPath.indexOf("!")); + final String jarFilePath = jarPath.substring(jarPath.lastIndexOf("/") + 1); + if (!hasPlugin(container.buildAutoIdFromName(jarFilePath))) { + addPlugin(jarPath); + } + } } } } catch (final IOException e) { @@ -1299,11 +1314,14 @@ public void onCreate(final Container container) { final AnnotationFinder finder; Archive archive = null; + final String rootModule = container.getRootModule(); + final boolean nested = rootModule != null && rootModule.startsWith("nested:"); try { String alreadyScannedClasses = null; Filter filter = KnownClassesFilter.INSTANCE; - try (final InputStream containerFilterConfig = - container.getLoader().getResourceAsStream("TALEND-INF/scanning.properties")) { + try (final InputStream containerFilterConfig = nested + ? loader.getNestedResource(rootModule + "!/TALEND-INF/scanning.properties") + : loader.getResourceAsStream("TALEND-INF/scanning.properties")) { if (containerFilterConfig != null) { final Properties config = new Properties(); config.load(containerFilterConfig); @@ -1778,8 +1796,10 @@ private Archive toArchive(final String module, final String moduleId, final Conf } } info(module + " (" + moduleId + ") is not a file, will try to look it up from a nested maven repository"); - final URL nestedJar = - loader.getParent().getResource(ConfigurableClassLoader.NESTED_MAVEN_REPOSITORY + module); + URL nestedJar = loader.getParent().getResource(ConfigurableClassLoader.NESTED_MAVEN_REPOSITORY + module); + if (nestedJar == null) { + nestedJar = loader.getParent().getResource(module); + } if (nestedJar != null) { InputStream nestedStream = null; final JarInputStream jarStream; diff --git a/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/service/ResolverImpl.java b/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/service/ResolverImpl.java index 1ba69e875a6c5..cf699aa45e5e3 100644 --- a/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/service/ResolverImpl.java +++ b/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/service/ResolverImpl.java @@ -67,7 +67,7 @@ public ClassLoaderDescriptor mapDescriptorToClassLoader(final InputStream descri } catch (final MalformedURLException e) { throw new IllegalStateException(e); } - } else if (loader.getResource("MAVEN-INF/repository/" + path) != null) { + } else if (loader.getResource(path) != null) { nested.add(path); resolved.add(artifact.toCoordinate()); } // else will be missing diff --git a/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/ComponentManagerTest.java b/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/ComponentManagerTest.java index 585e197c1ce3e..69d12bd624f95 100644 --- a/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/ComponentManagerTest.java +++ b/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/ComponentManagerTest.java @@ -60,7 +60,9 @@ import javax.management.ReflectionException; import org.apache.xbean.finder.util.Files; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; @@ -98,6 +100,16 @@ private ComponentManager newManager() { return newManager(new File("target/test-dependencies")); } + @BeforeAll + static void setup() { + System.setProperty("talend.component.manager.m2.fallback", "true"); + } + + @AfterAll + static void teardown() { + System.clearProperty("talend.component.manager.m2.fallback"); + } + @Test void doubleClose() { final ComponentManager instance = ComponentManager.instance(); @@ -417,7 +429,7 @@ void extendFamilyInNestedRepo(@TempDir final File temporaryFolder) throws Except final URLClassLoader parentLoader = new URLClassLoader(new URL[] { fatJar.toURI().toURL() }, thread.getContextClassLoader()); thread.setContextClassLoader(parentLoader); - try (final ComponentManager manager = newManager(new File("target/missing_" + UUID.randomUUID().toString()))) { + try (final ComponentManager manager = newManager(pluginFolder)) { try { manager.addPlugin(plugin2.getAbsolutePath()); @@ -429,7 +441,7 @@ void extendFamilyInNestedRepo(@TempDir final File temporaryFolder) throws Except .map(File::getName) .sorted() .toArray(String[]::new); - assertEquals(1, dependencies.length); // ignored transitive deps, enables the new root to control it + assertEquals(2, dependencies.length); // ignored transitive deps, enables the new root to control it assertEquals("main.jar", dependencies[0]); // transitive-1.0.0.jar is nested } finally { if (!transitive.delete()) { diff --git a/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/service/ResolverImplTest.java b/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/service/ResolverImplTest.java index 0f704c2a90daf..4f57d58d58b26 100644 --- a/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/service/ResolverImplTest.java +++ b/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/service/ResolverImplTest.java @@ -99,7 +99,7 @@ void resolvefromDescriptor() throws IOException { private void addDepToJar(final String dep, final JarOutputStream out) { final String[] segments = dep.split(":"); - final String path = "MAVEN-INF/repository/" + segments[0].replace(".", "/") + "/" + segments[1] + "/" + final String path = segments[0].replace(".", "/") + "/" + segments[1] + "/" + segments[3] + "/" + segments[1] + "-" + segments[3] + "." + segments[2]; // create folders for this m2 embedded deps @@ -114,7 +114,7 @@ private void addDepToJar(final String dep, final JarOutputStream out) { } } // add the dep - final File jar = new File("target/test-dependencies", path.substring("MAVEN-INF/repository/".length())); + final File jar = new File("target/test-dependencies", path); try { out.putNextEntry(new ZipEntry(path)); Files.copy(jar.toPath(), out); diff --git a/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/xbean/NestedJarArchiveTest.java b/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/xbean/NestedJarArchiveTest.java index bdc1b8cd5d305..7c60166964dfd 100644 --- a/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/xbean/NestedJarArchiveTest.java +++ b/component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/xbean/NestedJarArchiveTest.java @@ -53,9 +53,9 @@ void xbeanNestedScanning(final TestInfo info, @TempDir final File temporaryFolde final File jar = createPlugin(temporaryFolder, info.getTestMethod().get().getName()); final ConfigurableClassLoader configurableClassLoader = new ConfigurableClassLoader("", new URL[0], new URLClassLoader(new URL[] { jar.toURI().toURL() }, Thread.currentThread().getContextClassLoader()), - n -> true, n -> true, new String[] { "com/foo/bar/1.0/bar-1.0.jar" }, new String[0]); + n -> true, n -> true, new String[] { "BOOT-INF/lib/com/foo/bar/1.0/bar-1.0.jar" }, new String[0]); try (final JarInputStream jis = new JarInputStream( - configurableClassLoader.getResourceAsStream("MAVEN-INF/repository/com/foo/bar/1.0/bar-1.0.jar"))) { + configurableClassLoader.getResourceAsStream("BOOT-INF/lib/com/foo/bar/1.0/bar-1.0.jar"))) { assertNotNull(jis, "test is wrongly setup, no nested jar, fix the createPlugin() method please"); final AnnotationFinder finder = new AnnotationFinder(new NestedJarArchive(null, jis, configurableClassLoader)); @@ -72,7 +72,7 @@ private File createPlugin(final File pluginFolder, final String name) throws IOE final File target = new File(pluginFolder, name); target.getParentFile().mkdirs(); try (final JarOutputStream outputStream = new JarOutputStream(new FileOutputStream(target))) { - outputStream.putNextEntry(new ZipEntry("MAVEN-INF/repository/com/foo/bar/1.0/bar-1.0.jar")); + outputStream.putNextEntry(new ZipEntry("BOOT-INF/lib/com/foo/bar/1.0/bar-1.0.jar")); try (final JarOutputStream nestedStream = new JarOutputStream(outputStream)) { final String packageName = "org/talend/test/generated/" + name.replace(".jar", ""); { // the factory (declaration) diff --git a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java index 3ded8250b3ccd..c03f5e8911bc3 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java @@ -28,6 +28,8 @@ import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.File; +import java.io.FileNotFoundException; +import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.instrument.ClassFileTransformer; @@ -38,7 +40,10 @@ import java.net.URLClassLoader; import java.net.URLConnection; import java.net.URLStreamHandler; +import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.security.CodeSource; import java.security.cert.Certificate; import java.util.ArrayList; @@ -55,6 +60,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.function.Predicate; +import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarInputStream; import java.util.jar.Manifest; @@ -150,7 +156,7 @@ private ConfigurableClassLoader(final String id, final URL[] urls, final ClassLo private void loadNestedDependencies(final ClassLoader parent, final String[] nestedDependencies) { final byte[] buffer = new byte[8192]; // should be good for most cases final ByteArrayOutputStream out = new ByteArrayOutputStream(buffer.length); - Stream.of(nestedDependencies).map(d -> NESTED_MAVEN_REPOSITORY + d).forEach(resource -> { + Stream.of(nestedDependencies).forEach(resource -> { final URL url = ofNullable(super.findResource(resource)).orElseGet(() -> parent.getResource(resource)); if (url == null) { throw new IllegalArgumentException("Didn't find " + resource + " in " + asList(nestedDependencies)); @@ -459,7 +465,7 @@ public Enumeration findResources(final String name) throws IOException { } private boolean isNestedDependencyResource(final String name) { - return name != null && name.startsWith(NESTED_MAVEN_REPOSITORY); + return name.startsWith(NESTED_MAVEN_REPOSITORY) || name.endsWith(".jar"); } private boolean isInJvm(final URL resource) { @@ -502,6 +508,60 @@ public List findContainedResources(final String name) { } } + /** + * Opens a stream to a resource located in a nested JAR. + * + * @param nestedUrl The full "nested:" URL, e.g. + * nested:/path/to/outer.jar/!path/inner.jar!/file.txt + * @return InputStream to the resource (must be closed by caller) + */ + public InputStream getNestedResource(final String nestedUrl) throws IOException { + if (nestedUrl == null || !nestedUrl.startsWith("nested:")) { + throw new IllegalArgumentException("Invalid nested URL: " + nestedUrl); + } + final String path = nestedUrl.substring("nested:".length()); + // Find the "/!" and "!/" separators + final int firstBang = path.indexOf("/!"); + final int secondBang = path.indexOf("!/", firstBang + 2); + if (firstBang < 0 || secondBang < 0) { + throw new IllegalArgumentException("Malformed nested URL: " + nestedUrl); + } + final Path outerJarPath = Paths.get(path.substring(0, firstBang)); // before /! + final String innerJarPath = path.substring(firstBang + 2, secondBang); // between /! and !/ + final String resourcePath = path.substring(secondBang + 2); // after the last !/ + // Open the outer JAR file + try (JarFile outerJar = new JarFile(outerJarPath.toFile())) { + JarEntry innerEntry = outerJar.getJarEntry(innerJarPath); + if (innerEntry == null) { + throw new FileNotFoundException("Inner JAR not found: " + innerJarPath); + } + // Copy the inner JAR to a temporary file + try (InputStream innerStream = outerJar.getInputStream(innerEntry)) { + final Path tempInnerJar = Files.createTempFile("nested-inner-", ".jar"); + Files.copy(innerStream, tempInnerJar, StandardCopyOption.REPLACE_EXISTING); + + final JarFile innerJar = new JarFile(tempInnerJar.toFile()); + final JarEntry resourceEntry = innerJar.getJarEntry(resourcePath); + if (resourceEntry == null) { + innerJar.close(); + Files.deleteIfExists(tempInnerJar); + throw new FileNotFoundException("Resource not found: " + resourcePath); + } + + // Return a stream that cleans up automatically when closed + return new FilterInputStream(innerJar.getInputStream(resourceEntry)) { + + @Override + public void close() throws IOException { + super.close(); + innerJar.close(); + Files.deleteIfExists(tempInnerJar); + } + }; + } + } + } + private URL nestedResourceToURL(final String name, final Resource nestedResource) { try { return new URL("nested", null, -1, nestedResource.entry + "!/" + name, new Handler(nestedResource)); diff --git a/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java b/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java index 67e33c498479a..24591bcc1b6c4 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java @@ -101,7 +101,7 @@ public Container(final String id, final String rootModule, final Artifact[] depe this.dependencies = dependencies; this.localDependencyRelativeResolver = localDependencyRelativeResolver; this.lastModifiedTimestamp.set(new Date(0)); - this.hasNestedRepository = hasNestedRepository; + this.hasNestedRepository = rootModule.startsWith("nested:") || hasNestedRepository; ofNullable(initializer).ifPresent(i -> i.accept(this)); this.classloaderProvider = () -> { @@ -143,9 +143,11 @@ public Container(final String id, final String rootModule, final Artifact[] depe .distinct() .toArray(String[]::new) : null; - final ConfigurableClassLoader loader = new ConfigurableClassLoader(id, urls, - overrideClassLoaderConfig.getParent(), overrideClassLoaderConfig.getParentClassesFilter(), - overrideClassLoaderConfig.getClassesFilter(), rawNestedDependencies, jvmMarkers); + final Predicate parentFilter = + this.hasNestedRepository ? (name) -> true : overrideClassLoaderConfig.getClassesFilter(); + final ConfigurableClassLoader loader = + new ConfigurableClassLoader(id, urls, overrideClassLoaderConfig.getParent(), parentFilter, + overrideClassLoaderConfig.getClassesFilter(), rawNestedDependencies, jvmMarkers); transformers.forEach(loader::registerTransformer); activeSpecificTransformers(loader); return loader; @@ -171,7 +173,7 @@ private boolean findNestedDependency(final ContainerManager.ClassLoaderConfigura } final URL url = overrideClassLoaderConfig .getParent() - .getResource(ConfigurableClassLoader.NESTED_MAVEN_REPOSITORY + depPath); + .getResource(depPath); return url != null; } @@ -307,6 +309,10 @@ public Date getCreated() { return created.get(); } + public boolean hasNestedRepository() { + return hasNestedRepository; + } + public void registerTransformer(final ClassFileTransformer transformer) { transformers.add(transformer); } diff --git a/container/container-core/src/main/java/org/talend/sdk/component/container/ContainerManager.java b/container/container-core/src/main/java/org/talend/sdk/component/container/ContainerManager.java index 393401aeadf87..34e23a6b5151e 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/container/ContainerManager.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/container/ContainerManager.java @@ -29,6 +29,9 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; @@ -116,6 +119,7 @@ public ContainerManager(final DependenciesResolutionConfiguration dependenciesRe if (log.isDebugEnabled()) { log.debug("Using root repository: " + this.rootRepositoryLocation.toAbsolutePath()); + getSystemInformation(); } final String nestedPluginMappingResource = ofNullable(classLoaderConfiguration.getNestedPluginMappingResource()) @@ -129,6 +133,12 @@ public ContainerManager(final DependenciesResolutionConfiguration dependenciesRe try (final InputStream mappingStream = classLoaderConfiguration.getParent().getResourceAsStream(nestedPluginMappingResource)) { if (mappingStream != null) { + if (log.isDebugEnabled()) { + final URL plug = classLoaderConfiguration.getParent().getResource(nestedPluginMappingResource); + if (plug != null) { + log.debug("[sysinfo] plugins mapping " + plug.toString()); + } + } final Properties properties = new Properties() { { @@ -155,10 +165,13 @@ public ContainerManager(final DependenciesResolutionConfiguration dependenciesRe this.jvmMarkers = Stream .concat(Stream.concat(Stream.of(getJre()), getComponentModules()), getCustomJvmMarkers()) .toArray(String[]::new); - this.hasNestedRepository = - this.classLoaderConfiguration.isSupportsResourceDependencies() && this.classLoaderConfiguration - .getParent() - .getResource(ConfigurableClassLoader.NESTED_MAVEN_REPOSITORY) != null; + final URL nestedMvn = this.classLoaderConfiguration + .getParent() + .getResource(ConfigurableClassLoader.NESTED_MAVEN_REPOSITORY); + this.hasNestedRepository = this.classLoaderConfiguration.isSupportsResourceDependencies() && nestedMvn != null; + if (log.isDebugEnabled() && hasNestedRepository) { + log.debug("[sysinfo] nested maven repository: " + nestedMvn); + } } public File getRootRepositoryLocation() { @@ -394,6 +407,22 @@ private String getJre() { .orElseThrow(IllegalArgumentException::new); } + private void getSystemInformation() { + try { + final RuntimeMXBean rt = ManagementFactory.getRuntimeMXBean(); + log.debug("[sysinfo] JVM arguments: " + rt.getInputArguments()); + try { + log.debug("[sysinfo] Boot classpath: " + rt.getBootClassPath()); + } catch (Exception e) { + // nop, will fail in some cases for boot classpath + } + log.debug("[sysinfo] Runtime classpath: " + rt.getClassPath()); + log.debug("[sysinfo] Runtime arguments: " + System.getProperty("sun.java.command")); + } catch (Exception e) { + log.debug("Unable to get JVM information: " + e.getMessage(), e); + } + } + @Override public void close() { lifecycle.closeIfNeeded(() -> { diff --git a/container/container-core/src/main/java/org/talend/sdk/component/dependencies/maven/MvnDependencyListLocalRepositoryResolver.java b/container/container-core/src/main/java/org/talend/sdk/component/dependencies/maven/MvnDependencyListLocalRepositoryResolver.java index c061f2d95caec..d115b7663437d 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/dependencies/maven/MvnDependencyListLocalRepositoryResolver.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/dependencies/maven/MvnDependencyListLocalRepositoryResolver.java @@ -66,22 +66,21 @@ public Stream resolve(final ClassLoader rootLoader, final String artif .filter(Files::exists) .map(this::findDependenciesFile) .orElseGet(() -> { - final boolean isNested; - try (final InputStream stream = rootLoader - .getResourceAsStream(ConfigurableClassLoader.NESTED_MAVEN_REPOSITORY + artifact)) { + boolean isNested; + try (final InputStream stream = rootLoader.getResourceAsStream(artifact)) { isNested = stream != null; } catch (final IOException e) { log.debug(e.getMessage(), e); return ""; } - if (isNested) { // we reuse ConfigurableClassLoader just to not - // rewrite the logic but it is NOT a plugin! - try (final ConfigurableClassLoader configurableClassLoader = + if (isNested) { + try (final ConfigurableClassLoader ccl = new ConfigurableClassLoader("", new URL[0], rootLoader, name -> true, name -> true, new String[] { artifact }, new String[0])) { - try (final InputStream deps = - configurableClassLoader.getResourceAsStream(dependenciesListFile)) { + try (final InputStream deps = artifact.startsWith("nested:") + ? ccl.getNestedResource(artifact + "!/" + dependenciesListFile) + : ccl.getResourceAsStream(dependenciesListFile)) { return ofNullable(deps).map(s -> { try { return slurp(s); diff --git a/container/container-core/src/test/java/org/talend/sdk/component/classloader/ConfigurableClassLoaderTest.java b/container/container-core/src/test/java/org/talend/sdk/component/classloader/ConfigurableClassLoaderTest.java index 639b7b091d9e9..0401356ad2a10 100644 --- a/container/container-core/src/test/java/org/talend/sdk/component/classloader/ConfigurableClassLoaderTest.java +++ b/container/container-core/src/test/java/org/talend/sdk/component/classloader/ConfigurableClassLoaderTest.java @@ -193,8 +193,7 @@ void nestedJars(@TempDir final File temporaryFolder) throws IOException { final URL url = loader.getResource(resource); assertNotNull(url); assertEquals("nested", url.getProtocol()); - assertEquals( - "MAVEN-INF/repository/org/apache/tomee/ziplock/8.0.14/ziplock-8.0.14.jar!/org/apache/ziplock/JarLocation.class", + assertEquals("org/apache/tomee/ziplock/8.0.14/ziplock-8.0.14.jar!/org/apache/ziplock/JarLocation.class", url.getFile()); final byte[] bytes = slurp(url.openStream()); assertEquals(4666, bytes.length, mavenJarSizeMargin); @@ -377,7 +376,7 @@ private File createNestedJar(final File temporaryFolder, final String... deps) t Stream.of(deps).forEach(s -> { final String[] segments = s.split(":"); - final String path = "MAVEN-INF/repository/" + segments[0].replace(".", "/") + "/" + segments[1] + "/" + final String path = segments[0].replace(".", "/") + "/" + segments[1] + "/" + segments[3] + "/" + segments[1] + "-" + segments[3] + "." + segments[2]; { // create folders for this m2 embedded deps @@ -393,8 +392,7 @@ private File createNestedJar(final File temporaryFolder, final String... deps) t } } { // add the dep - final File jar = - new File(Constants.DEPENDENCIES_LOCATION, path.substring("MAVEN-INF/repository/".length())); + final File jar = new File(Constants.DEPENDENCIES_LOCATION, path); try { out.putNextEntry(new ZipEntry(path)); Files.copy(jar.toPath(), out); diff --git a/container/container-core/src/test/java/org/talend/sdk/component/dependencies/maven/MvnDependencyListLocalRepositoryResolverTest.java b/container/container-core/src/test/java/org/talend/sdk/component/dependencies/maven/MvnDependencyListLocalRepositoryResolverTest.java index aa02eedb0176d..b6950ab38d6e7 100644 --- a/container/container-core/src/test/java/org/talend/sdk/component/dependencies/maven/MvnDependencyListLocalRepositoryResolverTest.java +++ b/container/container-core/src/test/java/org/talend/sdk/component/dependencies/maven/MvnDependencyListLocalRepositoryResolverTest.java @@ -33,6 +33,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +import org.talend.sdk.component.classloader.ConfigurableClassLoader; import org.talend.sdk.component.test.dependencies.DependenciesTxtBuilder; class MvnDependencyListLocalRepositoryResolverTest { @@ -58,7 +59,7 @@ void nestedDependency(@TempDir final File temporaryFolder) throws IOException { new URLClassLoader(new URL[] { file.toURI().toURL() }, getSystemClassLoader())) { final List toResolve = new MvnDependencyListLocalRepositoryResolver("TALEND-INF/dependencies.txt", d -> null) - .resolve(tempLoader, "foo/bar/dummy/1.0.0/dummy-1.0.0.jar") + .resolve(tempLoader, "MAVEN-INF/repository/foo/bar/dummy/1.0.0/dummy-1.0.0.jar") .map(Artifact::toPath) .collect(toList()); assertEquals(asList("org/apache/tomee/ziplock/8.0.14/ziplock-8.0.14.jar", @@ -71,8 +72,7 @@ void nestedDependencyWithJira(@TempDir final File temporaryFolder) throws IOExce final File file = new File(temporaryFolder, UUID.randomUUID().toString() + ".jar"); file.getParentFile().mkdirs(); try (final JarOutputStream enclosing = new JarOutputStream(new FileOutputStream(file))) { - enclosing.putNextEntry( - new ZipEntry("MAVEN-INF/repository/foo/bar/dummy/1.0.0-TCOMP-2285/dummy-1.0.0-TCOMP-2285.jar")); + enclosing.putNextEntry(new ZipEntry("BOOT-INF/lib/dummy-1.0.0-TCOMP-2285.jar")); try (final JarOutputStream nested = new JarOutputStream(enclosing)) { nested.putNextEntry(new ZipEntry("TALEND-INF/dependencies.txt")); nested @@ -85,10 +85,13 @@ void nestedDependencyWithJira(@TempDir final File temporaryFolder) throws IOExce } try (final URLClassLoader tempLoader = - new URLClassLoader(new URL[] { file.toURI().toURL() }, getSystemClassLoader())) { + new URLClassLoader(new URL[] { file.toURI().toURL() }, getSystemClassLoader()); + final ConfigurableClassLoader ccl = new ConfigurableClassLoader("test", + new URL[] {}, getSystemClassLoader(), name -> true, name -> true, + new String[] {}, new String[0])) { final List toResolve = new MvnDependencyListLocalRepositoryResolver("TALEND-INF/dependencies.txt", d -> null) - .resolve(tempLoader, "foo/bar/dummy/1.0.0-TCOMP-2285/dummy-1.0.0-TCOMP-2285.jar") + .resolve(tempLoader, "BOOT-INF/lib/dummy-1.0.0-TCOMP-2285.jar") .map(Artifact::toPath) .collect(toList()); assertEquals(asList("org/apache/tomee/ziplock/8.0.14/ziplock-8.0.14.jar", From 0c45a2a12c2b75235524e0a058e1805cf8a83c59 Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Mon, 24 Nov 2025 11:32:55 +0100 Subject: [PATCH 02/12] feat(QTDI-2134): fix ConfigurableClassLoader parentFilter argument --- .../main/java/org/talend/sdk/component/container/Container.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java b/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java index 24591bcc1b6c4..4a5644447567c 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java @@ -144,7 +144,7 @@ public Container(final String id, final String rootModule, final Artifact[] depe .toArray(String[]::new) : null; final Predicate parentFilter = - this.hasNestedRepository ? (name) -> true : overrideClassLoaderConfig.getClassesFilter(); + this.hasNestedRepository ? (name) -> true : overrideClassLoaderConfig.getParentClassesFilter(); final ConfigurableClassLoader loader = new ConfigurableClassLoader(id, urls, overrideClassLoaderConfig.getParent(), parentFilter, overrideClassLoaderConfig.getClassesFilter(), rawNestedDependencies, jvmMarkers); From 80fc6e7a7b8cc7d483c4b849080f928cc5c99666 Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Mon, 24 Nov 2025 13:35:05 +0100 Subject: [PATCH 03/12] feat(QTDI-2134): remove unused var - fix leak if exception --- .../runtime/manager/ComponentManager.java | 1 - .../classloader/ConfigurableClassLoader.java | 36 +++++++++---------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java b/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java index 5a613e2af5c0a..e4d52cf80d4ae 100644 --- a/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java +++ b/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java @@ -918,7 +918,6 @@ private void autoDiscoverPlugins0(final boolean callers, final boolean classpath if (marker != null && "jar".equals(marker.getProtocol())) { final String urlFile = marker.getFile(); final String jarPath = urlFile.substring(0, urlFile.lastIndexOf("!")); - final String relativePath = jarPath.substring(jarPath.indexOf("!")); final String jarFilePath = jarPath.substring(jarPath.lastIndexOf("/") + 1); if (!hasPlugin(container.buildAutoIdFromName(jarFilePath))) { addPlugin(jarPath); diff --git a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java index c03f5e8911bc3..4d46a2c82a7c4 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java @@ -536,28 +536,28 @@ public InputStream getNestedResource(final String nestedUrl) throws IOException throw new FileNotFoundException("Inner JAR not found: " + innerJarPath); } // Copy the inner JAR to a temporary file + final Path tempInnerJar = Files.createTempFile("nested-inner-", ".jar"); try (InputStream innerStream = outerJar.getInputStream(innerEntry)) { - final Path tempInnerJar = Files.createTempFile("nested-inner-", ".jar"); Files.copy(innerStream, tempInnerJar, StandardCopyOption.REPLACE_EXISTING); - final JarFile innerJar = new JarFile(tempInnerJar.toFile()); - final JarEntry resourceEntry = innerJar.getJarEntry(resourcePath); - if (resourceEntry == null) { - innerJar.close(); - Files.deleteIfExists(tempInnerJar); - throw new FileNotFoundException("Resource not found: " + resourcePath); - } - - // Return a stream that cleans up automatically when closed - return new FilterInputStream(innerJar.getInputStream(resourceEntry)) { - - @Override - public void close() throws IOException { - super.close(); - innerJar.close(); - Files.deleteIfExists(tempInnerJar); + try (JarFile innerJar = new JarFile(tempInnerJar.toFile())) { + final JarEntry resourceEntry = innerJar.getJarEntry(resourcePath); + if (resourceEntry == null) { + throw new FileNotFoundException("Resource not found: " + resourcePath); } - }; + + // Return a stream that cleans up automatically when closed + return new FilterInputStream(innerJar.getInputStream(resourceEntry)) { + @Override + public void close() throws IOException { + super.close(); + Files.deleteIfExists(tempInnerJar); + } + }; + } + } catch (IOException e) { + Files.deleteIfExists(tempInnerJar); + throw e; } } } From aa0409a340159b9f3f04848e673e31813c9ad7d6 Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Mon, 24 Nov 2025 15:04:11 +0100 Subject: [PATCH 04/12] feat(QTDI-2134): remove duplicated annotation for dynamic dependencies configuration type --- ...namicDependenciesServiceConfiguration.java | 34 ------------------- .../classloader/ConfigurableClassLoader.java | 1 + 2 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesServiceConfiguration.java diff --git a/component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesServiceConfiguration.java b/component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesServiceConfiguration.java deleted file mode 100644 index d367dce515f68..0000000000000 --- a/component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesServiceConfiguration.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.api.configuration.type; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import org.talend.sdk.component.api.configuration.type.meta.ConfigurationType; -import org.talend.sdk.component.api.meta.Documentation; - -@Target(TYPE) -@Retention(RUNTIME) -@ConfigurationType("dynamicDependenciesServiceConfiguration") -@Documentation("Mark a model (complex object) as being the configuration used in services annotated with @DynamicDependencies.") -public @interface DynamicDependenciesServiceConfiguration { - - String value() default "default"; -} \ No newline at end of file diff --git a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java index 4d46a2c82a7c4..4f248b6ab1eda 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java @@ -548,6 +548,7 @@ public InputStream getNestedResource(final String nestedUrl) throws IOException // Return a stream that cleans up automatically when closed return new FilterInputStream(innerJar.getInputStream(resourceEntry)) { + @Override public void close() throws IOException { super.close(); From d4a0aa303a144643921156424133527a33ef0f6f Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Mon, 24 Nov 2025 15:21:12 +0100 Subject: [PATCH 05/12] feat(QTDI-2134): fix sample for remove duplicated annotation for dynamic dependencies configuration type --- .../test/connectors/config/DynamicDependenciesConf.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sample-parent/sample-connector/src/main/java/org/talend/sdk/component/test/connectors/config/DynamicDependenciesConf.java b/sample-parent/sample-connector/src/main/java/org/talend/sdk/component/test/connectors/config/DynamicDependenciesConf.java index 22258c28bebca..4d182f743ac96 100644 --- a/sample-parent/sample-connector/src/main/java/org/talend/sdk/component/test/connectors/config/DynamicDependenciesConf.java +++ b/sample-parent/sample-connector/src/main/java/org/talend/sdk/component/test/connectors/config/DynamicDependenciesConf.java @@ -18,14 +18,14 @@ import java.io.Serializable; import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.type.DynamicDependenciesServiceConfiguration; +import org.talend.sdk.component.api.configuration.type.DynamicDependenciesConfiguration; import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; import org.talend.sdk.component.api.meta.Documentation; import lombok.Data; @Data -@DynamicDependenciesServiceConfiguration +@DynamicDependenciesConfiguration @GridLayout({ @GridLayout.Row({ "group" }), @GridLayout.Row({ "artifact" }) From 9d972a2a6f46d00c1b14f54a2fd462434d6bec9f Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Wed, 26 Nov 2025 15:50:36 +0100 Subject: [PATCH 06/12] feat(QTDI-2134): fix double inputstream doubled close --- .../classloader/ConfigurableClassLoader.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java index 4f248b6ab1eda..289d013daf517 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java @@ -540,22 +540,24 @@ public InputStream getNestedResource(final String nestedUrl) throws IOException try (InputStream innerStream = outerJar.getInputStream(innerEntry)) { Files.copy(innerStream, tempInnerJar, StandardCopyOption.REPLACE_EXISTING); - try (JarFile innerJar = new JarFile(tempInnerJar.toFile())) { - final JarEntry resourceEntry = innerJar.getJarEntry(resourcePath); - if (resourceEntry == null) { - throw new FileNotFoundException("Resource not found: " + resourcePath); - } + JarFile innerJar = new JarFile(tempInnerJar.toFile()); + final JarEntry resourceEntry = innerJar.getJarEntry(resourcePath); + if (resourceEntry == null) { + throw new FileNotFoundException("Resource not found: " + resourcePath); + } - // Return a stream that cleans up automatically when closed - return new FilterInputStream(innerJar.getInputStream(resourceEntry)) { + // Return a stream that cleans up automatically when closed + return new FilterInputStream(innerJar.getInputStream(resourceEntry)) { - @Override - public void close() throws IOException { + @Override + public void close() throws IOException { + try { super.close(); + } finally { Files.deleteIfExists(tempInnerJar); } - }; - } + } + }; } catch (IOException e) { Files.deleteIfExists(tempInnerJar); throw e; From 7b109ec2380455527551aea68412231652662c30 Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Wed, 26 Nov 2025 19:17:35 +0100 Subject: [PATCH 07/12] feat(QTDI-2134): include sample-feature from QTDI-1914 --- .../dynamic-dependencies/README.md | 38 ++ .../classloader-test-library/pom.xml | 48 +++ .../StringMapProvider.java | 24 ++ .../StringMapTransformer.java | 80 +++++ .../resource.properties | 16 + .../classloader-test-spi/pom.xml | 56 +++ .../StringMapProviderImpl.java | 31 ++ .../CLASSLOADER-TEST-SPI/resource.properties | 16 + ...s.classloadertestlibrary.StringMapProvider | 16 + .../StringMapProviderImplTest.java | 37 ++ .../dynamic-dependencies-common/pom.xml | 96 +++++ .../dynamicdependencies/config/Connector.java | 65 ++++ .../config/Dependency.java | 48 +++ .../config/DynamicDependencyConfig.java | 30 ++ .../AbstractDynamicDependenciesService.java | 336 ++++++++++++++++++ ...bstractDynamicDependenciesServiceTest.java | 100 ++++++ .../pom.xml | 69 ++++ .../DynamicDependencySupported.java | 34 ++ .../config/Config.java | 74 ++++ .../config/Dataset.java | 41 +++ .../config/Datastore.java | 30 ++ .../config/SubConfig.java | 45 +++ ...denciesWithDataprepRunAnnotationInput.java | 66 ++++ .../package-info.java | 23 ++ ...endenciesDataprepRunAnnotationService.java | 50 +++ .../src/main/resources/icons/dark/icon.svg | 66 ++++ .../src/main/resources/icons/light/icon.svg | 66 ++++ .../Messages.properties | 18 + .../config/Messages.properties | 24 ++ .../input/Messages.properties | 17 + ...nciesDataprepRunAnnotationServiceTest.java | 77 ++++ .../dynamic-dependencies-with-dataset/pom.xml | 67 ++++ .../withdataset/config/Config.java | 66 ++++ .../withdataset/config/Dataset.java | 55 +++ .../withdataset/config/Datastore.java | 30 ++ .../DynamicDependenciesWithDatasetInput.java | 64 ++++ .../withdataset/package-info.java | 23 ++ ...DynamicDependenciesWithDatasetService.java | 48 +++ .../src/main/resources/icons/dark/icon.svg | 66 ++++ .../src/main/resources/icons/light/icon.svg | 66 ++++ .../withdataset/Messages.properties | 18 + .../withdataset/config/Messages.properties | 22 ++ .../withdataset/input/Messages.properties | 17 + ...micDependenciesWithDatasetServiceTest.java | 56 +++ .../pom.xml | 69 ++++ .../withdatastore/config/Config.java | 66 ++++ .../withdatastore/config/Dataset.java | 41 +++ .../withdatastore/config/Datastore.java | 47 +++ ...DynamicDependenciesWithDatastoreInput.java | 64 ++++ .../withdatastore/package-info.java | 23 ++ ...namicDependenciesWithDatastoreService.java | 49 +++ .../src/main/resources/icons/dark/icon.svg | 66 ++++ .../src/main/resources/icons/light/icon.svg | 66 ++++ .../withdatastore/Messages.properties | 18 + .../withdatastore/config/Messages.properties | 22 ++ .../withdatastore/input/Messages.properties | 17 + ...cDependenciesWithDatastoreServiceTest.java | 56 +++ .../pom.xml | 72 ++++ .../config/Config.java | 71 ++++ .../config/Dataset.java | 41 +++ .../config/Datastore.java | 30 ++ .../config/SubConfig.java | 47 +++ ...DynamicDependenciesConfigurationInput.java | 66 ++++ .../package-info.java | 23 ++ ...ynamicependenciesConfigurationService.java | 49 +++ .../src/main/resources/icons/dark/icon.svg | 66 ++++ .../src/main/resources/icons/light/icon.svg | 66 ++++ .../Messages.properties | 18 + .../config/Messages.properties | 23 ++ .../input/Messages.properties | 17 + ...icependenciesConfigurationServiceTest.java | 58 +++ .../dynamic-dependencies-with-spi/pom.xml | 66 ++++ .../withspi/config/Config.java | 47 +++ .../withspi/config/Dataset.java | 46 +++ .../withspi/config/Datastore.java | 36 ++ .../DynamicDependenciesWithSPIInput.java | 64 ++++ .../withspi/package-info.java | 23 ++ .../DynamicDependenciesWithSPIService.java | 88 +++++ .../src/main/resources/icons/dark/icon.svg | 66 ++++ .../src/main/resources/icons/light/icon.svg | 66 ++++ .../withspi/Messages.properties | 19 + .../withspi/config/Messages.properties | 22 ++ .../withspi/input/Messages.properties | 17 + .../src/main/resources/version.properties | 17 + .../dynamic-dependencies/pom.xml | 51 +++ sample-parent/sample-features/pom.xml | 1 + 86 files changed, 4215 insertions(+) create mode 100644 sample-parent/sample-features/dynamic-dependencies/README.md create mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-library/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapProvider.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapTransformer.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/resources/CLASSLOADER-TEST-LIBRARY/resource.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImpl.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/CLASSLOADER-TEST-SPI/resource.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/META-INF/services/org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapProvider create mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImplTest.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Connector.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDataprepRunAnnotationInput.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationServiceTest.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Datastore.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesWithDatasetInput.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesConfigurationInput.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationService.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationServiceTest.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Config.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Dataset.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Datastore.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/DynamicDependenciesWithSPIInput.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/package-info.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/service/DynamicDependenciesWithSPIService.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/dark/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/light/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/version.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/pom.xml diff --git a/sample-parent/sample-features/dynamic-dependencies/README.md b/sample-parent/sample-features/dynamic-dependencies/README.md new file mode 100644 index 0000000000000..aff3dac7f1be4 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/README.md @@ -0,0 +1,38 @@ +# Component Runtime :: Sample Feature :: DynamicDependency + +## Table of Contents +- [Overview](#overview) +- [Usage](#usage) + - [How to build the connector plugin](#how-to-build-the-sample-connector-plugin) + - [How to use](#how-to-use) + + +## Overview +This is a test TCK connector plugin to test and validate the DynamicDependency input feature. + +This project contains 4 test connectors: +### DynamicDependency with Dataset +The service of this connector use a dataset as parameter. + +### DynamicDependency with Datastore +The service of this connector use a datastore as parameter. + +### DynamicDependency with Dataprep run annotation +The service of this connector use a new annotation @DynamicDependencySupported. + +### DynamicDependency with @DynamicDependenciesConfiguration +The service of this connector use a config which using @DynamicDependenciesConfiguration. + +## Usage +### How to build the sample connector plugin +Checkout the code from the repository and build the project using `mvn clean install` +Alternatively build the feature module using `mvn install -am -pl :dynamicdependencies` + +### How to use +- Deploy the connector into Studio: +java -jar dynamic-dependencies-with-dataset-1.86.0-SNAPSHOT.car studio-deploy --location c:\Talend-Studio-20251010_0827-V8.0.2SNAPSHOT + +- Use the connector in the job. +- Click "Guess schema" of the connector. +- Add others you want to use in the job, then run the job. + diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/pom.xml b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/pom.xml new file mode 100644 index 0000000000000..8358575457b4e --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies + 1.86.0-SNAPSHOT + + + org.talend.sdk.samplefeature.dynamicdependencies + classloader-test-library + + jar + Component Runtime :: Sample Feature @DynamicDependency :: a classloader test library + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + dynamic.dependencies.classloadertestlibrary + + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapProvider.java b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapProvider.java new file mode 100644 index 0000000000000..7004bed056076 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapProvider.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary; + +import java.util.Map; + +public interface StringMapProvider { + + Map getMap(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapTransformer.java b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapTransformer.java new file mode 100644 index 0000000000000..8e29acabcbd62 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapTransformer.java @@ -0,0 +1,80 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.ServiceLoader; +import java.util.function.BiFunction; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.talend.sdk.component.api.exception.ComponentException; + +public class StringMapTransformer { + + private final StringMapProvider stringMapProvider; + + public StringMapTransformer(final boolean failIfSeveralServicesFound) { + ServiceLoader serviceLoader = ServiceLoader.load(StringMapProvider.class); + + List stringMapProviderList = new ArrayList<>(); + serviceLoader.iterator().forEachRemaining(stringMapProviderList::add); + + if (stringMapProviderList.size() <= 0) { + throw new ComponentException("No %s service found.".formatted(StringMapProvider.class)); + } + + if (stringMapProviderList.size() > 1 && failIfSeveralServicesFound) { + String join = stringMapProviderList.stream() + .map(m -> m.getClass().getName()) + .collect(Collectors.joining("\n")); + throw new ComponentException("More than one %s service has been found: %s" + .formatted(StringMapProvider.class, join)); + } + + this.stringMapProvider = stringMapProviderList.get(0); + } + + public List transform(final BiFunction function) { + Map map = stringMapProvider.getMap(); + return map.entrySet() + .stream() + .map(e -> function.apply(e.getKey(), e.getValue())) + .toList(); + } + + public String getResourceContent() { + Stream resources = this.getClass().getClassLoader().resources("CLASSLOADER-TEST-SPI/resource.properties"); + return resources + .map(url -> { + try (InputStream is = url.openStream()) { + return new String(is.readAllBytes(), StandardCharsets.UTF_8); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + }) + .filter(l -> !l.startsWith("#")) + .collect(Collectors.joining("\n")); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/resources/CLASSLOADER-TEST-LIBRARY/resource.properties b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/resources/CLASSLOADER-TEST-LIBRARY/resource.properties new file mode 100644 index 0000000000000..dfa17bc74aadd --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/resources/CLASSLOADER-TEST-LIBRARY/resource.properties @@ -0,0 +1,16 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example +org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.message=This is a resource file from classloader-test-library. \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/pom.xml b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/pom.xml new file mode 100644 index 0000000000000..5bd2d3c7fe11b --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/pom.xml @@ -0,0 +1,56 @@ + + + + 4.0.0 + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies + 1.86.0-SNAPSHOT + + + org.talend.sdk.samplefeature.dynamicdependencies + classloader-test-spi + + jar + Component Runtime :: Sample Feature @DynamicDependency :: a spi service + + + + org.talend.sdk.samplefeature.dynamicdependencies + classloader-test-library + ${project.version} + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + dynamic.dependencies.dynamicdependencyspi + + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImpl.java b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImpl.java new file mode 100644 index 0000000000000..2e730380df1e8 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestspi; + +import java.util.HashMap; +import java.util.Map; + +import org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapProvider; + +public class StringMapProviderImpl implements StringMapProvider { + + @Override + public Map getMap() { + Map map = new HashMap<>(); + map.put("key1", "value1"); + return map; + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/CLASSLOADER-TEST-SPI/resource.properties b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/CLASSLOADER-TEST-SPI/resource.properties new file mode 100644 index 0000000000000..1d5ecab5e0199 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/CLASSLOADER-TEST-SPI/resource.properties @@ -0,0 +1,16 @@ +<<<<<<<<<<<<<<<<<<# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example>>>>>>>>>>>>>>>>>> +org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestspi.message=This is a resource file from classloader-test-spi. \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/META-INF/services/org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapProvider b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/META-INF/services/org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapProvider new file mode 100644 index 0000000000000..bc36faaceadbb --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/META-INF/services/org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapProvider @@ -0,0 +1,16 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example +org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestspi.StringMapProviderImpl \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImplTest.java b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImplTest.java new file mode 100644 index 0000000000000..34834c9b45b2d --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImplTest.java @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestspi; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapTransformer; + +class StringMapProviderImplTest { + + @Test + void testSPI() { + StringMapTransformer stringMapTransformer = new StringMapTransformer<>(true); + List transform = stringMapTransformer.transform((s1, s2) -> s1 + ":" + s2); + List sorted = new ArrayList<>(transform); + sorted.sort(String::compareTo); + String collect = String.join("/", sorted); + Assertions.assertEquals("key1:value1", collect); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml new file mode 100644 index 0000000000000..f14a434b72623 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml @@ -0,0 +1,96 @@ + + + + 4.0.0 + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies + 1.86.0-SNAPSHOT + + + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-common + jar + Component Runtime :: Sample Feature @DynamicDependency Common + + + + org.talend.sdk.samplefeature.dynamicdependencies + classloader-test-library + ${project.version} + + + org.talend.sdk.samplefeature.dynamicdependencies + classloader-test-spi + ${project.version} + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + dynamic.dependencies.common + + + + + + + test-jar + + + + + + org.talend.sdk.component + talend-component-maven-plugin + ${project.version} + + + talend-component-validate + + false + false + false + + + + + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} + + + + + test-jar + + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Connector.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Connector.java new file mode 100644 index 0000000000000..3aed79831e48e --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Connector.java @@ -0,0 +1,65 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@GridLayout(value = { + @GridLayout.Row({ "groupId", "artifactId", "version", "connectorFamily", "connectorName", "connectorVersion", + "loadTransitiveDependencies", "connectorConfiguration" }) +}) +public class Connector implements Serializable { + + @Option + @Documentation("The connector's group id.") + private String groupId; + + @Option + @Documentation("The connector's artifact id.") + private String artifactId; + + @Option + @Documentation("The connector's artifact version.") + private String version; + + @Option + @Documentation("The connector's family.") + private String connectorFamily; + + @Option + @Documentation("The connector's namer.") + private String connectorName; + + @Option + @Documentation("The connector's version.") + private int connectorVersion; + + @Option + @Documentation("Load transitive dependencies from TALEND-INF/dependencies.txt.") + private boolean loadTransitiveDependencies; + + @Option + @Documentation("The connector's configuration.") + private String connectorConfiguration; + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java new file mode 100644 index 0000000000000..a4c67f8826dbd --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@GridLayout(value = { + @GridLayout.Row({ "groupId", "artifactId", "version", "clazz" }) +}) +public class Dependency implements Serializable { + + @Option + @Documentation("The groupId of the dependency.") + private String groupId; + + @Option + @Documentation("The artifactId of the dependency.") + private String artifactId; + + @Option + @Documentation("The version of the dependency.") + private String version; + + @Option + @Documentation("The class to try to load from this dependency.") + private String clazz; + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java new file mode 100644 index 0000000000000..ec866e68c5a19 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.config; + +import java.util.List; + +public interface DynamicDependencyConfig { + + List getDependencies(); + + List getConnectors(); + + boolean isEnvironmentInformation(); + + boolean isDieOnError(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java new file mode 100644 index 0000000000000..8d1aa84c2781f --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java @@ -0,0 +1,336 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.service; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Serializable; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.talend.sdk.component.api.exception.ComponentException; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.api.record.Record.Builder; +import org.talend.sdk.component.api.record.Schema; +import org.talend.sdk.component.api.record.Schema.Type; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.api.service.dependency.Resolver; +import org.talend.sdk.component.api.service.record.RecordBuilderFactory; +import org.talend.sdk.component.api.service.source.ProducerFinder; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public abstract class AbstractDynamicDependenciesService implements Serializable { + + public static final String ENTRY_MAVEN = "maven"; + + public static final String ENTRY_CLASS = "clazz"; + + public static final String ENTRY_IS_LOADED = "is_loaded"; + + public static final String ENTRY_CONNECTOR_CLASSLOADER = "connector_classloader"; + + public static final String ENTRY_CLAZZ_CLASSLOADER = "clazz_classloader"; + + public static final String ENTRY_FROM_LOCATION = "from_location"; + + public static final String ENTRY_IS_TCK_CONTAINER = "is_tck_container"; + + public static final String ENTRY_FIRST_RECORD = "first_record"; + + public static final String ENTRY_ROOT_REPOSITORY = "root_repository"; + + public static final String ENTRY_RUNTIME_CLASSPATH = "runtime_classpath"; + + public static final String ENTRY_WORKING_DIRECTORY = "Working_directory"; + + @Service + private RecordBuilderFactory factory; + + @Service + private ProducerFinder finder; + + @Service + private Resolver resolver; + + public Iterator loadIterator(final DynamicDependencyConfig dynamicDependencyConfig) { + Schema schema = buildSchema(dynamicDependencyConfig); + + List standardDependencies = loadStandarDependencies(dynamicDependencyConfig, schema); + List additionalConnectors = loadConnectors(dynamicDependencyConfig, schema); + + return Stream.concat(standardDependencies.stream(), additionalConnectors.stream()).iterator(); + } + + private List loadStandarDependencies(final DynamicDependencyConfig dynamicDependencyConfig, + final Schema schema) { + List records = new ArrayList<>(); + for (Dependency dependency : dynamicDependencyConfig.getDependencies()) { + + String maven = String.format("%s:%s:%s", dependency.getGroupId(), dependency.getArtifactId(), + dependency.getVersion()); + + boolean isLoaded = false; + String connectorClassLoaderId = this.getClass().getClassLoader().toString(); + String clazzClassLoaderId = "N/A"; + String fromLocation = "N/A"; + try { + Class clazz = Class.forName(dependency.getClazz()); + isLoaded = true; + clazzClassLoaderId = clazz.getClassLoader().toString(); + + // This way to retrieve the location works even if the jar from where clazz comes from + // is nested into another jar (uber jar scenario) + String classPath = clazz.getName().replace('.', '/') + ".class"; + URL url = clazz.getClassLoader().getResource(classPath); + fromLocation = String.valueOf(url); + } catch (ClassNotFoundException e) { + manageException(dynamicDependencyConfig.isDieOnError(), + "Cannot load class %s from system classloader".formatted(dependency.getClazz()), e); + } + + Record record = buildRecord(schema, + dynamicDependencyConfig, + maven, + dependency.getClazz(), + isLoaded, + connectorClassLoaderId, + clazzClassLoaderId, + fromLocation, + false, + Optional.empty()); + records.add(record); + } + + return records; + } + + private List loadConnectors(final DynamicDependencyConfig dynamicDependencyConfig, final Schema schema) { + List records = new ArrayList<>(); + for (Connector connector : dynamicDependencyConfig.getConnectors()) { + + String maven = String.format("%s:%s:%s", connector.getGroupId(), connector.getArtifactId(), + connector.getVersion()); + + String connectorClassLoaderId = this.getClass().getClassLoader().toString(); + String clazzClassLoaderId = "N/A"; + String fromLocation = "N/A"; + Optional optionalRecord = testLoadingData(connector); + boolean isLoaded = optionalRecord.isPresent(); + + Record record = buildRecord(schema, + dynamicDependencyConfig, + maven, + "N/A", + isLoaded, + connectorClassLoaderId, + clazzClassLoaderId, + fromLocation, + true, + optionalRecord); + records.add(record); + } + + return records; + + } + + private Record buildRecord(final Schema schema, + final DynamicDependencyConfig dynamicDependencyConfig, + final String maven, + final String clazz, + final boolean isLoaded, + final String connectorClassLoaderId, + final String clazzClassLoaderId, + final String fromLocation, + final boolean isTckContainer, + final Optional firstRecord) { + Builder builder = factory.newRecordBuilder(schema); + Builder recordBuilder = builder + .withString(ENTRY_MAVEN, maven) + .withString(ENTRY_CLASS, clazz) + .withBoolean(ENTRY_IS_LOADED, isLoaded) + .withString(ENTRY_CONNECTOR_CLASSLOADER, connectorClassLoaderId) + .withString(ENTRY_CLAZZ_CLASSLOADER, clazzClassLoaderId) + .withString(ENTRY_FROM_LOCATION, fromLocation) + .withBoolean(ENTRY_IS_TCK_CONTAINER, isTckContainer); + + if (firstRecord.isPresent()) { + builder.withRecord(ENTRY_FIRST_RECORD, firstRecord.get()); + } + + if (dynamicDependencyConfig.isEnvironmentInformation()) { + String rootRepository = System.getProperty("talend.component.manager.m2.repository"); + String runtimeClasspath = System.getProperty("java.class.path"); + String workDirectory = System.getProperty("user.dir"); + + recordBuilder = recordBuilder + .withString(ENTRY_ROOT_REPOSITORY, rootRepository) + .withString(ENTRY_RUNTIME_CLASSPATH, runtimeClasspath) + .withString(ENTRY_WORKING_DIRECTORY, workDirectory); + } + + return recordBuilder.build(); + } + + private Optional testLoadingData(final Connector connector) { + Iterator recordIterator = this.loadData(connector.getConnectorFamily(), connector.getConnectorName(), + connector.getConnectorVersion(), json2Map(connector.getConnectorConfiguration())); + return Optional.ofNullable( + recordIterator.hasNext() ? recordIterator.next() : null); + } + + private Map json2Map(final String json) { + // Transform the given json to map + return Collections.emptyMap(); + } + + protected Schema buildSchema(final DynamicDependencyConfig dynamicDependencyConfig) { + Schema.Builder builder = factory.newSchemaBuilder(Type.RECORD) + .withEntry(factory.newEntryBuilder().withName(ENTRY_MAVEN).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_CLASS).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_LOADED).withType(Type.BOOLEAN).build()) + .withEntry( + factory.newEntryBuilder().withName(ENTRY_CONNECTOR_CLASSLOADER).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_CLAZZ_CLASSLOADER).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_FROM_LOCATION).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_TCK_CONTAINER).withType(Type.BOOLEAN).build()); + + if (dynamicDependencyConfig.isEnvironmentInformation()) { + builder = builder + .withEntry(factory.newEntryBuilder().withName(ENTRY_ROOT_REPOSITORY).withType(Type.STRING).build()) + .withEntry( + factory.newEntryBuilder().withName(ENTRY_RUNTIME_CLASSPATH).withType(Type.STRING).build()) + .withEntry( + factory.newEntryBuilder().withName(ENTRY_WORKING_DIRECTORY).withType(Type.STRING).build()); + } + + return builder.build(); + } + + protected Iterator loadData(final String family, final String name, final int version, + final Map parameters) { + return finder.find(family, name, version, parameters); + } + + private void manageException(final boolean dieOnError, final String message, final Exception e) { + String msg = "Dynamic dependencies connector raised an exception: %s : %s".formatted(message, e.getMessage()); + log.error(msg, e); + if (dieOnError) { + throw new ComponentException(msg, e); + } + } + + protected List getDynamicDependencies(final List dependencies, + final List connectors) { + List standardDependencies = dependencies + .stream() + .map(d -> String.format("%s:%s:%s", d.getGroupId(), d.getArtifactId(), d.getVersion())) + .toList(); + + List additionalConnectors = connectors + .stream() + .map(c -> String.format("%s:%s:%s", c.getGroupId(), c.getArtifactId(), c.getVersion())) + .toList(); + + List connectorsDependencies = connectors + .stream() + .flatMap(this::getConnectorDependencies) + .toList(); + List all = Stream.of(standardDependencies, additionalConnectors, connectorsDependencies) + .flatMap(Collection::stream) + .toList(); + + if (log.isInfoEnabled()) { + String collect = all.stream().collect(Collectors.joining("\n- ", "- ", "")); + log.info("All identified dependencies:\n" + collect); + } + return all; + } + + private Stream getConnectorDependencies(final Connector connector) { + if (!connector.isLoadTransitiveDependencies()) { + return Stream.empty(); + } + + List result; + + String gav = String.format("%s:%s:%s", connector.getGroupId(), + connector.getArtifactId(), + connector.getVersion()); + Collection jarFiles = resolver.resolveFromDescriptor( + Collections.singletonList(gav)); + + if (jarFiles == null || jarFiles.size() <= 0) { + throw new ComponentException("Can't find additional connector '%s'.".formatted(gav)); + } + if (jarFiles.size() > 1) { + String join = jarFiles.stream().map(File::getAbsolutePath).collect(Collectors.joining(",")); + throw new ComponentException("Several files have been found to resolve '%s': %s".formatted(gav, join)); + } + + File jarFile = jarFiles.iterator().next(); + + try (JarFile jar = new JarFile(jarFile)) { + JarEntry entry = jar.getJarEntry("TALEND-INF/dependencies.txt"); + if (entry == null) { + throw new ComponentException("TALEND-INF/dependencies.txt not found in JAR"); + } + + try (InputStream is = jar.getInputStream(entry); + BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { + + result = reader.lines() + .filter(line -> !line.isBlank()) // skip empty lines + .map(line -> line.substring(0, line.lastIndexOf(":"))) // remove last ':xxx' + .collect(Collectors.toList()); + } + + } catch (IOException e) { + throw new ComponentException("Can't load dependencies for %s: %s".formatted(gav, e.getMessage()), e); + } + return result.stream(); + } + + /** + * Return true if the given path correspond to a class that has been loaded from a jar that contains + * a TALEND-INF/dependencies.txt file. + * + * @param path The clazz location + * @return true if the given path correspond to a TCK container + */ + private boolean isTCKContainer(final String path) { + // TO DO + return false; + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java new file mode 100644 index 0000000000000..270b228c525e1 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java @@ -0,0 +1,100 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies; + +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CLASS; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CLAZZ_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CONNECTOR_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_FROM_LOCATION; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_IS_LOADED; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_MAVEN; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_ROOT_REPOSITORY; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_WORKING_DIRECTORY; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; + +import lombok.Getter; + +public abstract class AbstractDynamicDependenciesServiceTest { + + @Getter + private C config; + + protected abstract C buildConfig(); + + protected abstract S getService(); + + @BeforeEach + void setUp() { + this.config = this.buildConfig(); + } + + @Test + void testloadIterator() { + System.setProperty("talend.component.manager.m2.repository", "./lib/"); + + final Iterator result = getService().loadIterator(config); + + Assertions.assertTrue(result.hasNext()); + this.assertRecord(result.next()); + Assertions.assertFalse(result.hasNext()); + } + + protected List getDependList() { + List depends = new ArrayList<>(); + Dependency depend = new Dependency(); + depend.setArtifactId("commons-numbers-primes"); + depend.setVersion("1.2"); + depend.setGroupId("org.apache.commons"); + depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); + depends.add(depend); + return depends; + } + + private void assertRecord(Record record) { + Assertions.assertNotNull(record); + Assertions.assertEquals("org.apache.commons:commons-numbers-primes:1.2", record.getString(ENTRY_MAVEN)); + Assertions.assertEquals( + "org.apache.commons.numbers.primes.SmallPrimes", + record.getString(ENTRY_CLASS)); + Assertions.assertTrue(record.getBoolean(ENTRY_IS_LOADED)); + Assertions.assertNotNull(record.getString(ENTRY_CONNECTOR_CLASSLOADER)); + Assertions.assertTrue(record.getString(ENTRY_CONNECTOR_CLASSLOADER) + .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); + Assertions.assertNotNull(record.getString(ENTRY_CLAZZ_CLASSLOADER)); + Assertions.assertTrue(record.getString(ENTRY_CLAZZ_CLASSLOADER) + .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); + Assertions.assertNotNull(record.getString(ENTRY_FROM_LOCATION)); + Assertions.assertTrue(record.getString(ENTRY_FROM_LOCATION) + .endsWith( + "org/apache/commons/commons-numbers-primes/1.2/commons-numbers-primes-1.2.jar!/org/apache/commons/numbers/primes/SmallPrimes.class")); + Assertions.assertEquals("./lib/", record.getString(ENTRY_ROOT_REPOSITORY)); + Assertions.assertNotNull(record.getString(ENTRY_RUNTIME_CLASSPATH)); + Assertions.assertEquals(System.getProperty("user.dir"), record.getString(ENTRY_WORKING_DIRECTORY)); + Assertions.assertTrue(record.getString(ENTRY_RUNTIME_CLASSPATH).contains("commons-numbers-primes-1.2.jar")); + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml new file mode 100644 index 0000000000000..80c0b8bc45460 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml @@ -0,0 +1,69 @@ + + + + 4.0.0 + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies + 1.86.0-SNAPSHOT + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-with-dataprepRunAnnotation + jar + Component Runtime :: Sample Feature @DynamicDependency with DataprepRun annotation + + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-common + ${project.version} + + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-common + ${project.version} + test-jar + test + + + + org.apache.commons + commons-numbers-primes + 1.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + dynamic.dependencies.withDataprepRunAnnotation + + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java new file mode 100644 index 0000000000000..7c81044cfbce7 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.annotation; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import org.talend.sdk.component.api.configuration.type.meta.ConfigurationType; +import org.talend.sdk.component.api.meta.Documentation; + +@Target(TYPE) +@Retention(RUNTIME) +@ConfigurationType("configuration") +@Documentation("Copy/past of the annotation from tDataprepRun.") +public @interface DynamicDependencySupported { + + String value() default "default"; +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java new file mode 100644 index 0000000000000..535e4b06acd90 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.annotation.DynamicDependencySupported; + +import lombok.Data; + +/** + * For this sample, the same configuration is used for all connectors input/processor/output. + */ +@Data +@DynamicDependencySupported +@GridLayout({ + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "subConfig" }), + @GridLayout.Row({ "environmentInformation" }) +}) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "dieOnError" }) +}) +public class Config implements DynamicDependencyConfig, Serializable { + + @Option + @Documentation("The dataset configuration.") + private Dataset dse = new Dataset(); + + @Option + @Documentation("Sub-configuration that contains the DynamidDependenciesConfiguration.") + private SubConfig subConfig = new SubConfig(); + + @Option + @Documentation("If enable throw an exception for any error, if not just log the error.") + private boolean dieOnError = false; + + @Option + @Documentation("More environment information.") + private boolean environmentInformation = false; + + @Override + public List getDependencies() { + return new ArrayList<>(this.getSubConfig().getDependencies()); + } + + @Override + public List getConnectors() { + return new ArrayList<>(this.getSubConfig().getConnectors()); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java new file mode 100644 index 0000000000000..ea45a9daba395 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataSet; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@DataSet("dyndepsdse") +@GridLayout(value = { + @GridLayout.Row({ "dso" }) +}) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dso" }) +}) +public class Dataset implements Serializable { + + @Option + @Documentation("A datastore.") + private Datastore dso = new Datastore(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java new file mode 100644 index 0000000000000..1749603106828 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.type.DataStore; +import org.talend.sdk.component.api.configuration.ui.layout.AutoLayout; + +import lombok.Data; + +@Data +@DataStore("dyndepsdso") +@AutoLayout +public class Datastore implements Serializable { + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java new file mode 100644 index 0000000000000..97b8a8db6fb0a --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java @@ -0,0 +1,45 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; + +import lombok.Data; + +@Data +@GridLayout({ + @GridLayout.Row({ "dependencies" }), + @GridLayout.Row({ "connectors" }) +}) +public class SubConfig implements Serializable { + + @Option + @Documentation("The dependencies to load dynamically.") + private List dependencies = new ArrayList<>(); + + @Option + @Documentation("The connectors to load dynamically.") + private List connectors = new ArrayList<>(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDataprepRunAnnotationInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDataprepRunAnnotationInput.java new file mode 100644 index 0000000000000..26ab1b60d7a09 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDataprepRunAnnotationInput.java @@ -0,0 +1,66 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.input; + +import java.io.Serializable; +import java.util.Iterator; + +import javax.annotation.PostConstruct; + +import org.talend.sdk.component.api.component.Icon; +import org.talend.sdk.component.api.component.Version; +import org.talend.sdk.component.api.input.Emitter; +import org.talend.sdk.component.api.input.Producer; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.service.DynamicDependenciesDataprepRunAnnotationService; + +@Version +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +@Emitter(name = "Input") +@Documentation("Dynamic dependencies sample input connector.") +public class DynamicDependenciesWithDataprepRunAnnotationInput extends AbstractDynamicDependenciesService + implements Serializable { + + private final Config config; + + private final DynamicDependenciesDataprepRunAnnotationService service; + + private Iterator recordIterator; + + public DynamicDependenciesWithDataprepRunAnnotationInput(final Config config, + final DynamicDependenciesDataprepRunAnnotationService service) { + this.config = config; + this.service = service; + } + + @PostConstruct + public void init() { + this.recordIterator = this.service.loadIterator(this.config); + } + + @Producer + public Record next() { + if (recordIterator == null || !recordIterator.hasNext()) { + return null; + } + + return recordIterator.next(); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java new file mode 100644 index 0000000000000..f671561c7be2c --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Components( + family = "DynamicDependenciesWithDataprepAnnotation", + categories = "sample") +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation; + +import org.talend.sdk.component.api.component.Components; +import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java new file mode 100644 index 0000000000000..39f7e7ea4b08f --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.service; + +import java.io.Serializable; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.record.Schema; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.api.service.dependency.DynamicDependencies; +import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class DynamicDependenciesDataprepRunAnnotationService extends AbstractDynamicDependenciesService + implements Serializable { + + public final static String DEPENDENCY_WITHDATAPREPRUN_ACTION = "DEPENDENCY_WITHDATAPREPRUN_ACTION"; + + public static final String DEPENDENCY_ACTION = "dataprep-dependencies"; + + @DynamicDependencies(DEPENDENCY_ACTION) + public List getDynamicDependencies(@Option("theConfig") final Config config) { + return super.getDynamicDependencies(config.getDependencies(), config.getConnectors()); + } + + @DiscoverSchemaExtended(DEPENDENCY_WITHDATAPREPRUN_ACTION) + public Schema guessSchema4Input(final @Option("configuration") Config config) { + return super.buildSchema(config); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg new file mode 100644 index 0000000000000..85e6a3e1e8eda --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDataprepRun + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg new file mode 100644 index 0000000000000..85e6a3e1e8eda --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDataprepRun + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties new file mode 100644 index 0000000000000..6a100dc952c46 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties @@ -0,0 +1,18 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +DynamicDependenciesWithDataprepAnnotation.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with datapreprun +DynamicDependenciesWithDataprepAnnotation.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with datapreprun \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties new file mode 100644 index 0000000000000..1b0eda6eb9634 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties @@ -0,0 +1,24 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +Dataset.dso._displayName = +Dataset.dependencies._displayName = Dependencies +Config.dse._displayName = +Config.dieOnError._displayName = Die on error +Config.environmentInformation._displayName = Environment information +Config.subConfig._displayName = +SubConfig.dependencies._displayName = Dependencies +SubConfig.connectors._displayName = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties new file mode 100644 index 0000000000000..a0c8970bddfa2 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +DynamicDependenciesWithDataprepAnnotation.Input._displayName = Dynamic Dependencies With DataprepRun annotation Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationServiceTest.java new file mode 100644 index 0000000000000..c1097e2960ddc --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationServiceTest.java @@ -0,0 +1,77 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.service; + +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Datastore; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation") +public class DynamicDependenciesDataprepRunAnnotationServiceTest + extends AbstractDynamicDependenciesServiceTest { + + @Service + DynamicDependenciesDataprepRunAnnotationService dynamicDependenciesServiceService; + + @Override + protected Config buildConfig() { + Config config = new Config(); + Dataset dse = new Dataset(); + Datastore dso = new Datastore(); + List depends = this.getDependList(); + config.getSubConfig().setDependencies(depends); + dse.setDso(dso); + config.setDse(dse); + config.setEnvironmentInformation(true); + + return config; + } + + // use tck cnnector as dependency + protected List getDependList() { + List depends = new ArrayList<>(); + Dependency depend = new Dependency(); + depend.setArtifactId("commons-numbers-primes"); + depend.setVersion("1.2"); + depend.setGroupId("org.apache.commons"); + depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); + depends.add(depend); + + // //for connector depend + // Dependency depend2 = new Dependency(); + // depend.setArtifactId("record-provider"); + // depend.setVersion("1.71.0-SNAPSHOT"); + // depend.setGroupId("org.talend.components"); + // depend.setClazz("org.talend.components.recordprovider.source.GenericMapper"); + // depends.add(depend2); + return depends; + } + + @Override + protected DynamicDependenciesDataprepRunAnnotationService getService() { + return dynamicDependenciesServiceService; + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml new file mode 100644 index 0000000000000..6b8bbdadb1d7d --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml @@ -0,0 +1,67 @@ + + + + 4.0.0 + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies + 1.86.0-SNAPSHOT + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-with-dataset + jar + Component Runtime :: Sample Feature @DynamicDependency with Dataset + + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-common + ${project.version} + + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-common + ${project.version} + test-jar + test + + + + org.apache.commons + commons-numbers-primes + 1.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.talend.sdk.component.dynamic.dependencies.withdataset + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java new file mode 100644 index 0000000000000..95352ed168631 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java @@ -0,0 +1,66 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; + +import lombok.Data; + +/** + * For this sample, the same configuration is used for all connectors input/processor/output. + */ +@Data +@GridLayout({ + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "environmentInformation" }) +}) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "dieOnError" }), +}) +public class Config implements DynamicDependencyConfig, Serializable { + + @Option + @Documentation("The dataset configuration.") + private Dataset dse = new Dataset(); + + @Option + @Documentation("If enable throw an exception for any error, if not just log the error.") + private boolean dieOnError = false; + + @Option + @Documentation("More environment information.") + private boolean environmentInformation = false; + + @Override + public List getDependencies() { + return new ArrayList<>(this.getDse().getDependencies()); + } + + public List getConnectors() { + return new ArrayList<>(this.getDse().getConnectors()); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java new file mode 100644 index 0000000000000..de1cd0b4ca719 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java @@ -0,0 +1,55 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataSet; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; + +import lombok.Data; + +@Data +@DataSet("dyndepsdse") +@GridLayout(value = { + @GridLayout.Row({ "dso" }), + @GridLayout.Row({ "dependencies" }), + @GridLayout.Row({ "connectors" }) +}) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dso" }) +}) +public class Dataset implements Serializable { + + @Option + @Documentation("A datastore.") + private Datastore dso = new Datastore(); + + @Option + @Documentation("The dependencies to load dynamically.") + private List dependencies = new ArrayList<>(); + + @Option + @Documentation("The connectors to load dynamically.") + private List connectors = new ArrayList<>(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Datastore.java new file mode 100644 index 0000000000000..de540902c68ff --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Datastore.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.type.DataStore; +import org.talend.sdk.component.api.configuration.ui.layout.AutoLayout; + +import lombok.Data; + +@Data +@DataStore("dyndepsdso") +@AutoLayout +public class Datastore implements Serializable { + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesWithDatasetInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesWithDatasetInput.java new file mode 100644 index 0000000000000..30e4e53d5d897 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesWithDatasetInput.java @@ -0,0 +1,64 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.input; + +import java.io.Serializable; +import java.util.Iterator; + +import javax.annotation.PostConstruct; + +import org.talend.sdk.component.api.component.Icon; +import org.talend.sdk.component.api.component.Version; +import org.talend.sdk.component.api.input.Emitter; +import org.talend.sdk.component.api.input.Producer; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService; + +@Version +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +@Emitter(name = "Input") +@Documentation("Dynamic dependencies sample input connector.") +public class DynamicDependenciesWithDatasetInput implements Serializable { + + private final Config config; + + private final DynamicDependenciesWithDatasetService service; + + private Iterator recordIterator; + + public DynamicDependenciesWithDatasetInput(final Config config, + final DynamicDependenciesWithDatasetService service) { + this.config = config; + this.service = service; + } + + @PostConstruct + public void init() { + this.recordIterator = this.service.loadIterator(this.config); + } + + @Producer + public Record next() { + if (recordIterator == null || !recordIterator.hasNext()) { + return null; + } + + return recordIterator.next(); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java new file mode 100644 index 0000000000000..525faeb12ae02 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Components( + family = "DynamicDependenciesWithDataset", + categories = "sample") +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset; + +import org.talend.sdk.component.api.component.Components; +import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java new file mode 100644 index 0000000000000..a532095bcc62b --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; + +import java.io.Serializable; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.record.Schema; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.api.service.dependency.DynamicDependencies; +import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Dataset; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class DynamicDependenciesWithDatasetService extends AbstractDynamicDependenciesService implements Serializable { + + public final static String DEPENDENCY_WITHDATASET_ACTION = "DEPENDENCY_WITHDATASET_ACTION"; + + @DynamicDependencies() + public List getDynamicDependencies(@Option("theDataset") final Dataset dataset) { + return super.getDynamicDependencies(dataset.getDependencies(), dataset.getConnectors()); + } + + @DiscoverSchemaExtended(DEPENDENCY_WITHDATASET_ACTION) + public Schema guessSchema4Input(final @Option("configuration") Config config) { + return super.buildSchema(config); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg new file mode 100644 index 0000000000000..3e6ba66a42db8 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDataset + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg new file mode 100644 index 0000000000000..3e6ba66a42db8 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDataset + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties new file mode 100644 index 0000000000000..e2466c2844474 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties @@ -0,0 +1,18 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +DynamicDependenciesWithDataset.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with dataset +DynamicDependenciesWithDataset.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with dataset \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties new file mode 100644 index 0000000000000..42b990411eaf6 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties @@ -0,0 +1,22 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +Dataset.dso._displayName = +Dataset.dependencies._displayName = Dependencies +Config.dse._displayName = +Config.dieOnError._displayName = Die on error +Config.environmentInformation._displayName = Environment information +Dataset.connectors._displayName = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties new file mode 100644 index 0000000000000..43d63aaae3a02 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +DynamicDependenciesWithDataset.Input._displayName = Dynamic Dependencies With Dataset Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java new file mode 100644 index 0000000000000..1602ef1a7fa83 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; + +import java.util.List; + +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Datastore; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset") +public class DynamicDependenciesWithDatasetServiceTest + extends AbstractDynamicDependenciesServiceTest { + + @Service + private DynamicDependenciesWithDatasetService dynamicDependenciesServiceService; + + @Override + protected Config buildConfig() { + Config config = new Config(); + Dataset dse = new Dataset(); + Datastore dso = new Datastore(); + List depends = this.getDependList(); + dse.setDependencies(depends); + dse.setDso(dso); + config.setDse(dse); + config.setEnvironmentInformation(true); + + return config; + } + + @Override + protected DynamicDependenciesWithDatasetService getService() { + return dynamicDependenciesServiceService; + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml new file mode 100644 index 0000000000000..a64addc4322ae --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml @@ -0,0 +1,69 @@ + + + + 4.0.0 + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies + 1.86.0-SNAPSHOT + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-with-datastore + jar + Component Runtime :: Sample Feature @DynamicDependency with Datastore + + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-common + ${project.version} + + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-common + ${project.version} + test-jar + test + + + + org.apache.commons + commons-numbers-primes + 1.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.talend.sdk.component.dynamic.dependencies.withdatastore + + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java new file mode 100644 index 0000000000000..50b8591e816f3 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java @@ -0,0 +1,66 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; + +import lombok.Data; + +/** + * For this sample, the same configuration is used for all connectors input/processor/output. + */ +@Data +@GridLayout({ + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "environmentInformation" }) +}) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "dieOnError" }), +}) +public class Config implements DynamicDependencyConfig, Serializable { + + @Option + @Documentation("The dataset configuration.") + private Dataset dse = new Dataset(); + + @Option + @Documentation("If enable throw an exception for any error, if not just log the error.") + private boolean dieOnError = false; + + @Option + @Documentation("More environment information.") + private boolean environmentInformation = false; + + @Override + public List getDependencies() { + return new ArrayList<>(this.getDse().getDso().getDependencies()); + } + + public List getConnectors() { + return new ArrayList<>(this.getDse().getDso().getConnectors()); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java new file mode 100644 index 0000000000000..abc52e5ec91c4 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataSet; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@DataSet("dyndepsdse") +@GridLayout(value = { + @GridLayout.Row({ "dso" }) +}) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dso" }) +}) +public class Dataset implements Serializable { + + @Option + @Documentation("A datastore.") + private Datastore dso = new Datastore(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java new file mode 100644 index 0000000000000..8218f4e27f7cc --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataStore; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; + +import lombok.Data; + +@Data +@DataStore("dyndepsdso") +@GridLayout({ + @GridLayout.Row({ "dependencies" }), + @GridLayout.Row({ "connectors" }) +}) +public class Datastore implements Serializable { + + @Option + @Documentation("The dependencies to load dynamically.") + private List dependencies = new ArrayList<>(); + + @Option + @Documentation("The connectors to load dynamically.") + private List connectors = new ArrayList<>(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java new file mode 100644 index 0000000000000..09159bfbc339d --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java @@ -0,0 +1,64 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.input; + +import java.io.Serializable; +import java.util.Iterator; + +import javax.annotation.PostConstruct; + +import org.talend.sdk.component.api.component.Icon; +import org.talend.sdk.component.api.component.Version; +import org.talend.sdk.component.api.input.Emitter; +import org.talend.sdk.component.api.input.Producer; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService; + +@Version +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +@Emitter(name = "Input") +@Documentation("Dynamic dependencies sample input connector.") +public class DynamicDependenciesWithDatastoreInput implements Serializable { + + private final Config config; + + private final DynamicDependenciesWithDatastoreService service; + + private Iterator recordIterator; + + public DynamicDependenciesWithDatastoreInput(final Config config, + final DynamicDependenciesWithDatastoreService service) { + this.config = config; + this.service = service; + } + + @PostConstruct + public void init() { + this.recordIterator = this.service.loadIterator(this.config); + } + + @Producer + public Record next() { + if (recordIterator == null || !recordIterator.hasNext()) { + return null; + } + + return recordIterator.next(); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java new file mode 100644 index 0000000000000..84c17f8fc511b --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Components( + family = "DynamicDependenciesWithDatastore", + categories = "sample") +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore; + +import org.talend.sdk.component.api.component.Components; +import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java new file mode 100644 index 0000000000000..ea08f69beb09c --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service; + +import java.io.Serializable; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.record.Schema; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.api.service.dependency.DynamicDependencies; +import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Datastore; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class DynamicDependenciesWithDatastoreService extends AbstractDynamicDependenciesService + implements Serializable { + + public final static String DEPENDENCY_WITHDATASTORE_ACTION = "DEPENDENCY_WITHDATASTORE_ACTION"; + + @DynamicDependencies() + public List getDynamicDependencies(@Option("theDatastore") final Datastore datastore) { + return super.getDynamicDependencies(datastore.getDependencies(), datastore.getConnectors()); + } + + @DiscoverSchemaExtended(DEPENDENCY_WITHDATASTORE_ACTION) + public Schema guessSchema4Input(final @Option("configuration") Config config) { + return super.buildSchema(config); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg new file mode 100644 index 0000000000000..750d837d60cec --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDatastore + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg new file mode 100644 index 0000000000000..750d837d60cec --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDatastore + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties new file mode 100644 index 0000000000000..54e6e670c24ff --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties @@ -0,0 +1,18 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +DynamicDependenciesWithDatastore.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with datastore +DynamicDependenciesWithDatastore.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with datastore \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties new file mode 100644 index 0000000000000..2a933f364e575 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties @@ -0,0 +1,22 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +Datastore.dependencies._displayName = Dependences +Dataset.dso._displayName = +Config.dse._displayName = +Config.dieOnError._displayName = Die on error +Config.environmentInformation._displayName = Environment information +Datastore.connectors._displayName = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties new file mode 100644 index 0000000000000..686de01008376 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +DynamicDependenciesWithDatastore.Input._displayName = Dynamic Dependencies With Datastore Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java new file mode 100644 index 0000000000000..465e126902f54 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service; + +import java.util.List; + +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Datastore; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore") +public class DynamicDependenciesWithDatastoreServiceTest + extends AbstractDynamicDependenciesServiceTest { + + @Service + DynamicDependenciesWithDatastoreService dynamicDependenciesServiceService; + + @Override + protected Config buildConfig() { + Config config = new Config(); + Dataset dse = new Dataset(); + Datastore dso = new Datastore(); + List depends = this.getDependList(); + dso.setDependencies(depends); + dse.setDso(dso); + config.setDse(dse); + config.setEnvironmentInformation(true); + + return config; + } + + @Override + protected DynamicDependenciesWithDatastoreService getService() { + return dynamicDependenciesServiceService; + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml new file mode 100644 index 0000000000000..842ad3faa79b2 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml @@ -0,0 +1,72 @@ + + + + 4.0.0 + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies + 1.86.0-SNAPSHOT + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-with-dynamicDependenciesConfiguration + jar + Component Runtime :: Sample Feature @DynamicDependency with DynamicDependenciesConfiguration + + + org.talend.sdk.component:dynamic-dependencies-common + include-exclude + + + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-common + ${project.version} + + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-common + ${project.version} + test-jar + test + + + + org.apache.commons + commons-numbers-primes + 1.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.talend.sdk.component.dynamic.dependencies.withDynamicDependenciesConfiguration + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java new file mode 100644 index 0000000000000..cd2c88cbd673b --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java @@ -0,0 +1,71 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; + +import lombok.Data; + +/** + * For this sample, the same configuration is used for all connectors input/processor/output. + */ +@Data +@GridLayout({ + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "subConfig" }), + @GridLayout.Row({ "environmentInformation" }) +}) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "dieOnError" }), +}) +public class Config implements DynamicDependencyConfig, Serializable { + + @Option + @Documentation("The dataset configuration.") + private Dataset dse = new Dataset(); + + @Option + @Documentation("Sub-configuration that contains the DynamidDependenciesConfiguration.") + private SubConfig subConfig = new SubConfig(); + + @Option + @Documentation("If enable throw an exception for any error, if not just log the error.") + private boolean dieOnError = false; + + @Option + @Documentation("More environment information.") + private boolean environmentInformation = false; + + @Override + public List getDependencies() { + return new ArrayList<>(this.getSubConfig().getDependencies()); + } + + public List getConnectors() { + return new ArrayList<>(this.getSubConfig().getConnectors()); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java new file mode 100644 index 0000000000000..8bd5960324df2 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataSet; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@DataSet("dyndepsdse") +@GridLayout(value = { + @GridLayout.Row({ "dso" }) +}) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dso" }) +}) +public class Dataset implements Serializable { + + @Option + @Documentation("A datastore.") + private Datastore dso = new Datastore(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java new file mode 100644 index 0000000000000..3c3dbdc92160e --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.type.DataStore; +import org.talend.sdk.component.api.configuration.ui.layout.AutoLayout; + +import lombok.Data; + +@Data +@DataStore("dyndepsdso") +@AutoLayout +public class Datastore implements Serializable { + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java new file mode 100644 index 0000000000000..12efa3c258d42 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DynamicDependenciesConfiguration; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; + +import lombok.Data; + +@Data +@DynamicDependenciesConfiguration +@GridLayout({ + @GridLayout.Row({ "dependencies" }), + @GridLayout.Row({ "connectors" }) +}) +public class SubConfig implements Serializable { + + @Option + @Documentation("The dependencies to load dynamically.") + private List dependencies = new ArrayList<>(); + + @Option + @Documentation("The connectors to load dynamically.") + private List connectors = new ArrayList<>(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesConfigurationInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesConfigurationInput.java new file mode 100644 index 0000000000000..335322e79b7fb --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesConfigurationInput.java @@ -0,0 +1,66 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.input; + +import java.io.Serializable; +import java.util.Iterator; + +import javax.annotation.PostConstruct; + +import org.talend.sdk.component.api.component.Icon; +import org.talend.sdk.component.api.component.Version; +import org.talend.sdk.component.api.input.Emitter; +import org.talend.sdk.component.api.input.Producer; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicependenciesConfigurationService; + +@Version +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +@Emitter(name = "Input") +@Documentation("Dynamic dependencies sample input connector.") +public class DynamicDependenciesWithDynamicDependenciesConfigurationInput extends AbstractDynamicDependenciesService + implements Serializable { + + private final Config config; + + private final DynamicDependenciesWithDynamicependenciesConfigurationService service; + + private Iterator recordIterator; + + public DynamicDependenciesWithDynamicDependenciesConfigurationInput(final Config config, + final DynamicDependenciesWithDynamicependenciesConfigurationService service) { + this.config = config; + this.service = service; + } + + @PostConstruct + public void init() { + this.recordIterator = this.service.loadIterator(this.config); + } + + @Producer + public Record next() { + if (recordIterator == null || !recordIterator.hasNext()) { + return null; + } + + return recordIterator.next(); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java new file mode 100644 index 0000000000000..fcc2ed3c55c47 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Components( + family = "DynamicDependenciesWithDynamicDependenciesConfiguration", + categories = "sample") +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration; + +import org.talend.sdk.component.api.component.Components; +import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationService.java new file mode 100644 index 0000000000000..3d0057a5fafec --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationService.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service; + +import java.io.Serializable; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.record.Schema; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.api.service.dependency.DynamicDependencies; +import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.SubConfig; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class DynamicDependenciesWithDynamicependenciesConfigurationService extends AbstractDynamicDependenciesService + implements Serializable { + + public final static String DEPENDENCY_WITHDYNDEPSCONFIG_ACTION = "DEPENDENCY_WITHDYNDEPSCONFIG_ACTION"; + + @DynamicDependencies() + public List getDynamicDependencies(@Option("theSubConfig") final SubConfig subConfig) { + return super.getDynamicDependencies(subConfig.getDependencies(), subConfig.getConnectors()); + } + + @DiscoverSchemaExtended(DEPENDENCY_WITHDYNDEPSCONFIG_ACTION) + public Schema guessSchema4Input(final @Option("configuration") Config config) { + return super.buildSchema(config); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark/icon.svg new file mode 100644 index 0000000000000..75edf24718ba0 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDynDepConf + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light/icon.svg new file mode 100644 index 0000000000000..75edf24718ba0 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDynDepConf + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties new file mode 100644 index 0000000000000..c86de8883106d --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties @@ -0,0 +1,18 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +DynamicDependenciesWithDynamicDependenciesConfiguration.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies With DynamicDependenciesConfiguration +DynamicDependenciesWithDynamicDependenciesConfiguration.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies With DynamicDependenciesConfiguration \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties new file mode 100644 index 0000000000000..2585384578ebd --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties @@ -0,0 +1,23 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +Dataset.dso._displayName = +Config.dse._displayName = +Config.dieOnError._displayName = Die on error +Config.environmentInformation._displayName = Environment information +Config.subConfig._displayName = +SubConfig.dependencies._displayName = Dependencies +SubConfig.connectors._displayName = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties new file mode 100644 index 0000000000000..b252d46a5697c --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +DynamicDependenciesWithDynamicDependenciesConfiguration.Input._displayName = Dynamic Dependencies With DynamicDependenciesConfiguration Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationServiceTest.java new file mode 100644 index 0000000000000..7b2bc3083c4a4 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationServiceTest.java @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service; + +import java.util.List; + +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Datastore; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@WithComponents( + value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration") +public class DynamicDependenciesWithDynamicependenciesConfigurationServiceTest + extends + AbstractDynamicDependenciesServiceTest { + + @Service + DynamicDependenciesWithDynamicependenciesConfigurationService dynamicDependenciesServiceService; + + @Override + protected Config buildConfig() { + Config config = new Config(); + Dataset dse = new Dataset(); + Datastore dso = new Datastore(); + List depends = this.getDependList(); + config.getSubConfig().setDependencies(depends); + dse.setDso(dso); + config.setDse(dse); + config.setEnvironmentInformation(true); + + return config; + } + + @Override + protected DynamicDependenciesWithDynamicependenciesConfigurationService getService() { + return dynamicDependenciesServiceService; + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/pom.xml new file mode 100644 index 0000000000000..485213f4ef979 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/pom.xml @@ -0,0 +1,66 @@ + + + + 4.0.0 + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies + 1.86.0-SNAPSHOT + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-with-spi + jar + Component Runtime :: Sample Feature @DynamicDependency with spi + + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-common + ${project.version} + + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies-common + ${project.version} + test-jar + test + + + + + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.talend.sdk.component.dynamic.dependencies.withspi + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Config.java new file mode 100644 index 0000000000000..31b3b04ae1f03 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Config.java @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +/** + * For this sample, the same configuration is used for all connectors input/processor/output. + */ +@Data +@GridLayout({ + @GridLayout.Row({ "dse" }), +}) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "dieOnError" }), +}) +public class Config implements Serializable { + + @Option + @Documentation("The dataset configuration.") + private Dataset dse = new Dataset(); + + @Option + @Documentation("If enable throw an exception for any error, if not just log the error.") + private boolean dieOnError = false; + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Dataset.java new file mode 100644 index 0000000000000..bbb28640b0c6b --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Dataset.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataSet; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@DataSet("dyndepsdse") +@GridLayout(value = { + @GridLayout.Row({ "dso" }), + @GridLayout.Row({ "bbb" }), +}) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dso" }) +}) +public class Dataset implements Serializable { + + @Option + @Documentation("A datastore.") + private Datastore dso = new Datastore(); + + @Option + @Documentation("Xxxx xxx.") + private String bbb; + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Datastore.java new file mode 100644 index 0000000000000..91d74dac3fdb6 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Datastore.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataStore; +import org.talend.sdk.component.api.configuration.ui.layout.AutoLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@DataStore("dyndepsdso") +@AutoLayout +public class Datastore implements Serializable { + + @Option + @Documentation("Xxxx xxx.") + private String aaa; + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/DynamicDependenciesWithSPIInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/DynamicDependenciesWithSPIInput.java new file mode 100644 index 0000000000000..3e26377bbed1c --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/DynamicDependenciesWithSPIInput.java @@ -0,0 +1,64 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.input; + +import java.io.Serializable; +import java.util.Iterator; + +import javax.annotation.PostConstruct; + +import org.talend.sdk.component.api.component.Icon; +import org.talend.sdk.component.api.component.Version; +import org.talend.sdk.component.api.input.Emitter; +import org.talend.sdk.component.api.input.Producer; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.service.DynamicDependenciesWithSPIService; + +@Version +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +@Emitter(name = "Input") +@Documentation("Dynamic dependencies sample input connector.") +public class DynamicDependenciesWithSPIInput implements Serializable { + + private final Config config; + + private final DynamicDependenciesWithSPIService service; + + private Iterator recordIterator; + + public DynamicDependenciesWithSPIInput(final Config config, + final DynamicDependenciesWithSPIService service) { + this.config = config; + this.service = service; + } + + @PostConstruct + public void init() { + this.recordIterator = this.service.getRecordIterator(); + } + + @Producer + public Record next() { + if (recordIterator == null || !recordIterator.hasNext()) { + return null; + } + + return recordIterator.next(); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/package-info.java new file mode 100644 index 0000000000000..8f684f5ab8500 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/package-info.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Components( + family = "DynamicDependenciesWithSPI", + categories = "sample") +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi; + +import org.talend.sdk.component.api.component.Components; +import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/service/DynamicDependenciesWithSPIService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/service/DynamicDependenciesWithSPIService.java new file mode 100644 index 0000000000000..739a043507634 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/service/DynamicDependenciesWithSPIService.java @@ -0,0 +1,88 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.service; + +import java.io.IOException; +import java.io.InputStream; +import java.io.Serializable; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.exception.ComponentException; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.api.record.Schema; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.api.service.dependency.DynamicDependencies; +import org.talend.sdk.component.api.service.record.RecordBuilderFactory; +import org.talend.sdk.component.api.service.schema.DiscoverSchema; +import org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapTransformer; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.config.Dataset; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class DynamicDependenciesWithSPIService implements Serializable { + + private static String version; + + @Service + private RecordBuilderFactory recordBuilderFactory; + + @DynamicDependencies + public List getDynamicDependencies(@Option("theDataset") final Dataset dataset) { + String dep = "org.talend.sdk.samplefeature.dynamicdependencies:classloader-test-spi:" + + loadVersion(); + System.out.println("Dynamic dependency to load: " + dep); + return Collections.singletonList(dep); + } + + @DiscoverSchema("dyndepsdse") + public Schema guessSchema4Input(final @Option("configuration") Dataset dse) { + Iterator recordIterator = getRecordIterator(); + if (!recordIterator.hasNext()) { + throw new ComponentException("No data loaded from StringMapTransformer."); + } + + Record record = recordIterator.next(); + return record.getSchema(); + } + + public Iterator getRecordIterator() { + StringMapTransformer stringMapTransformer = new StringMapTransformer<>(true); + List records = stringMapTransformer + .transform((s1, s2) -> recordBuilderFactory.newRecordBuilder().withString(s1, s2).build()); + return records.iterator(); + } + + private static String loadVersion() { + if (version == null) { + try (InputStream is = DynamicDependenciesWithSPIService.class.getClassLoader() + .getResourceAsStream("version.properties")) { + Properties props = new Properties(); + props.load(is); + version = props.getProperty("version"); + } catch (IOException e) { + throw new ComponentException("Unable to load project version", e); + } + } + return version; + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/dark/icon.svg new file mode 100644 index 0000000000000..3e6ba66a42db8 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/dark/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDataset + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/light/icon.svg new file mode 100644 index 0000000000000..3e6ba66a42db8 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/light/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDataset + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/Messages.properties new file mode 100644 index 0000000000000..07fabc121dc11 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/Messages.properties @@ -0,0 +1,19 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +DynamicDependenciesWithSPI.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies With SPI +DynamicDependenciesWithSPI.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies With SPI +DynamicDependenciesWithSPI.actions.schema.dyndepsdse._displayName = Dynamic dependencies With SPI discover schema \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Messages.properties new file mode 100644 index 0000000000000..a83b1f07a4954 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Messages.properties @@ -0,0 +1,22 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example +Dataset.dso._displayName = +Config.dse._displayName = +Config.dieOnError._displayName =Die on error +Datastore.aaa._displayName = +Dataset.bbb._displayName = +Datastore.aaa._placeholder = +Dataset.bbb._placeholder = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/Messages.properties new file mode 100644 index 0000000000000..5d3c3478cce11 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/Messages.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +DynamicDependenciesWithSPI.Input._displayName = Dynamic Dependencies With SPI Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/version.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/version.properties new file mode 100644 index 0000000000000..c7c8d1f0f47db --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/version.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +version=${project.version} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/pom.xml b/sample-parent/sample-features/dynamic-dependencies/pom.xml new file mode 100644 index 0000000000000..209a16957fe6a --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + + org.talend.sdk.component + sample-features + 1.86.0-SNAPSHOT + + + org.talend.sdk.samplefeature.dynamicdependencies + dynamic-dependencies + pom + + Component Runtime :: Sample Feature @DynamicDependency + + dynamic-dependencies-common + dynamic-dependencies-with-dataset + dynamic-dependencies-with-datastore + dynamic-dependencies-with-dynamicDependenciesConfiguration + dynamic-dependencies-with-dataprepRunAnnotation + dynamic-dependencies-with-spi + classloader-test-library + classloader-test-spi + + + + + org.talend.sdk.component + component-runtime-junit + ${project.version} + test + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/pom.xml b/sample-parent/sample-features/pom.xml index cd68e50847c03..b14b123d75971 100644 --- a/sample-parent/sample-features/pom.xml +++ b/sample-parent/sample-features/pom.xml @@ -35,6 +35,7 @@ checkpoint-runner configuration-form entry-with-error + dynamic-dependencies From 4cdad2ecc9333a283309df1bfef8288a5e7c0d10 Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Thu, 27 Nov 2025 13:28:51 +0100 Subject: [PATCH 08/12] feat(QTDI-2134): add classloader resources loading from parent. --- .../classloader/ConfigurableClassLoader.java | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java index 289d013daf517..417da5dea68d3 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java @@ -108,6 +108,8 @@ public class ConfigurableClassLoader extends URLClassLoader { private final String[] nameJvmPrefixes; + private final String[] allowedParentResources; + private final ConcurrentMap> proxies = new ConcurrentHashMap<>(); private volatile URLClassLoader temporaryCopy; @@ -120,7 +122,16 @@ public class ConfigurableClassLoader extends URLClassLoader { public ConfigurableClassLoader(final String id, final URL[] urls, final ClassLoader parent, final Predicate parentFilter, final Predicate childFirstFilter, final String[] nestedDependencies, final String[] jvmPrefixes) { - this(id, urls, parent, parentFilter, childFirstFilter, emptyMap(), jvmPrefixes); + this(id, urls, parent, parentFilter, childFirstFilter, emptyMap(), jvmPrefixes, new String[] {}); + if (nestedDependencies != null) { + loadNestedDependencies(parent, nestedDependencies); + } + } + + public ConfigurableClassLoader(final String id, final URL[] urls, final ClassLoader parent, + final Predicate parentFilter, final Predicate childFirstFilter, + final String[] nestedDependencies, final String[] jvmPrefixes, final String[] localParentResources) { + this(id, urls, parent, parentFilter, childFirstFilter, emptyMap(), jvmPrefixes, localParentResources); if (nestedDependencies != null) { loadNestedDependencies(parent, nestedDependencies); } @@ -128,7 +139,8 @@ public ConfigurableClassLoader(final String id, final URL[] urls, final ClassLoa private ConfigurableClassLoader(final String id, final URL[] urls, final ClassLoader parent, final Predicate parentFilter, final Predicate childFirstFilter, - final Map> resources, final String[] jvmPrefixes) { + final Map> resources, final String[] jvmPrefixes, + final String[] localParentResources) { super(urls, parent); this.id = id; this.creationUrls = urls; @@ -150,6 +162,18 @@ private ConfigurableClassLoader(final String id, final URL[] urls, final ClassLo } else { cacheableClasses = Collections.emptyList(); } + // initialize allowed parent resources for this classloader + final String[] globalAllowedParentResources = Stream + .concat(Arrays.stream(new String[] { "META-INF/services/" }), + Arrays.stream(System.getProperty("talend.tccl.allowed.parent.resources", "").split(","))) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .toArray(String[]::new); + allowedParentResources = + Stream.concat(Arrays.stream(globalAllowedParentResources), Arrays.stream(localParentResources)) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .toArray(String[]::new); } // load all in memory to avoid perf issues - should we try offheap? @@ -235,7 +259,7 @@ public void registerTransformer(final ClassFileTransformer transformer) { public synchronized URLClassLoader createTemporaryCopy() { final ConfigurableClassLoader self = this; return temporaryCopy == null ? temporaryCopy = new ConfigurableClassLoader(id, creationUrls, getParent(), - parentFilter, childFirstFilter, resources, fullPathJvmPrefixes) { + parentFilter, childFirstFilter, resources, fullPathJvmPrefixes, allowedParentResources) { @Override public synchronized void close() throws IOException { @@ -465,10 +489,17 @@ public Enumeration findResources(final String name) throws IOException { } private boolean isNestedDependencyResource(final String name) { - return name.startsWith(NESTED_MAVEN_REPOSITORY) || name.endsWith(".jar"); + return name.startsWith(NESTED_MAVEN_REPOSITORY) || name.endsWith(".jar"); // TODO: improve coz not at all + // precise } private boolean isInJvm(final URL resource) { + // Services and parent global/local allowed resources that should always be found by top level classloader. + // By default, META-INF/services/ is always allowed otherwise SPI won't work properly in nested environments. + // Warning: local selection shouldn't be too generic! Use very specific paths only like jndi.properties. + if (Stream.of(allowedParentResources).anyMatch(it -> resource.getFile().contains(it))) { + return true; + } final Path path = toPath(resource); if (path == null) { return false; From 594632ceb1d95ba7be81aafbd5a1e0a7001c9419 Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Thu, 27 Nov 2025 18:05:34 +0100 Subject: [PATCH 09/12] feat(QTDI-2134): fix classloader resources loading from parent. --- .../classloader/ConfigurableClassLoader.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java index 417da5dea68d3..3d62ea81fbb33 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java @@ -163,12 +163,11 @@ private ConfigurableClassLoader(final String id, final URL[] urls, final ClassLo cacheableClasses = Collections.emptyList(); } // initialize allowed parent resources for this classloader - final String[] globalAllowedParentResources = Stream - .concat(Arrays.stream(new String[] { "META-INF/services/" }), - Arrays.stream(System.getProperty("talend.tccl.allowed.parent.resources", "").split(","))) - .map(String::trim) - .filter(s -> !s.isEmpty()) - .toArray(String[]::new); + final String[] globalAllowedParentResources = + Arrays.stream(System.getProperty("talend.tccl.allowed.parent.resources", "").split(",")) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .toArray(String[]::new); allowedParentResources = Stream.concat(Arrays.stream(globalAllowedParentResources), Arrays.stream(localParentResources)) .map(String::trim) From 33c16e86c75d31156e79483004fbe2ea8860fe5e Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Thu, 4 Dec 2025 10:15:26 +0100 Subject: [PATCH 10/12] feat(QTDI-2134): add parent resources in customizer --- .../runtime/manager/ComponentManager.java | 33 +++++++++++++++++++ .../classloader/ConfigurableClassLoader.java | 33 +++++++------------ .../sdk/component/container/Container.java | 3 +- .../component/container/ContainerManager.java | 3 ++ 4 files changed, 50 insertions(+), 22 deletions(-) diff --git a/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java b/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java index e4d52cf80d4ae..1396c41a75441 100644 --- a/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java +++ b/component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/ComponentManager.java @@ -113,6 +113,7 @@ import org.apache.xbean.finder.archive.FileArchive; import org.apache.xbean.finder.archive.FilteredArchive; import org.apache.xbean.finder.archive.JarArchive; +import org.apache.xbean.finder.filter.ContainsFilter; import org.apache.xbean.finder.filter.ExcludeIncludeFilter; import org.apache.xbean.finder.filter.Filter; import org.apache.xbean.finder.filter.FilterList; @@ -312,6 +313,8 @@ public String[] categories() { // + tcomp "runtime" indeed (invisible from the components but required for the runtime private final Filter classesFilter; + private final Filter resourcesFilter; + private final ParameterModelService parameterModelService; private final InternationalizationServiceFactory internationalizationServiceFactory; @@ -427,6 +430,13 @@ public ComponentManager(final Path m2, final String dependenciesResource, final .map(PrefixFilter::new) .toArray(Filter[]::new)); + resourcesFilter = new FilterList(Stream.concat( + Stream.of("META-INF/services/"), + additionalParentResources()) + .distinct() + .map(ContainsFilter::new) + .toArray(Filter[]::new)); + jsonpProvider = loadJsonProvider(); jsonbProvider = loadJsonbProvider(); // these factories have memory caches so ensure we reuse them properly @@ -460,6 +470,7 @@ public ComponentManager(final Path m2, final String dependenciesResource, final migrationHandlerFactory = new MigrationHandlerFactory(reflections); final Predicate isContainerClass = name -> isContainerClass(classesFilter, name); + final Predicate isParentResource = name -> isContainerResource(resourcesFilter, name); final ContainerManager.ClassLoaderConfiguration defaultClassLoaderConfiguration = ContainerManager.ClassLoaderConfiguration .builder() @@ -467,6 +478,7 @@ public ComponentManager(final Path m2, final String dependenciesResource, final .parentClassesFilter(isContainerClass) .classesFilter(isContainerClass.negate()) .supportsResourceDependencies(true) + .parentResourcesFilter(isParentResource) .create(); this.container = new ContainerManager(ContainerManager.DependenciesResolutionConfiguration .builder() @@ -611,6 +623,16 @@ private Stream additionalContainerClasses() { .orElseGet(Stream::empty)); } + private Stream additionalParentResources() { + return Stream + .concat(customizers.stream().flatMap(Customizer::parentResources), + ofNullable( + System.getProperty("talend.component.manager.classloader.container.parentResources")) + .map(s -> s.split(",")) + .map(Stream::of) + .orElseGet(Stream::empty)); + } + public static Path findM2() { return new MavenRepositoryDefaultResolver().discover(); } @@ -1059,6 +1081,10 @@ protected boolean isContainerClass(final Filter filter, final String name) { return name != null && filter.accept(name); } + protected boolean isContainerResource(final Filter filter, final String name) { + return name != null && filter.accept(name); + } + @Override public void close() { container.close(); @@ -2226,6 +2252,13 @@ public interface Customizer { */ Stream containerClassesAndPackages(); + /** + * @return + */ + default Stream parentResources() { + return Stream.empty(); + } + /** * @return advanced toggle to ignore built-in beam exclusions and let this customizer override them. */ diff --git a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java index 3d62ea81fbb33..0187468d3d3e0 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/classloader/ConfigurableClassLoader.java @@ -98,6 +98,9 @@ public class ConfigurableClassLoader extends URLClassLoader { @Getter private final Predicate childFirstFilter; + @Getter + private final Predicate resourcesFilter; + private final Map> resources = new HashMap<>(); private final Collection transformers = new ArrayList<>(); @@ -108,8 +111,6 @@ public class ConfigurableClassLoader extends URLClassLoader { private final String[] nameJvmPrefixes; - private final String[] allowedParentResources; - private final ConcurrentMap> proxies = new ConcurrentHashMap<>(); private volatile URLClassLoader temporaryCopy; @@ -122,7 +123,7 @@ public class ConfigurableClassLoader extends URLClassLoader { public ConfigurableClassLoader(final String id, final URL[] urls, final ClassLoader parent, final Predicate parentFilter, final Predicate childFirstFilter, final String[] nestedDependencies, final String[] jvmPrefixes) { - this(id, urls, parent, parentFilter, childFirstFilter, emptyMap(), jvmPrefixes, new String[] {}); + this(id, urls, parent, parentFilter, childFirstFilter, emptyMap(), jvmPrefixes, (name) -> false); if (nestedDependencies != null) { loadNestedDependencies(parent, nestedDependencies); } @@ -130,8 +131,8 @@ public ConfigurableClassLoader(final String id, final URL[] urls, final ClassLoa public ConfigurableClassLoader(final String id, final URL[] urls, final ClassLoader parent, final Predicate parentFilter, final Predicate childFirstFilter, - final String[] nestedDependencies, final String[] jvmPrefixes, final String[] localParentResources) { - this(id, urls, parent, parentFilter, childFirstFilter, emptyMap(), jvmPrefixes, localParentResources); + final String[] nestedDependencies, final String[] jvmPrefixes, final Predicate resourcesFilter) { + this(id, urls, parent, parentFilter, childFirstFilter, emptyMap(), jvmPrefixes, resourcesFilter); if (nestedDependencies != null) { loadNestedDependencies(parent, nestedDependencies); } @@ -140,12 +141,13 @@ public ConfigurableClassLoader(final String id, final URL[] urls, final ClassLoa private ConfigurableClassLoader(final String id, final URL[] urls, final ClassLoader parent, final Predicate parentFilter, final Predicate childFirstFilter, final Map> resources, final String[] jvmPrefixes, - final String[] localParentResources) { + final Predicate resourcesFilter) { super(urls, parent); this.id = id; this.creationUrls = urls; this.parentFilter = parentFilter; this.childFirstFilter = childFirstFilter; + this.resourcesFilter = resourcesFilter; this.resources.putAll(resources); this.fullPathJvmPrefixes = @@ -162,17 +164,6 @@ private ConfigurableClassLoader(final String id, final URL[] urls, final ClassLo } else { cacheableClasses = Collections.emptyList(); } - // initialize allowed parent resources for this classloader - final String[] globalAllowedParentResources = - Arrays.stream(System.getProperty("talend.tccl.allowed.parent.resources", "").split(",")) - .map(String::trim) - .filter(s -> !s.isEmpty()) - .toArray(String[]::new); - allowedParentResources = - Stream.concat(Arrays.stream(globalAllowedParentResources), Arrays.stream(localParentResources)) - .map(String::trim) - .filter(s -> !s.isEmpty()) - .toArray(String[]::new); } // load all in memory to avoid perf issues - should we try offheap? @@ -258,7 +249,7 @@ public void registerTransformer(final ClassFileTransformer transformer) { public synchronized URLClassLoader createTemporaryCopy() { final ConfigurableClassLoader self = this; return temporaryCopy == null ? temporaryCopy = new ConfigurableClassLoader(id, creationUrls, getParent(), - parentFilter, childFirstFilter, resources, fullPathJvmPrefixes, allowedParentResources) { + parentFilter, childFirstFilter, resources, fullPathJvmPrefixes, resourcesFilter) { @Override public synchronized void close() throws IOException { @@ -493,10 +484,10 @@ private boolean isNestedDependencyResource(final String name) { } private boolean isInJvm(final URL resource) { - // Services and parent global/local allowed resources that should always be found by top level classloader. + // Services and parent allowed resources that should always be found by top level classloader. // By default, META-INF/services/ is always allowed otherwise SPI won't work properly in nested environments. - // Warning: local selection shouldn't be too generic! Use very specific paths only like jndi.properties. - if (Stream.of(allowedParentResources).anyMatch(it -> resource.getFile().contains(it))) { + // Warning: selection shouldn't be too generic! Use very specific paths only like jndi.properties. + if (resourcesFilter.test(resource.getFile())) { return true; } final Path path = toPath(resource); diff --git a/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java b/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java index 4a5644447567c..f2d5a5a88af98 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/container/Container.java @@ -147,7 +147,8 @@ public Container(final String id, final String rootModule, final Artifact[] depe this.hasNestedRepository ? (name) -> true : overrideClassLoaderConfig.getParentClassesFilter(); final ConfigurableClassLoader loader = new ConfigurableClassLoader(id, urls, overrideClassLoaderConfig.getParent(), parentFilter, - overrideClassLoaderConfig.getClassesFilter(), rawNestedDependencies, jvmMarkers); + overrideClassLoaderConfig.getClassesFilter(), rawNestedDependencies, jvmMarkers, + overrideClassLoaderConfig.getParentResourcesFilter()); transformers.forEach(loader::registerTransformer); activeSpecificTransformers(loader); return loader; diff --git a/container/container-core/src/main/java/org/talend/sdk/component/container/ContainerManager.java b/container/container-core/src/main/java/org/talend/sdk/component/container/ContainerManager.java index 34e23a6b5151e..593fe282101b5 100644 --- a/container/container-core/src/main/java/org/talend/sdk/component/container/ContainerManager.java +++ b/container/container-core/src/main/java/org/talend/sdk/component/container/ContainerManager.java @@ -128,6 +128,7 @@ public ContainerManager(final DependenciesResolutionConfiguration dependenciesRe ofNullable(classLoaderConfiguration.getParent()).orElseGet(ContainerManager.class::getClassLoader), ofNullable(classLoaderConfiguration.getClassesFilter()).orElseGet(() -> name -> true), ofNullable(classLoaderConfiguration.getParentClassesFilter()).orElseGet(() -> name -> true), + ofNullable(classLoaderConfiguration.getParentResourcesFilter()).orElseGet(() -> name -> true), classLoaderConfiguration.isSupportsResourceDependencies(), nestedPluginMappingResource); if (classLoaderConfiguration.isSupportsResourceDependencies()) { try (final InputStream mappingStream = @@ -455,6 +456,8 @@ public static class ClassLoaderConfiguration { private final Predicate parentClassesFilter; + private final Predicate parentResourcesFilter; + // is nested jar in jar supported (1 level only) private final boolean supportsResourceDependencies; From 24efc01ebfa0b6fc54f47aa5ae4d657d83e3bb5a Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Thu, 4 Dec 2025 14:55:10 +0100 Subject: [PATCH 11/12] feat(QTDI-2134): remove dynamicdependencies feature from codebase. --- .../dynamic-dependencies/README.md | 38 -- .../classloader-test-library/pom.xml | 48 --- .../StringMapProvider.java | 24 -- .../StringMapTransformer.java | 80 ----- .../resource.properties | 16 - .../classloader-test-spi/pom.xml | 56 --- .../StringMapProviderImpl.java | 31 -- .../CLASSLOADER-TEST-SPI/resource.properties | 16 - ...s.classloadertestlibrary.StringMapProvider | 16 - .../StringMapProviderImplTest.java | 37 -- .../dynamic-dependencies-common/pom.xml | 96 ----- .../dynamicdependencies/config/Connector.java | 65 ---- .../config/Dependency.java | 48 --- .../config/DynamicDependencyConfig.java | 30 -- .../AbstractDynamicDependenciesService.java | 336 ------------------ ...bstractDynamicDependenciesServiceTest.java | 100 ------ .../pom.xml | 69 ---- .../DynamicDependencySupported.java | 34 -- .../config/Config.java | 74 ---- .../config/Dataset.java | 41 --- .../config/Datastore.java | 30 -- .../config/SubConfig.java | 45 --- ...denciesWithDataprepRunAnnotationInput.java | 66 ---- .../package-info.java | 23 -- ...endenciesDataprepRunAnnotationService.java | 50 --- .../src/main/resources/icons/dark/icon.svg | 66 ---- .../src/main/resources/icons/light/icon.svg | 66 ---- .../Messages.properties | 18 - .../config/Messages.properties | 24 -- .../input/Messages.properties | 17 - ...nciesDataprepRunAnnotationServiceTest.java | 77 ---- .../dynamic-dependencies-with-dataset/pom.xml | 67 ---- .../withdataset/config/Config.java | 66 ---- .../withdataset/config/Dataset.java | 55 --- .../withdataset/config/Datastore.java | 30 -- .../DynamicDependenciesWithDatasetInput.java | 64 ---- .../withdataset/package-info.java | 23 -- ...DynamicDependenciesWithDatasetService.java | 48 --- .../src/main/resources/icons/dark/icon.svg | 66 ---- .../src/main/resources/icons/light/icon.svg | 66 ---- .../withdataset/Messages.properties | 18 - .../withdataset/config/Messages.properties | 22 -- .../withdataset/input/Messages.properties | 17 - ...micDependenciesWithDatasetServiceTest.java | 56 --- .../pom.xml | 69 ---- .../withdatastore/config/Config.java | 66 ---- .../withdatastore/config/Dataset.java | 41 --- .../withdatastore/config/Datastore.java | 47 --- ...DynamicDependenciesWithDatastoreInput.java | 64 ---- .../withdatastore/package-info.java | 23 -- ...namicDependenciesWithDatastoreService.java | 49 --- .../src/main/resources/icons/dark/icon.svg | 66 ---- .../src/main/resources/icons/light/icon.svg | 66 ---- .../withdatastore/Messages.properties | 18 - .../withdatastore/config/Messages.properties | 22 -- .../withdatastore/input/Messages.properties | 17 - ...cDependenciesWithDatastoreServiceTest.java | 56 --- .../pom.xml | 72 ---- .../config/Config.java | 71 ---- .../config/Dataset.java | 41 --- .../config/Datastore.java | 30 -- .../config/SubConfig.java | 47 --- ...DynamicDependenciesConfigurationInput.java | 66 ---- .../package-info.java | 23 -- ...ynamicependenciesConfigurationService.java | 49 --- .../src/main/resources/icons/dark/icon.svg | 66 ---- .../src/main/resources/icons/light/icon.svg | 66 ---- .../Messages.properties | 18 - .../config/Messages.properties | 23 -- .../input/Messages.properties | 17 - ...icependenciesConfigurationServiceTest.java | 58 --- .../dynamic-dependencies-with-spi/pom.xml | 66 ---- .../withspi/config/Config.java | 47 --- .../withspi/config/Dataset.java | 46 --- .../withspi/config/Datastore.java | 36 -- .../DynamicDependenciesWithSPIInput.java | 64 ---- .../withspi/package-info.java | 23 -- .../DynamicDependenciesWithSPIService.java | 88 ----- .../src/main/resources/icons/dark/icon.svg | 66 ---- .../src/main/resources/icons/light/icon.svg | 66 ---- .../withspi/Messages.properties | 19 - .../withspi/config/Messages.properties | 22 -- .../withspi/input/Messages.properties | 17 - .../src/main/resources/version.properties | 17 - .../dynamic-dependencies/pom.xml | 51 --- 85 files changed, 4214 deletions(-) delete mode 100644 sample-parent/sample-features/dynamic-dependencies/README.md delete mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-library/pom.xml delete mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapProvider.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapTransformer.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/resources/CLASSLOADER-TEST-LIBRARY/resource.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/pom.xml delete mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImpl.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/CLASSLOADER-TEST-SPI/resource.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/META-INF/services/org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapProvider delete mode 100644 sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImplTest.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Connector.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDataprepRunAnnotationInput.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationServiceTest.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Datastore.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesWithDatasetInput.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesConfigurationInput.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationService.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark/icon.svg delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light/icon.svg delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationServiceTest.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/pom.xml delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Config.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Dataset.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Datastore.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/DynamicDependenciesWithSPIInput.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/package-info.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/service/DynamicDependenciesWithSPIService.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/dark/icon.svg delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/light/icon.svg delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/Messages.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/version.properties delete mode 100644 sample-parent/sample-features/dynamic-dependencies/pom.xml diff --git a/sample-parent/sample-features/dynamic-dependencies/README.md b/sample-parent/sample-features/dynamic-dependencies/README.md deleted file mode 100644 index aff3dac7f1be4..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# Component Runtime :: Sample Feature :: DynamicDependency - -## Table of Contents -- [Overview](#overview) -- [Usage](#usage) - - [How to build the connector plugin](#how-to-build-the-sample-connector-plugin) - - [How to use](#how-to-use) - - -## Overview -This is a test TCK connector plugin to test and validate the DynamicDependency input feature. - -This project contains 4 test connectors: -### DynamicDependency with Dataset -The service of this connector use a dataset as parameter. - -### DynamicDependency with Datastore -The service of this connector use a datastore as parameter. - -### DynamicDependency with Dataprep run annotation -The service of this connector use a new annotation @DynamicDependencySupported. - -### DynamicDependency with @DynamicDependenciesConfiguration -The service of this connector use a config which using @DynamicDependenciesConfiguration. - -## Usage -### How to build the sample connector plugin -Checkout the code from the repository and build the project using `mvn clean install` -Alternatively build the feature module using `mvn install -am -pl :dynamicdependencies` - -### How to use -- Deploy the connector into Studio: -java -jar dynamic-dependencies-with-dataset-1.86.0-SNAPSHOT.car studio-deploy --location c:\Talend-Studio-20251010_0827-V8.0.2SNAPSHOT - -- Use the connector in the job. -- Click "Guess schema" of the connector. -- Add others you want to use in the job, then run the job. - diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/pom.xml b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/pom.xml deleted file mode 100644 index 8358575457b4e..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - 4.0.0 - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies - 1.86.0-SNAPSHOT - - - org.talend.sdk.samplefeature.dynamicdependencies - classloader-test-library - - jar - Component Runtime :: Sample Feature @DynamicDependency :: a classloader test library - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - dynamic.dependencies.classloadertestlibrary - - - - - - - - \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapProvider.java b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapProvider.java deleted file mode 100644 index 7004bed056076..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapProvider.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary; - -import java.util.Map; - -public interface StringMapProvider { - - Map getMap(); - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapTransformer.java b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapTransformer.java deleted file mode 100644 index 8e29acabcbd62..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestlibrary/StringMapTransformer.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UncheckedIOException; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.ServiceLoader; -import java.util.function.BiFunction; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.talend.sdk.component.api.exception.ComponentException; - -public class StringMapTransformer { - - private final StringMapProvider stringMapProvider; - - public StringMapTransformer(final boolean failIfSeveralServicesFound) { - ServiceLoader serviceLoader = ServiceLoader.load(StringMapProvider.class); - - List stringMapProviderList = new ArrayList<>(); - serviceLoader.iterator().forEachRemaining(stringMapProviderList::add); - - if (stringMapProviderList.size() <= 0) { - throw new ComponentException("No %s service found.".formatted(StringMapProvider.class)); - } - - if (stringMapProviderList.size() > 1 && failIfSeveralServicesFound) { - String join = stringMapProviderList.stream() - .map(m -> m.getClass().getName()) - .collect(Collectors.joining("\n")); - throw new ComponentException("More than one %s service has been found: %s" - .formatted(StringMapProvider.class, join)); - } - - this.stringMapProvider = stringMapProviderList.get(0); - } - - public List transform(final BiFunction function) { - Map map = stringMapProvider.getMap(); - return map.entrySet() - .stream() - .map(e -> function.apply(e.getKey(), e.getValue())) - .toList(); - } - - public String getResourceContent() { - Stream resources = this.getClass().getClassLoader().resources("CLASSLOADER-TEST-SPI/resource.properties"); - return resources - .map(url -> { - try (InputStream is = url.openStream()) { - return new String(is.readAllBytes(), StandardCharsets.UTF_8); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - }) - .filter(l -> !l.startsWith("#")) - .collect(Collectors.joining("\n")); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/resources/CLASSLOADER-TEST-LIBRARY/resource.properties b/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/resources/CLASSLOADER-TEST-LIBRARY/resource.properties deleted file mode 100644 index dfa17bc74aadd..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/classloader-test-library/src/main/resources/CLASSLOADER-TEST-LIBRARY/resource.properties +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.message=This is a resource file from classloader-test-library. \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/pom.xml b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/pom.xml deleted file mode 100644 index 5bd2d3c7fe11b..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - 4.0.0 - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies - 1.86.0-SNAPSHOT - - - org.talend.sdk.samplefeature.dynamicdependencies - classloader-test-spi - - jar - Component Runtime :: Sample Feature @DynamicDependency :: a spi service - - - - org.talend.sdk.samplefeature.dynamicdependencies - classloader-test-library - ${project.version} - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - dynamic.dependencies.dynamicdependencyspi - - - - - - - - \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImpl.java b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImpl.java deleted file mode 100644 index 2e730380df1e8..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestspi; - -import java.util.HashMap; -import java.util.Map; - -import org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapProvider; - -public class StringMapProviderImpl implements StringMapProvider { - - @Override - public Map getMap() { - Map map = new HashMap<>(); - map.put("key1", "value1"); - return map; - } -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/CLASSLOADER-TEST-SPI/resource.properties b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/CLASSLOADER-TEST-SPI/resource.properties deleted file mode 100644 index 1d5ecab5e0199..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/CLASSLOADER-TEST-SPI/resource.properties +++ /dev/null @@ -1,16 +0,0 @@ -<<<<<<<<<<<<<<<<<<# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example>>>>>>>>>>>>>>>>>> -org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestspi.message=This is a resource file from classloader-test-spi. \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/META-INF/services/org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapProvider b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/META-INF/services/org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapProvider deleted file mode 100644 index bc36faaceadbb..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/main/resources/META-INF/services/org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapProvider +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestspi.StringMapProviderImpl \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImplTest.java b/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImplTest.java deleted file mode 100644 index 34834c9b45b2d..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/classloader-test-spi/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/classloadertestspi/StringMapProviderImplTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestspi; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapTransformer; - -class StringMapProviderImplTest { - - @Test - void testSPI() { - StringMapTransformer stringMapTransformer = new StringMapTransformer<>(true); - List transform = stringMapTransformer.transform((s1, s2) -> s1 + ":" + s2); - List sorted = new ArrayList<>(transform); - sorted.sort(String::compareTo); - String collect = String.join("/", sorted); - Assertions.assertEquals("key1:value1", collect); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml deleted file mode 100644 index f14a434b72623..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - 4.0.0 - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies - 1.86.0-SNAPSHOT - - - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-common - jar - Component Runtime :: Sample Feature @DynamicDependency Common - - - - org.talend.sdk.samplefeature.dynamicdependencies - classloader-test-library - ${project.version} - - - org.talend.sdk.samplefeature.dynamicdependencies - classloader-test-spi - ${project.version} - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - dynamic.dependencies.common - - - - - - - test-jar - - - - - - org.talend.sdk.component - talend-component-maven-plugin - ${project.version} - - - talend-component-validate - - false - false - false - - - - - - org.apache.maven.plugins - maven-jar-plugin - ${maven-jar-plugin.version} - - - - - test-jar - - - - - - - - \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Connector.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Connector.java deleted file mode 100644 index 3aed79831e48e..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Connector.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.config; - -import java.io.Serializable; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; - -import lombok.Data; - -@Data -@GridLayout(value = { - @GridLayout.Row({ "groupId", "artifactId", "version", "connectorFamily", "connectorName", "connectorVersion", - "loadTransitiveDependencies", "connectorConfiguration" }) -}) -public class Connector implements Serializable { - - @Option - @Documentation("The connector's group id.") - private String groupId; - - @Option - @Documentation("The connector's artifact id.") - private String artifactId; - - @Option - @Documentation("The connector's artifact version.") - private String version; - - @Option - @Documentation("The connector's family.") - private String connectorFamily; - - @Option - @Documentation("The connector's namer.") - private String connectorName; - - @Option - @Documentation("The connector's version.") - private int connectorVersion; - - @Option - @Documentation("Load transitive dependencies from TALEND-INF/dependencies.txt.") - private boolean loadTransitiveDependencies; - - @Option - @Documentation("The connector's configuration.") - private String connectorConfiguration; - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java deleted file mode 100644 index a4c67f8826dbd..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.config; - -import java.io.Serializable; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; - -import lombok.Data; - -@Data -@GridLayout(value = { - @GridLayout.Row({ "groupId", "artifactId", "version", "clazz" }) -}) -public class Dependency implements Serializable { - - @Option - @Documentation("The groupId of the dependency.") - private String groupId; - - @Option - @Documentation("The artifactId of the dependency.") - private String artifactId; - - @Option - @Documentation("The version of the dependency.") - private String version; - - @Option - @Documentation("The class to try to load from this dependency.") - private String clazz; - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java deleted file mode 100644 index ec866e68c5a19..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.config; - -import java.util.List; - -public interface DynamicDependencyConfig { - - List getDependencies(); - - List getConnectors(); - - boolean isEnvironmentInformation(); - - boolean isDieOnError(); - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java deleted file mode 100644 index 8d1aa84c2781f..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java +++ /dev/null @@ -1,336 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.service; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Serializable; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.talend.sdk.component.api.exception.ComponentException; -import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.api.record.Record.Builder; -import org.talend.sdk.component.api.record.Schema; -import org.talend.sdk.component.api.record.Schema.Type; -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.api.service.dependency.Resolver; -import org.talend.sdk.component.api.service.record.RecordBuilderFactory; -import org.talend.sdk.component.api.service.source.ProducerFinder; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public abstract class AbstractDynamicDependenciesService implements Serializable { - - public static final String ENTRY_MAVEN = "maven"; - - public static final String ENTRY_CLASS = "clazz"; - - public static final String ENTRY_IS_LOADED = "is_loaded"; - - public static final String ENTRY_CONNECTOR_CLASSLOADER = "connector_classloader"; - - public static final String ENTRY_CLAZZ_CLASSLOADER = "clazz_classloader"; - - public static final String ENTRY_FROM_LOCATION = "from_location"; - - public static final String ENTRY_IS_TCK_CONTAINER = "is_tck_container"; - - public static final String ENTRY_FIRST_RECORD = "first_record"; - - public static final String ENTRY_ROOT_REPOSITORY = "root_repository"; - - public static final String ENTRY_RUNTIME_CLASSPATH = "runtime_classpath"; - - public static final String ENTRY_WORKING_DIRECTORY = "Working_directory"; - - @Service - private RecordBuilderFactory factory; - - @Service - private ProducerFinder finder; - - @Service - private Resolver resolver; - - public Iterator loadIterator(final DynamicDependencyConfig dynamicDependencyConfig) { - Schema schema = buildSchema(dynamicDependencyConfig); - - List standardDependencies = loadStandarDependencies(dynamicDependencyConfig, schema); - List additionalConnectors = loadConnectors(dynamicDependencyConfig, schema); - - return Stream.concat(standardDependencies.stream(), additionalConnectors.stream()).iterator(); - } - - private List loadStandarDependencies(final DynamicDependencyConfig dynamicDependencyConfig, - final Schema schema) { - List records = new ArrayList<>(); - for (Dependency dependency : dynamicDependencyConfig.getDependencies()) { - - String maven = String.format("%s:%s:%s", dependency.getGroupId(), dependency.getArtifactId(), - dependency.getVersion()); - - boolean isLoaded = false; - String connectorClassLoaderId = this.getClass().getClassLoader().toString(); - String clazzClassLoaderId = "N/A"; - String fromLocation = "N/A"; - try { - Class clazz = Class.forName(dependency.getClazz()); - isLoaded = true; - clazzClassLoaderId = clazz.getClassLoader().toString(); - - // This way to retrieve the location works even if the jar from where clazz comes from - // is nested into another jar (uber jar scenario) - String classPath = clazz.getName().replace('.', '/') + ".class"; - URL url = clazz.getClassLoader().getResource(classPath); - fromLocation = String.valueOf(url); - } catch (ClassNotFoundException e) { - manageException(dynamicDependencyConfig.isDieOnError(), - "Cannot load class %s from system classloader".formatted(dependency.getClazz()), e); - } - - Record record = buildRecord(schema, - dynamicDependencyConfig, - maven, - dependency.getClazz(), - isLoaded, - connectorClassLoaderId, - clazzClassLoaderId, - fromLocation, - false, - Optional.empty()); - records.add(record); - } - - return records; - } - - private List loadConnectors(final DynamicDependencyConfig dynamicDependencyConfig, final Schema schema) { - List records = new ArrayList<>(); - for (Connector connector : dynamicDependencyConfig.getConnectors()) { - - String maven = String.format("%s:%s:%s", connector.getGroupId(), connector.getArtifactId(), - connector.getVersion()); - - String connectorClassLoaderId = this.getClass().getClassLoader().toString(); - String clazzClassLoaderId = "N/A"; - String fromLocation = "N/A"; - Optional optionalRecord = testLoadingData(connector); - boolean isLoaded = optionalRecord.isPresent(); - - Record record = buildRecord(schema, - dynamicDependencyConfig, - maven, - "N/A", - isLoaded, - connectorClassLoaderId, - clazzClassLoaderId, - fromLocation, - true, - optionalRecord); - records.add(record); - } - - return records; - - } - - private Record buildRecord(final Schema schema, - final DynamicDependencyConfig dynamicDependencyConfig, - final String maven, - final String clazz, - final boolean isLoaded, - final String connectorClassLoaderId, - final String clazzClassLoaderId, - final String fromLocation, - final boolean isTckContainer, - final Optional firstRecord) { - Builder builder = factory.newRecordBuilder(schema); - Builder recordBuilder = builder - .withString(ENTRY_MAVEN, maven) - .withString(ENTRY_CLASS, clazz) - .withBoolean(ENTRY_IS_LOADED, isLoaded) - .withString(ENTRY_CONNECTOR_CLASSLOADER, connectorClassLoaderId) - .withString(ENTRY_CLAZZ_CLASSLOADER, clazzClassLoaderId) - .withString(ENTRY_FROM_LOCATION, fromLocation) - .withBoolean(ENTRY_IS_TCK_CONTAINER, isTckContainer); - - if (firstRecord.isPresent()) { - builder.withRecord(ENTRY_FIRST_RECORD, firstRecord.get()); - } - - if (dynamicDependencyConfig.isEnvironmentInformation()) { - String rootRepository = System.getProperty("talend.component.manager.m2.repository"); - String runtimeClasspath = System.getProperty("java.class.path"); - String workDirectory = System.getProperty("user.dir"); - - recordBuilder = recordBuilder - .withString(ENTRY_ROOT_REPOSITORY, rootRepository) - .withString(ENTRY_RUNTIME_CLASSPATH, runtimeClasspath) - .withString(ENTRY_WORKING_DIRECTORY, workDirectory); - } - - return recordBuilder.build(); - } - - private Optional testLoadingData(final Connector connector) { - Iterator recordIterator = this.loadData(connector.getConnectorFamily(), connector.getConnectorName(), - connector.getConnectorVersion(), json2Map(connector.getConnectorConfiguration())); - return Optional.ofNullable( - recordIterator.hasNext() ? recordIterator.next() : null); - } - - private Map json2Map(final String json) { - // Transform the given json to map - return Collections.emptyMap(); - } - - protected Schema buildSchema(final DynamicDependencyConfig dynamicDependencyConfig) { - Schema.Builder builder = factory.newSchemaBuilder(Type.RECORD) - .withEntry(factory.newEntryBuilder().withName(ENTRY_MAVEN).withType(Type.STRING).build()) - .withEntry(factory.newEntryBuilder().withName(ENTRY_CLASS).withType(Type.STRING).build()) - .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_LOADED).withType(Type.BOOLEAN).build()) - .withEntry( - factory.newEntryBuilder().withName(ENTRY_CONNECTOR_CLASSLOADER).withType(Type.STRING).build()) - .withEntry(factory.newEntryBuilder().withName(ENTRY_CLAZZ_CLASSLOADER).withType(Type.STRING).build()) - .withEntry(factory.newEntryBuilder().withName(ENTRY_FROM_LOCATION).withType(Type.STRING).build()) - .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_TCK_CONTAINER).withType(Type.BOOLEAN).build()); - - if (dynamicDependencyConfig.isEnvironmentInformation()) { - builder = builder - .withEntry(factory.newEntryBuilder().withName(ENTRY_ROOT_REPOSITORY).withType(Type.STRING).build()) - .withEntry( - factory.newEntryBuilder().withName(ENTRY_RUNTIME_CLASSPATH).withType(Type.STRING).build()) - .withEntry( - factory.newEntryBuilder().withName(ENTRY_WORKING_DIRECTORY).withType(Type.STRING).build()); - } - - return builder.build(); - } - - protected Iterator loadData(final String family, final String name, final int version, - final Map parameters) { - return finder.find(family, name, version, parameters); - } - - private void manageException(final boolean dieOnError, final String message, final Exception e) { - String msg = "Dynamic dependencies connector raised an exception: %s : %s".formatted(message, e.getMessage()); - log.error(msg, e); - if (dieOnError) { - throw new ComponentException(msg, e); - } - } - - protected List getDynamicDependencies(final List dependencies, - final List connectors) { - List standardDependencies = dependencies - .stream() - .map(d -> String.format("%s:%s:%s", d.getGroupId(), d.getArtifactId(), d.getVersion())) - .toList(); - - List additionalConnectors = connectors - .stream() - .map(c -> String.format("%s:%s:%s", c.getGroupId(), c.getArtifactId(), c.getVersion())) - .toList(); - - List connectorsDependencies = connectors - .stream() - .flatMap(this::getConnectorDependencies) - .toList(); - List all = Stream.of(standardDependencies, additionalConnectors, connectorsDependencies) - .flatMap(Collection::stream) - .toList(); - - if (log.isInfoEnabled()) { - String collect = all.stream().collect(Collectors.joining("\n- ", "- ", "")); - log.info("All identified dependencies:\n" + collect); - } - return all; - } - - private Stream getConnectorDependencies(final Connector connector) { - if (!connector.isLoadTransitiveDependencies()) { - return Stream.empty(); - } - - List result; - - String gav = String.format("%s:%s:%s", connector.getGroupId(), - connector.getArtifactId(), - connector.getVersion()); - Collection jarFiles = resolver.resolveFromDescriptor( - Collections.singletonList(gav)); - - if (jarFiles == null || jarFiles.size() <= 0) { - throw new ComponentException("Can't find additional connector '%s'.".formatted(gav)); - } - if (jarFiles.size() > 1) { - String join = jarFiles.stream().map(File::getAbsolutePath).collect(Collectors.joining(",")); - throw new ComponentException("Several files have been found to resolve '%s': %s".formatted(gav, join)); - } - - File jarFile = jarFiles.iterator().next(); - - try (JarFile jar = new JarFile(jarFile)) { - JarEntry entry = jar.getJarEntry("TALEND-INF/dependencies.txt"); - if (entry == null) { - throw new ComponentException("TALEND-INF/dependencies.txt not found in JAR"); - } - - try (InputStream is = jar.getInputStream(entry); - BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { - - result = reader.lines() - .filter(line -> !line.isBlank()) // skip empty lines - .map(line -> line.substring(0, line.lastIndexOf(":"))) // remove last ':xxx' - .collect(Collectors.toList()); - } - - } catch (IOException e) { - throw new ComponentException("Can't load dependencies for %s: %s".formatted(gav, e.getMessage()), e); - } - return result.stream(); - } - - /** - * Return true if the given path correspond to a class that has been loaded from a jar that contains - * a TALEND-INF/dependencies.txt file. - * - * @param path The clazz location - * @return true if the given path correspond to a TCK container - */ - private boolean isTCKContainer(final String path) { - // TO DO - return false; - } -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java deleted file mode 100644 index 270b228c525e1..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies; - -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CLASS; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CLAZZ_CLASSLOADER; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CONNECTOR_CLASSLOADER; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_FROM_LOCATION; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_IS_LOADED; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_MAVEN; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_ROOT_REPOSITORY; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_WORKING_DIRECTORY; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; -import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; - -import lombok.Getter; - -public abstract class AbstractDynamicDependenciesServiceTest { - - @Getter - private C config; - - protected abstract C buildConfig(); - - protected abstract S getService(); - - @BeforeEach - void setUp() { - this.config = this.buildConfig(); - } - - @Test - void testloadIterator() { - System.setProperty("talend.component.manager.m2.repository", "./lib/"); - - final Iterator result = getService().loadIterator(config); - - Assertions.assertTrue(result.hasNext()); - this.assertRecord(result.next()); - Assertions.assertFalse(result.hasNext()); - } - - protected List getDependList() { - List depends = new ArrayList<>(); - Dependency depend = new Dependency(); - depend.setArtifactId("commons-numbers-primes"); - depend.setVersion("1.2"); - depend.setGroupId("org.apache.commons"); - depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); - depends.add(depend); - return depends; - } - - private void assertRecord(Record record) { - Assertions.assertNotNull(record); - Assertions.assertEquals("org.apache.commons:commons-numbers-primes:1.2", record.getString(ENTRY_MAVEN)); - Assertions.assertEquals( - "org.apache.commons.numbers.primes.SmallPrimes", - record.getString(ENTRY_CLASS)); - Assertions.assertTrue(record.getBoolean(ENTRY_IS_LOADED)); - Assertions.assertNotNull(record.getString(ENTRY_CONNECTOR_CLASSLOADER)); - Assertions.assertTrue(record.getString(ENTRY_CONNECTOR_CLASSLOADER) - .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); - Assertions.assertNotNull(record.getString(ENTRY_CLAZZ_CLASSLOADER)); - Assertions.assertTrue(record.getString(ENTRY_CLAZZ_CLASSLOADER) - .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); - Assertions.assertNotNull(record.getString(ENTRY_FROM_LOCATION)); - Assertions.assertTrue(record.getString(ENTRY_FROM_LOCATION) - .endsWith( - "org/apache/commons/commons-numbers-primes/1.2/commons-numbers-primes-1.2.jar!/org/apache/commons/numbers/primes/SmallPrimes.class")); - Assertions.assertEquals("./lib/", record.getString(ENTRY_ROOT_REPOSITORY)); - Assertions.assertNotNull(record.getString(ENTRY_RUNTIME_CLASSPATH)); - Assertions.assertEquals(System.getProperty("user.dir"), record.getString(ENTRY_WORKING_DIRECTORY)); - Assertions.assertTrue(record.getString(ENTRY_RUNTIME_CLASSPATH).contains("commons-numbers-primes-1.2.jar")); - } -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml deleted file mode 100644 index 80c0b8bc45460..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - 4.0.0 - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies - 1.86.0-SNAPSHOT - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-with-dataprepRunAnnotation - jar - Component Runtime :: Sample Feature @DynamicDependency with DataprepRun annotation - - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-common - ${project.version} - - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-common - ${project.version} - test-jar - test - - - - org.apache.commons - commons-numbers-primes - 1.2 - test - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - dynamic.dependencies.withDataprepRunAnnotation - - - - - - - - \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java deleted file mode 100644 index 7c81044cfbce7..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.annotation; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import org.talend.sdk.component.api.configuration.type.meta.ConfigurationType; -import org.talend.sdk.component.api.meta.Documentation; - -@Target(TYPE) -@Retention(RUNTIME) -@ConfigurationType("configuration") -@Documentation("Copy/past of the annotation from tDataprepRun.") -public @interface DynamicDependencySupported { - - String value() default "default"; -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java deleted file mode 100644 index 535e4b06acd90..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.annotation.DynamicDependencySupported; - -import lombok.Data; - -/** - * For this sample, the same configuration is used for all connectors input/processor/output. - */ -@Data -@DynamicDependencySupported -@GridLayout({ - @GridLayout.Row({ "dse" }), - @GridLayout.Row({ "subConfig" }), - @GridLayout.Row({ "environmentInformation" }) -}) -@GridLayout(names = GridLayout.FormType.ADVANCED, value = { - @GridLayout.Row({ "dse" }), - @GridLayout.Row({ "dieOnError" }) -}) -public class Config implements DynamicDependencyConfig, Serializable { - - @Option - @Documentation("The dataset configuration.") - private Dataset dse = new Dataset(); - - @Option - @Documentation("Sub-configuration that contains the DynamidDependenciesConfiguration.") - private SubConfig subConfig = new SubConfig(); - - @Option - @Documentation("If enable throw an exception for any error, if not just log the error.") - private boolean dieOnError = false; - - @Option - @Documentation("More environment information.") - private boolean environmentInformation = false; - - @Override - public List getDependencies() { - return new ArrayList<>(this.getSubConfig().getDependencies()); - } - - @Override - public List getConnectors() { - return new ArrayList<>(this.getSubConfig().getConnectors()); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java deleted file mode 100644 index ea45a9daba395..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; - -import java.io.Serializable; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.type.DataSet; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; - -import lombok.Data; - -@Data -@DataSet("dyndepsdse") -@GridLayout(value = { - @GridLayout.Row({ "dso" }) -}) -@GridLayout(names = GridLayout.FormType.ADVANCED, value = { - @GridLayout.Row({ "dso" }) -}) -public class Dataset implements Serializable { - - @Option - @Documentation("A datastore.") - private Datastore dso = new Datastore(); - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java deleted file mode 100644 index 1749603106828..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; - -import java.io.Serializable; - -import org.talend.sdk.component.api.configuration.type.DataStore; -import org.talend.sdk.component.api.configuration.ui.layout.AutoLayout; - -import lombok.Data; - -@Data -@DataStore("dyndepsdso") -@AutoLayout -public class Datastore implements Serializable { - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java deleted file mode 100644 index 97b8a8db6fb0a..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; - -import lombok.Data; - -@Data -@GridLayout({ - @GridLayout.Row({ "dependencies" }), - @GridLayout.Row({ "connectors" }) -}) -public class SubConfig implements Serializable { - - @Option - @Documentation("The dependencies to load dynamically.") - private List dependencies = new ArrayList<>(); - - @Option - @Documentation("The connectors to load dynamically.") - private List connectors = new ArrayList<>(); - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDataprepRunAnnotationInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDataprepRunAnnotationInput.java deleted file mode 100644 index 26ab1b60d7a09..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDataprepRunAnnotationInput.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.input; - -import java.io.Serializable; -import java.util.Iterator; - -import javax.annotation.PostConstruct; - -import org.talend.sdk.component.api.component.Icon; -import org.talend.sdk.component.api.component.Version; -import org.talend.sdk.component.api.input.Emitter; -import org.talend.sdk.component.api.input.Producer; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.service.DynamicDependenciesDataprepRunAnnotationService; - -@Version -@Icon(value = Icon.IconType.CUSTOM, custom = "icon") -@Emitter(name = "Input") -@Documentation("Dynamic dependencies sample input connector.") -public class DynamicDependenciesWithDataprepRunAnnotationInput extends AbstractDynamicDependenciesService - implements Serializable { - - private final Config config; - - private final DynamicDependenciesDataprepRunAnnotationService service; - - private Iterator recordIterator; - - public DynamicDependenciesWithDataprepRunAnnotationInput(final Config config, - final DynamicDependenciesDataprepRunAnnotationService service) { - this.config = config; - this.service = service; - } - - @PostConstruct - public void init() { - this.recordIterator = this.service.loadIterator(this.config); - } - - @Producer - public Record next() { - if (recordIterator == null || !recordIterator.hasNext()) { - return null; - } - - return recordIterator.next(); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java deleted file mode 100644 index f671561c7be2c..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -@Components( - family = "DynamicDependenciesWithDataprepAnnotation", - categories = "sample") -@Icon(value = Icon.IconType.CUSTOM, custom = "icon") -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation; - -import org.talend.sdk.component.api.component.Components; -import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java deleted file mode 100644 index 39f7e7ea4b08f..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.service; - -import java.io.Serializable; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.record.Schema; -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.api.service.dependency.DynamicDependencies; -import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; -import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class DynamicDependenciesDataprepRunAnnotationService extends AbstractDynamicDependenciesService - implements Serializable { - - public final static String DEPENDENCY_WITHDATAPREPRUN_ACTION = "DEPENDENCY_WITHDATAPREPRUN_ACTION"; - - public static final String DEPENDENCY_ACTION = "dataprep-dependencies"; - - @DynamicDependencies(DEPENDENCY_ACTION) - public List getDynamicDependencies(@Option("theConfig") final Config config) { - return super.getDynamicDependencies(config.getDependencies(), config.getConnectors()); - } - - @DiscoverSchemaExtended(DEPENDENCY_WITHDATAPREPRUN_ACTION) - public Schema guessSchema4Input(final @Option("configuration") Config config) { - return super.buildSchema(config); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg deleted file mode 100644 index 85e6a3e1e8eda..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - DynamicDependenciesDataprepRun - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg deleted file mode 100644 index 85e6a3e1e8eda..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - DynamicDependenciesDataprepRun - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties deleted file mode 100644 index 6a100dc952c46..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -DynamicDependenciesWithDataprepAnnotation.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with datapreprun -DynamicDependenciesWithDataprepAnnotation.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with datapreprun \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties deleted file mode 100644 index 1b0eda6eb9634..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -Dataset.dso._displayName = -Dataset.dependencies._displayName = Dependencies -Config.dse._displayName = -Config.dieOnError._displayName = Die on error -Config.environmentInformation._displayName = Environment information -Config.subConfig._displayName = -SubConfig.dependencies._displayName = Dependencies -SubConfig.connectors._displayName = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties deleted file mode 100644 index a0c8970bddfa2..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -DynamicDependenciesWithDataprepAnnotation.Input._displayName = Dynamic Dependencies With DataprepRun annotation Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationServiceTest.java deleted file mode 100644 index c1097e2960ddc..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationServiceTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.service; - -import java.util.ArrayList; -import java.util.List; - -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.junit5.WithComponents; -import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Dataset; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Datastore; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation") -public class DynamicDependenciesDataprepRunAnnotationServiceTest - extends AbstractDynamicDependenciesServiceTest { - - @Service - DynamicDependenciesDataprepRunAnnotationService dynamicDependenciesServiceService; - - @Override - protected Config buildConfig() { - Config config = new Config(); - Dataset dse = new Dataset(); - Datastore dso = new Datastore(); - List depends = this.getDependList(); - config.getSubConfig().setDependencies(depends); - dse.setDso(dso); - config.setDse(dse); - config.setEnvironmentInformation(true); - - return config; - } - - // use tck cnnector as dependency - protected List getDependList() { - List depends = new ArrayList<>(); - Dependency depend = new Dependency(); - depend.setArtifactId("commons-numbers-primes"); - depend.setVersion("1.2"); - depend.setGroupId("org.apache.commons"); - depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); - depends.add(depend); - - // //for connector depend - // Dependency depend2 = new Dependency(); - // depend.setArtifactId("record-provider"); - // depend.setVersion("1.71.0-SNAPSHOT"); - // depend.setGroupId("org.talend.components"); - // depend.setClazz("org.talend.components.recordprovider.source.GenericMapper"); - // depends.add(depend2); - return depends; - } - - @Override - protected DynamicDependenciesDataprepRunAnnotationService getService() { - return dynamicDependenciesServiceService; - } -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml deleted file mode 100644 index 6b8bbdadb1d7d..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - 4.0.0 - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies - 1.86.0-SNAPSHOT - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-with-dataset - jar - Component Runtime :: Sample Feature @DynamicDependency with Dataset - - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-common - ${project.version} - - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-common - ${project.version} - test-jar - test - - - - org.apache.commons - commons-numbers-primes - 1.2 - test - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - org.talend.sdk.component.dynamic.dependencies.withdataset - - - - - - - \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java deleted file mode 100644 index 95352ed168631..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; - -import lombok.Data; - -/** - * For this sample, the same configuration is used for all connectors input/processor/output. - */ -@Data -@GridLayout({ - @GridLayout.Row({ "dse" }), - @GridLayout.Row({ "environmentInformation" }) -}) -@GridLayout(names = GridLayout.FormType.ADVANCED, value = { - @GridLayout.Row({ "dse" }), - @GridLayout.Row({ "dieOnError" }), -}) -public class Config implements DynamicDependencyConfig, Serializable { - - @Option - @Documentation("The dataset configuration.") - private Dataset dse = new Dataset(); - - @Option - @Documentation("If enable throw an exception for any error, if not just log the error.") - private boolean dieOnError = false; - - @Option - @Documentation("More environment information.") - private boolean environmentInformation = false; - - @Override - public List getDependencies() { - return new ArrayList<>(this.getDse().getDependencies()); - } - - public List getConnectors() { - return new ArrayList<>(this.getDse().getConnectors()); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java deleted file mode 100644 index de1cd0b4ca719..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.type.DataSet; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; - -import lombok.Data; - -@Data -@DataSet("dyndepsdse") -@GridLayout(value = { - @GridLayout.Row({ "dso" }), - @GridLayout.Row({ "dependencies" }), - @GridLayout.Row({ "connectors" }) -}) -@GridLayout(names = GridLayout.FormType.ADVANCED, value = { - @GridLayout.Row({ "dso" }) -}) -public class Dataset implements Serializable { - - @Option - @Documentation("A datastore.") - private Datastore dso = new Datastore(); - - @Option - @Documentation("The dependencies to load dynamically.") - private List dependencies = new ArrayList<>(); - - @Option - @Documentation("The connectors to load dynamically.") - private List connectors = new ArrayList<>(); - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Datastore.java deleted file mode 100644 index de540902c68ff..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Datastore.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config; - -import java.io.Serializable; - -import org.talend.sdk.component.api.configuration.type.DataStore; -import org.talend.sdk.component.api.configuration.ui.layout.AutoLayout; - -import lombok.Data; - -@Data -@DataStore("dyndepsdso") -@AutoLayout -public class Datastore implements Serializable { - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesWithDatasetInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesWithDatasetInput.java deleted file mode 100644 index 30e4e53d5d897..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesWithDatasetInput.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.input; - -import java.io.Serializable; -import java.util.Iterator; - -import javax.annotation.PostConstruct; - -import org.talend.sdk.component.api.component.Icon; -import org.talend.sdk.component.api.component.Version; -import org.talend.sdk.component.api.input.Emitter; -import org.talend.sdk.component.api.input.Producer; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService; - -@Version -@Icon(value = Icon.IconType.CUSTOM, custom = "icon") -@Emitter(name = "Input") -@Documentation("Dynamic dependencies sample input connector.") -public class DynamicDependenciesWithDatasetInput implements Serializable { - - private final Config config; - - private final DynamicDependenciesWithDatasetService service; - - private Iterator recordIterator; - - public DynamicDependenciesWithDatasetInput(final Config config, - final DynamicDependenciesWithDatasetService service) { - this.config = config; - this.service = service; - } - - @PostConstruct - public void init() { - this.recordIterator = this.service.loadIterator(this.config); - } - - @Producer - public Record next() { - if (recordIterator == null || !recordIterator.hasNext()) { - return null; - } - - return recordIterator.next(); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java deleted file mode 100644 index 525faeb12ae02..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -@Components( - family = "DynamicDependenciesWithDataset", - categories = "sample") -@Icon(value = Icon.IconType.CUSTOM, custom = "icon") -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset; - -import org.talend.sdk.component.api.component.Components; -import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java deleted file mode 100644 index a532095bcc62b..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; - -import java.io.Serializable; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.record.Schema; -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.api.service.dependency.DynamicDependencies; -import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; -import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Dataset; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class DynamicDependenciesWithDatasetService extends AbstractDynamicDependenciesService implements Serializable { - - public final static String DEPENDENCY_WITHDATASET_ACTION = "DEPENDENCY_WITHDATASET_ACTION"; - - @DynamicDependencies() - public List getDynamicDependencies(@Option("theDataset") final Dataset dataset) { - return super.getDynamicDependencies(dataset.getDependencies(), dataset.getConnectors()); - } - - @DiscoverSchemaExtended(DEPENDENCY_WITHDATASET_ACTION) - public Schema guessSchema4Input(final @Option("configuration") Config config) { - return super.buildSchema(config); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg deleted file mode 100644 index 3e6ba66a42db8..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - DynamicDependenciesDataset - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg deleted file mode 100644 index 3e6ba66a42db8..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - DynamicDependenciesDataset - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties deleted file mode 100644 index e2466c2844474..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -DynamicDependenciesWithDataset.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with dataset -DynamicDependenciesWithDataset.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with dataset \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties deleted file mode 100644 index 42b990411eaf6..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -Dataset.dso._displayName = -Dataset.dependencies._displayName = Dependencies -Config.dse._displayName = -Config.dieOnError._displayName = Die on error -Config.environmentInformation._displayName = Environment information -Dataset.connectors._displayName = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties deleted file mode 100644 index 43d63aaae3a02..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -DynamicDependenciesWithDataset.Input._displayName = Dynamic Dependencies With Dataset Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java deleted file mode 100644 index 1602ef1a7fa83..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; - -import java.util.List; - -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.junit5.WithComponents; -import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Dataset; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Datastore; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset") -public class DynamicDependenciesWithDatasetServiceTest - extends AbstractDynamicDependenciesServiceTest { - - @Service - private DynamicDependenciesWithDatasetService dynamicDependenciesServiceService; - - @Override - protected Config buildConfig() { - Config config = new Config(); - Dataset dse = new Dataset(); - Datastore dso = new Datastore(); - List depends = this.getDependList(); - dse.setDependencies(depends); - dse.setDso(dso); - config.setDse(dse); - config.setEnvironmentInformation(true); - - return config; - } - - @Override - protected DynamicDependenciesWithDatasetService getService() { - return dynamicDependenciesServiceService; - } -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml deleted file mode 100644 index a64addc4322ae..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - 4.0.0 - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies - 1.86.0-SNAPSHOT - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-with-datastore - jar - Component Runtime :: Sample Feature @DynamicDependency with Datastore - - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-common - ${project.version} - - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-common - ${project.version} - test-jar - test - - - - org.apache.commons - commons-numbers-primes - 1.2 - test - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - org.talend.sdk.component.dynamic.dependencies.withdatastore - - - - - - - - \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java deleted file mode 100644 index 50b8591e816f3..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; - -import lombok.Data; - -/** - * For this sample, the same configuration is used for all connectors input/processor/output. - */ -@Data -@GridLayout({ - @GridLayout.Row({ "dse" }), - @GridLayout.Row({ "environmentInformation" }) -}) -@GridLayout(names = GridLayout.FormType.ADVANCED, value = { - @GridLayout.Row({ "dse" }), - @GridLayout.Row({ "dieOnError" }), -}) -public class Config implements DynamicDependencyConfig, Serializable { - - @Option - @Documentation("The dataset configuration.") - private Dataset dse = new Dataset(); - - @Option - @Documentation("If enable throw an exception for any error, if not just log the error.") - private boolean dieOnError = false; - - @Option - @Documentation("More environment information.") - private boolean environmentInformation = false; - - @Override - public List getDependencies() { - return new ArrayList<>(this.getDse().getDso().getDependencies()); - } - - public List getConnectors() { - return new ArrayList<>(this.getDse().getDso().getConnectors()); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java deleted file mode 100644 index abc52e5ec91c4..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config; - -import java.io.Serializable; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.type.DataSet; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; - -import lombok.Data; - -@Data -@DataSet("dyndepsdse") -@GridLayout(value = { - @GridLayout.Row({ "dso" }) -}) -@GridLayout(names = GridLayout.FormType.ADVANCED, value = { - @GridLayout.Row({ "dso" }) -}) -public class Dataset implements Serializable { - - @Option - @Documentation("A datastore.") - private Datastore dso = new Datastore(); - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java deleted file mode 100644 index 8218f4e27f7cc..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.type.DataStore; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; - -import lombok.Data; - -@Data -@DataStore("dyndepsdso") -@GridLayout({ - @GridLayout.Row({ "dependencies" }), - @GridLayout.Row({ "connectors" }) -}) -public class Datastore implements Serializable { - - @Option - @Documentation("The dependencies to load dynamically.") - private List dependencies = new ArrayList<>(); - - @Option - @Documentation("The connectors to load dynamically.") - private List connectors = new ArrayList<>(); - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java deleted file mode 100644 index 09159bfbc339d..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.input; - -import java.io.Serializable; -import java.util.Iterator; - -import javax.annotation.PostConstruct; - -import org.talend.sdk.component.api.component.Icon; -import org.talend.sdk.component.api.component.Version; -import org.talend.sdk.component.api.input.Emitter; -import org.talend.sdk.component.api.input.Producer; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService; - -@Version -@Icon(value = Icon.IconType.CUSTOM, custom = "icon") -@Emitter(name = "Input") -@Documentation("Dynamic dependencies sample input connector.") -public class DynamicDependenciesWithDatastoreInput implements Serializable { - - private final Config config; - - private final DynamicDependenciesWithDatastoreService service; - - private Iterator recordIterator; - - public DynamicDependenciesWithDatastoreInput(final Config config, - final DynamicDependenciesWithDatastoreService service) { - this.config = config; - this.service = service; - } - - @PostConstruct - public void init() { - this.recordIterator = this.service.loadIterator(this.config); - } - - @Producer - public Record next() { - if (recordIterator == null || !recordIterator.hasNext()) { - return null; - } - - return recordIterator.next(); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java deleted file mode 100644 index 84c17f8fc511b..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -@Components( - family = "DynamicDependenciesWithDatastore", - categories = "sample") -@Icon(value = Icon.IconType.CUSTOM, custom = "icon") -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore; - -import org.talend.sdk.component.api.component.Components; -import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java deleted file mode 100644 index ea08f69beb09c..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service; - -import java.io.Serializable; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.record.Schema; -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.api.service.dependency.DynamicDependencies; -import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; -import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Datastore; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class DynamicDependenciesWithDatastoreService extends AbstractDynamicDependenciesService - implements Serializable { - - public final static String DEPENDENCY_WITHDATASTORE_ACTION = "DEPENDENCY_WITHDATASTORE_ACTION"; - - @DynamicDependencies() - public List getDynamicDependencies(@Option("theDatastore") final Datastore datastore) { - return super.getDynamicDependencies(datastore.getDependencies(), datastore.getConnectors()); - } - - @DiscoverSchemaExtended(DEPENDENCY_WITHDATASTORE_ACTION) - public Schema guessSchema4Input(final @Option("configuration") Config config) { - return super.buildSchema(config); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg deleted file mode 100644 index 750d837d60cec..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - DynamicDependenciesDatastore - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg deleted file mode 100644 index 750d837d60cec..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - DynamicDependenciesDatastore - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties deleted file mode 100644 index 54e6e670c24ff..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -DynamicDependenciesWithDatastore.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with datastore -DynamicDependenciesWithDatastore.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with datastore \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties deleted file mode 100644 index 2a933f364e575..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -Datastore.dependencies._displayName = Dependences -Dataset.dso._displayName = -Config.dse._displayName = -Config.dieOnError._displayName = Die on error -Config.environmentInformation._displayName = Environment information -Datastore.connectors._displayName = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties deleted file mode 100644 index 686de01008376..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -DynamicDependenciesWithDatastore.Input._displayName = Dynamic Dependencies With Datastore Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java deleted file mode 100644 index 465e126902f54..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service; - -import java.util.List; - -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.junit5.WithComponents; -import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Dataset; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Datastore; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore") -public class DynamicDependenciesWithDatastoreServiceTest - extends AbstractDynamicDependenciesServiceTest { - - @Service - DynamicDependenciesWithDatastoreService dynamicDependenciesServiceService; - - @Override - protected Config buildConfig() { - Config config = new Config(); - Dataset dse = new Dataset(); - Datastore dso = new Datastore(); - List depends = this.getDependList(); - dso.setDependencies(depends); - dse.setDso(dso); - config.setDse(dse); - config.setEnvironmentInformation(true); - - return config; - } - - @Override - protected DynamicDependenciesWithDatastoreService getService() { - return dynamicDependenciesServiceService; - } -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml deleted file mode 100644 index 842ad3faa79b2..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - 4.0.0 - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies - 1.86.0-SNAPSHOT - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-with-dynamicDependenciesConfiguration - jar - Component Runtime :: Sample Feature @DynamicDependency with DynamicDependenciesConfiguration - - - org.talend.sdk.component:dynamic-dependencies-common - include-exclude - - - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-common - ${project.version} - - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-common - ${project.version} - test-jar - test - - - - org.apache.commons - commons-numbers-primes - 1.2 - test - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - org.talend.sdk.component.dynamic.dependencies.withDynamicDependenciesConfiguration - - - - - - - \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java deleted file mode 100644 index cd2c88cbd673b..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; - -import lombok.Data; - -/** - * For this sample, the same configuration is used for all connectors input/processor/output. - */ -@Data -@GridLayout({ - @GridLayout.Row({ "dse" }), - @GridLayout.Row({ "subConfig" }), - @GridLayout.Row({ "environmentInformation" }) -}) -@GridLayout(names = GridLayout.FormType.ADVANCED, value = { - @GridLayout.Row({ "dse" }), - @GridLayout.Row({ "dieOnError" }), -}) -public class Config implements DynamicDependencyConfig, Serializable { - - @Option - @Documentation("The dataset configuration.") - private Dataset dse = new Dataset(); - - @Option - @Documentation("Sub-configuration that contains the DynamidDependenciesConfiguration.") - private SubConfig subConfig = new SubConfig(); - - @Option - @Documentation("If enable throw an exception for any error, if not just log the error.") - private boolean dieOnError = false; - - @Option - @Documentation("More environment information.") - private boolean environmentInformation = false; - - @Override - public List getDependencies() { - return new ArrayList<>(this.getSubConfig().getDependencies()); - } - - public List getConnectors() { - return new ArrayList<>(this.getSubConfig().getConnectors()); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java deleted file mode 100644 index 8bd5960324df2..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; - -import java.io.Serializable; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.type.DataSet; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; - -import lombok.Data; - -@Data -@DataSet("dyndepsdse") -@GridLayout(value = { - @GridLayout.Row({ "dso" }) -}) -@GridLayout(names = GridLayout.FormType.ADVANCED, value = { - @GridLayout.Row({ "dso" }) -}) -public class Dataset implements Serializable { - - @Option - @Documentation("A datastore.") - private Datastore dso = new Datastore(); - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java deleted file mode 100644 index 3c3dbdc92160e..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; - -import java.io.Serializable; - -import org.talend.sdk.component.api.configuration.type.DataStore; -import org.talend.sdk.component.api.configuration.ui.layout.AutoLayout; - -import lombok.Data; - -@Data -@DataStore("dyndepsdso") -@AutoLayout -public class Datastore implements Serializable { - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java deleted file mode 100644 index 12efa3c258d42..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.type.DynamicDependenciesConfiguration; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Connector; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; - -import lombok.Data; - -@Data -@DynamicDependenciesConfiguration -@GridLayout({ - @GridLayout.Row({ "dependencies" }), - @GridLayout.Row({ "connectors" }) -}) -public class SubConfig implements Serializable { - - @Option - @Documentation("The dependencies to load dynamically.") - private List dependencies = new ArrayList<>(); - - @Option - @Documentation("The connectors to load dynamically.") - private List connectors = new ArrayList<>(); - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesConfigurationInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesConfigurationInput.java deleted file mode 100644 index 335322e79b7fb..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesConfigurationInput.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.input; - -import java.io.Serializable; -import java.util.Iterator; - -import javax.annotation.PostConstruct; - -import org.talend.sdk.component.api.component.Icon; -import org.talend.sdk.component.api.component.Version; -import org.talend.sdk.component.api.input.Emitter; -import org.talend.sdk.component.api.input.Producer; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicependenciesConfigurationService; - -@Version -@Icon(value = Icon.IconType.CUSTOM, custom = "icon") -@Emitter(name = "Input") -@Documentation("Dynamic dependencies sample input connector.") -public class DynamicDependenciesWithDynamicDependenciesConfigurationInput extends AbstractDynamicDependenciesService - implements Serializable { - - private final Config config; - - private final DynamicDependenciesWithDynamicependenciesConfigurationService service; - - private Iterator recordIterator; - - public DynamicDependenciesWithDynamicDependenciesConfigurationInput(final Config config, - final DynamicDependenciesWithDynamicependenciesConfigurationService service) { - this.config = config; - this.service = service; - } - - @PostConstruct - public void init() { - this.recordIterator = this.service.loadIterator(this.config); - } - - @Producer - public Record next() { - if (recordIterator == null || !recordIterator.hasNext()) { - return null; - } - - return recordIterator.next(); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java deleted file mode 100644 index fcc2ed3c55c47..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -@Components( - family = "DynamicDependenciesWithDynamicDependenciesConfiguration", - categories = "sample") -@Icon(value = Icon.IconType.CUSTOM, custom = "icon") -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration; - -import org.talend.sdk.component.api.component.Components; -import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationService.java deleted file mode 100644 index 3d0057a5fafec..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationService.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service; - -import java.io.Serializable; -import java.util.List; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.record.Schema; -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.api.service.dependency.DynamicDependencies; -import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; -import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.SubConfig; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class DynamicDependenciesWithDynamicependenciesConfigurationService extends AbstractDynamicDependenciesService - implements Serializable { - - public final static String DEPENDENCY_WITHDYNDEPSCONFIG_ACTION = "DEPENDENCY_WITHDYNDEPSCONFIG_ACTION"; - - @DynamicDependencies() - public List getDynamicDependencies(@Option("theSubConfig") final SubConfig subConfig) { - return super.getDynamicDependencies(subConfig.getDependencies(), subConfig.getConnectors()); - } - - @DiscoverSchemaExtended(DEPENDENCY_WITHDYNDEPSCONFIG_ACTION) - public Schema guessSchema4Input(final @Option("configuration") Config config) { - return super.buildSchema(config); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark/icon.svg deleted file mode 100644 index 75edf24718ba0..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark/icon.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - DynamicDependenciesDynDepConf - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light/icon.svg deleted file mode 100644 index 75edf24718ba0..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light/icon.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - DynamicDependenciesDynDepConf - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties deleted file mode 100644 index c86de8883106d..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -DynamicDependenciesWithDynamicDependenciesConfiguration.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies With DynamicDependenciesConfiguration -DynamicDependenciesWithDynamicDependenciesConfiguration.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies With DynamicDependenciesConfiguration \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties deleted file mode 100644 index 2585384578ebd..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -Dataset.dso._displayName = -Config.dse._displayName = -Config.dieOnError._displayName = Die on error -Config.environmentInformation._displayName = Environment information -Config.subConfig._displayName = -SubConfig.dependencies._displayName = Dependencies -SubConfig.connectors._displayName = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties deleted file mode 100644 index b252d46a5697c..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -DynamicDependenciesWithDynamicDependenciesConfiguration.Input._displayName = Dynamic Dependencies With DynamicDependenciesConfiguration Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationServiceTest.java deleted file mode 100644 index 7b2bc3083c4a4..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicependenciesConfigurationServiceTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service; - -import java.util.List; - -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.junit5.WithComponents; -import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Dataset; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Datastore; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@WithComponents( - value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration") -public class DynamicDependenciesWithDynamicependenciesConfigurationServiceTest - extends - AbstractDynamicDependenciesServiceTest { - - @Service - DynamicDependenciesWithDynamicependenciesConfigurationService dynamicDependenciesServiceService; - - @Override - protected Config buildConfig() { - Config config = new Config(); - Dataset dse = new Dataset(); - Datastore dso = new Datastore(); - List depends = this.getDependList(); - config.getSubConfig().setDependencies(depends); - dse.setDso(dso); - config.setDse(dse); - config.setEnvironmentInformation(true); - - return config; - } - - @Override - protected DynamicDependenciesWithDynamicependenciesConfigurationService getService() { - return dynamicDependenciesServiceService; - } -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/pom.xml deleted file mode 100644 index 485213f4ef979..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - 4.0.0 - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies - 1.86.0-SNAPSHOT - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-with-spi - jar - Component Runtime :: Sample Feature @DynamicDependency with spi - - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-common - ${project.version} - - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies-common - ${project.version} - test-jar - test - - - - - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - org.talend.sdk.component.dynamic.dependencies.withspi - - - - - - - \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Config.java deleted file mode 100644 index 31b3b04ae1f03..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Config.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.config; - -import java.io.Serializable; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; - -import lombok.Data; - -/** - * For this sample, the same configuration is used for all connectors input/processor/output. - */ -@Data -@GridLayout({ - @GridLayout.Row({ "dse" }), -}) -@GridLayout(names = GridLayout.FormType.ADVANCED, value = { - @GridLayout.Row({ "dse" }), - @GridLayout.Row({ "dieOnError" }), -}) -public class Config implements Serializable { - - @Option - @Documentation("The dataset configuration.") - private Dataset dse = new Dataset(); - - @Option - @Documentation("If enable throw an exception for any error, if not just log the error.") - private boolean dieOnError = false; - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Dataset.java deleted file mode 100644 index bbb28640b0c6b..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Dataset.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.config; - -import java.io.Serializable; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.type.DataSet; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; - -import lombok.Data; - -@Data -@DataSet("dyndepsdse") -@GridLayout(value = { - @GridLayout.Row({ "dso" }), - @GridLayout.Row({ "bbb" }), -}) -@GridLayout(names = GridLayout.FormType.ADVANCED, value = { - @GridLayout.Row({ "dso" }) -}) -public class Dataset implements Serializable { - - @Option - @Documentation("A datastore.") - private Datastore dso = new Datastore(); - - @Option - @Documentation("Xxxx xxx.") - private String bbb; - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Datastore.java deleted file mode 100644 index 91d74dac3fdb6..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Datastore.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.config; - -import java.io.Serializable; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.type.DataStore; -import org.talend.sdk.component.api.configuration.ui.layout.AutoLayout; -import org.talend.sdk.component.api.meta.Documentation; - -import lombok.Data; - -@Data -@DataStore("dyndepsdso") -@AutoLayout -public class Datastore implements Serializable { - - @Option - @Documentation("Xxxx xxx.") - private String aaa; - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/DynamicDependenciesWithSPIInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/DynamicDependenciesWithSPIInput.java deleted file mode 100644 index 3e26377bbed1c..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/DynamicDependenciesWithSPIInput.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.input; - -import java.io.Serializable; -import java.util.Iterator; - -import javax.annotation.PostConstruct; - -import org.talend.sdk.component.api.component.Icon; -import org.talend.sdk.component.api.component.Version; -import org.talend.sdk.component.api.input.Emitter; -import org.talend.sdk.component.api.input.Producer; -import org.talend.sdk.component.api.meta.Documentation; -import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.service.DynamicDependenciesWithSPIService; - -@Version -@Icon(value = Icon.IconType.CUSTOM, custom = "icon") -@Emitter(name = "Input") -@Documentation("Dynamic dependencies sample input connector.") -public class DynamicDependenciesWithSPIInput implements Serializable { - - private final Config config; - - private final DynamicDependenciesWithSPIService service; - - private Iterator recordIterator; - - public DynamicDependenciesWithSPIInput(final Config config, - final DynamicDependenciesWithSPIService service) { - this.config = config; - this.service = service; - } - - @PostConstruct - public void init() { - this.recordIterator = this.service.getRecordIterator(); - } - - @Producer - public Record next() { - if (recordIterator == null || !recordIterator.hasNext()) { - return null; - } - - return recordIterator.next(); - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/package-info.java deleted file mode 100644 index 8f684f5ab8500..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -@Components( - family = "DynamicDependenciesWithSPI", - categories = "sample") -@Icon(value = Icon.IconType.CUSTOM, custom = "icon") -package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi; - -import org.talend.sdk.component.api.component.Components; -import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/service/DynamicDependenciesWithSPIService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/service/DynamicDependenciesWithSPIService.java deleted file mode 100644 index 739a043507634..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/service/DynamicDependenciesWithSPIService.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.service; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Serializable; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; - -import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.exception.ComponentException; -import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.api.record.Schema; -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.api.service.dependency.DynamicDependencies; -import org.talend.sdk.component.api.service.record.RecordBuilderFactory; -import org.talend.sdk.component.api.service.schema.DiscoverSchema; -import org.talend.sdk.component.sample.feature.dynamicdependencies.classloadertestlibrary.StringMapTransformer; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withspi.config.Dataset; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class DynamicDependenciesWithSPIService implements Serializable { - - private static String version; - - @Service - private RecordBuilderFactory recordBuilderFactory; - - @DynamicDependencies - public List getDynamicDependencies(@Option("theDataset") final Dataset dataset) { - String dep = "org.talend.sdk.samplefeature.dynamicdependencies:classloader-test-spi:" - + loadVersion(); - System.out.println("Dynamic dependency to load: " + dep); - return Collections.singletonList(dep); - } - - @DiscoverSchema("dyndepsdse") - public Schema guessSchema4Input(final @Option("configuration") Dataset dse) { - Iterator recordIterator = getRecordIterator(); - if (!recordIterator.hasNext()) { - throw new ComponentException("No data loaded from StringMapTransformer."); - } - - Record record = recordIterator.next(); - return record.getSchema(); - } - - public Iterator getRecordIterator() { - StringMapTransformer stringMapTransformer = new StringMapTransformer<>(true); - List records = stringMapTransformer - .transform((s1, s2) -> recordBuilderFactory.newRecordBuilder().withString(s1, s2).build()); - return records.iterator(); - } - - private static String loadVersion() { - if (version == null) { - try (InputStream is = DynamicDependenciesWithSPIService.class.getClassLoader() - .getResourceAsStream("version.properties")) { - Properties props = new Properties(); - props.load(is); - version = props.getProperty("version"); - } catch (IOException e) { - throw new ComponentException("Unable to load project version", e); - } - } - return version; - } - -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/dark/icon.svg deleted file mode 100644 index 3e6ba66a42db8..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/dark/icon.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - DynamicDependenciesDataset - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/light/icon.svg deleted file mode 100644 index 3e6ba66a42db8..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/icons/light/icon.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - DynamicDependenciesDataset - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/Messages.properties deleted file mode 100644 index 07fabc121dc11..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/Messages.properties +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -DynamicDependenciesWithSPI.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies With SPI -DynamicDependenciesWithSPI.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies With SPI -DynamicDependenciesWithSPI.actions.schema.dyndepsdse._displayName = Dynamic dependencies With SPI discover schema \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Messages.properties deleted file mode 100644 index a83b1f07a4954..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/config/Messages.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -Dataset.dso._displayName = -Config.dse._displayName = -Config.dieOnError._displayName =Die on error -Datastore.aaa._displayName = -Dataset.bbb._displayName = -Datastore.aaa._placeholder = -Dataset.bbb._placeholder = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/Messages.properties deleted file mode 100644 index 5d3c3478cce11..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withspi/input/Messages.properties +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -DynamicDependenciesWithSPI.Input._displayName = Dynamic Dependencies With SPI Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/version.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/version.properties deleted file mode 100644 index c7c8d1f0f47db..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-spi/src/main/resources/version.properties +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2006-2025 Talend Inc. - www.talend.com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Here you can change all your configuration display names to use more explicit labels -# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example - -version=${project.version} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/pom.xml b/sample-parent/sample-features/dynamic-dependencies/pom.xml deleted file mode 100644 index 209a16957fe6a..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - 4.0.0 - - org.talend.sdk.component - sample-features - 1.86.0-SNAPSHOT - - - org.talend.sdk.samplefeature.dynamicdependencies - dynamic-dependencies - pom - - Component Runtime :: Sample Feature @DynamicDependency - - dynamic-dependencies-common - dynamic-dependencies-with-dataset - dynamic-dependencies-with-datastore - dynamic-dependencies-with-dynamicDependenciesConfiguration - dynamic-dependencies-with-dataprepRunAnnotation - dynamic-dependencies-with-spi - classloader-test-library - classloader-test-spi - - - - - org.talend.sdk.component - component-runtime-junit - ${project.version} - test - - - - \ No newline at end of file From ff3973c7c330a1b8bd0e771710a7e2a82325059d Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Thu, 4 Dec 2025 14:59:51 +0100 Subject: [PATCH 12/12] feat(QTDI-2134): fix pom for remove dynamicdependencies feature. --- sample-parent/sample-features/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/sample-parent/sample-features/pom.xml b/sample-parent/sample-features/pom.xml index b14b123d75971..cd68e50847c03 100644 --- a/sample-parent/sample-features/pom.xml +++ b/sample-parent/sample-features/pom.xml @@ -35,7 +35,6 @@ checkpoint-runner configuration-form entry-with-error - dynamic-dependencies