0

I am writing the custom component for the talend. And I want to add a drop-down list in the component settings. Where I need to add the list items from the server using the given host id and password for example:

  1. Hostname
  2. Password
  3. Dropdown

once the user fills the 1 and 2 then the dropdown will be filled using the host response.

I tried to search the related content in the talend documents but didn't find

can anyone suggest me how I can achieve this feature or it is possible to develop?

I did the approach suggest create a plugin and installed to TOS/plugins added the header extension. when I tried to push the component to palette Talend raise errors below

java.lang.Exception: Component TalendDynamicList load error. because the exception:Bad number of extensions found on org.talend.core.external_component. Expecting between 1 and 1 but found 0.

at org.talend.designer.core.model.components.EmfComponent.load(EmfComponent.java:398)

at org.talend.designer.core.model.components.EmfComponent.<init>(EmfComponent.java:243)

at org.talend.designer.codegen.components.model.ComponentsFactory.loadComponentsFromFolder(ComponentsFactory.java:503)

at org.talend.designer.codegen.components.model.ComponentsFactory.loadComponents(ComponentsFactory.java:296)

at org.talend.designer.codegen.components.model.ComponentsFactory.loadComponentsFromComponentsProviderExtension(ComponentsFactory.java:280)

at org.talend.designer.codegen.components.model.ComponentsFactory.init(ComponentsFactory.java:179)

at org.talend.designer.codegen.components.model.ComponentsFactory.getComponents(ComponentsFactory.java:801)

at org.talend.librariesmanager.model.service.LocalLibraryManager.deployComponentAndExtensionLibs(LocalLibraryManager.java:1133)

at org.talend.librariesmanager.model.service.JavaLibrariesService.syncLibraries(JavaLibrariesService.java:227)

at org.talend.librariesmanager.model.service.LibrariesService.syncLibraries(LibrariesService.java:128)

at org.talend.designer.codegen.CodeGeneratorService.refreshTemplates(CodeGeneratorService.java:156)

at org.talend.componentdesigner.ui.action.provider.PushToPaletteActionProvider$PushToPaletteAction.run(PushToPaletteActionProvider.java:181)

at org.eclipse.jface.action.Action.runWithEvent(Action.java:519)

at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)

at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)

at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)

at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)

at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)

at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)

at org.talend.rcp.intro.Application.start(Application.java:243)

at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)

at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)

at org.eclipse.equinox.launcher.Main.run(Main.java:1465)

Caused by: java.lang.RuntimeException: plugin:org.talend.designer.plsap not found

at org.talend.core.model.repository.ExternalNodesFactory.getInstance(ExternalNodesFactory.java:38)

at org.talend.designer.core.model.components.EmfComponent.load(EmfComponent.java:396)

... 41 more

Caused by: org.talend.commons.exception.IllegalPluginConfigurationException: Bad number of extensions found on org.talend.core.external_component. Expecting between 1 and 1 but found 0.

at org.talend.commons.utils.workbench.extensions.ExtensionImplementationProvider.createInstances(ExtensionImplementationProvider.java:193)

at org.talend.commons.utils.workbench.extensions.ExtensionImplementationProvider.getInstance(ExtensionImplementationProvider.java:143)

at org.talend.core.model.repository.ExternalNodesFactory.getInstance(ExternalNodesFactory.java:36)

... 42 more

if possible then share the plugin templete, I tried to follow

https://www.talendforge.org/forum/viewtopic.php?id=38165 and http://community.jaspersoft.com/wiki/jaspersoft-etl-plugin-create-talend-plugin

both have same error please help

Sunil Soni
  • 443
  • 3
  • 18

2 Answers2

0

It is feasible but you have to completely think out of the box for it. Instead of solving it INSIDE the component you can have an extension to the STUDIO that can communicate with the component of yours.

I explained this on the talend forum so this is pretty-much a copy paste from there. http://www.talendforge.org/forum/viewtopic.php?id=9439 https://www.talendforge.org/forum/viewtopic.php?id=38165

Since I feel that my post was just a beginning of something bigger I'd like to open a new topic, where I can post my additional findings. Here's my original answer to that topic: (feel free to make it nicer)

So far the following seems to work: This is based on the ssps extension, that I used as a base. Why? because it has 2 parameters on the GUI, and it "just" parses a file into talend metadata.

Getting started:

  1. First of all we need an eclipse development environment. The following guide is accurate and okay. (Don't worry, we won't run Talend from SVN) http://www.talendforge.org/wiki/doku.php?id=dev:run_from_svn
  2. Then we need to create our own extension. Same apply as for the components: Use an existing one as a base. Without going into deep techincal details: We have an interface and a java program. The java program has a main( String args) function that is triggered from the gui.
  3. Setting up the component: you need to add the following entries int your component: To the HEADER tag insert: EXTENSION="org.talend.designer.plsap" So it will look like:
