After you have defined the component and its methods, you may need to configure the properties described here.
Configuring EJB component properties
If you are defining a stateful session bean, optionally switch to the Resources tab and enter a time limit in the Instance Timeout field. This value specifies how long, in seconds, that a client can hold an instance reference without making any calls. If you do not enter a value, or you specify 0, client references do not expire.
If creating an entity bean with container-managed persistence, configure the persistence settings as described in “Configuring automatic or EJB CMP persistence”.
Optionally configure the transaction properties for each method in the home and remote interfaces, or if all are the same, configure the component’s transaction properties. See “Component properties: Transactions” for more information.
If defining a version 2.0 or 1.1 EJB that calls other components, configure the properties described in “Configuring EJB references”.
If defining a version 2.0 or 1.1 EJB that uses database connections or JavaMail sessions, configure the properties described in “Configuring resource references”.
If defining a version 2.0 or 1.1 EJB, configure method security constraints as described in “Configuring role references and method permissions”.
If defining a version 2.0 EJB that calls other components, optionally configure the Run-As Identity properties to specify the identity used in intercomponent calls. See “Component properties: Run-As Identity” for more information.
If defining a version 2.0 EJB that uses JMS, configure the properties described in “Component properties: Resource Environment Refs”.
If defining a version 1.0 EJB that calls other components, configure the properties described in “Component properties: Run-As Mode”.
Optionally configure environment properties as described in “Configuring environment properties”.
Your EJB can use EJB references to instantiate proxies for other EJBs. You do not need to create references in order to invoke other EJBs from your code. However, doing so ensures that EJB references will be cataloged in the deployment descriptor if you export the EJB. There are two types of references:
Local references, for calls to EJB components hosted in the same server using the local home and local interfaces. To add or edit local references, follow the instructions in “Adding an EJB local reference”, or “Editing an EJB local reference”, respectively.
Remote references, for calls to components of any type using the component’s home and remote interfaces. To add or edit remote references, follow the instructions in “Adding an EJB reference”, or “Editing an EJB reference”, respectively.
Stubs used for EJB references must be in the custom
class list
You must list stubs used for intercomponent calls in the custom
class list for your component, as described in “Custom class lists for Java and EJB components”.
Resource references are used to obtain connector and database connections, and to access JMS connection factories, JavaMail sessions, and URL links.
Adding or editing a resource reference
Open the Component Properties dialog box.
Follow the instructions in “Adding a resource reference”, or “Editing a resource reference”.
To configure authorized access to an EJB 2.0 or 1.1 component, you must configure method permissions settings or call the isCallerInRole Java method to restrict access. See Chapter 2, “Securing Component Access,” in the EAServer Security Administration and Programming guide for more information.
Environment properties allow you to specify read-only data for use by an EJB. For example, you might use environment properties to tune the size of a data cache used in your implementation, or to specify the name of a log file. Use environment properties for any constant value that might change when the EJB is deployed to another server.
When coding your EJB, use JNDI to retrieve environment properties,
using the prefix java:comp/env
in
JNDI lookups.
When you export your EJB, the deployment descriptor catalogs the environment properties used by your servlets and JSPs, as well as each property’s Java datatype and default value. When the EJB is imported to another server, the deployer can override the default value for each environment property.
Environment properties for EJB 1.0 components
An EJB 1.0 component can only have environment properties
with datatype String, and these properties must
be configured in the Advanced window. Any property name that does
not begin with
com.sybase.jaguar.component
is considered
an environment property. In source code, use the EJBContext.getEnvironment method
to retrieve property values. You cannot use the JNDI InitialContext.lookup
method to retrieve these values.
Adding or editing an EJB environment property
Open the Component Properties dialog box.
Follow the instructions in “Adding an environment property”, or “Editing an environment property”.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |