Feature abstract controller factory

This pull request will fix #15 and #5
Notice: the #18 code is also merged into this branch, to make sure the generator can also configurate controllers.