Documentation

EJB 3.0

Deployment

Configuration

Commands

Feeds

 

Space Index

0-9 ... 0 A ... 2 B ... 1 C ... 8 D ... 28 E ... 8
F ... 0 G ... 2 H ... 3 I ... 7 J ... 4 K ... 0
L ... 0 M ... 1 N ... 1 O ... 3 P ... 2 Q ... 1
R ... 2 S ... 10 T ... 3 U ... 5 V ... 0 W ... 1
X ... 0 Y ... 0 Z ... 0 !@#$ ... 0    

0-9

A

Annotations, XML and Defaults
following is a list of all annotations and their attributes, the xml tags that correspond to them (for overriding), and what the default values are when left unspecified. Annotation xml element(s) default value @Stateless Stateless name The simple ...
Application discovery via the classpath
document details the various ways to get OpenEJB to pickup applications you'd like deployed while in an embedded mode. Empty ejbjar.xml approach (recommended) Simplify the issue of searching for annotated applications by adding an ejbjar.xml like this to your app ...

B

Built-in Type Converters
following builtin types are supported for @Resource injection in EJBs via elements in a METAINF/ejbjar.xml or via plain properties in a METAINF/enventries.properties file. EJB 3.0 required types: java.lang.Boolean java.lang.Byte java.lang.Character java.lang.Double java.lang.Float java.lang.Integer java.lang.Long java.lang.Short ...

C

