Thursday, November 13, 2008

Quantum Of Solace (2008)

New Bond movie is just around the corner. My friend and I managed to get two tickets just in time for the very first show, which will be shown in 3 hours from now. It will be Nov 14th 12.01 AM. We were so lucky that we managed to buy these two tickets for student discount and we were so luck that to get these two tickets to this show. Anyways, it's gonna be interesting.....and no spoilers; I promise. ;-)

FUSE

FUSE allows to develop fully functional filesystem in a userspace program. It provides,

1. Simple library API
2. Simple installation (no need to patch or recompile the kernel)
3. Secure implementation
4. Userspace - kernel interface is very efficient
5. Usable by non privileged users
6. Runs on Linux kernels 2.4.X and 2.6.X
7. Has proven very stable over time
[above items are extracted from http://fuse.sourceforge.net/]

Recently (after spending almost 2 weeks) I completed an assignment for Operating System class which needed an implementation of filesystem that follows FAT concepts. Inevitably I stick to FAT12/16 paradigm because it was easy to (kinda :-)) implement and simulate it. I didn't implement every little fine grained part of it, but for me it was quit a exhilarating assignment and I am happy with it. This assignment had forced me to teach a lot of C stuff. I believe, now I have a relatively good understanding of how to tame this beast.

So, why am I interested in FUSE anymore. Don't know whether this is feasible, but just hear me out. I am thinking of a concept of "mounting" a Web service. It's like you mount a disk and do all sort of operations and we kind a write a FILESYSTEM that would follow the same semantics of Web services, but in the context of file system paradigm. Ex: one could create a file say "foo.txt", but now this will be a Web service which will be exposed by this FILESYSTEM. Another thing I could think of is a directory, which is a grouping of web services. These are just wild thoughts. Since I'm now a die heart fan of C, I would like to give a "hello world" try to this idea in December using Axis2/C.

Hence, when you mount a disk which will adheres to this FILESYSTEM it will mount Web services. And of course you could umount the FILESYSTE anytime you want. Let me see whether I could come up with something useful and feasible and post the results. Anyway...

What you guys think ? Am I going crazy of what :-)

Wednesday, September 24, 2008

Playing the main role

It has been a while since I have participated in a drama. If I remembered correctly, it was in University, I did my last act (on a stage of course :-)). I go to this local church in Miami, St Augustine Church, for the remembrance of the Eucharist. Today there was a small drama on Jesus life from Luck 15:4-7 for youth. Yesterday, my beloved members of the young adults group asked me whether I could act the role of Jesus Christ. The main reason they wanted me to act was, I have long hair :-). Ironic !. Well I accepted the invitation and had to prepare myself with the setting and with the script less than 24 hrs. So today I dressed up as Jesus Christ and did my part. It was the main role btw. Everything has gone as planed and it was just awesome!!!!.

Saturday, September 20, 2008

Senator Barack Obama in University of Miami

Yesterday, Friday (09/19/08) Senator Obama gave a speech in University of Miami. Friday is a good day, because I have only one class!. I had this rear privilege of getting a ticket to attend this event. These tickets were quite hard to come by.So I knew a dude who new another dude, who had an extra ticket so that I could borrow. I did actually saw "the man" himself and his speech was quite exhilarating and encouraging to his supports. His speech quite touched my chain of thoughts very very deeply. Hey, don't ask my point of view in political parties, I just like the idea of presidency :-). Good luck to you Senator Obama, I know you will just do fine.

System calls to Linux kernel

System call provides an interface to user-space processes to interact with kernel. This interface gives applications to access hardware and other operating system resources. This article gives you a good introduction to implement system calls in i 386 architecture.

It seems that _syscallX macros have been removed from "unistd.h". Hence, we have to use syscall available from libc.

Wednesday, September 10, 2008

Compiling the newest Linux kernel

This semester I'm taking an advance operating system course and as part of my first assignment I have to hack the newest Linux kernel to provide a new system call that based on Intel architecture (32 bits). I have never hacked a Linux kernel before and this assignment has opened a quite unique experience for me.

How do you compile Linux kernel 2.6.26.6

0. Before starting check whether your /boot file system is ext3. If not you might end up with a lot of custom configurations, which I haven't mentioned here.

1. Get latest Linux kernel code.
Visit http://kernel.org/
wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.5.tar.bz2


2. Extract tar (.tar.bz2)
tar xvjz linux-2.6.26.5.tar.bz2 -C /usr/src/linux-2.6.26.5

