updated sample code to use containerPermissions. added java & xml formatting