Port to JSR-269

This PR tries to address issue described in #52. This is my first encounter with JSR-269 so all comments are very welcome.