Configuration Reference

The elements (defined by tags) of an XML document can include attributes, other elements, or both. The sections below include tables that describe those elements. In the Members column, element names are between < and > characters. Table 7-1 describes the meaning of the symbols in the Use column in the tables that describe an element’s members.

Table 7-1  Element usage symbols

Symbol in Use column

Meaning

Nothing

The tag or attribute is required by the parent tag.

?

The element or attribute can be omitted.

*

The element can be present zero or more times within the parent element.

+

The element must be present at least once within the parent element.

This chapter contains the following sections:

Elements of the Component-Managed Persistence Configuration File

The DTD for the CMPConfiguration.xml file is located at http://castor.exolab.org/mapping.dtd, and is shown in Listing 7-1.

Listing 7-1  DTD for CMPConfiguration.xml

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT mapping ( description?, include*, class*, key-generator* )>
 
<!ELEMENT include EMPTY>
<!ATTLIST include
    href  CDATA  #REQUIRED>
 
<!ELEMENT class ( description?, cache-type?, map-to?, field+ )>
<!ATTLIST class
    name            ID       #REQUIRED
    extends         IDREF    #IMPLIED
    depends         IDREF    #IMPLIED
    identity        CDATA    #IMPLIED
    access          ( read-only | shared | exclusive | db-locked )  "shared"
    key-generator   IDREF    #IMPLIED >
 
<!ELEMENT cache-type EMPTY>
<!ATTLIST cache-type
    type           ( none | count-limited | time-limited | unlimited ) "count-limited"
    capacity       NMTOKEN  #IMPLIED>
 
<!ELEMENT map-to EMPTY>
<!ATTLIST map-to
    table      NMTOKEN  #IMPLIED
    xml        NMTOKEN  #IMPLIED
    ns-uri     NMTOKEN  #IMPLIED
    ns-prefix  NMTOKEN  #IMPLIED
    ldap-dn    NMTOKEN  #IMPLIED
    ldap-oc    NMTOKEN  #IMPLIED>
 
<!ELEMENT field ( description?, sql?, bind-xml?, ldap? )>
<!ATTLIST field
    name           NMTOKEN  #REQUIRED
    type           NMTOKEN  #IMPLIED
    required       ( true | false )  "false"
    direct         ( true | false )  "false"
    lazy           ( true | false )  "false"
    get-method     NMTOKEN  #IMPLIED
    set-method     NMTOKEN  #IMPLIED
    create-method  NMTOKEN  #IMPLIED
    collection     ( array | vector | hashtable | collection | set | map )  #IMPLIED>
 
<!ELEMENT sql EMPTY>
<!ATTLIST sql
    name        NMTOKEN  #IMPLIED
    type        CDATA    #IMPLIED
    many-key    NMTOKEN  #IMPLIED
    many-table  NMTOKEN  #IMPLIED
    dirty  ( check | ignore )  "check">
 
<!ELEMENT bind-xml EMPTY>
<!ATTLIST bind-xml
    name  NMTOKEN  #IMPLIED
    type  NMTOKEN  #IMPLIED
    matches  NMTOKEN  #IMPLIED
    node  ( attribute | element | text )  #IMPLIED>
 
<!ELEMENT ldap EMPTY>
<!ATTLIST ldap
    name  NMTOKEN  #IMPLIED>
 
<!ELEMENT key-generator  ( param* )>
<!ATTLIST key-generator
          name   CDATA  #REQUIRED
          alias  CDATA  #IMPLIED>
 
<!ELEMENT param EMPTY>
<!ATTLIST param
          name   CDATA  #REQUIRED
          value  CDATA  #REQUIRED>
 
