Bug 564307 - Add generic type to HookContext

By making HookContext generic we can specify the hook class type.  Also,
recent changes to get the hook instances once per registration allows us
to do the instance of check once at registration instead of doing an
instanceof check and cast for each call to a hook.

Note that this does not optimize the case where the hook implementation
is somehow wired to a different package for the hook interfaces than the
framework itself. That should be very rare, but if it does happen then
this code will continually get/check/unget the service instance that is
wired to the wrong package for each hook call.

Change-Id: I9a6c392c0fc07ac00c6f99978a782609956acb2e
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
7 files changed