Sunday, September 29, 2013

Fuse ESB : Email Attachement Issue

I faced a very annoying issue when I tried to send an email with attachments using Fuse ESB. I created a simple project in Fuse IDE which sent a mail with attachments and it was working fine as a stand alone application but when the bundle was deployed in Fuse it was not sending the mail when there are attachments. There was no exception in logs, but then it was found that there is actually an exception and it was getting set to the exchange.

javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;

Many have come across this issue when dealing with javamail in other containers and for most of them it was because javamail jar was not found by the container.

Some solutions that have worked were found in this.
http://blog.hpxn.net/2009/12/02/tomcat-java-6-and-javamail-cant-load-dch/

But unfortunately it didn't work for me. 

javax.activation package exposed by the jre was not working. Removing it and adding an OSGI friendly version of this package created by Servicemix resolved the issue.

Solution
  1. Comment out the javax.activation export from jre.properties
  2. Install following bundle instead. install mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/2.2.0

Thursday, August 22, 2013

Entity-Attribute-Value

In the DB schema of a previous project (which was a 10 year old legacy system), there was a table with a set of attributes listed as rows instead of columns as shown below.


When asked why, it was told that there was a client request to add additional parameters to the product entity, but adding a new column was not feasible since the table contained millions of records. Instead they opted for this solution as a workaround. Two new tables were added and the "Product_Config_Param_Def" contained the new parameter definitions and "Product_Config_Param_Value" contained the corresponding values. This was flexible and allowed adding many more parameters without having to add columns. And the plus point is when there are products that don't have the entire set of parameters, we don't need to populate DB with nulls.

This is what is known as "Entity-Attribute-Value" Modeling (EAV) and it's a great way for us to get closer to the benefits offered by No SQL DBS with our relational DBs. No SQL DB of course offer us unlimited flexibility in adding dynamic attributes and is the way to go if our entities have large amount of varying attributes (In other words, when entities have different sets of attributes) and the relationships between entities is rather limited (Think FB accounts).

With EAV, data is modeled as attribute-value pairs.

EAV should be used with caution. Many identify it as an anti-pattern. It can be such a performance hit. If I may copy the example mentioned in http://tonyandrews.blogspot.com/2004/10/otlt-and-eav-two-big-design-mistakes.html

With no EAV:

select ename from emp where job=’CLERK’ and sal < 2000;

With EAV:

select ev1.name
from emp_values ev1, emp_values ev2 emp_values ev3
where ev1.code = ‘NAME’
and ev1.empno = ev2.empno
and ev2.code = ‘JOB’
and ev2.value = ‘CLERK’
and ev1.empno = ev3.empno
and ev3.code = ‘SAL’
and TO_NUMBER(ev3.value) < 2000;

Sunday, August 4, 2013

Camel-CXF: Java-First Service Implementation

Summarized from the documentation.

Web service interface is defined using a Service Endpoint Interface (SEI) and the WSDL is generated from it.

Steps
1. Implement & annotate the SEI.
2. Implement other requisite Java classes.
        - Any data types referenced by the SEI.
        - The implementation of the SEI. 3. Instantiate the Web service endpoint.
4. Generate the WSDL

1. Implement & annotate the SEI.

SEI is used as the;
• Base type of the Web service implementation (server side)—you define the Web service by implementing the SEI.
• Proxy type (client side)—on the client side, you use the SEI to invoke operations on the client proxy object.
• Basis for generating the WSDL contract—in the Java-first approach, you generate the WSDL contract by converting the SEI to WSDL.

In order to use the standard JAX-WS frontend, the SEI must be annotated with the @WebService annotation. Annotations are also used to customize the mapping from Java to WSDL.

import javax.jws.WebParam;
import javax.jws.WebService;

@WebService(targetNamespace = "http://demo.fusesource.com/wsdl/CustomerService/", name = "CustomerService", serviceName = "CustomerService", portName = "SOAPOverHTTP")
public interface CustomerService {
 public com.fusesource.demo.customer.Customer lookupCustomer(
   @WebParam(name = "customerId", targetNamespace = "") java.lang.String customerId);

 public void updateCustomer(
   @WebParam(name = "cust", targetNamespace = "") com.fusesource.demo.customer.Customer cust);

 public void getCustomerStatus(
   @WebParam(name = "customerId", targetNamespace = "") java.lang.String customerId,
   @WebParam(mode = WebParam.Mode.OUT, name = "status", targetNamespace = "") javax.xml.ws.Holder status,
   @WebParam(mode = WebParam.Mode.OUT, name = "statusMessage", targetNamespace = "") javax.xml.ws.Holder statusMessage);
}

