Chapter 7 Creating Enterprise JavaBeans Components
After you have defined the component and its methods, you may need to configure the properties described here.
Configuring EJB component 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:
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
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
| Copyright (C) 2004. Sybase Inc. All rights reserved. |
| |