refactoring javax.script engine