I have an application written in pure/basic Java without GUI. I have three classes with main methods, so each of them can run for themselves. Now I run them with ant in specific order.

In glassfish I deployed Web application only with RESTful service. 

What I want to do now is to transfer the three classes into glassfish, so I will call them in exact same order as before from RESTful service.

I watched series of videos on youtube on Java EE 6 APIs, but I didn't find anything that would help transfer pure Java application to glassfish. Should I use EJB API for this?