3. Configure kernel

Before doing anything else, you need to have development tools on your system. If you are using a Debian distribution you need lib6c-dev and libncursesw5-dev

Change the directory to /usr/src/linux-2.6.26.5

You have three options to get started
* make menuconfig - Text based color menus, radiolists & dialogs. This option also useful on remote server if you wanna compile kernel remotely.
* make xconfig - X windows (Qt) based configuration tool, works best under KDE desktop
* make gconfig - X windows (Gtk) based configuration tool, works best under Gnome Dekstop.

I like,
make menuconfig

4. Compile kernel

Start compiling to create a compressed kernel image
make

Start compiling to kernel modules
make modules

Install kernel modules
make modules_install

5. Install kernel

So far we have compile module and installed kernel. Let's install kernel,
make install

After that change directory to /boot, you will be able to observer,
System.map-2.6.26.5
config-2.6.26.5
vmlinuz-2.6.26.5

6. Create initrd image
cd /boot

mkinitramfs -o initrd.img-2.6.26.5 2.6.26.5

7. Modify Grub configuration file - /boot/grub/menu.lst
cd /boot/grub

update-grub

Update grub is a cool way to edit the file automatically. One could use LILO instead of GRUB. Though the update utility do the job for us, it wont set the initrd. Hence,

vi /boot/grub/menu.lst

## ## End Default Options ##

title Ubuntu, kernel 2.6.26.6 Default
root (hd0,0)
kernel /vmlinuz root=UUID=c45bb5a8-11b8-4d03-aec4-4c4f070edae6 ro quiet splash
quite

...

and change it to

## ## End Default Options ##

title Ubuntu, kernel 2.6.26.6 Default
root (hd0,0)
kernel /vmlinuz root=UUID=c45bb5a8-11b8-4d03-aec4-4c4f070edae6 ro
initrd /initrd.img-2.6.26.5
savedefault
boot

...

Please note that "root" will change according to your configuration

8. Reboot computer and boot into your new kernel

reboot

Next time I'll tell you how to add a system call with a little bit of theory. Have fun!

Saturday, September 6, 2008

Zen poem

To follow the path:
look to the master,
follow the master,
walk with the master,
see through the master,
become the master.

Saturday, August 30, 2008

Season of Tropical Storms and Hurricanes

It was just two/three weeks after T.S Fay and it has been reported that there has been new developments of two new storms, Hurricane Gastav and T.S Hanna. Gastov will pass Miami this weekend, while causing a lot of rain. I wanted to go to Miami Keys this Labour holiday, but due to high winds of Gastov (apx. 50 MPH), I might have to rethink of this visit. I wish I could go there and enjoy before I'm gonna stuck with course works!. Most of the people worry about T.S Hanna. She's going to do a major chaos. Let's hope for best and prepare for worst!.

Saturday, August 23, 2008

Was I in petite Olympic ?

Last week I had the graduate student orientation program and a lot of events in University of Miami. It was quite an unique experience. In all of these activities I had the chance of meeting a lot of students from over 50 countries. It was a vast diverse community which consist of student's who are pursing studies to become film directors, actors, micro biologists, lawyers, singers, composers, doctors, business administrators, physicians, engineers, scientists, and many more. When we were travelling to University's president house, one of my newly formed friend from Cuba got a call and she said "I met a lot of interesting people from Sri Lanka, China, Russia,.." and the first response she got was, "Are you in Olympics ?". At that time it hit me that this is a form of Olympic, where students from all over the world try to excel themselves to become the pioneers in their respective areas. There are so many things to be explored and I am just started to do so.

Tuesday, August 19, 2008

Kile(an integrated LaTeX environment)

Kile is a user-friendly LaTeX source editor and TeX shell for KDE. Well I use Ubuntu with GNOME and it works fine. Kile needs three/four third party libraries and if you are using Ubuntu, Synaptic Package Manager will solve the problem. Those who are writing papers and those who are into academia, this is a great tool.

Monday, August 18, 2008

Exposing OSGi service as a Web service using Apache Axis2

As part of Axis2/OSGi integration process, we have implemented the basic facility to expose an OSGi service as a Web service. Still some of the advanced functionalities related to this function is in development stage and we will update the progress as we go alone.

In order to facilitate this, register OSGi service with Directory object with name/value pair "org.apache.axis2.osgi.ws/name of WS". This will create an AxisService with default Axis2 properties. This includes message receivers to be RPC*, default schema/targetNamespace generation etc.

