How to load Users fron Another server's API

I want to implement My own UserProvider & GroupProvider which will hit an API to get All the users & groups
But i seem to not understand which functions are called in openfire and when.
Which function is called to getAll users in openfire.
Can any one help? If tit helps I want to integrate WSO2 Identity Server with openfire.

You can either write your own Providers from scratch, or you might be able to use an existing provider, that can use third-party database tables to retrieve data. The latter is described on http://download.igniterealtime.org/openfire/docs/latest/documentation/db-integration-guide.html

If you want to write your own Providers, then you should start with creating an implementation that implements the relevant interfaces, such as this one: http://download.igniterealtime.org/openfire/docs/latest/documentation/javadoc/org/jivesoftware/openfire/user/UserProvider.html

I advice that you study the source code of the existing implementations of those interfaces. That will give you good, pragmatic examples that you can use.

After you’ve finished your implementation, it should be a matter of setting a couple of properties to the correct value (the name of your new implementation) to make Openfire use that, instead of its default providers.