Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [science-iwg] Integrating OSGi bundles into P/Jython

We just got EASE working in ICE. We did this in the Rhino (_javascript_) shell to get our "Core" OSGi service:

loadModule('/System/Platform')
var core = getService(org.eclipse.ice.core.iCore.ICore)

It worked perfectly. Kasper Gammeltoft, one of our developers, then went on to script a whole neutron reflectivity calculation immediately after that.

We haven't tried it in the Jython shell yet. We're going to build a binary first with the EASE bundles and then install Jython to test it.

Jay

On Mon, Jun 29, 2015 at 10:58 AM, <Matt.Gerring@xxxxxxxxxxxxx> wrote:

…Want this *now* J

 

On Mon, Jun 29, 2015 at 4:20 PM, Janos Binder <janos.binder@xxxxxxxxxxxxx> wrote:

Hi there,

After a few days, I finally managed to "marry" OSGi and Jython. Briefly, the PythonInterpreter needs a ClassLoader, which can handle the OSGi bundles. So here is a StackOverflow article with my question and my answer there:
http://stackoverflow.com/questions/31001850/passing-osgi-bundles-for-jython-interpreter-on-the-fly

And the essential code:
https://sourceforge.net/p/openchrom3rdpl/openchrom3rdpl/ci/001f40ef8690ac01c43487f3b2fda0608d90c744/tree/openchrom/plugins/net.openchrom.thirdpartylibraries.jython/src/net/openchrom/thirdpartylibraries/jython/Activator.java
https://sourceforge.net/p/openchromplugins/processors/openchromjython/ci/develop/tree/openchrom/plugins/net.openchrom.chromatogram.msd.process.supplier.jython/src/net/openchrom/chromatogram/msd/process/supplier/jython/osgi/JythonClassLoader.java
https://sourceforge.net/p/openchromplugins/processors/openchromjython/ci/develop/tree/openchrom/plugins/net.openchrom.chromatogram.msd.process.supplier.jython/src/net/openchrom/chromatogram/msd/process/supplier/jython/osgi/JythonEnvironment.java
https://sourceforge.net/p/openchromplugins/processors/openchromjython/ci/develop/tree/openchrom/plugins/net.openchrom.chromatogram.msd.process.supplier.jython.ui/src/net/openchrom/chromatogram/msd/process/supplier/jython/ui/handler/ExecuteJythonScriptHandler.java
https://sourceforge.net/p/openchromplugins/processors/openchromjython/ci/develop/tree/openchrom/plugins/net.openchrom.chromatogram.msd.process.supplier.jython.ui/src/net/openchrom/chromatogram/msd/process/supplier/jython/ui/wizards/parse-chromatogram.py

Hope this email might save time, when you need to integrate Jython into your projects :)

Best wishes,

Janos



On 24.06.2015 21:07, Christian Pontesegger wrote:

Hi,

the python sample scripts were provided quite some time ago, when the project was part of the e4 incubator.
We changed lots of the code base since then, but no one updated the python scripts.

Regarding the one you mentioned:
The module names changed a bit:
eg "ResourcesModule" is called "Resources" by now.

Have a look at the js sample file that does the same:
http://git.eclipse.org/c/ease/org.eclipse.ease.scripts.git/tree/_javascript_%20Snippets/Java%20helpers/Add%20println%20Tasks.js

To see what modules/functions are available have a look at the 'Modules Explorer' view.
If you need more support, best subscribe to the ease-dev mailing list or go to the forums.
https://www.eclipse.org/ease/support/


HTH
Christian

On 24.06.2015 11:49, Janos Binder wrote:

Hi Christian,

thanks for pointing out that blogspot. I tried loadModule() today using the example here:

http://git.eclipse.org/c/ease/org.eclipse.ease.core.git/tree/plugins/org.eclipse.ease.lang.python.examples/samples/scripts/Find_System_Prints.py

However whenever I run this script as an EASE script I get the following error.

Unable to find module "ResourcesModule"
Unable to find module "WorkbenchModule"

I got similar errors with the other examples.

Jython version: 2.7b3 (default:e81256215fb0, Aug 4 2014, 02:39:51)
[OpenJDK 64-Bit Server VM (Oracle Corporation)]

What am I doing wrong? :-)

Best wishes,

Janos

On 23.06.2015 18:39, Christian Pontesegger wrote:

Hi there,

nice you discovered EASE. Our Jython interpreter is a full featured OSGI citizen. You may import any Java class from the JRE and from all available OSGI bundles.