Callbacks
Correct usage of PostConstruct, PreDestroy, PrePassivate, PostActivate, and AroundInvoke for EJBs and Interceptors. For Stateful, Stateless, and MessageDriven, the syntax is as follows: @PostConstruct void () @PreDestroy void () @PrePassivate void () @PostActivate void Client-Server Transports
Client/Server transports jar transport description openejbejbd3.0.jar provides the 'ejbd' protocol. A binary protocol traveling over a socket openejbhttp3.0.jar supports the ejbd protocol over http openejbderbynet3.0.jar allows for derby to accessed via it's network driver openejbhsql3.0.jar allows ...
Clients
Local Client (embedded container) Properties p = new Properties(); p.put("java.naming.factory.initial", "org.openejb.client.LocalInitialContextFactory"); InitialContext ctx = new InitialContext(p); MyBean myBean = (MyBean) ctx.lookup("MyBeanRemote"); Remote Client Properties p = new Properties(); p.put("java.naming.factory.initial", "org.openejb.client.RemoteInitialContextFactory ...
Configuring Containers in Tests
Like Resources, Containers can also be declared via InitialContext properties as well. The most useful is to declare a Stateful SessionBean container so that it's guaranteed to passivate and activate on each call to the bean, allowing you to test your callbacks behave as you ...
Configuring DataSources
Configuring DataSources in openejb.xml The element is used to configure a javax.sql.DataSource. It is also used to configure other resources like Timers, Topics, Queues. We will see some examples of using to configure a DataSource. The element is designed after @Resource ...
Configuring DataSources in Tests
You can configure data sources from within your test case (avoiding the need for an openejb.xml entirely) like so: Properties p = new Properties(); p.put(Context.INITIALCONTEXTFACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); p.put("myDataSource", "new://Resource?type=DataSource ...
Containers and Resources
Containers CMPENTITY Declarable in openejb.xml via Declarable in properties via Foo = new://Container?type=CMPENTITY Supports the following properties Property Name Description CmpEngineFactory Default value is org.apache.openejb.core.cmp.jpa.JpaCmpEngineFactory. BMPENTITY ...
Custom Injection
Overview As noted in the Injection of enventry Example, the EJB 3.0 supported enventry types are fairly limited. Also the use of several tags in an ejbjar.xml can get a bit verbose. OpenEJB does not restrict you to just these data types ...

D

Deploy Tool
NAME openejb deploy OpenEJB Deploy Tool SYNOPSIS openejb deploy #options \...\ NOTE The OpenEJB Deploy tool is an OPTIONAL tool that allows you to deploy into a running server and get feedback as if the app was deployed and how it was deployed ...
Deployments
Deployments' element in openejb.xml A single jar To include a single jar by name, just declare a 'Deployments' element with a 'jar' attribute pointing to the jar file on the file system. ... Design
OpenEJB System Design Definition A modular, configurable, customizable, embeddable open source EJB container system Also Known As container system Responsibilities Implement EJB 3.0 Specification Related Classes org.apache.openejb.OpenEJB Required Libraries openejbjavaagent3.0.x.jar openejbjee3.0.x.jar openejbcore3.0.x.jar ...
Design - Application Server
Application Server Subcomponent of OpenEJB Design Definition Any component wishing to serve or deliver Enterprise JavaBeans. Also Known As Server Adapter Server Provider Responsibilities Remote client access to OpenEJB Implement the bean's remote and home interfaces. Distribute ...
Design - Application ServerLinks
http://openejb.apache.org/images/figureappserver.gif
Design - Assembler
Assembler Subcomponent of OpenEJB Design Definition Instantiates and assembles a configured, runnable, instance of the container system and all subcomponents. Vendors needing extreme control over the construction of the container system can get it by implementing this class. Doing this comes with large amounts ...
Design - BMP EntityBean Container
BMP EntityBean Container Implementation of Container Design Container Description Container that implements the EJB defined beancontainer contract for EntityBeans with beanmanaged persistence. Also Known As BMP Entity Container BMP Container Related Classes org.apache.openejb.core.entity.EntityContainer
Design - Classic Assembler
Classic Assembler Implementation of Assembler Design Assembler Description The standard assembler supported by the OpenEJB team. Uses metadata supplied via the Configuration Factory to create all components in the system. It is assumed the metadata has been checked and validated, all links ...
Design - CMP EntityBean Container
CMP EntityBean Container Implementation of Container Design Container Description Container that implements the beancontainer contract for CMP 1.1 and CMP 2.1 EntityBeans. The container adapts these old CMP EntityBeans to the new JPA Entity bean model and persists them using ...
Design - Configuration Factory
Configuration Factory Subcomponent of Classic Assembler Design Classic Assembler Definition Creates an instance of the OpenEjbConfiguration class that contains all the data and configuration information the Classic assembler needs to construct the container system. The object structure in the OpenEjbConfiguration class is refered ...
Design - Container
Container Subcomponent of OpenEJB Design Definition An Enterprise JavaBeans container enforce the containerbean contract for an EJB 1.1, 2.0, 2.1 or 3.0 bean type. Containers for custom containerbean contracts can also be created. Also Known As Container ...
Design - Local Server
Local Server Implementation of Application Server Design Application Server Description Allows for optimized interaction among beans and clients in the same virtual machine. Also Known As IntraVM IntraVM Server Related Packages org.apache.openejb.core.ivm
Design - Local ServerLinks
Design - Nova Configuration Factory
Nova Configuration Factory Implementation of Configuration Factory Design Configuration Factory Description Populates an OpenEjbConfiguration object by combining the data from an openejb.xml file, the ejbjar.xml and openejbjar.xml from deployed bean jars, and servicejar.xml containing OpenEJB service ...
Design - Passivation Strategy
Passivation Strategy Subcomponent of Stateful SessionBean Container Design Stateful SessionBean Container Definition Used by the Stateful Container to passivate and activate stateful session beans to a temporary storage. Responsibilities Store and retrieve instances Related Classes org.apache.openejb.core.stateful.PassivationStrategy Implementations Random ...
Design - Random Access File Passivater
Random Access File Passivater Implementation of Passivation Strategy Design Passivation Strategy Description A PassivationStrategy that bulk passivates bean instances to a random access file. Also Known As RAF Passivater Related Classes org.apache.openejb.core.stateful.RAFPassivater
Design - Remote Server
Remote Server Implementation of Application Server Design Application Server Description Distributes EJB interface implementations to remote clients using a conversational serializationbased protocol. Also Known As EJBd Protocol Related Classes org.apache.openejb.server.EjbDaemon Related Packages org.apache.openejb.client org.apache.openejb.server ...
Design - Remote ServerLinks
Design - Resource Manager
Resource Manager Subcomponent of OpenEJB Design Definition Provides the container with managed connections to transactional data sources required by beans Also Known As Connector Connection Manager Responsibilities Provides beans with connection handles Manages pysical connections Related Packages ...
Design - Security Service
Security Service Subcomponent of OpenEJB Design Definition Provides the container with an authenticated client identity. Also Known As Security Provider Responsibilities Authenticate the user in an implementation specific way Provides OpenEJB a reference to the current security identity of the client ...
Design - Simple Passivater
Simple Passivater Implementation of Passivation Strategy Design Passivation Strategy Description A PassivationStrategy that idividually passivates bean instances to a binary file. Related Classes org.apache.openejb.core.stateful.SimplePassivater
Design - Stateful SessionBean Container
Stateful SessionBean Container Implementation of Container Design Container Description Container that implements the EJB defined beancontainer contract for Stateful SessionBeans. Also Known As Stateful Session Container Stateful Container Related Classes org.apache.openejb.core.stateful.StatefulContainer Subcomponents Passivation Strategy Design ...
Design - Stateless SessionBean Container
Stateless SessionBean Container Implementation of Container Design Container Description Container that implements the EJB defined beancontainer contract for stateless SessionBeans. Also Known As Stateless Session Container Stateless Container Related Classes org.apache.openejb.core.stateless.StatelessContainer
Design - Transaction Service
Transaction Service Subcomponent of OpenEJB Design Definition Provides the container with transactional integrity. Also Known As Transaction Manager Responsibilities To give OpenEJB a reference to a valid implementation of javax.transaction.TransactionManager Related Classes org.apache.openejb.spi.TransactionService javax.transaction.TransactionManager
DesignLinks
http://openejb.apache.org/images/figureopenejb.gif
Developers
Developers Guide
Documentation

E

EJB 2.1 Compatibility Example
Overview In EJB 3.0, your bean's interfaces are not required to extend any specific set of interfaces and generally have no requirements on them at all. These are referred to in EJB spec lingo as Business Interfaces. In EJB 2.1 and prior, however, there were some pretty ...
EJB 3.0 Specification
Specification The EJB 3.0 specification can be downloaded from the JSR 220 http://www.jcp.org/en/jsr/detail?id=220 at the JCP (Java Community Process) website after clicking through the JCP's online agreement. The specification is very large ...
EJB Refs
Referencing a bean in another jar (with annotations) When using annotations to reference a bean from another ejb in your ear you have to supplement the @EJB reference with a small chunk of xml in the ejbjar.xml of the referring bean. So in ejb app A colorsApp.jar ...
ejb-local-ref
Via annotation package org.superbiz.refs; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.naming.InitialContext; @Stateless @EJB(name = "myFooEjb", beanInterface = FooLocal.class) public class MyEjbLocalRefBean implements MyBeanInterface { @EJB private BarLocal myBarEjb; public void someBusinessMethod() throws Exception ...
ejb-ref
Via annotation package org.superbiz.refs; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.naming.InitialContext; @Stateless @EJB(name = "myFooEjb", beanInterface = FooRemote.class) public class MyEjbRemoteRefBean implements MyBeanInterface { @EJB private BarRemote myBarEjb; public void someBusinessMethod() throws Exception ...
Embedded and Remotable
Overview This example shows how to use OpenEJB3's remoting capabilities in an embedded scenario. By remoting we mean that you wish to allow clients in other vms access your ejbs. Note, you do not need to go to this extreme to unit ...
Examples
EJB3 Examples All examples come with JUnit unit tests that can be run in any IDE, Maven or Ant without special plugins using OpenEJB as an embedded EJB container. The easiest way to run the examples in your IDE is to use ...
Examples Table
title description APIs used Simple Stateless Simple Stateless Example Simple EJB3 @Stateless bean with local and remote business interfaces and unit test. javax.ejb.Remote javax.ejb.Local javax.ejb.Stateless Simple Stateful Simple Stateful Example Simple EJB3 @Stateful ...

F

G

Getting Started
nbsp;The following instructions are written using Eclipse 3.2. We will refer to the install location of OpenEJB as OPENEJBHOME Here are some basic steps you need to perform to get started with OpenEJB # Download and install OpenEJB # Setup your development environment ...
Getting Started (D)

H

Hello World
page shows the basic steps required to create, build, and run an EJB and EJB client in its most minimum form. It does not hide steps or rely on special build tools or IDEs and is about the most stripped down you can ...
Helloworld Weblogic
Hibernate
Sample persistence.xml For a unit called "movieunit" using two datasources called "movieDatabase" and "movieDatabaseUnmanaged" the following persistence.xml would work.

I

Index
EJB 3.0 Applications ## EJB 3.0 Specification ## Callbacks ## Understanding Callbacks ## Security Annotations ## Transaction Annotations ## EJB Refs ## XML Overrides Annotations, XML and Defaults # Configuration ## Understanding the Directory Layout ## System Properties ## Deployments ## Containers and Resources ## MDB ...
Injection of DataSource Example
Overview In this example we use the @Resource annotation to inject a javax.sql.DataSource into our bean. The trickiest thing about injecting a DataSource is not declaring the annotation, but actually configuring the data source. In OpenEJB the rules are quite simple. An declaration like the following in code ...
Injection of EntityManager Example
Overview Shows use of @Resource to have an EntityManager with an EXTENDED persistence context injected into a @Stateful bean. An EJB 3 @Entity bean is used with the EntityManager to create, persist and merge data to a database. If you need to use a TRANSACTION ...
Injection of env-entry Example
Overview The EJB 3.0 spec added Dependency Injection as a main feature. The @Resource annotation can be used to inject several things including EntityManagers, DataSources, Topics, Queues, etc. Most of these are container supplied objects. It is possible, however, to supply your ...
Injection of other EJBs Example
Overview This example shows how to use the @EJB annotation in a bean class to refer to other beans. This functionality is often referred as dependency injection, and has been introduced in Java EE 5. In this particular example, we will create two session stateless ...
Interceptor Example
Introduction to the command line tools

J

Java EE Refs
JavaAgent
Adding a JavaAgent Adding a java agent is done via a vm parameter as follows: java javaagent:openejbjavaagent3.0beta2.jar \other params... The java agent is only required if using OpenJPA as your persistence provider or if using CMP. Maven2 In maven2 you can ...
JNDI Names
What's My Bean's JNDI Name? There are two things to keep in mind before you start reading: # OpenEJB provides a default JNDI name to your EJB. # You can customize the JNDI name. Default JNDI name The default JNDI ...
JPA Usage
Things to watch out for Critical: Always set jtadatasource and nonjtadatasource Always set the value of jtadatasource and nonjtadatasource in your persistence.xml file. Regardless if targeting your EntityManager usage for transactiontype="RESOURCELOCAL" or transactiontype="TRANSACTION", it's very difficult to guarantee one or the other ...

K

L

M

MDB Container
Here are the options for an MDB Container and the related Resource Adapter: # The resource adapter delivers messages to the container ResourceAdapter MyActiveMQResourceAdapter # Specifies the message listener interface handled by this container MessageListenerInterface javax.jms.MessageListener # Specifies ...

N

Navigation
Documentation Index Examples EJB 3.0 Specification EJB 3.0 Specification Callbacks Security Security Annotations Transactions Transaction Annotations EJB Refs Defaults Annotations, XML and Defaults Deployment Embedded Application discovery via the classpath Configured Deployments ...

O

Online Javadocs
openejb.xml
Overview The openejb.xml is the main configuration file for the container system and it's services such as transaction, security, and data sources. The format is a mix of xml and properties inspired by the format of the httpd configuration file. Basically: ...properties... Such as: OpenJPA
OpenJPA is bundled with OpenEJB as the default persistence provider. An example of working persistence.xml for OpenJPA: movieDatabase movieDatabaseUnmanaged

P

Properties Tool
Properties Command line Tool To see all configurable properties in use by OpenEJB, using the following tool against a running server: ./bin/openejb properties The output of this tool takes all overrideable components OpenEJB sees and outputs their properties along ...
Property Overriding
OpenEJB consists of several components (containers, resource adapters, security services, etc.) all of which are pluggable and have their own unique set of configurable properties. These components are required to specify their default property values in their servicejar.xml file. This means that at a minimum you ...

Q

QuickLinks
Home OPENEJB:Index Download OPENEJB:Download Lists OPENEJB:Mailing Lists

R

Resource Injection
Overview This example demonstrates the use of the injection of environment entries using @Resource annotation. The EJB 3.0 specification (EJB Core Contracts and Requirements) section 16.2.2 reads: A field or method of a bean class may be annotated to request that an entry from ...
resource-ref for DataSource
Via annotation package org.superbiz.refs; import javax.annotation.Resource; import javax.ejb.Stateless; import javax.naming.InitialContext; import javax.sql.DataSource; @Stateless @Resource(name = "myFooDataSource", type = DataSource.class) public class MyDataSourceRefBean implements MyBeanInterface { @Resource private DataSource myBarDataSource; public void someBusinessMethod ...

S

Security
Security How To. We've got basic username and password login which can be done with either the org.apache.openejb.client.LocalInitialContextFactory or org.apache.openejb.client.RemoteInitialContextFactory. You simply construct your InitialContext with the standard javax.naming.Context properties for user/pass info, which is: Properties props = new Properties ...
Security Annotations
page shows the correct usage of the security related annotations: javax.annotation.security.RolesAllowed javax.annotation.security.PermitAll javax.annotation.security.DenyAll javax.annotation.security.RunAs javax.annotation.security.DeclareRoles Basic idea By default all methods of a business interface are accessible, logged in or not The annotations go on the bean class, not the business interface Security annotations can ...
Service Locator
functionality of the openejb.jndiname.format JNDI Names allows for writing some really fun service locator code. Creating the exact layout you want using the exact data you want means you can create robust libraries for pulling things ...
Simple Stateful Example
Overview This example shows how to create a Stateful session EJB using annotations. A Stateful session bean is a session bean whose instances can maintain the conversational state with the client. The conversational state of the stateful session bean, which describes the conversation ...
Simple Stateless Example
Overview This example shows how to create a Stateless session EJB using annotations. As stated in the "JSR 220: Enterprise JavaBeansTM,Version 3.0 EJB Core Contracts and Requirements", "Stateless session beans are session beans whose instances have no conversational ...
Space Index
Spring
Bootstrapping OpenEJB in Spring If you wish to use OpenEJB inside Spring you can do so pretty easily. Include OpenEJB and its dependencies in your classpath as you would in a plain embedded scenario then add a custom factory like ...
Startup
NAME openejb start OpenEJB Remote Server SYNOPSIS openejb start #options NOTE The OpenEJB Remote Server can be started by running the openejb.bat script for windows and the openejb script for Linux and other Unix based OSes. Before running these scripts ...
Stateless Session Beans
System Properties
General properties openejb.assembler openejb.base openejb.home openejb.conf.file openejb.configuration openejb.deploymentId.format openejb.deployments.classpath.exclude openejb.deployments.classpath.include openejb.localcopy openejb.naming openejb.nobanner Overriding openejb.xml Anything in the openejb.xml file can be overridden via system properties of the format: D.= ..where id ...

T

Testing Security Example
Overview Builds upon the Injection of EntityManager Example but adds the use of @RolesAllowed and @PermitAll in the @Stateful bean to restrict who can perform create, persist and remove operations on the EntityManager. Shows a TestCase using the @RunAs annotation to execute and test the bean code ...
Testing Transactions Example
Overview Testing an EntityManager that uses the default, PersistenceContextType.TRANSACTION, can be challenging due to Entities detaching around transaction boundaries. If you were to take the Injection of EntityManager Example which uses an EXTENDED persistence context and switch it to a TRANSACTION persistence ...
Transaction Annotations
Transaction Annotations also see Testing Transactions Testing Transactions Example for an example of how to use and test EJB transaction attributes The javax.ejb.TransactionAttribute annotation (@TransactionAttribute) can be applied to a bean class or it's methods. Usage of the @TransactionAttribute requires you to specify ...

U

Understanding Callbacks
rules here are pretty hard to follow without examples. When they say one AroundInvoke per class they mean that in the most literal sense as in one individual java class definition, not including it's parent class or classes, may exactly one AroundInvoke ...
Understanding the Directory Layout
When freshly unpacked, OpenEJB will look like this: openejb3.0/ openejb3.0/logs/ openejb3.0/apps/ openejb3.0/lib/ openejb3.0/lib/ openejb3.0/LICENSE.txt openejb3.0/NOTICE.txt openejb3.0/README.txt openejb3.0/bin/ openejb3.0/bin/openejb.bat openejb3.0/bin/openejb openejb3.0/conf/ openejb3.0/conf/README.txt Directories bin/ Contains ...
Unit Testing Transactions
Basic setup Add the following interface and bean to your test sources (they could even be inner classes of a test case): Business interface public interface Caller Bean Implementation(s) import java.util.concurrent.Callable; @Stateless @TransactionAttribute(REQUIRESNEW) public class TransactionBean ...
Users
Users Guide
Table of Contents: # Getting Started # Understanding the Directory Layout # Introduction to the command line tools # OPENEJB:Persistence # Stateless Session Beans # OPENEJB:Stateful Session Beans # OPENEJB:Message Driven Beans # Configuring the Server ## Configure a DataSource Configuring DataSources ...

V

W

Wiki

X

Y

Z

!@#$

   

Apache OpenEJB is an project of The Apache Software Foundation (ASF)
Site Powered by Atlassian Confluence .
[ edit ]