How to synchronize friends by using roster API

Hi all.

I am developing an IM based on Openfire. But now I have to develop a plugin, I wonder how to synchronize friends by using roster API. in detail:

I have a friendship list saying that List<Friendship>, where Friendship is a friend ship pair, one is a, the other is b.

Then I want to synchronize List<Friendship> to openfire server, but I’m not familiar with roster API.

could someone give me a code hit

Thanks