Top Description Fields Constructors Methods
javax.ejb.embeddable

public abstract Class EJBContainer

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Imports
java.io.PrintWriter, .StringWriter, java.util.Map, .HashMap, .Set, .HashSet, .ServiceLoader, javax.naming.Context, javax.ejb.EJBException, javax.ejb.spi.EJBContainerProvider

Used to execute an EJB application in an embeddable container.
Since
EJB 3.1

Field Summary

Modifier and TypeField and Description
public static final String
APP_NAME

Standard property name for specifying the application name of the EJB modules executing within the embeddable container.

public static final String
MODULES

Standard property name for specifying the set of modules to be initialized.

private static final String
public static final String
PROVIDER

Standard property name for specifying the embeddable container implementation bootstrap class.

private static final ServiceLoader<EJBContainerProvider>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract void
close()

Redeclares java.lang.AutoCloseable.close.

Shutdown an embeddable EJBContainer instance.
public static EJBContainer

Returns:

EJBContainer instance
createEJBContainer
()

Create and initialize an embeddable EJB container.

public static EJBContainer

Returns:

EJBContainer instance
createEJBContainer
(Map<?, ?>
Spec-defined and/or vendor-specific properties. The spec reserves the prefix "javax.ejb." for spec-defined properties.
properties
)

Create and initialize an embeddable EJB container with a set of configuration properties.

private static String
public abstract Context

Returns:

naming context
getContext
()

Retrieve a naming context for looking up references to session beans executing in the embeddable container.

private static void
reportError(Map<?, ?>
the properties passed as an argument to the createEJBContainer() method
properties
,
Map<String, String>
the Map of errors encountered during the createEJBContainer() call
errors
,
Set<String>
the Set of providers that returned null on createEJBContainer() call
returnedNull
)

Create a meaningful EJBException in case no EJBContainer provider had been found.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

APP_NAMEback to summary
public static final String APP_NAME

Standard property name for specifying the application name of the EJB modules executing within the embeddable container. If specified, the property value applies to the <app-name> portion of the portable global JNDI name syntax. If this property is not specified, the <app-name> portion of the portable global JNDI name syntax does not apply.

MODULESback to summary
public static final String MODULES

Standard property name for specifying the set of modules to be initialized. Property value is one of the following :

  • a single module name String from the JVM classpath
  • a String[] array of module names from the JVM classpath
  • a java.io.File representing an ejb-jar or exploded ejb-jar directory
  • a java.io.File array, each element of which represents an ejb-jar or exploded ejb-jar directory
newLineback to summary
private static final String newLine
PROVIDERback to summary
public static final String PROVIDER

Standard property name for specifying the embeddable container implementation bootstrap class. Property value is a fully-qualified class name.

providersback to summary
private static final ServiceLoader<EJBContainerProvider> providers

Constructor Detail

EJBContainerback to summary
public EJBContainer()

Method Detail

closeback to summary
public abstract void close()

Redeclares java.lang.AutoCloseable.close.

Shutdown an embeddable EJBContainer instance. Embeddable applications should always call close() in order to free up the resources associated with the embeddable container.

createEJBContainerback to summary
public static EJBContainer createEJBContainer()

Create and initialize an embeddable EJB container. JVM classpath is searched for all ejb-jars or exploded ejb-jars in directory format.

Returns:EJBContainer

EJBContainer instance

Exceptions
EJBException:
Thrown if the container or application could not be successfully initialized.
createEJBContainerback to summary
public static EJBContainer createEJBContainer(Map<?, ?> properties)

Create and initialize an embeddable EJB container with a set of configuration properties.

Parameters
properties:Map<?, ?>

Spec-defined and/or vendor-specific properties. The spec reserves the prefix "javax.ejb." for spec-defined properties.

Returns:EJBContainer

EJBContainer instance

Exceptions
EJBException:
Thrown if the container or application could not be successfully initialized.
createErrorMessageback to summary
private static String createErrorMessage(Throwable t)
getContextback to summary
public abstract Context getContext()

Retrieve a naming context for looking up references to session beans executing in the embeddable container.

Returns:Context

naming context

reportErrorback to summary
private static void reportError(Map<?, ?> properties, Map<String, String> errors, Set<String> returnedNull) throws EJBException

Create a meaningful EJBException in case no EJBContainer provider had been found.

Parameters
properties:Map<?, ?>

the properties passed as an argument to the createEJBContainer() method

errors:Map<String, String>

the Map of errors encountered during the createEJBContainer() call

returnedNull:Set<String>

the Set of providers that returned null on createEJBContainer() call