You can test this out from here. Follow "axis2_osgi_integration.pdf" to set up the environment.

The example has registered a simple Calculator POJO as an OSGi service and exposed it as a WS. The name/value pair for this instance is "org.apache.axis2.osgi.ws/myCal". Then one will be able to observe

wsdl -> http://localhost:8080/services/myCal?wsdl
wsdl2 -> http://localhost:8080/services/myCal?wsdl2
A request -> http://localhost:8080/services/myCal/add?x=10&y=10

Winners & Losers

01. The Winner is always part of the answer;
The Loser is always part of the problem.

02. Winners always thrive in chaos;
Losers always look for excuses.

03. The Winner says, "Let me do it for you";
The Loser says, "That's not my job.";

04. The Winner sees an answer for every problem;
The Loser sees a problem for every answer.

05. The Winner says, "It may be difficult but it is possible";
The Loser says, "It may be possible but it is too
difficult."

06. When a Winner makes a mistake, he says "I was wrong";
When a Loser makes a mistake, he says "It wasn't my fault."

07. A Winner makes commitments;
A Loser makes promises.;

08. Winners have dreams;
Losers have schemes.

09. Winners suggest and take ownership;
Losers complain and pass the buck.

10. Winners say, "I must do something";
Losers say, "Something must be done."

11. Winners are a part of the team;
Losers are apart from the team.

12. Winners see the gain;
Losers see pain.

13. Winners see possibilities;
Losers see problems.

14. Winners believe in win/win;
Losers believe for them to win someone has to lose.

15. Winners are far sighted and see the potential;
Losers are short sighted and see the past.;

16. Winners learn from mistakes;
Losers keep repeating the same mistakes.

17. Winners choose what they say;
Losers say what they choose.

18. Winners say "WE did it";
Losers say "I did it".

19. Winners use hard arguments, but soft words;
Losers use soft arguments, but hard words.;

20. Winners always think "There is something to learn from
others";
Losers always think "I know all and no one should try to
teach me".

21. Winners stand firm on values and objectives but compromise on
petty things;
Losers stand firm on petty things but compromise on values
and objectives.

22. Winners follow the philosophy of empathy "Don't do to others
what you don't want them to do to you";
Losers follow the philosophy "Do it to others before they
do it to you."

23. Winners make it happen;
Losers let it happen.

24. Winners always look out for challenges;
Losers always challenge others.

25. Winners share knowledge and build teams.
Losers hang on to knowledge and glorify themselves.

Sunday, August 17, 2008

Welcome to Miami !

It has been almost three weeks since I have arrived to Miami, US to pursue my graduate studies in computer science in Department of Computer Science at University of Miami. If I may honest with you, these three weeks have been the most toughest and sort of expensive weeks of my entire life so far and it seems that the next week is also going to be more tough with the tropical storm Fay.

So when I landed in Miami three weeks ago, I had succumbed with a kidney stone, one of the most painful illnesses one could ever have. Since I was being a kidney stone patient for almost 2/3 years, I kinda new what hit me this time. No one to blamed but me because I don't drink enough WATER. So I started drinking plenty of water but the pain continued to persist throughout the week and next week. Normally from my experience, this excruciating pain should go away after 9/10 days but this time it didn't and I had no pain medicine with me. So finally I went to my universities health center to check this out and they immediately transferred me to University of Miami Hospital ER to CT my kindness and appendix. Thank god that I was negative for appendix but the CT showed that I had a swamp of particles in the kidney which was ready to pass down the narrow tube (urethra) on its way to my bladder, which was going to cause more pain. So I had given Vicodin, one of the most powerful pain medicine you could ever find on this plant. Pills were great, they did what they supposed to do. I believe my student health insurance covered the costs involved but I have to wait and see the report. It seems that the pain is kinda gone now but not completely yet that's encouraging. So guys/girls, if you are reading this, don't take it for granted, just drink enough WATER.

Officially I stared the graduate program on 15th August 2008. I'm not quite decided what should I do for my grad studies yet. I wanted to do distributed systems but there are plenty of research areas and I hope time will tell the answer. Anyhow I needed a transportation to go the Uni which is almost four miles away from my apartment. Public transportation in this area suck worse and quite expensive. Hence, I bought my first vehicle to go to Uni, which cost me $ 70 :). I haven't ridden a cycle for more than 15 years and this is going to be quite an experience and I love it.




