To add a resource to the registry instance, create a Resource object and then pass the created resource object to the registry instance's
Create a collection called "/c1/c2" in the org.wso2.carbon.registry.core.CollectionImpl class.
If you call the get method, then you will be able to access that created resource. You can also use the set method to set the value of the resource in the org.wso2.carbon.registry.core.Registry class. For example:
To add a resource with content, create a Resource object in the org.wso2.carbon.registry.core.Resource class and then set content.
See also Adding a Resource to learn how to do it using the Management Console.