Archive for the 'Open Source' Category

catch that ESB! - ServiceMix the right concoction for all your ESB needs.

Yes i’ve been lazy! as always!. And this latest post is in response to the question "time to update ur blog?" from someone i know. You know who you are :D , and i know you are the only one reading it :p
So here goes, educate yourself :D . Go back to your Maths and Physics after ur done, ok?

What is ESB?

ESB (Enterprise Service Bus) is not just a fancy name used in the Java world, Its become an iconic term when people talk about "Integration". Imaging 10 different applications wanting to communicate with each other by some means, and lets say each application has some form of communication link between them, the end result? a mesh of communication links running across each of the individual applications resulting in CHAOS! The way ESB solves this problem is providing a single interface to for application to communicate to each other, synonymous to a line and different components connected to the same line at different places. Something like a BUS? :D

Now for some technical jargon….. 

The purpose of an ESB is to facilitate application and process integration by providing distributed processing, intelligent routing, security, and dynamic data transformation. In an ESB these services are infrastructure services so each application does not have to implement these requirements independently and in a proprietary manner. The ESB addresses the disadvantages of existing solutions by creating a standard infrastructure for integration. Point-to-point solutions, where each of n components requires n-1 interfaces for full communication, are replaced by a bus solution where each component requires a single interface to the bus for global communication. An ESB provides distributed messaging, routing, business process orchestration, reliability and security. It also provides pluggable services and, because of the standard bus, these pluggable services can be provided by third parties and still interoperate reliably with the bus.

ServiceMix - Whats it all about?

ServiceMix was an Apache incubator project which finally graduated and is now an Apache top level project. Apache ServiceMix is an Open Source ESB (Enterprise Service Bus) that combines the functionality of a Service Oriented Architecture (SOA) and an Event Driven Architecture (EDA)  to create an agile, enterprise ESB. Its an open source distributed ESB built from the ground up on the  Java Business Integration (JBI) specification JSR 208 and released under the Apache license. The goal of JBI is to allow components and services to be integrated in a vendor independent way, allowing users and vendors to plug and play. 

Why ServiceMix?

There are many vendors that provide ESB solutions (like Oracle ESB and IBM Websphere ESB), but there is no universal agreement as to the best design or architecture for an ESB. ServiceMix has a design that is based on the JBI (JSR 208) specification in order to create a standards based ESB and the ServiceMix ESB combines the functionality of both a Service Oriented Architecture (S0A) and Event Driven Architecture (EDA) to achieve an agile, enterprise ESB.As previously stated, ServiceMix is an open source ESB that is based on the Java Business Integration (JBI) standard. These two factors, open source and open standards-based, allow for low entry cost, maximum flexibility, reuse, and investment protection.

ServiceMix uses yet another Apache project ActiveMQ to provide remoting, clustering, reliability and distributed failover. Iam not going to go into any details on using ServiceMix, there are already plenty of resource for it on the project’s homepage. So goahead and give it a try.

OpenWRT on ASUS WL500gP - Router on Steroids!

