code: public JavaResource newEJB(
              final Project project,
              final String ejbName,
              final String targetPackage,
              final EJBType ejbType,
              final boolean serializable) throws FileNotFoundException
     {
        final JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
        JavaClassSource javaClass = createJavaClass(ejbName, targetPackage, ejbType, serializable);
        return java.saveJavaSource(javaClass);
     }
docs: Creates a new {@link JavaResource} in the specified project. If no project is available, use
  {@link EJBOperations#newEntity(DirectoryResource, String, String, GenerationType)}
  
  @param project the current project in which to create the bean. Must not be null
  @param ejbName the name of the bean
  @param targetPackage the package of the bean to be created
  @param ejbType the {@link EJBType} chosen for this bean
  @param serializable whether or not the EJB should be serializable
  @param destType JMS destination type
  @return the created java resource
  @throws FileNotFoundException if something wrong happens while saving the {@link JavaClass}