2. Implement other requisite Java classes.

When you run the Java-to-WSDL compiler on the SEI, it converts not only the SEI, but also the classes referenced as parameters or return values. The parameter types must be convertible to XML, otherwise it would not be possible for WSDL operations to send or to receive those data types. In fact, when you run the Java-to-WSDL compiler, it is typically necessary to convert an entire tree of related classes to XML using the standard JAX-B encoding.

Each related class must have a default constructor .

public class Customer {
 protected String firstName;
 protected String lastName;
 protected String phoneNumber;
 protected String id;

 // Default constructor, required by JAX-WS
 public Customer() {
 }

 public Customer(String firstName, String lastName, String phoneNumber,
   String id) {
  super();
  this.firstName = firstName;
  this.lastName = lastName;
  this.phoneNumber = phoneNumber;
  this.id = id;
 }

 public String getFirstName() {
  return firstName;
 }

 public void setFirstName(String value) {
  this.firstName = value;
 }

 public String getLastName() {
  return lastName;
 }

 public void setLastName(String value) {
  this.lastName = value;
 }

 public String getPhoneNumber() {
  return phoneNumber;
 }

 public void setPhoneNumber(String value) {
  this.phoneNumber = value;
 }

 public String getId() {
  return id;
 }

 public void setId(String value) {
  this.id = value;
 }
}

3. Instantiate the Web service endpoint.

In Apache CXF, you create a WS endpoint by defining a jaxws:endpoint element in XML. The WS endpoint is effectively the runtime representation of the Web service: it opens an IP port to listen for SOAP/HTTP requests, is responsible for marshalling and unmarshalling messages (making use of the
generated Java stub code), and routes incoming requests to the relevant methods on the implementor class.

jaxws:endpoint => To integrate a WS endpoint with a Java implementation class.
cxf:cxfEndpoint => To integrate a WS endpoint with a Camel route.

Creating a Web service in Spring XML consists of the following two steps:
1. Create an instance of the implementor class, using the Spring bean element.
2. Create a WS endpoint, using the jaxws:endpoint element.


 
 
 
 
 
 
 

4. Generate the WSDL

To generate a WSDL contract from your SEI, you can use either the java2ws command-line utility or the cxf-java2ws-plugin Maven plug-in. Plug-in approached is given below.

Add plugin to the POM .


 ...
 
  2.4.2-fuse-00-05
 
 
  install
  
   ...
   
    org.apache.cxf
    cxf-java2ws-plugin
    ${cxf.version}
    
     
      org.apache.cxf
      cxf-rt-frontend-jaxws
      ${cxf.version}
     
     
      org.apache.cxf
      cxf-rt-frontend-simple
      ${cxf.version}
     
    
    
     
      process-classes
      process-classes
      
       org.fusesource.demo.camelcxf.ws.server.CustomerService
       
       
        ${basedir}/../src/main/resources/wsdl/CustomerService.wsdl
       
       true
       true
      
      
       java2ws
      
     
    
   
  
 
 

Thursday, July 25, 2013

REST API Design Rules

Found REST API Design Rulebook to be a useful guideline in designing REST APIs, and it's short n sweet with only 144 pages.



It has dished out a set of clear rules that are practical and easy to follow. Here is a summarized list of all the rules given in the book.

Identifier Design with URIs

URI Format
Rule: Forward slash separator (/) must be used to indicate a hierarchical relationship
Rule: A trailing forward slash (/) should not be included in URIs
Rule: Hyphens (-) should be used to improve the readability of URIs
Rule: Underscores (_) should not be used in URIs
Rule: Lowercase letters should be preferred in URI paths
Rule: File extensions should not be included in URIs

URI Authority Design
Rule: Consistent subdomain names should be used for your APIs
Rule: Consistent subdomain names should be used for your client developer portal

URI Path Design
Rule: A singular noun should be used for document names
Rule: A plural noun should be used for collection names
Rule: A plural noun should be used for store names
Rule: A verb or verb phrase should be used for controller names
Rule: Variable path segments may be substituted with identity-based values
Rule: CRUD function names should not be used in URIs

URI Query Design
Rule: The query component of a URI may be used to filter collections or stores
Rule: The query component of a URI should be used to paginate collection or store results

Interaction Design with HTTP

Request Methods
Rule: GET and POST must not be used to tunnel other request methods
Rule: GET must be used to retrieve a representation of a resource
Rule: HEAD should be used to retrieve response headers
Rule: PUT must be used to both insert and update a stored resource
Rule: PUT must be used to update mutable resources
Rule: POST must be used to create a new resource in a collection
Rule: POST must be used to execute controllers
Rule: DELETE must be used to remove a resource from its parent
Rule: OPTIONS should be used to retrieve metadata that describes a resource’s available interactions

