There is an article in the Eclipse wiki how to configure user's p2 default repositories of an RCP application by adding a static conf file to your product:
Equinox/p2/Adding Self-Update to an RCP Application - Configuring the user's default repositories
I want to do the same programmatically in a Java class when the user changes some configuration details. I could not find appropriate p2 API documentation for that.