How to install Jython standard library into Confluence? - jython

I'm starting to integrate some Jython code into our Confluence wiki and I'd like to install the Jython standard lib -- the Jython plugin from Atlassian apparently is only the base Jython install, so I need to make a Jar with the Jython library and get it up onto the server (our server is hosted, btw). So, where can I put that jar -- or where to I tell the service folks to put it?

You can install Jython on the server and set the JYTHONPATH environment variable to point to the Jython lib directory. We're running Confluence on Tomcat on Solaris and set JYTHONPATH=path_to_jython_install/Lib in setenv.sh. Setenv.sh is called by catalina.sh, which is called by start-confluence.sh.
Here's a link that explains this: https://bobswift.atlassian.net/wiki/display/SCRP/How+to+use+Jython+libraries?focusedCommentId=31916077#comment-31916077

Related

Where to find groovy library on intellij(mac) when installed groovy through sdkman

I installed groovy through sdkman on mac. When i try to create a new groovy project in intellij, it asks for groovy library location. Where can i find the installed groovy?
I ran into similar issue. By using
/Users/<username/.sdkman/candidates/groovy/current
or
/Users/<username/.sdkman/candidates/groovy/<version>
worked for me.
Adding the answer that solved my problem (thanks to ThomasW comment)
When dialog box is opened you can click CMDSHIFT.
and this allows you to pick the hidden folder in the open dialog box.
Then you can use:
/Users/<username>/.sdkman/candidates/groovy/current
Just run $ which groovy after have it installed.
You may not be able to find groovy path with which command.
After installation of sdkman on linux-like systems Mac OSX, Linux, Cygwin, Solaris and FreeBSD, First, run $ source "$HOME/.sdkman/bin/sdkman-init.sh", then you will be able to access the installed development kits.
Namely, if you type 'which groovy' it should show the path, and you can invoke other SDK commands.

Integrate Apache ACE with Equinox

I've read in the documentations of Apache Ace 2 that it works with Equinox OSGi targets as well, but I can't find out how to configure it. I am aware there is already p2 for Equinox but I also want to integrate it with the Ace software.
I've found somewhere that I should edit managementagent bundle, if that's true still don't know how.
The binary release of Apache ACE ships with:
An executable jar that contains Apache Felix and the management agent. It can be found in the server-allinone/store folder and is called ace-launcher.jar
A "development" target in the target/ folder that can be used to for development/testing and pre-installs a shell, logging and the management agent.
Neither gives you Equinox out of the box.
However, if you checkout the ACE sources, there is a project called org.apache.ace.agent.launcher which creates two jar files:
felix.bnd which creates the ace-launcher.jar mentioned above and embeds Apache Felix
base.bnd which relies on the standardized launcher API of OSGi and will bootstrap the first framework it finds on the classpath
So, you can either use the artifact generated by base.bnd and put Equinox on your classpath, or take felix.bnd and modify it so it will run equinox instead.
By the way, we would be happy to accept such work as a patch so we can provide this out of the box.

To use ServiceMix my project has to be an OSGi bundle?

I' starting to use ServiceMix and Camel and I've run through many examples.
It seems that the examples that are OSGi can be deployed in ServiceMix via hot deploy or via console, but I don't know how to deploy a project that is not an OSGI. Can it be done?
For example, I'm looking at the example project from Camel 2.10.0 called camel-example-cxf-proxy. I did some alterations and now I wanted to load it in ServiceMix. If I copy/paste to the deploy directory it is loaded but when I try to run it via osgi:start id it fails.
However if I run it from the IDE as a standalone it runs just fine and I can send and receive requests via SoapUI.
When I'm done with the examples I'll want to create my own project in eclipse and do tests in the IDE and in ServiceMix. I don't really understand the advantage of OSGi yet. SO I'm not too compelled to use OSGi for my project.
My main question is: Can I deploy a non-OSGi non-JBI compliant project in servicemix? Something like the camel-example-cxf-proxy. If yes, how can I do it? If no, how can I OSGi-fy the camel-example-cxf-proxy?
Thank you :)
Apache ServiceMix which uses Apache Karaf as its kernel, support pluggable deployment units. Though OSGi is the main unit.
You can deploy JBI artifacts (eg JBI was used as deployment units for Apache ServiceMix 3.x). So we offer that as a migration path to run JBI in SMX 4.x.
A plain WAR file can be deployed as well. You can for example just drop a .war file in the deploy directory. If you deploy from the shell, you need to prefix the deployer with war so it knows to use the war deployer.
There is some documentation about the various pluggable deployers here
http://fusesource.com/docs/esbent/7.0/esb_deploy_osgi/UrlHandlers.html
For example to install an Apache Wicket WAR example using Maven you can do from the shell:
osgi:install war:mvn:org.apache.wicket/wicket-examples/1.4.7/war?Web-ContextPath=wicket
The Apache documentation about deployer is mainly documented at Apache Karaf
http://karaf.apache.org/manual/2.2.9/users-guide/deployer.html
Now to deploy OSGi applications can be a bit of pain to assemble. And that is why FuseSource created FAB to make it much easier. I blogged about this a bit, which references to videos and more material: http://www.davsclaus.com/2012/08/osgi-deployment-made-easy-with-fab.html
With FAB you can just deploy regular Maven projects out of the box without any OSGi pain.
If your project is a maven project, you can try :
mvn install
Then start your servicemix, and in servicemix command line :
install mvn:groupId/artifactId/version
This will prompt a bundle ID. Then, juste start the bundle :
start <bundle_id>
You can check the state of your bundle with command "list"
The project has to be a bundle to be installed in servicemix / karaf. So the steps to make a camel project work in OSGi are the following.
Use the maven bundle plugin in the pom and configure it to import / export the necessary packages if necessary.
Make sure your camel context is defined in a way that OSGi can start. This is either in the activator of the bundle or in a spring config in the right location or with a blueprint config in the right location.
See two of my karaf tutorials for the details:
CXF: http://www.liquid-reality.de/x/EoBk
Camel: http://www.liquid-reality.de/x/G4Bk

how to run Activemq program in java

i have install activemq 5.5.1 in my c:\programFiles\activemq\...
and from the command prompt i have installed it and set enviroment variable.
and i have also run it. and it is also running on local host.
i have write a java program in my eclipse editor.
and i have added Activiemq library in project form that path.
programm:
http://developers-blog.org/blog/default/2008/10/28/A-simple-ActiveMQ-example
but i am also confuse What the use of that c:\programFiles\activemq... installation how i use it.
I want to only to create my first Activiemq program through java.
plz help
The installation of ActiveMQ gives you everything you need to run the broker standalone by just running the activemq.bat under the bin directory. It's just a nice way of packaging the application as opposed to just giving you some jar files.
If you want to run the broker inside a Java program you just need to include the jars for the broker and you won't need to use the installation directory again.

Query on Jython with Web Start

I am looking at creating a jython application and deploying it as a java web start.
My query is related to a concern that for web start deployment, we have to distribute the jython standard jar package also along with our application jar.
From all the web resources , this is what I hear. And the concern is that this will make the download time of the application significantly large as jython jar file is nearly 9 Mb.
If anyone of you has deployed a jython app through web start, can you clarify if we need to bundle the jython jar package along with our application files or only the application files in a standalone jar file ( this solves my problem)
Regards
Shyam
OK , as I figured out...I have to package the jython jar also along with the application jar to make it work.
The reason is that, the application jar consists of python code which the client JVM has no way to understand unless it uses the jython jar package.
As I hear jython has no support currently to convert python code to java classes. Unless this is possible , the jython jar package has to be included.