Posts tonen met het label System i. Alle posts tonen
Posts tonen met het label System i. Alle posts tonen

woensdag 19 augustus 2009

Running Equinox OSGi and ECF on the System i - Part 2

In the previous installment of this series I have demonstrated what it takes to run OSGi on the AS/400 (or System i as it is called today.)

Goal
In this part we take the OSGi installation one step further by adding additional bundles to the initial installation. A bundle is OSGi slang for a group of Java classes that together perform certain tasks. They are also called modules or plug-ins (because of their plug and play nature).

Remote Services
As I mentioned earlier, our company is in the process of creating a multiplatform SCM for which we need a Multiplatform Communication Layer. Multiplatform can be mapped to Java and Communication Layer translates to the Eclipse Communication Framework, ECF. Since we have already decided to use the OSGi technology as the runtime container, we were also looking for a OSGi defined solution. As you might know, OSGi only provides specifications. It is up to others, like the people from Eclipse and Apache, to write an implementation. One of the new specifications in the upcoming OSGi release is referred to as RFC 119. It describes how an OSGi service should be addressed remotely.

Remote Services is important to us because we have to sometimes manage several hunderds end-nodes. Beeing able to do so in standard OSGi makes us free from the choice of using one specific remoting solution. The RFC 119 technology enables us to choose from different implementations and we have tried both the Apache and the Eclipse implementation.

Cleanup the OSGi installation
If you have followed the previous article, you will notice that there are a lot of bundles in the plugins directory. For our current purpose we don't need all of them and we also want to be as clean as possible. So we are going to move all the unused bundles to a special directory called "Equinox Bundles" we can get to this directory if we need another bundle later. Create a directory with the name "Equinox Bundles" in the /QOpenSys/Equinox directory and move all the bundles in the "plugins" directory into this directory. Now copy back the three jars from the "Equinox Bundles" directory that start with:
  • org.eclipse.equinox.common
  • org.eclipse.osgi
  • org.eclipse.update.configurator
and are followed by a version number and a build identifier.

Setup the configuration.ini
OSGi is configured using the config.ini file in the installation directories 'configuration' directory. OSGi already created this directory for you after the first launch. If it is not there, please see the first article and run the framework.

Now we are going to create the config.ini file with the following content:

osgi.bundles=org.eclipse.equinox.common@2:start, org.eclipse.update.configurator@3:start
eclipse.ignoreApp=true
osgi.install.area=file:/Qopensys/Equinox/plugins/
osgi.console=667
osgi.noShutdown=true

Line 1 instructs the OSGi framework to first start the common bundle and then the configurator bundle. The configurator bundel will automaticall
y install all plugins that are located in the plugins directory of the install directory. In the next step we will put all of our non-framework bundles in that directory.

Line 4 will listen at the TCP/IP port 667 with a telnet server. You can use putty or any other client to telnet to port 667 of this machine. It will give you the console and enables you to run the OSGi framework in a batch job and still be able to control it. Mind you that many OSGi installations happily run without a console or are controlled through other means (e.g. a controlling bundle).

Running as a Batch job
To run the OSGi framework as a batch job start the following command (adapted to the id of your download)

SBMJOB CMD(JAVA CLASS('/QOpenSys/Equinox/plugins/org.eclipse.osgi_3.5.0.v20090520.jar')) JOB(OSGI)

Now fire up your favourite telnet client and try to access port 667. Keep in mind that you can only connect one session at a time.

Now type the "ss" command to show that the framework is running and indeed all our bundles are active.









The exit command will stop the framework and exit. The disconnect command will terminate the telnet session but will leave the framework running.


Setup ECF
Since we are Eclipse junkies we setup our distribution server with the ECF software from Eclipse. So download the ECF SDK. If this link is broken then just go to the Eclipse site and navigate to the ECF SDK and get the zip. Then drop all the bundles from this zip into the '/QOpenSys/Equinox/plugins/plugins' directory. That is correct, two plugins directories.

The reason for this is the org.eclipse.osgi.configurator bundle. It will install all bundles that are found in the plugins directory for us so we don't have to do that ourselves. Since we have installed OSGi in the /QOpenSys/Equinox/plugins directory, we have two directories with this name.











Now stop the framework and submit the job again. Telnet to port 667 and try the "ss" command. This time you will see a lot more. You can filter the list to show only the active bundles by using "ss -s active"

The Next Time
The next time we will create two plugins. One will consume the remote service that the other will provide.

Thank you for your feedback


vrijdag 31 juli 2009

Running Equinox on the System i - Part 1


For our next version of TD/OMS, which is our System i based Software Change Management System, we are moving to OSGi. Since a large part of the processing involves the management of the local System i file system we also need to setup OSGi on this machine.

Okay so the first thing to do is to determine which OSGi implementation to install. Since we are an Eclipse foundation member the first thing to try is the Eclipse implementation of OSGi called Equinox. Equinox has its own page at http://www.eclipse.org/equinox and there is a quick start guide.

The quick start guide instructs us to download Equinox from the download site and sure enough there is a 25 mb drop. After downloading the contents of the zip we can safely say that there is too much in this file but we will worry about that later.

Installing Equinox on the AS/400
I have arranged network access to the IFS so the first thing to do is determine a location. For this I have picked the QOpenSys file system which I always use for long filename and case sensitive related stuff. In the QOpenSys file system I create an Equinox directory and then I copy the plugins directory from the drop into this directory.

According to the getting started guide I would now be able to run equinox with the following command. java -jar org.eclipse.osgi_3.2.0.jar -console

On the System i and translated to the correct jar in the plugins directory (yes you have to look that up yourself) this looks like this:

JAVA CLASS('/QOpenSys/Equinox/plugins/org.eclipse.osgi_3.5.0.v20090520.jar') PARM('-console')

The 5250 java console pops up and after a while the message "Attaching Java program to /QOpenSys/Equinox/plugins/org.eclipse.osgi_3.5.0.v20090520.jar." appears. This is the indication that the jar file was found and that the System i is now compiling all class files to local digestable classes.

And sure enough, after a short while we see the OSGi console. To check all the installed bundles we enter the command "ss" and there, in all its glory, is the org.eclipse.osgi bundle.

I would call this a completely painless operation.

In the next part I will try to install ECF and some homegrown bundles