org.openejb
Class OpenEJB

java.lang.Object
  extended by org.openejb.OpenEJB

public final class OpenEJB
extends java.lang.Object

OpenEJB is the main factory for bootstrapping and obtaining a references to the ContainerSystem. The properties used in the static init( ) method this class determines the characteristics of the ContainerSystem assembled at run time.

An OpenEJB container system is assembled at runtime by the application server according to the properties passed into the static init( ) method. Properties determine the Assembler used to assemble the ContainerSystem as well as the source configuration data used by the Assembler. A set of standard environment property names are defined in the org.openejb.EnvProps class.

Below is an example of how an application server would initialize and use this class to assemble and obtain an ContainerSystem.

Properties initProps = new Properites(); initProps.setProperty(EnvProps.ASSEMBLER,"org.openejb.core.conf.Assembler"); initProps.setProperty(EnvProps.CONFIGURATION, "/openejb/bin/config/openejb.xml"); OpenEJB myEJB = OpenEJB.init(initProps);

When assembling a ContainerSystem OpenEJB will use the Assembler implementation specified in the EnvProps.ASSEMBLER property. By default the org.openejb.core.conf.Assembler is used. In addition to specifying the Assembler, developers can also specify the location configuration of the configuration file that the Assembler will use. In the case of the default Assembler the configuration property must a URI to an XML document that adheres to the OpenEJB DTD.

Custom Assembler can be created that assemble containers from different a different configuration source using a different algorithm and implementation classes. See the org.openejb.spi.Assembler interfce for more details.

Initialization properties can also be declared in the System properties. The System properties are combined with properties explicitly passed in the OpenEJB.init( )method. Properties passed into the init( ) method override System properties.

OpenEJB provides a singleton interface for the OpenEJB container system. Only one OpenEJB instance can be constructed in the lifetime of a VM process.

Since:
JDK 1.2
Version:
$Rev: 2174 $
Author:
Richard Monson-Haefel, David Blevins
See Also:
EnvProps, Assembler, Assembler

Constructor Summary
OpenEJB()
           
 
Method Summary
static Container[] containers()
          Gets all the Containers in this container system.
static DeploymentInfo[] deployments()
          Gets the DeploymentInfo objects for all the beans deployed in all the containers in this container system.
static ApplicationServer getApplicationServer()
           
static Container getContainer(java.lang.Object id)
          Returns the Container in this container system with the specified id.
static java.lang.ClassLoader getContextClassLoader()
           
static DeploymentInfo getDeploymentInfo(java.lang.Object id)
          Gets the DeploymentInfo object for the bean with the specified deployment id.
static java.util.Properties getInitProps()
          This method returns a clone of the original properties used to initialize the OpenEJB class.
static javax.naming.Context getJNDIContext()
          Returns the global JNDI name space for the OpenEJB container system.
static java.lang.String getProperty(java.lang.String property)
           
static SecurityService getSecurityService()
          Gets the SecurityService that this container manager exposes to the Containers it manages.
static javax.transaction.TransactionManager getTransactionManager()
          Gets the TransactionManager that this container manager exposes to the Containers it manages.
static void init(java.util.Properties props)
           
static void init(java.util.Properties initProps, ApplicationServer appServer)
           
static boolean isInitialized()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenEJB

public OpenEJB()
Method Detail

init

public static void init(java.util.Properties props)
                 throws OpenEJBException
Throws:
OpenEJBException

init

public static void init(java.util.Properties initProps,
                        ApplicationServer appServer)
                 throws OpenEJBException
Parameters:
initProps - Specifies the Assembler and other properties used to build the ContainerSystem
appServer - application server
Throws:
OpenEJBException - Thrown if a problem occurs building the ContainerSystem
Since:
JDK 1.2

getTransactionManager

public static javax.transaction.TransactionManager getTransactionManager()
Gets the TransactionManager that this container manager exposes to the Containers it manages.

Returns:
the TransactionManager to be used by this container manager's containers when servicing beans
See Also:
"javax.transaction.TransactionManager", TransactionService.getTransactionManager()

getSecurityService

public static SecurityService getSecurityService()
Gets the SecurityService that this container manager exposes to the Containers it manages.

Returns:
the SecurityService to be used by this container manager's containers when servicing beans
See Also:
SecurityService

getApplicationServer

public static ApplicationServer getApplicationServer()

getDeploymentInfo

public static DeploymentInfo getDeploymentInfo(java.lang.Object id)
Gets the DeploymentInfo object for the bean with the specified deployment id.

Parameters:
id - the deployment id of the deployed bean.
Returns:
the DeploymentInfo object associated with the bean.
See Also:
DeploymentInfo, Container.getDeploymentInfo, DeploymentInfo.getDeploymentID()

deployments

public static DeploymentInfo[] deployments()
Gets the DeploymentInfo objects for all the beans deployed in all the containers in this container system.

Returns:
an array of DeploymentInfo objects
See Also:
DeploymentInfo, Container.deployments()

getContainer

public static Container getContainer(java.lang.Object id)
Returns the Container in this container system with the specified id.

Parameters:
id - the id of the Container
Returns:
the Container associated with the id
See Also:
Container, Container.getContainerID()

containers

public static Container[] containers()
Gets all the Containers in this container system.

Returns:
an array of all the Containers
See Also:
Container

getJNDIContext

public static javax.naming.Context getJNDIContext()
Returns the global JNDI name space for the OpenEJB container system. The global JNDI name space contains bindings for all enterprise bean EJBHome object deployed in the entire container system. EJBHome objects are bound using their deployment-id under the java:openejb/ejb/ namespace. For example, an enterprise bean with the deployment id = 55555 would be have its EJBHome bound to the name "java:openejb/ejb/55555"

Returns:
the global JNDI context

getInitProps

public static java.util.Properties getInitProps()
This method returns a clone of the original properties used to initialize the OpenEJB class. Modifications to the clone will not affect the operations of the OpenEJB container system.


isInitialized

public static boolean isInitialized()

getProperty

public static java.lang.String getProperty(java.lang.String property)
Parameters:
property - property name the value is asked for
Returns:
property value

getContextClassLoader

public static java.lang.ClassLoader getContextClassLoader()


Copyright © 1999-2011 OpenEJB. All Rights Reserved.