Response Status Codes
Rule: 200 (“OK”) should be used to indicate nonspecific success
Rule: 200 (“OK”) must not be used to communicate errors in the response body
Rule: 201 (“Created”) must be used to indicate successful resource creation
Rule: 202 (“Accepted”) must be used to indicate successful start of an asynchronous action
Rule: 204 (“No Content”) should be used when the response body is intentionally empty
Rule: 301 (“Moved Permanently”) should be used to relocate resources
Rule: 302 (“Found”) should not be used
Rule: 303 (“See Other”) should be used to refer the client to a different URI
Rule: 304 (“Not Modified”) should be used to preserve bandwidth
Rule: 307 (“Temporary Redirect”) should be used to tell clients to resubmit the request to another URI
Rule: 400 (“Bad Request”) may be used to indicate nonspecific failure
Rule: 401 (“Unauthorized”) must be used when there is a problem with the client’s credentials
Rule: 403 (“Forbidden”) should be used to forbid access regardless of authorization state
Rule: 404 (“Not Found”) must be used when a client’s URI cannot be mapped to a resource
Rule: 405 (“Method Not Allowed”) must be used when the HTTP method is not supported
Rule: 406 (“Not Acceptable”) must be used when the requested media type cannot be served
Rule: 409 (“Conflict”) should be used to indicate a violation of resource state
Rule: 412 (“Precondition Failed”) should be used to support conditional operations
Rule: 415 (“Unsupported Media Type”) must be used when the media type of a request’s payload cannot be processed
Rule: 500 (“Internal Server Error”) should be used to indicate API malfunction

Metadata Design

HTTP Headers
Rule: Content-Type must be used
Rule: Content-Length should be used
Rule: Last-Modified should be used in responses
Rule: ETag should be used in responses
Rule: Stores must support conditional PUT requests
Rule: Location must be used to specify the URI of a newly created resource
Rule: Cache-Control, Expires, and Date response headers should be used to encourage caching
Rule: Cache-Control, Expires, and Pragma response headers may be used to discourage caching
Rule: Caching should be encouraged
Rule: Expiration caching headers should be used with 200 (“OK”) responses
Rule: Expiration caching headers may optionally be used with 3xx and 4xx responses
Rule: Custom HTTP headers must not be used to change the behavior of HTTP methods

Media Type Design
Rule: Application-specific media types should be used
Rule: Media type negotiation should be supported when multiple representations are available
Rule: Media type selection using a query parameter may be supported

Representation Design

Message Body Format
Rule: JSON should be supported for resource representation
Rule: JSON must be well-formed
Rule: XML and other formats may optionally be used for resource representation
Rule: Additional envelopes must not be created

Hypermedia Representation
Rule: A consistent form should be used to represent links
Rule: A consistent form should be used to represent link relations
Rule: A consistent form should be used to advertise links
Rule: A self link should be included in response message body representations
Rule: Minimize the number of advertised “entry point” API URIs
Rule: Links should be used to advertise a resource’s available actions in a state-sensitive manner

Media Type Representation
Rule: A consistent form should be used to represent media type formats
Rule: A consistent form should be used to represent media type schemas

Error Representation
Rule: A consistent form should be used to represent errors
Rule: A consistent form should be used to represent error responses
Rule: Consistent error types should be used for common error conditions

Client Concerns

Versioning
Rule: New URIs should be used to introduce new concepts
Rule: Schemas should be used to manage representational form versions
Rule: Entity tags should be used to manage representational state versions

Security
Rule: OAuth may be used to protect resources
Rule: API management solutions may be used to protect resources

Response Representation Composition
Rule: The query component of a URI should be used to support partial responses
Rule: The query component of a URI should be used to embed linked resources

JavaScript Clients
Rule: JSONP should be supported to provide multi-origin read access from JavaScript
Rule: CORS should be supported to provide multi-origin read/write access from JavaScript

Tuesday, July 16, 2013

Fuse ESB Demo Code

Fuse ESB Enterprise documentation is making use of demonstration code to illustrate the capabilities of the system. Explanations are not very clear to follow without the code, but unfortunately the code is for subscribers only.

Downloading the demonstration package

The source code for the demonstrations is packaged as a Zip file, cxf-webinars-assembly-1.1.1-src.zip, and is available from the following location:
http://repo.fusesource.com/nexus/content/repositories/subscriber/org/fusesource/sparks/fuse-
webinars/cxf-webinars-assembly/1.1.1

When you try to navigate to this location with your browser, you will be prompted for a username and password. Enter your subscription login credentials to gain access to this directory and click on cxf-webinars-assembly-1.1.1-src.zip to start downloading.