loadModule() is a command we inject into the Jython engine. It allows us to load libraries written in Java (it' s easy, see http://codeandme.blogspot.co.at/2014/10/writing-modules-for-ease.html ) which basically wrap java functionality to script functions. Call it a more convenient way for users to call the java world. Loading modules is not necessary to access java classes!

For Jython we would love to find a way to get numerics in. We are missing numpy scipy support deeply there, so if you have any solutions/worarounds for this problem we would be glad to bring them to EASE.

best regards
Christian

On 23.06.2015 18:02, Janos Binder wrote:

Jay, Matt,

Thanks for the replies. I am looking at the python examples in EASE. They use e.g. loadModule("WorkbenchModule"). Does this mean, that integrating EASE in our Ecliple RCP-based software I could reach the our OSGi bundles?

Best wishes,

Janos




_______________________________________________
science-iwg mailing list
science-iwg@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/science-iwg



-- 
~~~~~~~~~~~~~~~~~~~~~~~~
Dr. Janos Binder » Software developer » ph +49 (0) 40 428 38 - 3140 » janos.binder@xxxxxxxxxxxxx » Lablicate UG (haftungsbeschränkt) » Martin-Luther-King-Platz 6, 20146 Hamburg » Germany
 
Lablicate UG (haftungsbeschränkt), Amtsgericht Hamburg, HRB 129018, USt-IdNr.: DE291156854
Geschäftsführer: Dr. Philip Wenig, Dr. Andreas Klingberg
 
The information contained in the email may be private and confidential. If you are not the intended recipient(s) or have otherwise received this email in error, please delete the email and inform the sender as soon as possible. This email may not be disclosed, used or copied by anyone other than the intended recipient(s) Any opinions, statements or comments contained in this email are not necessarily those of Lablicate UG. If you wish clarification of any matter, please request confirmation in writing.
~~~~~~~~~~~~~~~~~~~~~~~~ 



_______________________________________________
science-iwg mailing list
science-iwg@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/science-iwg




_______________________________________________
science-iwg mailing list
science-iwg@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/science-iwg



-- 
~~~~~~~~~~~~~~~~~~~~~~~~
Dr. Janos Binder » Software developer » ph +49 (0) 40 428 38 - 3140 » janos.binder@xxxxxxxxxxxxx » Lablicate UG (haftungsbeschränkt) » Martin-Luther-King-Platz 6, 20146 Hamburg » Germany
 
Lablicate UG (haftungsbeschränkt), Amtsgericht Hamburg, HRB 129018, USt-IdNr.: DE291156854
Geschäftsführer: Dr. Philip Wenig, Dr. Andreas Klingberg
 
The information contained in the email may be private and confidential. If you are not the intended recipient(s) or have otherwise received this email in error, please delete the email and inform the sender as soon as possible. This email may not be disclosed, used or copied by anyone other than the intended recipient(s) Any opinions, statements or comments contained in this email are not necessarily those of Lablicate UG. If you wish clarification of any matter, please request confirmation in writing.
~~~~~~~~~~~~~~~~~~~~~~~~ 


_______________________________________________
science-iwg mailing list
science-iwg@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/science-iwg

 




_______________________________________________
science-iwg mailing list
science-iwg@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/science-iwg



-- 
~~~~~~~~~~~~~~~~~~~~~~~~
Dr. Janos Binder » Software developer » ph +49 (0) 40 428 38 - 3140 » janos.binder@xxxxxxxxxxxxx » Lablicate UG (haftungsbeschränkt) » Martin-Luther-King-Platz 6, 20146 Hamburg » Germany
 
Lablicate UG (haftungsbeschränkt), Amtsgericht Hamburg, HRB 129018, USt-IdNr.: DE291156854
Geschäftsführer: Dr. Philip Wenig, Dr. Andreas Klingberg
 
The information contained in the email may be private and confidential. If you are not the intended recipient(s) or have otherwise received this email in error, please delete the email and inform the sender as soon as possible. This email may not be disclosed, used or copied by anyone other than the intended recipient(s) Any opinions, statements or comments contained in this email are not necessarily those of Lablicate UG. If you wish clarification of any matter, please request confirmation in writing.
~~~~~~~~~~~~~~~~~~~~~~~~ 

 

-- 

This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
 


_______________________________________________
science-iwg mailing list
science-iwg@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/science-iwg



--
Jay Jay Billings
Oak Ridge National Laboratory
Twitter Handle: @jayjaybillings

Back to the top