add application run and stop hooks
Merge pull request #349 from rstudio/feature/run-hook

add application run and stop hooks