Hi,
At the end of big struggle got a solution to my problem. I've provided the sample codes here (may be it will useful for others like me
). I've tested this and working fine as we expected.
But whenever I use classes of jdt.internal.* warning says security constraints may create problem, but no impact on runtime.
Really it was very hard to find these easy methods to work it out.Thanks Peter and Gibbons for your support on this.
[edited to add code tags]