To add to the excitement, National Oceanic and Atmospheric Administration has predicted that the tropical storm Fay is going to hit Miami big time on Tuesday at around 2.00 pm, specially Miami-Dade county where I live in. As this is not a hurricane, residence here believe that this storm is not going to do much damage and I hope it will stay that way. So, if I don't blog at the end of this week, there is a probability that I might have blown away with the gusty winds :). Anyway I hope that this will not going to be too serious.

Miami is a pretty exciting place and I will try to share my experiences, hopefully stay alive and healthy and write to you guys. To get the spirit flowing, listing to "Miami" by Will Simith ;).

Guys, ***c pain, I did went to South beach and the place really bringin the heat, you gotta see to believe it!.

Tuesday, July 22, 2008

Everything can be a bundle

One of the demanding aspect of server side OSGi is to reuse the existing classic jar files as bundles. The other aspect of the spectrum is to diagnose these bundles. Out of the lot BND (Bundle Tool) tool from Peter Kriens helps you to create and diagnose OSGi R4 bundles.

The key features are,

1. Show the manifest and JAR content of a bundle
2. Wraps a JAR as a bundle
3. Create a bundle from a specification and a classpath
4. Verifying the validity of the manifest entries

This tool can be used as a,

1. Command line tool
2. Eclipse plugin
3. Maven plugin
4. Ant plugin

You will find more information about this tool here.

Apache Felix folks has written a Maven2 plugin based on BND called maven-bundle-plugin to create bundles.

You'll find a really cool article on usage of BND is available here.

Monday, July 14, 2008

Maven 2 GPG Plugin

Maven 2 GPG Plugin, allows to sign attached artifacts with GunPG. One of the tedious processes involved in releasing a project is to sign its artifacts. Some of the releases might contain 10-15 artifacts. Ex: WSO2 WSAS etc. So in order to get the release process smoother, one could just need to add the following plugin into the parent pom.xml,

<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-gpg-plugin</artifactid>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>


The latest version of this plugin is 1.0-alpha-4 as at 2007-09-28.

Then using "mvn clean deploy" will sign the artifacts in addition to md5 & sha1. It's advisable if the prior plugin be added in a "profile" section. Then only at the release time, "asc" files are generated. Trust me, when you have A LOT OF artifacts to be signed, above plugin is a life saver.

Wednesday, July 9, 2008

Partial solution to TCCL problem in OSGi

One of perennial problem that OSGi uses asked from mailing lists is to resolved the problem of TCCL. As I have mentioned in the blog post "OSGi and TCCL dilemma", there is no proper definition is available in OSGi R4.1 specification for TCCL.

