Java snippet additional bundles

Hi Folks

i’m working on a connector for Adwords using service account auth.

In order to do this i need to import these into the java snippet

import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.services.sqladmin.SQLAdminScopes;

The first one is part of the additional bundles
The latter is not. How do i add this to the java snippet? and in such a way so that if i share the metanode via hub, the library is also available to those users?

cheers

1 Like

Hi @Gavin_Attard,

not sure if this is your question.
But you can just put the additional jars in the same project folder as the workflow and then reference it in the additional libraries:

e.g. if I would want to add the POI Lib:
grafik


knime url looks something like this:
knime://knime.workflow/…/poi-4.1.2.jar

Then I can do the imports like normally
grafik

And then you can just export the whole project folder as a knar and share it :slight_smile:

1 Like

oh i see, that’s very close to what i was hoping for.

Following on from that, i wonder if i can put the jar file in hub, then reference the hub url?

That way when i share the component, it will work for any user also.

Hi @Gavin_Attard,

I think if you do it in the above described way and share the complete knar in the Hub - then I should work for every user.
I mean you could also share the jar file in the hub - then have a get-node to download the jar every time it executes (but I think you do not have to do it :slight_smile: )

Hello @Gavin_Attard,

don’t think this is yet possible. See here: Shared component with external file

There is ticket to address this use case and have given it +1. (Internal reference: AP-6125)

Br,
Ivan

2 Likes

Hi @Gavin_Attard,

sorry I think @ipazin is right :frowning:
I did not read your requirement correctl. …
If you want to share it as a shared component then I actually do not know how to do it beside downloading the file (thought you only wanted to share the workflow :frowning: )
Will give you an example which downloads the jar - not nice but might still work fine :slight_smile:

1 Like

Hi @Gavin_Attard,

here the promised example with downloading the jar file and the using it in the java snippet.

KNIME_project25.knwf (161.9 KB)

Sadly it will download the file every time the workflow is executed - but if the Libraries are not too large then it should still work :slight_smile:

3 Likes

also @ipazin, would could you give a +1 for the request from me as well?
Thx in advance

Thanks for you input both. Yes a feature to include a jar file with a component would be cool. I think that would start to open up component building to more users without going into dev mode. (add the java snippet capability to create a table rather than just a row by row and we will be onto a real winner for a wider range of users in my view).

Ok, so i’m parking this one in the mean time. I have been working on the signature signing for auth, almost there, still won’t accept my JWT for some reason but will start a separate thread for that.

Thanks again and have a good week

1 Like

@AnotherFraudUser done.
Br,
Ivan

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.