<HEADER EXTENSION="org.talend.designer.plsap" PLATEFORM="ALL" ....>
  1. Also we need a custom button in the component XML:
<PARAMETER NAME="MAP" FIELD="EXTERNAL" NUM_ROW="89">
<DEFAULT />
</PARAMETER>

Creating the extension JAR!

  1. Before we start we need to edit the manifest file:
  2. A custom ID is a must, as well as the right configuration of the Extension tab.
  3. Now lets install it, for this we need a JAR file. This was the tricky part for me (I've spent a total like 4-5 hours to get the whole working, this includes the SVN checkout as well):
  4. When you export your extension don't go straight to the finish.
  5. Click Next-Next until you reach the manifest part: Here you need to add the components manifest file, not a file that was generated by eclipse.

Installing the extension JAR!

  1. Go to the talend installation where you want to apply this "extension".
  2. The exported jar should go under the plugins folder.
  3. Locate the following file: features\org.talend.tos.components-feature_5.4.1.r111943\features.xml Here I added the following entry:
   <plugin
         id="org.talend.designer.plsap"
         download-size="0"
         install-size="0"
         version="5.4.1.r111943"
         unpack="false"/>
  1. In case of Talend Enterprise, create an extrabundles.info file under:<studio>\configuration\org.talend.configurator Content should be:

org.talend.designer.plsap,5.4.1.r111943,plugins/org.talend.designer.plsap_5.4.1.r111943.jar,4,false

  1. Delete the following folders:
    • \configuration\org.eclipse.core.runtime
    • \configuration\org.eclipse.equinox.app
    • \configuration\org.eclipse.osgi
    • \configuration\org.eclipse.update
  2. Profit, you're done!

How does it work?

Whenever you click that button on the GUI the java program will be called, and it can get / set the parameters of your component. I still have a few to do / check: I'm not sure if the parameter NAME= value is passed or not. I'm not sure if we can start any kind of external java program.

Troubleshooting:

  • Talend fails to load the component: Make sure you use the same version in the features.xml that you used in the plugin.xml

I'll try and dig up some code from the actual java code how we interacted with the component.

Balazs Gunics
  • 2,017
  • 2
  • 17
  • 24
  • Thanks for your support, I have gone through your answer, and setup the eclipse development environment, so Now Shoulld I create a Simple Jar file and add it to the talend or create the plugin using PDE and export as jar, if you have any example that will be great for me. – Sunil Soni Apr 12 '17 at 05:32
-1

I have found the solution in the Talend git repository, you can create the custom component by following the steps below

  1. setup the maven and java on your machine
  2. go to your workspace and run the following command

    mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=org.talend.components -DarchetypeArtifactId=input-component-archetypes -DarchetypeVersion=0.20.0-SNAPSHOT  -DarchetypeRepository=https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceRelease/
    
  3. meanwhile you are command is running it will ask you few questions like name of the component and version etc.

  4. once you have done with command, it will generate an input component template for you

  5. in the command there is DarchetypeVersion version you can change if you need the different version

     -DarchetypeVersion=0.20.0-SNAPSHOT 
    

    in my case I am using the

     -DarchetypeVersion=0.16.0-SNAPSHOT 
    
  6. now just find the POM.XML file of the component and run the command

      mvn install
    
  7. This command will compile the source code and generate few jar file with different classifiers. jar and bundle
  8. during the compile process you can have errors, for now remove the test classes.
  9. once the source code is compiled, copy the bundle jar file to Talend root->plugins
  10. Restart the Talend Studio
  11. after restarting the Talend search your component in the palette

Once you found your component in the palette then next step is to add the dynamic drop down in your component. follow the steps

  1. In your Source code search for the file .properties.java
  2. define the property

        public Property<List<NamedThing>> dropdown = newProperty(new 
        TypeLiteral<List<NamedThing>>() {
    
        }, "dropdown");
    
    
        public List<String> items = new ArrayList<>();
    
  3. this will create the dropdown in component configuration 4 to fill values, first add items in the types 5 and then on refreshLayout function add the following code

        dropdown.setPossibleValues(items);
    
  4. now build again the source and install the bundle.jar in the talend plugins. you will see the dynamic drop down list

Sunil Soni
  • 443
  • 3
  • 18
  • Just a link is not a good answer. Please write the relevant information to your answer. – zuluk May 24 '17 at 06:51