moved calling of Resource constructor into Scala