try {
AuthenticateStub authenticateStub = new AuthenticateStub();
ResourceAdminServiceStub resourceAdminServiceStub = new ResourceAdminServiceStub("https://" + FrameworkSettings.HOST_NAME + ":" + FrameworkSettings.HTTPS_PORT + "/services/ResourceAdminService");
authenticateStub.authenticateAdminStub(resourceAdminServiceStub, sessionCookie);
//add a collection to the registry
String collectionPath = resourceAdminServiceStub.addCollection("/_system/config/", "ResFiles", "", "contains ResFiles");
log.info("collection added to " + collectionPath);
// Changing media type
collectionPath = resourceAdminServiceStub.addCollection("/_system/config/", "ResFiles", "application/vnd.wso2.esb", "application/vnd.wso2.esb media type collection");