Enumerate the MBeans is easy - grab the MBeanServerConnection and use its API. This wiki entry should help get you started:
While you have the MBeans, the EJBs should be easy because each EJB has its own MBean with this naming pattern. Here is the pattern for EJB3 (the pattern is slightly different for EJB2.x)
Thanks so much!!!