I was tired of my old Netgear wireless router, since i had to reset it every…hmm lemme think…1hr!! and i used to go crazy walking to it on the other room and reset it. But finally its all over, i got myself a nice and shiny new ASUS WL500g Premium. Trying to find it at SimLim Square was kinda pain in the arse, considering only one shop had it. The primary reason i wanted to get this particular router was, it had 2 USB ports (called Storage Link in Linksys terminology) making it somewhat of a NAS (Network Attached Storage). The firmware provided was all good, but i needed something better and what better than OpenWRT (http://www.openwrt.org), the open-source linux os for the router initially made for the Linksys WRT series routers but was later ported to routers made by ASUS, Buffalo etc. To make it more clear, this is what the creator of OpenWRT have to say about it.

"OpenWrt is described as a Linux distribution for embedded devices.

Instead of trying to create a single, static firmware, OpenWrt provides a fully writable filesystem with package management. This frees you from the application selection and configuration provided by the vendor and allows you to customize the device through the use of packages to suit any application. For developer, OpenWrt is the framework to build an application without having to build a complete firmware around it; for users this means the ability for full customization, to use the device in ways never envisioned."

What makes OpenWRT so great?

Well it depends on how much you love the word "Freedom". It lets you install everything from an OpenVPN Server,Web Server, FTP Server, Samba Server or a simple NAS server. and the best part its worth around 179 SGD and you get a low end server which always stays on. You could even use it as a bittorrent or an emule client to download stuff of P2P without even having to switch on your PC. It comes with all the goodies provided by the Linux 2.4 kernel.

Another project that complements OpenWRT is X-Wrt (http://www.x-wrt.org ) which is a web interface to configure OpenWRT based systems.

To get started I used the image http://downloads.x-wrt.org/xwrt/firmware_images/whiterussian/ 0.9/latest-daily-build/openwrt-brcm-2.4-squashfs.trx
which comes pre-built with x-wrt packages. And i used the TFTP method mentioned in OpenWRT Wiki to update the firmware

1. Connect your PC to the routers with one of the LAN ports on the routers.

2. Set your PCs IP to a static IP (ex: 192.168.1.10)

3. Unplug the power cord on the router

4. Push the RESTORE (not the red EZsetup!!!!) button on the router using a pen or such, and keep the button pushed down.

5. Plug the power on the router while keeping the (black) RESTORE button pushed for few seconds.

If you see a slowly blinking power light, you’re in diag mode. Now the router should accept an image via tftp.

6. On the PC open up a cmd window.

7. Type "tftp -i 192.168.1.1 PUT openwrt-brcm-2.4-squashfs.trx" and press enter in the command window.

8. After the tftp upload is complete, wait at least 6 minutes. Asus WL-500gP doesn’t seem to reboot automatically after the upgrade is complete. You need to plug off the power, and plug it back on to make the router alive again.

after the router is back up. goto http://192.168.1.1 to get access to the x-wrt management interface.

and don’t forget to use the mighty SSH to login to the router and let your imagination run wild!

 

Django for Python

Django is a web-framework similar to Rails for Ruby, i’ve not worked on rails much thought but my friend vivek seems to be the "GURU" of rails =), but when he mentioned Django i just wanted to give it a try. From what i can say Django has been a no pain and all gain framework. Easy to setup and code. In the world of Web 2.0, isn’t that want we want. I had an old friend who ones said "Good Programmers are Lazy Programmers".I still remember your words, Hats-off to you Jacob!. That said, Django is pretty easy to get things started with, I won’t start with providing a tutorials for it, the site already has a great set of tutorials. You can also check out www.djangobook.com  which is a book in making for Django. One other interesting thing to check out is a video on Django at http://video.google.com/videoplay?docid=-70449010942275062&q=Django
 

If you have trouble figuring out Django you can also drop in at the IRC channel #django at irc.freenode.net 

Well thats it from me for a while, I’ve been feeling lazy lately :b 

JBoss Seam (EJB3+JSF+WORKFLOW)

Ok you wanted a sneak peak into EJB3? find a way to integrate JSF with EJB3?

Well here comes JBoss Seam it has everything u need to get started with EJB3 and also to find out how cool JSF can be when integrated with EJB3. I came across some nice features about Seam when i visited the Linux Asia 2006 conference held in New Delhi, India. I met Subramaniam Satyamoorthy (Director of Operations and Services (Asia Pacific)) , quite a funny guy :) . He showed us some of the workings of Seam, that got me hooked into it. And i am still experimenting with a lot of interesting stuff in it, not to mention JBoss jBPM which i had no idea about untill i knew about JBoss Seam. EJB3 uses Hibernate for persistance so you got best of both worlds :p. Maybe after a while i might  just post some code for download regrading Seam. Eventhough Seam is still in beta its still a handfull.  So check it out at http://www.jboss.com/products/seam 

and oh btw, you need to either select "ejb3 cluster" or "ejb3" profile while installing Jboss Application Server .

Using Apache Axis to create Web Services

Apache axis, is one of the best way to deploy Web Services without needing to buy those expensive Application Servers out there. Axis is deployed as a simple web application, with web services deployed as either simple .jws files or more complex compiled classes. Web Services can either be coded as simple java classes and later renamed to .jws rather than the usual .java, when invoked via axis using a url like http://localhost:8080/axis/services/MyService.jws, Axis compiles the code and exposes it as a SOAP Web Service. The other way of deploying a web service is by compiling the code and writing something called as the "Web Service Deployment Descriptor (WSDD)" WSDD files describe a Web Service,ex: the actual class and the methods that have been exposed in the Web Service, the scope of the Web Service etc. A sample axis Web Application which contains both a service (Calc) and a Client for the Web Service (Calc.jsp) can be found here.

Using Jasper Reports with Hibernate and Teamwork

Jasper Reports is the perfect open source reporting tool for the masses, heres a code snippet to generate the "Operator by Worklog" sample report using Jasper Report in Teamwork 3

 

CompanyCalendar cc = new CompanyCalendar();
 
 cc.set(CompanyCalendar.YEAR, cc.get(CompanyCalendar.YEAR) - 1);
 cc.set(CompanyCalendar.MONTH, CompanyCalendar.JANUARY);
 cc.set(CompanyCalendar.DAY_OF_MONTH, 1);
 
 OqlQuery oql = new OqlQuery(“select new map(r.id as id, r.personName as personName , r.personSurname  as personSurname, sum(w.duration) as worklog_total) from com.twproject.resource.Resource r, com.twproject.worklog.Worklog w where w.assig = r.myself and w.inserted > :paramInserted and r.myself is not null group by r.id”);
 
 oql.setParameter(“paramInserted”,cc.getTime());
 List persLog = oql.list();
 
 Map parameters = new HashMap();
 
 InputStream reportStream = new FileInputStream(
 request.getRealPath(“applications/teamwork/reports/jrxml/new_worklog.jrxml”));
 JasperDesign jasperDesign = JasperManager.loadXmlDesign(reportStream);
 JasperReport jasperReport = JasperManager.compileReport(jasperDesign);
 
 JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(persLog);
 JasperPrint jasperPrint = JasperManager.fillReport(jasperReport, parameters, ds);
 
 //—- Export PDF —-
 JasperManager.printReportToPdfFile(jasperPrint, request.getRealPath(“”) + “/applications/teamwork/reports/output/report.pdf”);
 
 //—- Export HTML —-
 JasperExportManager.exportReportToHtmlFile(jasperPrint, request.getRealPath(“”) + “/applications/teamwork/reports/output/report.html”);

 

Sample worklog.jrxml for Teamwork 3