On the other hand Eclipse Equinox OSGi implementation has taken steps to prevent this problem with the invent of ContextFinder (CF). When the framework starts, Equinox sets the framework TCCL to CF. Hence, all the bundles spawn from this framework will set its TCCL to CF. CF finds classes and resources from the classloader associate with the current method of the execution stack. (java.lang.SecurityManager#getClassContext). This is not the complete answer to the problem, but it will solve most of the common scenarios. Thus, it's very easy to use this concept and apply to other OSGi implementations as well, such as Apache Felix.

WSO2 is align with producing products that are OSGi enabled. The underline infrastructure of these products uses a product called "Carbon", which is an OSGi wrapper powered with either Eclipse Equinox or Apache Felix and provide a
Web Services infrastructure powered by Apache Axis2. Carbon uses the "servletbridge" design principle to bridge OSGi and Servlet container. Hence, Carbon is one such infrastructure that harness the benefits of server-side OSGi. Though Carbon defaults to Equinox and Felix OSGi implementations, it has give a very powerful API to integrate other OSGi implementations as well.

You will be able to find the source code from "svn co https://svn.wso2.org/repos/wso2/trunk/carbon".

Nice thing about Carbon is that it can switch between Equinox or Felix based on users preference. It can switched to any other OSGi implementations that is registered with too. Carbon uses the prior mentioned ContextFinder principle to solve the TCCL problem and I think it's a very fair assumption until OSGi specification mandate on the TCCL.

One of the very first product that is scheduled to be released on this month on top of the prior mentioned infrastructure is "Data Services Solution", which is a complete solution for data services via web services.

Saturday, July 5, 2008

Light weight, OSGi based, Axis2 powered, web services application server in 5 minuets

Few days back I blogged about "Embed Eclipse Equinox in a Servlet Container". Let's extend this idea a little bit more to write your own light weight, OSGi based, Axis2 powered, web services application server.

There is an ongoing effort to extend Axis2 Web Services engine to deploy as a bundle in an OSGi environment. The purpose of this extension is to allow deployed bundles to provide services and modules which will be recognized by OSGi based Axis2 engine and deploy them.

Let's create the light weight, OSGi based, Axis2 powered, web services application server using Eclipse Equinox OSGi implementation and Apache Tomcat.

1. Download Apache Tomcat
2. Download bridge.war from Eclipse Equinox.
3. Download commons logging (org.eclipse.equinox.common_3.3.0.v20070426.jar) bundle from Eclipse Equinox.
4. Copy the downloaded bridge.war to Apache Tomcat webapps directory
5. svn co https://svn.apache.org/repos/asf/webservices/axis2/scratch/java/saminda/osgi_test osgi_test
6. Go to osgi_test directory and type "mvn clean install -U". You need Maven2 build system.
7. Go to osgi_test/distribution/target directory and unzipped distribution-1.0.0.zip.
8. Copy all the bundles from distribution-1.0.0/plugin folder to /webapps/bridge/WEB-INF/eclipse/plugins and copy commons logging bundle too.
9. Restart Tomcat
10. On the osgi> command prompt start all bundles except fragment host bundles.

11. http://localhost:8080/bridge/services/Version?wsdl
http://localhost:8080/bridge/services/Version?wsdl2
http://localhost:8080/bridge/services/Version/getVersion

You have your personal light weight, OSGi based, Axis2 powered web services application server.

Friday, June 27, 2008

OSGi and TCCL dilemma

OSGi in server side is still in its infant stage, though the technology is prominent in embedded and mobile devices space. Most of the time use will try to wrap the non-OSGi libraries to bundles including proper import, export etc OSGi headers. There are so many tools available for this conversion in web, and one of the most popular tool is maven-bundle-plugin that associate with Maven2.

In order to OSGi import/export paradigm to work, bundle must use the bundle classloader. But many of the wrapped non-OSGi bundles might have used system classloader or thread context class loader (TCCL). Problem arise when TCCL is used and which is not fully explained in current OSGi specification.

Luckily, Eclipse Equinox OSGi implementation has addressed this problem by setting a "ContextFinder" in systems bundles TCCL, which is capable of traversing the bundle classloader cache and obtaining the relevant resources and classes. But other OSGi implementations such as Knopflerfish uses, what they called "byte code injection". Apache Felix has not covered this dilemma yet.

So IMO, in order to OSGi to be dominant in server side, TCCL problem should be addressed and it should be addressed quite soon.

Thursday, June 26, 2008

Embed Eclipse Equinox in a Servlet Container

OSGi is dominant mobile phones and handheld devices. Now the interest has significantly moved from these embedded to full blown servers. Hence, people are looking at eliminating barriers using OSGi on servers.

Eclipse Equinox is pursing work related to "Server-Side Equinox". The target is to embed Equinox in a Servlet Container, using what is called the principle of "servletbridge" to run OSGi based application in a servlet container.

To test this out read here,

In summary.

1. Install your favourite servlet container (Tomcat, Jetty etc)
2. Download and deploy per-build web application archive (bridge.war)
3. Start the web container (http://localhost:8080/bridge)
4. There are bunch of things you can do, which will be available here.


"servletbridge" is a cool concept, which can be applied to any OSGi implementation, such as Apache Felix, Knopflerfish etc
Hence, WSO2 Carbon, the next generation web services infrastructure powered by enterprise Axis2 uses "servletbridge" concept to provide an OSGi environment to uses to embed bundles that mimic the behavior of Axis2 service & module archives.

Wednesday, June 25, 2008

New look to Apache Axis2 with OSGi

Apache Axis2 has span its spectrum with the incorporation of OSGi integration. This will be mainstream in next Axis2 main release. In summary, there exist an OSGi bundle, org.apache.axis2.osgi_.jar, which can be deployed in any OSGi environment. This bundle has few wire dependencies to other bundles, which can either be available in the OSGi implementation or one can simply create them using most popular bundling tools.

In order to better understand how this will work in Eclipse Equinox OSGi implementation, I have create a scratch project, which will be available here. Just do an svn checkout on prior url. Do follow the axis2_osgi_integration.pdf for more comprehensive detail of this effort.