<!ELEMENT description ( #PCDATA )>

The following sections describe the elements of the CMPConfiguration.xml file.

bind-xml element

The attribute or element name and XML schema must be specified for all XML-dependent fields. The node attribute indicates whether the field maps to an attribute, another tag, or the textual content of this element. Only simple types (primitives, date, string, and so on) can be used for attribute values. In addition, only one field can be specified as the content model in a given object. Table 7-2 describes this element’s members.

Table 7-2  Members of the bind-xml element

Member

Use

Description

name

?

Table-column name.

type

?

matches

?

node

?

Value: attribute, element, or text.

cache-type element

This element tells the container how to cache instances of this enterprise bean. Table 7-3 describes the members of this element.

Table 7-3  Members of the cache-type element

Member

Use

Description

type

Value: none, count-limited, time-limited, or unlimited. Default = "count-limited".

capacity

?

The maximum number of instances of this bean the container is to create.

class element

This element describes the mapping between a Java class (enterprise bean implementation) and an SQL table, an XML element, an LDAP entry, or any other engine. To map a class into LDAP, you must specify an identity field.

A class is specified by its fully qualified name; for example, com.my.ejb.Person. If a class extends another class for which a mapping file exists, you should use the extends attribute to include the class being extended. Do not use the extends attribute to describe class inheritance that is not reflected in any mapping.

The class mapping specifies each field in the class that is mapped to a table column. Fields that are not mapped are not stored, read, or otherwise processed. Table 7-4 describes this element’s members.

Table 7-4  Members of the class element

Member

Use

Description

name

Class name.

extends

?

Implied by the persistence manager. It’s the name of the class this class extends. Used only if this class extends another class for which mapping information is provided.

depends

?

Implied by the persistence manager.

identity

?

Implied by the persistence manager.

access

Value: read-only, shared, exclusive or db-locked. Default = "shared".

key-generator

?

Name or alias of the key generator to use. Use only for classes with single-property, numeric ID fields. If your class uses a compound primary key or the primary key contains strings, you must use a custom key generator; that is, the bean itself must create the primary-key values. See key-generator element.

<description>

?

Optional class description.

<cache-type>

?

See cache-type element.

<map-to>

?

Used if the name of the element this class maps to is not the same as the name of the class. By default, the persistence manager infers the name of the element from the name of the class. For example, a class named SocialEvent is mapped to an element called social-event. See map-to element.

<field>

+

Describes the properties of an enterprise bean. See field element.

field element

This element specifies the mapping between a field in an enterprise bean’s and an SQL table column, an XML element or attribute, an LDAP attribute, and so on. Table 7-5 describes its members.

Table 7-5  Members of the field element

Member

Use

Description

name

Name of the enterprise bean’s field being mapped.

type

?

Java type of the field. For example, java.lang.Integer.

required

?

Value: true or false. Default = "false". Indicates whether the field is optional or required.

direct

?

Value: true or false. Default = "false".

lazy

?

Value: true or false. Default = "false".

get-method

?

Implied by the persistence manager.

set-method

?

Implied by the persistence manager.

create-method

?

Implied by the persistence manager.

collection

?

Value: array, vector, hashtable, collection, set, or map. Implied by the persistence manager.

<description>

?

Optional field description.

<sql>

?

See sql element.

<bind-xml>

?

See bind-xml element.

<ldap>

?

See ldap element.

The mapping is specified from the perspective of the bean’s implementation class. The field name is required even if no such field exists in the class in order to support field references. A field is an abstraction of an enterprise bean’s property: It can refer to a property directly (by mapping to a public instance variable that is not static or transient) or indirectly by using accessor methods.

Unless specified otherwise, the persistence manager accesses the field through get methods and set methods, whose names are derived from the field name. For example, for a field called lastName, the accessors String getName() and void setName(String) are used. Collection fields require only a get method, except an array requires both a get and a set method. If the accessors are specified through the get-method and set-method attributes, the persistence manager accesses the field only through those methods. The methods must be public and not static.

If the direct attribute is true, the field is accessed directly. The field must be public, not static, and not transient.

The type attribute indicates the type of the instance variable being mapped or the type of each element in a collection. You can use fully qualified class names or a short name, as Table 7-6 illustrates.

Table 7-6  Values for the type attribute of the field element for CMP beans

Short name

Fully qualified name

other

java.lang.Object

string

java.lang.String

integer

integer

long

long

boolean

boolean

double

double

float

float

big-decimal

java.math.BigDecimal

byte

byte

date

java.util.Date

short

short

char

char

bytes

byte[]

chars

char[]

strings

string[]

locale

java.lang.Locale

If the field is a collection, you specify the collection type through the collection attribute and the type of each element of the collection through the type attribute. Use the following table to determine the appropriate value for the collection attribute.

Table 7-7  Values for the collection attribute of the field element CMP beans

Collection attribute value

Type of collection

Default implementation

array

<type>[]

<type>[]

vector

java.util.Vector

java.util.Vector

hashtable

java.util.Hashtable

java.util.Hashtable

collection

java.util.Collection

java.util.Arraylist

set

java.util.Set

java.util.Hashset

map

java.util.Map

java.util.Hashmap

The “Default implementation” column indicates the type used when the object holding the collection is null and needs to be instantiated. For hashtable and map collections, the persistence manager adds an object with the put(Object, Object) method: The object added is both the key and the value.

Table 7-5 describes the members of the field element.

key-generator element

This element specifies parameters for the key generator (if needed). For example, to obtain sequential values from the table SEQTAB, use

<key-generator name="SEQUENCE">
    <param name="table" value="SEQTAB">
    <param name="global" value="0">
</key-generator>
<class key-generator="SEQUENCE">
    ...
</class>

If you have to use several key generators of the same type for the same data store, use aliases:

<key-generator name="SEQUENCE" alias="seq1">
    <param name="table" value="SEQTAB">
    <param name="global" value="0">
</key-generator>
<key-generator name="SEQUENCE" alias="seq2">
    <param name="table" value="SEQGLOBAL">
    <param name="global" value="1">
</key-generator>
<class key-generator="seq2">
    ...
</class>

Table 7-8 describes the members of the key-generator element.

Table 7-8  Members of the key-generator element

Member

Use

Description

name

Sequence-table name.

alias

?

Additional identifier for the key generator.

<param>

*

See param element.param element

Table 7-9 lists the key-generator names supported in the persistence manager.

Table 7-9  Key-generator names supported in the persistence manager

Name

Description

MAX

MAX generic algorithm: MAX(pk) + 1.

HIGH/LOW

HIGH/LOW generic algorithm.

UUID

UUID generic algorithm.

IDENTITY

Supports auto-increase identity fields in Sybase ASE/ASA, MS SQL Server, MySQL, and Hypersonic SQL.

SEQUENCE

Supports the SEQUENCE algorithm in Oracle, PostgreSQL, Interbase, and SAP DB.

ldap element

This element contains field mapping information for fields mapped to LDAP resources. Table 7-10 describes its members.

Table 7-10  Members of the ldap element

Member

Use

Description

name

?

LDAP-resource name.

map-to element

This element specifies the mapping between an enterprise bean and an SQL table. Table 7-11 describes the element’s members.

Table 7-11  Members of the map-to element

Members

Use

Description

table

?

SQL table name.

xml

?

ns-uri

?

ns-prefix

?

ldap-dn

?

ldap-oc

?

mapping element

This element is the root element of the entire file. It defines a collection of class mappings. Its members are described in Table 7-12.

Table 7-12  Members of the mapping element

Member

Use

Description

<description>

?

Optional description of the mapping.

<include>

*

Used to include other mappings in this mapping. The tag’s sole member is the href attribute, set to the URL that indicates the location of the mapping file.

<class>

*

See class element.

<key-generator>

*

See key-generator element.

param element

This element is used to provide named parameters to the containing element. Table 7-13 describes the members of this element.

Table 7-13  Members of the param element

Member

Use

Description

name

Parameter name.

value

Parameter value.

sql element

This element provides field mapping information that is relevant only for fields mapped to SQL tables. The type can be the proper Java-class type returned by the JDBC driver or the SQL type without precision; for example, "java.math.BigDecimal" or "numeric". However, the type could contain the parameter for the SQL-to-Java type convertors in square brackets; for example, "char[01]" for false=0, true=1 conversion from the boolean Java type to the char SQL type. Table 7-14 describes this element’s members.

Table 7-14  Members of the sql element

Member

Use

Description

name

?

Table-column name.

type

?

SQL type of the column.

many-key

?

many-table

?

dirty

?

Value: check or ignore. Default = "check".

Elements of the Transaction Manager Configuration File

The following sections describe the elements of the TransactionManagerConfiguration.xml file.

config element

The config element provides the configuration for a JDBC data source. Table 7-15 describes its members.

Table 7-15  Members of the config element

Member

Use

Description

<serverName>

Server name.

<portNumber>

Port number.

<databaseName>

?

Database name.

<driverType>

?

Driver type. Value: thin.

<user>

User ID.

<password>

Password.

connector element

The connector element specifies a database-connection factory. Table 7-16 describes its members.

Table 7-16  Members of the connector element

Member

Use

Description

<name>

Connector name.

<jar>

Connector JAR filename.

<paths>

?

Paths to additional JAR files and dependent files.

<config>

?

See config element.

<limits>

?

See limits element.

dataSource element

The dataSource element contains a specification for a JDBC data source. Table 7-17 describes the members of this element.

Table 7-17  Members of the dataSource element

Member

Use

Description

<name>

Data-source name.

<jar>

Data-source JAR filename.

<paths>

?

Paths to additional JAR files and dependent files.

<class>

Class name of the data-source implementation.

<config>

?

See config element.

<limits>

?

See limits element.

domain element

The domain element is the root element of the entire file. Table 7-18 describes the members of this element.

Table 7-18  Members of the domain element

Member

Use

Description

<name>

Domain name.

<maximum>

?

Maximum number of open transactions allowed.

<timeout>

?

Default timeout (in seconds) for transactions.

<resources>

?

See resources element.

limits element

The limits element provides resource limits for a data source or a connector. Table 7-19 describes its members.

Table 7-19  Members of the limits element

Member

Use

Description

<maximum>

?

Maximum number of connections allowed.

<minimum>

?

Minimum number of connections allowed.

<initial>

?

Initial pool size.

<maxRetain>

?

Maximum period (in seconds) to retain open connections.

<timeout>

?

Maximum timeout (in seconds) to wait for a new connection.

<trace>

?

Turns tracing on ("true") or off ("false").

resources element

The resources element is the top-level element of a list of JDBC data sources and JCA connectors. Table 7-20 describes the members of this element.

Table 7-20  Members of the resources element

Member

Use

Description

<dataSource>

*

See dataSource element.

<connector>

*

See connector element.

Elements of the Container Configuration File

The DTD for the deployment configuration file, openejb_config.dtd, is stored in /System/Library/WebObjects/JavaApplications/OpenEJBTool.woa/Contents/Resources. The DTD is also added to the Resources group of an enterprise-bean–client application project. The file is shown in Listing 7-2 . (You must never edit this file.)

Listing 7-2  DTD for OpenEJBConfiguration.xml

<?xml encoding="US-ASCII"?>
<!ELEMENT entity-bean (description?, display-name?, small-icon?,large-icon?,
ejb-deployment-id, home, remote, ejb-class, persistence-type, prim-key-class, reentrant,
cmp-field-name*, primkey-field?, jndi-enc?, security-role-ref*, query*)>
<!ELEMENT query (description?, method, query-statement)>
<!ELEMENT query-statement (#PCDATA)>
<!ELEMENT entity-container (class-name?, codebase?, description?, display-name?, container-name, properties?, entity-bean+)>
<!ELEMENT codebase (#PCDATA)>
<!ELEMENT class-name (#PCDATA)>
<!ELEMENT cmp-field-name (#PCDATA)>
<!ELEMENT connection-manager (connection-manager-id, class-name,properties?)>
<!ELEMENT connectors (connector*, connection-manager+)>
<!ELEMENT connector (connector-id, connection-manager-id, managed-connection-factory)>
<!ELEMENT connector-id (#PCDATA)>
<!ELEMENT connection-manager-id (#PCDATA)>
<!ELEMENT containers     (stateful-session-container|stateless-session-container|entity-container)+>
<!ELEMENT container-name (#PCDATA)>
<!ELEMENT container-system (containers, security-role*, method-permission*, method-transaction*)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT display-name (#PCDATA)>
<!ELEMENT ejb-class (#PCDATA)>
<!ELEMENT ejb-deployment-id (#PCDATA)>
<!ELEMENT ejb-ref-name (#PCDATA)>
<!ELEMENT home (#PCDATA)>
<!ELEMENT env-entry (env-entry-name, env-entry-type, env-entry-value)>
<!ELEMENT env-entry-name (#PCDATA)>
<!ELEMENT env-entry-type (#PCDATA)>
<!ELEMENT env-entry-value (#PCDATA)>
<!ELEMENT facilities (intra-vm-server, remote-jndi-contexts?, connectors?, services)>
<!ELEMENT remote-jndi-contexts (jndi-context+)>
<!ELEMENT jndi-context (jndi-context-id, properties)>
<!ELEMENT jndi-context-id (#PCDATA)>
<!ELEMENT ejb-ref (ejb-ref-name, home, ejb-ref-location)>
<!ELEMENT ejb-ref-location (ejb-deployment-id | (remote-ref-name, jndi-context-id))>
<!ELEMENT remote-ref-name (#PCDATA)>
<!ELEMENT factory-class (#PCDATA)>
<!ELEMENT intra-vm-server (proxy-factory, codebase?, properties?)>
<!ELEMENT jndi-enc (env-entry*, ejb-ref*, resource-ref*)>
<!ELEMENT large-icon (#PCDATA)>
<!ELEMENT logical-role-name (#PCDATA)>
<!ELEMENT managed-connection-factory (class-name, properties?)>
<!ELEMENT method (description?, ejb-deployment-id?, method-intf?, method-name, method-params?)>
<!ELEMENT method-intf (#PCDATA)>
<!ELEMENT method-name (#PCDATA)>
<!ELEMENT method-param (#PCDATA)>
<!ELEMENT method-params (method-param*)>
<!ELEMENT method-permission (description?, role-name+, method+)>
<!ELEMENT method-transaction (description?, method+, trans-attribute)>
<!ELEMENT openejb (container-system, facilities)>
<!ELEMENT persistence-type (#PCDATA) >
<!ELEMENT physical-role-name (#PCDATA)>
<!ELEMENT prim-key-class (#PCDATA)>
<!ELEMENT primkey-field (#PCDATA)>
<!ELEMENT properties (property+)>
<!ELEMENT property (property-name, property-value)>
<!ELEMENT property-name (#PCDATA)>
<!ELEMENT property-value (#PCDATA)>
<!ELEMENT proxy-factory (#PCDATA)>
<!ELEMENT reentrant (#PCDATA)>
<!ELEMENT role-mapping (logical-role-name+, physical-role-name+)>
<!ELEMENT role-name (#PCDATA)>
<!ELEMENT role-link (#PCDATA)>
<!ELEMENT remote (#PCDATA)>
<!ELEMENT res-auth (#PCDATA)>
<!ELEMENT res-id (#PCDATA)>
<!ELEMENT res-ref-name (#PCDATA)>
<!ELEMENT res-type (#PCDATA)>
<!ELEMENT resource-ref (description?, res-ref-name, res-type, res-auth, (res-id | properties | connector-id))>
<!ELEMENT resource (description?, res-id, properties)>
<!ELEMENT security-role (description?, role-name)>
<!ELEMENT security-role-ref (description?, role-name, role-link)>
<!ELEMENT security-service (description?, display-name?, service-name, factory-class, codebase?,properties?, role-mapping*)>
<!ELEMENT security-service-name (#PCDATA)>
<!ELEMENT services (security-service, transaction-service)>
<!ELEMENT service-name (#PCDATA)>
<!ELEMENT small-icon (#PCDATA)>
<!ELEMENT stateful-bean (description?, display-name?, small-icon?,large-icon?, ejb-deployment-id, home, remote, ejb-class, transaction-type, jndi-enc?, security-role-ref*)>
<!ELEMENT stateless-bean (description?, display-name?, small-icon?,large-icon?, ejb-deployment-id, home, remote, ejb-class, transaction-type, jndi-enc?, security-role-ref*)>
<!ELEMENT stateful-session-container (codebase?, description?, display-name?, container-name, properties?, stateful-bean+)>
<!ELEMENT stateless-session-container (codebase?, description?, display-name?, container-name, properties?, stateless-bean+)>
<!ELEMENT transaction-service (description?, display-name?, service-name, factory-class, codebase?, properties?) >
<!ELEMENT transaction-service-name (#PCDATA)>
<!ELEMENT transaction-type (#PCDATA)>
<!ELEMENT trans-attribute (#PCDATA)>

The following sections describe the elements of the OpenEJBConfiguration.xml file.

connection-manager element

This element specifies a connection manager. Table 7-21 describes its members.

Table 7-21  Members of the connection-manager element

Member

Use

Description

<connection-manager-id>

Name of the connection manager.

<class-name>

Class name of the data source.

<properties>

Properties required by the data source.

connector element

This element defines a connector. Table 7-22 describes its members.

Table 7-22  Members of the connector element

Member

Use

Description

<connector-id>

Name of the connector.

<connection-manager-id>

Specifies a connection manager. See connection-manager element.

<managed-connection-factory>

*

See managed-connection-factory element.

connectors element

This element encloses connectors or connection managers. Table 7-23 describes its members.

Table 7-23  Members of the connectors element

Member

Use

Description

<connector>

*

See connector element.

<connection-manager>

+

See connection-manager element.

container-system element

This element delimits the container configuration section of the deployment configuration file. Table 7-24 describes its members.

Table 7-24  Members of the container-system element

Member

Use

Description

<containers>

See dataSource element.

<security-role>

+

See connector element.

<method-permission>

+

Assigns a logical role to methods of the enterprise beans defined in the containers element.

<method-transaction>

+

Specifies a method’s transaction attribute.

containers element

This element encloses containers for the three types of enterprise beans: stateless session beans, stateful session beans, and entity beans. Table 7-25 describes its members.

Table 7-25  Members of the containers element

Member

Use

Description

<stateful-session-container><stateless-session-container><entity-container>

+

At least one of these items must be present.

ejb-ref element

This element defines a reference to a bean so that the bean can be accessed using JNDI calls. Table 7-26 describes its members.

Table 7-26  Members of the ejb-ref element

Member

Use

Description

<ejb-ref-name>

JNDI name for the bean. For example, ejb/agent/Agent.

<home>

Home interface of the bean. For example, webobjectsexamples.realestate.agent.AgentHome.

<ejb-ref-location>

See ejb-ref-location element.

ejb-ref-location element

This element identifies a bean through its name (using its <ejb-deployment-id> member) or through its remote interface and JNDI context ID. Table 7-27 describes its members.

Table 7-27  Members of the ejb-ref-location element

Member

Use

Description

<ejb-deployment-id> or (<remote-ref-name>, <jndi-context-id>)

Either <ejb-deployment-id> or <remote-ref-name> and <jndi-context-id> must be specified.

entity-bean element

This element defines an entity session bean. Table 7-28 describes its members.

Table 7-28  Members of the entity-bean element

Member

Use

Description

<description>

?

Description for the bean.

<display-name>

?

<small-icon>

?

<large-icon>

?

<ejb-deployment-id>

Name of the bean.

<home>

Home interface (for example, com.my.ejb.PersonHome).

<remote>

Remote interface (for example, com.my.ejb.Person).

<ejb-class>

Implementation class (for example, com.my.ejb.PersonBean).

<persistence-type>

Value: Container or Bean.

<prim-key-class>

Fully qualified class name of the primary key.

<reentrant>

Value: true or false. Should be false.

<cmp-field-name>

*

Container-managed–persistence field name.

<primkey-field>

?

Primary-key field name.

<jndi-enc>

?

See jndi-enc element.

<security-role-ref>

*

See security-role-ref element.

<query>

*

Specifies a query for a finder method.

entity-container element

This element defines an entity-bean container and encloses the definition of entity beans. Table 7-29 describes its members.

Table 7-29  Members of the entity-container element

Member

Use

Description

<codebase>

?

<description>

?

Description of the container.

<display-name>

?

<container-name>

Name for the container.

<properties>

?

Used to tell the container how to handle instances of entity beans. See properties element.

<entity-bean>

+

Entity bean definitions. See entity-bean element.

env-entry element

This element defines an environment variable and its value (which can be accessed by other beans through JNDI). Table 7-30 describes its members.

Table 7-30  Members of the env-entry element

Member

Use

Description

<env-entry-name>

Name of the variable.

<env-entry-type>

Java type of the variable.

<env-entry-value>

Value for the variable.

facilities element

This element specifies the runtime environment: proxy-generation attributes, remote JNDI contexts, data-store connections, and J2EE services. You should not change the information within <facilities> and </facilities> tags. Table 7-31 describes its members.

Table 7-31  Members of the facilities element

Member

Use

Description

<intra-vm-server>

<remote-jndi-contexts>

?

<connectors>

?

<services>

jndi-context element

This element defines one external JNDI context to be used by the application. Table 7-32 describes its members.

Table 7-32  Members of the jndi-context element

Member

Use

Description

<jndi-context-id>

Name of the JNDI context.

<properties>

Required properties.

jndi-enc element

This element encloses naming information so that this bean can be located through JNDI. Table 7-33 describes the members of the jndi-enc element.

Table 7-33  Members of the jndi-enc element

Member

Use

Description

<env-entry>

*

<ejb-ref>

*

Defines a reference to this bean. See ejb-ref element.

<resource-ref>

*

Defines the bean’s data source. See resource-ref element.

intra-vm-server element

This element specifies the dynamic factory proxy to use to create client proxies of the real EJB objects. Table 7-34 describes its member.

Table 7-34  Member of the intra-vm-server element

Member

Use

Description

<proxy-factory>

Dynamic proxy factory. Values: org.openejb.util.proxy.jdk13.Jdk13ProxyFactory or org.openejb.util.proxy.DynamicProxy.

managed-connection-factory element

This element defines a managed-connection factory. Table 7-35 describes its members.

Table 7-35  Members of the managed-connection-factory element

Member

Use

Description

<class-name>

Class name of the data source.

<properties>

?

Properties required by the data source.

method element

This element specifies a home or remote interface method of an enterprise bean. Table 7-36 describes its members.

Table 7-36  Members of the method element

Member

Use

Description

<description>

?

Description for the method.

<ejb-deployment-id>

?

Must specify the ID (name) of one of the enterprise beans declared in the container-system element. If this element isn’t specified, this method declaration applies to all matching bean methods (home and remote interfaces) of all the enterprise beans defined in the <container-system> tag.

<method-intf>

?

Value: Home or Remote. Distinguishes between a method with the same signature that is defined in both the home interface and the remote interface.

<method-name>

Specifies the method name.

<method-params>

?

Identifies a single method among multiple methods with an overloaded method name. If the method takes no input arguments, this element can be empty or omitted.

These are examples of the three possible styles of the method element’s syntax:

  • Referring to all the methods (home interfaces and remote interfaces) defined within the <container-system> tag:

    <method>
        <method-name>*</method-name>
    </method>
  • Referring to a specific method defined within the <container-system> tag:

    <method>
        <method-name>METHOD</method-name>
    </method>
  • Referring to a single method within a set of methods (home interfaces and remote interfaces) with an overloaded name:

    <method>
        <method-name>METHOD</method-name>
        <method-params>
            <method-param>PARAM-1</method-param>
            <method-param>PARAM-2</method-param>
                    ...
            <method-param>PARAM-n</method-param>
        </method-params>
    </method>

method-params element

This element is used when further identification of a method is needed due to method-name overloading. Table 7-37 describes its members.

Table 7-37  Members of the method-params element

Member

Use

Description

<method-param>

*

Fully qualified Java type. Specify arrays by following the array element’s type with one or more pairs of square brackets (for example, int[]).

method-permission element

This element maps security roles to methods. Table 7-38 describes its members.

Table 7-38  Members of the method-permission element

Member

Use

Description

<description>

?

Description for the method permission.

<role-name>

+

Logical role name corresponding to a security-role element.

<method>

+

See method element.

method-transaction element

This element specifies how the container manages transaction scopes when delegating a method invocation to an enterprise bean’s implementation class. Table 7-39 describes its members.

Table 7-39  Members of the method-transaction element

Member

Use

Description

<description>

?

Description for the method and the transaction.

<method>

+

Methods to apply the transaction type to.

<trans-attribute>

Value: NotSupported, Supports, Required, RequiresNew, Mandatory, Never, or Bean.

openejb element

This is the root tag of the deployment configuration file. Table 7-40 describes its members.

Table 7-40  Members of the openejb element

Member

Use

Description

<container-system>

See container-system element.

<facilities>

See facilities element.

properties element

This element encloses a set of property-value definitions. Table 7-41 describes its members.

Table 7-41  Member of the properties element

Member

Use

Description

<property>

See property element.

property element

This element encloses a property-value definition. Table 7-42 describes its members.

Table 7-42  Members of the property element

Member

Use

Description

<property-name>

The name of the property.

<property-value>

The value for the property.

query element

This element can be used to declare a query statement and bind it to a specific finder method. The value can be retrieved using the org.openejb.core.DeploymentInfo.getQuery method. Table 7-43 describes this element’s members.

Table 7-43  Members of the query element

Member

Use

Description

<description>

?

Description for the query.

<method>

The ejb-deployment-id element of the method element is ignored (should not be used). See method element.

<query-statement>

*

SQL statement.

remote-jndi-contexts element

This element groups external JNDI contexts. Table 7-44 describes its members.

Table 7-44  Members of the remote-jndi-contexts element

Member

Use

Description

<jndi-context>

+

See jndi-context element.

resource element

This element defines a resource. Table 7-45 describes its members.

Table 7-45  Member of the resource element

Member

Use

Description

<description>

?

Description for the resource.

<res-id>

Maps this resource to a connector-id element in the corresponding connectors element.

<properties>

See properties element.

resource-ref element

This element specifies a reference to an external resource. Table 7-46 describes its members.

Table 7-46  Members of the resource-ref element

Member

Use

Description

<description>

?

Description for the resource.

<res-ref-name>

Specifies the name of a resource manager connection-factory reference (for example, comp/env/jdbc/Employee).

<res-type>

Specifies the type of the data source, that is, the Java class or interface expected to be implemented by the data-store engine; for example, javax.sql.DataSource.

<res-auth>

Value: Application or Container. Specifies who signs on to the resource manager, the enterprise bean or the container.

<res-id> or <connector-id> or <properties>

You can map this resource reference to a resource, a connector, or to a set of properties.

This is an example of a <resource-ref> definition using properties:

<resource-ref>
    <res-ref-name>comp/env/jdbc/Employee</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    <properties>
        <property>
            <property-name>url</property-name>
            <property-value>jdbc:odbc:orders</property-value>
        </property>
        <property>
            <property-name>username</property-name>
            <property-value>Admin</property-value>
        </property>
        <property>
            <property-name>password</property-name>
            <property-value></property-value>
        </property>
    </properties>
</resource-ref>

role-mapping element

This element maps a logical security role to a physical security role. Table 7-47 describes its members.

Table 7-47  Members of the role-mapping element

Member

Use

Description

<logical-role-name>

+

Logical security-role name.

<physical-role-name>

+

Physical security-role name.

security-role element

This element defines a logical role name. Table 7-48 describes its members.

Table 7-48  Members of the security-role element

Member

Use

Description

<description>

?

Description of the logical role.

<role-name>

Logical role name; for example, everyone or admin.

security-role-ref element

This element specifies a security-role reference. Table 7-49 describes its members

Table 7-49  Members of the security-role-ref element

Member

Use

Description

<description>

?

Description of the security role.

<role-name>

Security-role name used in code. It must be the String used as the argument in the invocation of the isCallerInRole(String) method of EJBContext.

<role-link>

Name of a security role (security-role element). Links this security-role reference to a defined security role. See security-role element.

security-service element

This element defines a security service. Table 7-50 describes its members.

Table 7-50  Members of the security-service element

Member

Use

Description

<description>

?

Description of the service.

<display-name>

?

<service-name>

?

Name of the service.

<factory-class>

Name of the factory class for the service.

<codebase>

?

<properties>

?

Properties needed by the service.

<role-mapping>

+

See role-mapping element.

services element

This element encloses services used by the container. Table 7-51 describes its members.

Table 7-51  Members of the services element

Member

Use

Description

<security-service>

Description of the services.

<transaction-service>

*

See transaction-service element.

stateful-bean element

This element defines a stateful session bean. Table 7-52 describes its members.

Table 7-52  Members of the stateful-bean element

Member

Use

Description

<description>

?

Description for the bean.

<display-name>

?

<small-icon>

?

<large-icon>

?

<ejb-deployment-id>

Name of the bean; for example, HelloBean.

<home>

Home interface; for example, com.my.ejb.HelloHome.

<remote>

Remote interface; for example, com.my.ejb.Hello.

<ejb-class>

Implementation class; for example, com.my.ejb.HelloBean.

<transaction-type>

Value: Container or Bean.

<jndi-enc>

?

See jndi-enc element.

<security-role-ref>

*

See security-role-ref element.

stateful-session-container element

This element defines a stateful session bean container and encloses the definitions of stateful session beans. Table 7-53 describes its members.

Table 7-53  Members of the stateful-session-container element

Member

Use

Description

<codebase>

?

<description>

?

Description of the container.

<display-name>

?

<container-name>

Name for the container.

<properties>

?

Used to tell the container how to handle instances of stateful session beans. See properties element.

<stateful-bean>

+

Stateful bean definitions. See stateful-bean element.

stateless-bean element

This element defines a stateless session bean. Table 7-54 describes its members.

Table 7-54  Members of the stateless-bean element

Member

Use

Description

<description>

?

<display-name>

?

<small-icon>

?

<large-icon>

?

<ejb-deployment-id>

Name of the bean.

<home>

Home interface; for example, com.my.ejb.HelloHome.

<remote>

Remote interface; for example, com.my.ejb.Hello.

<ejb-class>

Implementation class; for example, com.my.ejb.HelloBean.

<transaction-type>

Value: Container or Bean.

<jndi-enc>

?

See jndi-enc element.

<security-role-ref>

*

See security-role-ref element.

stateless-session-container element

This element defines a stateless session bean container and encloses the definitions of stateless session beans. Table 7-55 describes its members.

Table 7-55  Members of the stateless-session-container element

Member

Use

Description

<codebase>

?

<description>

?

Description of the container.

<display-name>

?

<container-name>

<properties>

?

Used to tell the container how to handle instances of stateless session beans. See properties element.

<stateless-bean>

+

Stateless bean definitions. See stateless-bean element.

transaction-service element

This element defines a transaction service. Table 7-56 describes its members.

Table 7-56  Members of the transaction-service element

Member

Use

Description

<description>

?

Description of the transaction service.

<display-name>

?

<service-name>

Name of the transaction service.

<factory-class>

Name of the factory class for the service.

<codebase>

?

<properties>

?

Properties needed by the service.