Dedup locking code in RoleObject and ServiceObject

Move locking code into FileLock class.
Remove unneeded methods from RoleObject
Merge pull request #931 from bkutil/move_locking_into_separate_class

Move locking into separate class