Did a little Googling to see if any generous developer has shared the code, and look what we found!

The actual git repository they use for storing these projects is not restricted.

http://fusesource.com/forge/git/sparks.git/?p=sparks.git;a=tree

It's not possible to clone it, since it requires authentication. But can click on the snapshot  (http://fusesource.com/forge/git/sparks.git/?p=sparks.git;a=snapshot;h=HEAD;sf=tgz) and the entire lot is downloaded.

Wednesday, July 10, 2013

Frequently Used Linux Commands

For my easy reference,

find . -name *.jar | xargs grep -i 'ABC.class'
# Find a jar file which has ABC.class in it

printenv
# Environment variables

printenv | grep proxy
# Environment variables with proxy in name

export https_proxy=http://x.x.x.x:3128
# Set environment variable

sudo su
# Login as super user

rm -rf folderToDelete
# Delete the folder and the contents

netstat -anp|grep :7001
# Find a process binding a port

kill -9 21286
# Kill process

telnet hostA 1521
# Telnet a port

nslookup hostA
# 

uname -a
# kernel-name, nodename, processor, OS etc

lsb_release -a
# OS version

cat /etc/*release 
# OS version

df -h
# file system sizes & free space

du -s folderloc
# folder size

du --si -s file 
# File size shown in G,M

ssh root@serverA
# Connect to serverA as root

scp root@serverA.abc.com:/path/a.log b.log
# Copy a file from serverA

scp -r /path/folderA  userB@serverB:/path/folderB
# Copy a folder to serverB

tar -cf archive.tar foo bar
# Create archive.tar from files foo and bar.

tar -xf archive.tar
# Extract all files from archive.tar.

vpnc-connect
# VPN connect

date
# Current date

date +%T -s "15:22:13"
# Update time

split --bytes=50m largeFile.log splitFile_
# Split a file to files with 50m


Common Options

-f, --force
-r, -R, --recursive
-a, --all
-v, --verbose
--help
--version

SOAP vs REST


SOAP REST
Simple Object Access Protocol REpresentational State Transfer
XML based messaging protocol Architectural style
JAX-WS JAX-RS
XML JSON, XML, plain text etc
RPC URL path
Binary data that is sent must be encoded Binary data can simply be delivered
Standard specification No standard specification
Exposes operations that represent logic Exposes resources that represent data

Install Soap UI on Ubuntu

It should be as simple as this

sudo add-apt-repository ppa:upubuntu-com/web
sudo apt-get update
sudo apt-get install soapui

But since I'm behind a proxy "add-apt-repository" gives an error.

Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 125, in 
ppa_info = get_ppa_info_from_lp(user, ppa_name)
File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 84, in get_ppa_info_from_lp
curl.perform()
pycurl.error: (7, "couldn't connect to host")

Check if proxy is configured as environment variable.

printenv | grep proxy

Both http_proxy and https_proxy should be there. If not add them.

export http_proxy=http://x.x.x.x:port
export https_proxy=http://x.x.x.x:port

Run sudo with the -E option so that environment variables get passed to the root account.

sudo -E add-apt-repository ppa:upubuntu-com/web

Tuesday, July 9, 2013

SyntaxHighlighter in blogger

I can't believe that I wrote a dev blog for a year without using a tool to highlight Syntax.

I added SyntaxHighlighter (http://alexgorbatchev.com/SyntaxHighlighter/) today and am delighted with the result. Followed the tutorial on http://oneqonea.blogspot.com/2012/04/how-do-i-add-syntax-highlighting-to-my.html

You basically have to add the following to the in the blog template.








We can keep only the brushes we need (.js includes) and remove the rest.

There are several themes as mentioned in http://alexgorbatchev.com/SyntaxHighlighter/manual/themes/ and I'm using the eclipse theme.

When creating blog posts surround the code snippets with following tags. Pick the right brush depending on the programming language used.

<pre class="brush:java;"
Code Snippet
</pre>


Camel Route: Quering Oracle DB


camel-context.xml





 
  
   
   
    Select * from ACCOUNT
   
   
   
  
 

 
  
  
  
  
 

 



pom.xml



  
  
   org.apache.camel
   camel-core
   2.10.0.redhat-60024
  

  
   org.apache.camel
   camel-spring
   2.10.0.redhat-60024
  

  
   org.apache.camel
   camel-jdbc
   2.10.0.redhat-60024
  

  
    org.springframework
    spring-jdbc
    3.1.0.RELEASE
   

   
    com.oracle
    ojdbc6
   11.2.0
   

  


Following dependency issued were encountered when implementing the above.

java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSource 

Adding spring-jdbc jar was the solution, but the question was which version.


org.springframework
spring-jdbc
x.x.x


Tried 1.2.9, 2.0.1, 2.5.6. All gave the following error.

[ERROR] Failed to execute goal org.apache.camel:camel-maven-plugin:2.10.0.redhat-60024:run (default-cli) on project poc-database: null: MojoExecutionException: org/springframework/core/env/EnvironmentCapable: org.springframework.core.env.EnvironmentCapable -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

Running with -e switch revealed the following error.


Caused by: java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable

This class was found in 3.x versions of spring-jdbc. Tried with 3.1.0.RELEASE, and it gave the following error.

[ERROR] Failed to execute goal org.apache.camel:camel-maven-plugin:2.10.0.redhat-60024:run (default-cli) on project poc-database: null: MojoExecutionException: InvocationTargetException: Error creating bean with name 'dataSource' defined in URL [file:/home/kl40306/SAM6/Fuse_POC/workspace/poc-database/src/main/resources/META-INF/spring/DatabaseSample.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'driverClass' of bean class [org.springframework.jdbc.datasource.DriverManagerDataSource]: Bean property 'driverClass' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? -> [Help 1]
[ERROR]

The reason is the attribute which was "driverClass" is now "driverClassName" in DriverManagerDataSource.

After fixing the above, following error came up.

PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.driver.OracleDriver]

Needed to add Oracle maven dependency.


   com.oracle
   ojdbc6
   11.2.0
  

This is not downloaded automatically from maven repositories. Need to install manually.

Download the jar and run

mvn install:install-file -Dfile=/path_to_jar/ojdbc.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar


Friday, June 28, 2013

SVN Commands

For my own reference :)
  • svn co svnLocation
  • svn add  dirLocation
  • svn commit dirLocation
  • svn status
  • svn info
  • svn log
  • svn log --stop-on-copy
  • svn diff -r 125:HEAD --summarize
  • svn mkdir -m "Create Dir"  svnLocation
  • svn delete svnLocation
  • svn revert -R dirLocation
  • svn copy svnLocationTrunk svnLocationBranch -m "Creating a new branch."
  • svn merge -r 5:10 svnLocationTrunk --non-interactive

Simplest JAX-WS in Eclipse

1. Create a new java project in Eclipse

2. Create package structure com.mycompany.wsServer

3. Create following class in it.
SimpleWebService.java
package com.mycompany.wsServer;
import javax.jws.WebService;

@WebService
public class SimpleWebService {
    public String getGreeting() {
        return "Hello ";
    }
}


4. Create ant build file
build.xml
<project default="wsgen">
 <target name="wsgen" >
   <exec executable="wsgen">    
    <arg line="-cp ./bin -keep -s ./src -d ./bin com.mycompany.wsServer.SimpleWebService"/>    
   </exec>    
 </target>
</project>


5. Run the Ant build.xml file. Generated code is found under the new package called com.mycompany.wsServer.jaxws

6. Create following class to run the web service
RunService.java
package com.mycompany.wsServer;
import javax.xml.ws.Endpoint;


public class RunService {
     public static void main(String[] args) {
        System.out.println("Web Service started.");
        Endpoint.publish("http://localhost:8080/wsServerExample", new SimpleWebService());
      }
}


7. Run the class. Web service will start. View the wsdl on
 http://localhost:8080/wsServerExample?wsdl

Monday, June 24, 2013

How to Own Your Own Library

I had always been  a greedy, greedy bookworm!

Books were basically the only form of entertainment I had as a child (TV antenna was broken most of the time :/ ) . I thought one day I'd own one of those grand book libraries that you see in English movies set in the previous century, with glass paneled, ceiling high cupboards covering up the walls and huge leather bound volumes filling them up. But when I grew up and found a job, in other words when that "one day" became now, I realized it's not going to happen. Only a small book cupboard would fit in my tiny rented house and my not-so-grand budget.

From a different paradigm, I was a software developer and was not very happy about my developer know-how. After endless arguments, brainstorms and discussions with my own self, I decided that books had to be the answer. Internet let me know that the subject area which had most number of books written ever is actually this area. I bought a few books, but then realized there were just too many to choose from.

After a while, with so many hours spent browsing the web, I discovered it.

Ebooks.

And most importantly, they can be FREE!

Treasure hunt for ebooks started like that and now I'm a proud owner of a virtual library with more than 5000 books, all in PDF format. My childhood dream became true without spending anything at all.

Here are some tips on finding ebooks online for free .

1. Use Amazon. Being the world's largest bookstore, amazon offers a wealth of information about what books are written on any topic. There are reviews, ratings etc and gives us a very good idea of what books we need to find.

2. Best Book lists Apart from amazon, there are many more web based sources, like blogs for example, that lists best books written about a certain subject area.

3. Learn Googling.
It's an art. There are some great and easy ways to efficiently use Google. After figuring out the book you need from the previous steps, you can Google it. Type
bookname filetype:pdf
and it will give only search results to pdf links. More popular the book, more chance for it to be found. There are more options in Google Advanced Search.
Play around with Google, changing words like title, author, publisher etc.

4. File repositories.
Once you find a link to a book, check if that link leads to a file repository that contain more books. I found huge on-line collections like this, which were not secured to restrict access.

5. Torrent
Not only movies, book collections are also shared on torrent.

Please note that it's much easier to find computer technology related books online for obvious reasons :)

Thursday, June 20, 2013

Fuse ESB 123


Download Fuse ESB from http://www.jboss.org/products/fuse 

Create a Web Services (WS) Project
mkdir get-started
cd get-started
mvn archetype:generate -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-cxf-code-first-osgi-bundle -DgroupId=org.fusesource.example -DartifactId=cxf-basic -Dversion=1.0-SNAPSHOT
Create project
cd cxf-basic/
mvn install
Build project
cd ESBInstallDir/bin
./fuse
Start Fuse ESB
karaf@root> install mvn:org.fusesource.example/cxf-basic/1.0-SNAPSHOT Install the WS as an OSGi bundle
karaf@root> start 229 Start the WS with bundle id returned from previous step.
karaf@root> list Check if the bundle has started
cd get-started/cxf-basic
mvn -Pclient
Run the WS client

Tuesday, June 18, 2013

Great Software Quotes

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”
- C.A.R. Hoare (British computer scientist, winner of the 1980 Turing Award)

“Measuring programming progress by lines of code is like measuring aircraft building progress by weight.”
- Bill Gates (co-founder of Microsoft)

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.”
- Martin Golding

“When debugging, novices insert corrective code; experts remove defective code.”
- Richard Pattis

“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter.”
- Eric S. Raymond (American programmer, open source software advocate, author of “The Cathedral and the Bazaar”)

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.”
- Rich Cook

“Good code is its own best documentation. As you’re about to add a comment, ask yourself, ‘How can I improve the code so that this comment isn’t needed?’”
- Steve McConnell (author of many software engineering books including “Code Complete”)

“One of my most productive days was throwing away 1000 lines of code.”
- Ken Thompson (computer scientist, early developer of UNIX OS)

“Before software can be reusable it first has to be usable.”
- Ralph Johnson (computer scientist)

Quotes




Monday, June 17, 2013

Power of Words

This is a collection of hand picked speeches that are great lessons in public speaking. Inspiring!





AePona in a Nutshell

 Logo

History

1997: Aldiscon, an Ireland-based pioneer of text messaging and the first company to market with a commercial SMSC platform, was sold to Logica and Apion was founded, which thrived in the Mobile Internet / WAP Gateway market

1999: Apion was sold to Openwave.

2002: Aepona was founded to capitalize on the nascent market for Telecoms Value Added Services(VAS), launching the world’s first Application Gateway platform based on the emerging Parlay standards.

2007: Aepona acquired the Swedish Application Server vendor Appium, strengthening the company’s product portfolio and customer base.

2009: Aepona acquired Valista, a leading provider of Payments and Settlement solutions based in Ireland, bringing valuable revenue management and product merchandizing capabilities to the company.

2013: Aepona was acquired by Intel Corporation.

What does AePona do?

Aepona is an industry leader in API exposure and monetization platforms for service providers around the world.



Employees
As of 2013, 300+ based in Belfast, Dublin, Sri Lanka and the United States.

Aepona Sri Lanka
Aepona Sri Lanka Development Center is Java centric with significant expertise in Telco application development. It performs three key product engineering functions – R&D, Professional Services and Solutions Support.

Aepona and Intel
While globally recognised as a chip business, Intel also has a very large software business, which if it were a stand alone company would be one of the largest in the world.

AePona is now part of the Network Products and Service divisions within Intel, reporting into the Software & Services Group(SSG). 

Monday, June 10, 2013

Don’t just have an MBA – Be an MBA

Fifteenth June 2013 is a special day. It's the day that we celebrate two years of hard and intensive work, life turning experiences and endless learnings; the day that we are officially crowned as PIM MBAs.

People ask me all the time why I did a MBA if I'm not planning to move to the PM track. I always fight the urge to answer back "why not do a MBA?" There are so many reasons to be an MBA, and it's difficult to pin point to a single reason or a list of reasons for that matter. MBA is the key for me to be the professional that I'm today. Post-MBA me and pre-MBA me are miles apart in so many aspects.

I was a mere software developer. I had a job where I had to stare at the computer screen 95% of the time. The limited time I got to interact with anyone or do anything else was considered a waste of time.

I was feeling like a frog in a well, I was a techie and simply was ignorant to the outside world.

People in suites; who "managed", who directed, and who marketed were as familiar to me as aliens from Mars. They were a species that basically had nothing more in common with me than two eyes and a nose in-between. Mandarin made more sense than accounts and business strategy.

I had the gut feeling that I was capable of something more. What can be lying outside my happy little well; I wondered! What would be the best way to widen my horizons? How could I ever understand why my project manager behaved the way he did! Is this the right way to do things, can there be other ways?

I sought my answers from the right place.

PIM!

It had been hell of a ride for me. The two years gave me 20 years worth of experience. New worlds opened up in the 3 hours we spent in the class. Little by little lot of things made sense. I was not at a loss when people spoke in debits and credits. I understood how my company is run and what the guys in suits do. I, who had shyed away from talking to my manager simply because I just didn't know how, ranked top in negotiation class.

I've learned to appreciate the different skills and different ideas of different people. I've experienced first hand the fresh perspective you get to a problem from a lawyer or from a banker.

I stepped out of PIM as a transformed person, ready to face challenges with a confident smile.

PIM gave me the courage to quit my job and give myself free time to prepare for what I wanted to do, instead of just doing what I was told to do. Thanks to that bold decision I'm having my dream job and enjoying every minute of it. I apply my MBA learnings every day and see the results.

I've already forgotten the theories I learned and I may never look at the huge text books that were given; they are nothing compared to what PIM has given me, it is not tangible and it cannot be expressed with a few words. The best I can say is that PIM gave a me a new ME, a new self with a wider horizons, a huge dose of confidence and completely different view points and perspectives.

I still develop software. But I'm not a mere software developer.

I'm an MBA.

Monday, May 20, 2013

BPMN 2.0 : Business Process Model and Notation

The BPMN 2.0 standard specification was formally released in January 2011. This specification is the result of collaboration between companies such as Oracle, IBM, Red Hat, Intalio, and many others within the Object Management Group, to conform  a unified language to model and execute business processes.

The specification aims to reduce/eliminate the gap between technical business process representations and the fact that a lot of business analysts use flow chart representations to define how a company works. This gap can be eliminated using a standardized mapping between the visual notation of the business process and the execution semantic of the model. A business processes modeled using the BPMN notation defines the flow of data and the association of the data artifacts to business activities.

BPMN2 covers more than just the notation that needs to be used to draw our business processes, and the complete specification is divided into four sections that allow different vendors to be compliant with one or more of these four conformance types:
  • Process Modeling
  • Process Execution
  • Collaboration Modeling
  • Choreography Modeling 
e.g: A diagram that conforms to process modeling notation is shown below.

Monday, May 13, 2013

Running jPBM 5.0 Demo

You can supposedly get jPBM demo running in a breeze.
  1. Download full version from here.
  2. Unzip
  3. Go to install location
  4. Run: ant install.demo
  5. Run: ant start.demo
I had to tweak the build.xml a bit to get it running smoothly.

1. Eclipse download path was incorrect. (L 253 => http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads)

2. Since my OS was Linux, had to change the OS in start.jboss7 target from 'unix' to 'Linux' (L 756). Otherwise jboss won't start.

3. Replace 'osfamily' with 'os'

Friday, May 10, 2013

Error: type doesn't support the "osfamily" attribute

Above error can come when executing an ant target. This happens because ant versions older than 1.7 do not support osfamily.

Solve it by,
1. If you're using a older ant version, replace 'osfamily' attribute in exec tasks with 'os' in your build file.
or
2. If you're using ant 1.7, see if an older version of jar is getting picked up. If you have a certain jar earlier in the classpath which has ant dependencies, it might load an older version. Move such jars to the bottom of the classpath.

Thursday, May 9, 2013

MongoDB



If you're interested in learning MongoDB check this out.

It's a free on-line course hosted by the MongoDB company itself.

https://education.10gen.com

Quoting their about us page;

10gen Education is an online learning platform run by 10gen (the MongoDB company) available to anyone in the world with an internet connection. Our free courses will teach you how to develop for and administer MongoDB quickly and efficiently.

Frequent assessments help you verify your understanding, and at the end of a course, you'll receive a certificate of completion from 10gen. You'll also become a member of 10gen's community of cutting-edge NoSQL technologists. Over time, we'll be adding classes on schema design, advanced scaling and replication, and other topics, so check back often!

10gen's education platform was developed under a collaboration with edX, the not-for-profit consortium between MIT, Harvard and Berkeley.

I18n = Internationalization

I18n stands for "Internationalization"


The story goes as follows (as sited in Internet):
A DEC employee named Jan Scherpenhuizen was given an email account of S12n by a system administrator, since his name was too long to be an account name. This approach to abbreviating long names was intended to be humorous and became generalized at DEC. The convention was applied to "internationalization" at DEC which was using the numeronym by 1985.

Drools

Rule engines provide us a declarative language to express our rules, in contrast to the imperative nature of languages. Java, C, PHP, Python, and Cobol are imperative languages, meaning that they follow the instructions that we give them, one after the other.

Using Drools Rule Language(DRL) we specify situations that are evaluated by the rule engine. Each rule defines a situation. A rule has two sections,

conditional section => Starts when 'when' keyword
consequence section => Starts when 'then' keyword

A rule that is activated is said to be eligible to be fired.

In the rule consequence, you can write any Java code you want. This code will be executed as regular Java code.

Rule engine doesn't care about the order of the rules that we provide; it will analyze them by their conditional sections

rule "enabled to drive must have a car"
When
$p: Person( enabledToDrive == true )
not(Car(person == $p))
then
insert(new Car($p));
end

rule "person with new car must be happy"
when
$p: Person()
$c: Car(person == $p)
then
$p.setHappy(true);
end

Wednesday, May 8, 2013

Technical/IT Product Evaluation Criteria

We've been doing a couple of technology/product evaluations recently. Following is a list of useful evaluation criteria that can be considered generally for any kind of product evaluation.
  • Adherence to standards
  • Latest version
  • Resource monitoring
  • Optimization tools and capabilities
  • Testing/Debug capabilities
  • Integration with external systems
  • Integration with frameworks
  • Server/OS compatibility
  • Performance
  • Community (developer and user)
  • Product Support
  • Pricing\Product Model
  • License (tricky restrictions?)
  • Clients
  • Maturity
  • Ratings by independent product evaluators (Forrester, Gartner etc)
  • Road-map
  • Stability
  • Documentation
  • Usage of proprietary technology (Risk of vendor lock-in)
  • Expert Availability
  • Security Criteria
  • Deployment Methods
  • Light weight vs feature rich

Competition for Best Open Source ESB!!

A long story in a nutshell...


We were asked to find out the best open source ESB to be used for a new product our company is designing.

Step 1
Found the key players we need to evaluate. We looked at industry standard ESB evaluations, latest Forrester and Gartner reports.

 


The Forrester ESB Evaluation -2011

 
Gartner Magic Quadrant for SOA Infrastructure Projects - 2012

 Short listed candidates,
  • Fuse ESB
  • Mule ESB
  • WSO2 ESB (A Sri Lankan company made it! wow)
  
Step 2
Decided on evaluation criteria based on the product requirement.


1
Support multiple protocols
2
Dynamic configuration
3
Dynamic Integration of multiple components
4
Hot deployment
5
Retry mechanism
6
Service pooling
7
Dynamic content based routing
8
Flexible service coordination
9
Expose multiple services as a  single service
10
Web based UI components
11
Message transformation
12
Embedding the ESB runtime in a Java application


Step 3
Evaluated the short listed products against the criteria.

Evaluation details are bit too lengthy and techi for a simple blog post.

WSO2 ESB which claimed to be great in performance, which was even selected by eBay for their platform (case study available on net), had to be rejected because they did not recommend hot deployment which we really wanted.

FuseESB which scored great against all the evaluation criteria was chosen without much debate. Being based on Apache Camel was a big plus point.

Inside Intel!

Dreams can come true in the most weird and awkward ways!

I always day dreamed, "if only I was smart enough to work for Google"  (or in some silicon valley company at least :)). The reason had mostly to do with their cool and funky workplaces :)

Well... it did come true in a way (minus the funky workplace part though) when my company (AePona) announced that we are going to be acquired by Intel!!

We did see some Internet talk few days back about it, but Intel?? nahhh it's just some silly gossip; we thought. Our folks had done a pretty good job keeping it  a secret, so yes, we were surprised when they actually asked us to come for this big company wide meeting.


Then WE were asked to keep it a secret, but all of us went home and bragged about it the family :D

Then we had a day with Intel HR where we were given employment contracts from Intel.

We finally had the most awaited Day 1 with Intel on 29th April. Now we are proud owners of Intel mail addresses (something to impress the friends at parties) and have access to Intel intranet.

Really excited!! Whatever Intel has on hold for me, having Intel on my CV would simply rock!!