home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book Home Java Enterprise in a Nutshell Search this book

Chapter 20. The javax.ejb.deployment Package

The javax.ejb.deployment package defines classes used by EJB containers to encapsulate information about EJB objects. An EJB container should provide a tool that creates an instance of the EntityDescriptor or SessionDescriptor class for a bean, initializes its fields, and then serializes that initialized instance. Then, when the bean is deployed into the EJB container, the container reads the serialized deployment descriptor class and its properties to obtain configuration information for the bean. Figure 20-1 shows the class hierarchy of this package.

figure

Figure 20-1. The javax.ejb.deployment package class hierarchy

AccessControlEntryEJB 1.0
javax.ejb.deploymentserializable

This is a serializable class that represents a security-related entry within a bean deployment descriptor. Each AccessControlEntry included within a DeploymentDescriptor specifies a list of identities, in the form of java.security.Identity objects, that should have access to a particular method on a bean. If there is no method set for the entry, the entry is considered the default access control entry for the entire bean, listing which identities should have access to the bean. Any method on a bean without its own AccessControlEntry object uses the default entry for access control.

public class AccessControlEntry implements Serializable {
// Public Constructors
public AccessControlEntry ();
public AccessControlEntry (java.lang.reflect.Method method);
public AccessControlEntry (java.lang.reflect.Method method, java.security.Identity[ ] identities);
// Public Instance Methods
public java.security.Identity[ ] getAllowedIdentities (); default:null
public java.security.Identity getAllowedIdentities (int index);
public java.lang.reflect.Method getMethod (); default:null
public void setAllowedIdentities (java.security.Identity[ ] values);
public void setAllowedIdentities (int index, java.security.Identity value);
public void setMethod (java.lang.reflect.Method value);
}

Hierarchy: Object-->AccessControlEntry(Serializable)

Passed To: DeploymentDescriptor.setAccessControlEntries()

Returned By: DeploymentDescriptor.getAccessControlEntries()

ControlDescriptorEJB 1.0
javax.ejb.deploymentserializable

A ControlDescriptor is a component of a DeploymentDescriptor that specifies how a container should manage the transaction and security features for a specific method on a bean. If no method is specified in the ControlDescriptor, the features apply by default to all methods on the bean, unless a method has its own ControlDescriptor.

The methods on the ControlDescriptor let you specify the transaction isolation level (using the constant TRANSACTION_XXX members of the class), the identity under which to run the method, the run-as mode (CLIENT_IDENTITY, SPECIFIED_IDENTITY, or SYSTEM_IDENTITY), and how transactions should be managed for the method (using the TX_XXX constants).

public class ControlDescriptor implements Serializable {
// Public Constructors
public ControlDescriptor ();
public ControlDescriptor (java.lang.reflect.Method method);
// Public Constants
public static final int CLIENT_IDENTITY ; =0
public static final int SPECIFIED_IDENTITY ; =1
public static final int SYSTEM_IDENTITY ; =2
public static final int TRANSACTION_READ_COMMITTED ; =2
public static final int TRANSACTION_READ_UNCOMMITTED ; =1
public static final int TRANSACTION_REPEATABLE_READ ; =4
public static final int TRANSACTION_SERIALIZABLE ; =8
public static final int TX_BEAN_MANAGED ; =1
public static final int TX_MANDATORY ; =5
public static final int TX_NOT_SUPPORTED ; =0
public static final int TX_REQUIRED ; =2
public static final int TX_REQUIRES_NEW ; =4
public static final int TX_SUPPORTS ; =3
// Public Instance Methods
public int getIsolationLevel (); default:2
public java.lang.reflect.Method getMethod (); default:null
public java.security.Identity getRunAsIdentity (); default:null
public int getRunAsMode (); default:1
public int getTransactionAttribute (); default:3
public void setIsolationLevel (int value);
public void setMethod (java.lang.reflect.Method value);
public void setRunAsIdentity (java.security.Identity value);
public void setRunAsMode (int value);
public void setTransactionAttribute (int value);
}

Hierarchy: Object-->ControlDescriptor(Serializable)

Passed To: DeploymentDescriptor.setControlDescriptors()

Returned By: DeploymentDescriptor.getControlDescriptors()

DeploymentDescriptorEJB 1.0
javax.ejb.deploymentserializable

DeploymentDescriptor is a serializable class that contains all the parameters that tell an EJB container how to deploy and manage a bean. A serialized DeploymentDescriptor object is packaged with the relevant classes for an EJB object when it is deployed within an EJB container. The container deserializes the DeploymentDescriptor object and reads the deployment information from it.

This abstract base class defines deployment properties that apply to any type of bean; the SessionDescriptor and EntityDescriptor subclasses define additional properties specific to deploying session beans and entity beans.

The DeploymentDescriptor provides access to a list of AccessControlEntry objects that specify the access levels for the methods on the bean, as well as a list of ControlDescriptor objects that specify how transactions and security features should be handled for specific methods on the bean. The descriptor also contains the class names for the bean implementation class, its home interface, and its remote interface, as well as a boolean flag that indicates whether the bean is reentrant.

public abstract class DeploymentDescriptor implements Serializable {
// Public Constructors
public DeploymentDescriptor ();
// Public Instance Methods
public AccessControlEntry[ ] getAccessControlEntries ();
public AccessControlEntry getAccessControlEntries (int index);
public javax.naming.Name getBeanHomeName ();
public ControlDescriptor[ ] getControlDescriptors ();
public ControlDescriptor getControlDescriptors (int index);
public String getEnterpriseBeanClassName ();
public java.util.Properties getEnvironmentProperties ();
public String getHomeInterfaceClassName ();
public boolean getReentrant ();
public String getRemoteInterfaceClassName ();
public boolean isReentrant ();
public void setAccessControlEntries (AccessControlEntry[ ] values);
public void setAccessControlEntries (int index, AccessControlEntry value);
public void setBeanHomeName (javax.naming.Name value);
public void setControlDescriptors (ControlDescriptor[ ] value);
public void setControlDescriptors (int index, ControlDescriptor value);
public void setEnterpriseBeanClassName (String value);
public void setEnvironmentProperties (java.util.Properties value);
public void setHomeInterfaceClassName (String value);
public void setReentrant (boolean value);
public void setRemoteInterfaceClassName (String value);
// Protected Instance Fields
protected int versionNumber ;
}

Hierarchy: Object-->DeploymentDescriptor(Serializable)

Subclasses: EntityDescriptor, SessionDescriptor

EntityDescriptorEJB 1.0
javax.ejb.deploymentserializable

This extension of DeploymentDescriptor adds deployment properties specific to entity beans. It contains a list of bean properties whose persistence should be managed by the container, as well as the name of the bean's primary key class.

public class EntityDescriptor extends DeploymentDescriptor {
// Public Constructors
public EntityDescriptor ();
// Public Instance Methods
public java.lang.reflect.Field[ ] getContainerManagedFields (); default:null
public java.lang.reflect.Field getContainerManagedFields (int index);
public String getPrimaryKeyClassName (); default:""
public void setContainerManagedFields (java.lang.reflect.Field[ ] values);
public void setContainerManagedFields (int index, java.lang.reflect.Field value);
public void setPrimaryKeyClassName (String value);
}

Hierarchy: Object-->DeploymentDescriptor(Serializable)-->EntityDescriptor

SessionDescriptorEJB 1.0
javax.ejb.deploymentserializable

This extension of DeploymentDescriptor class adds deployment properties specific to session beans. Included are the bean's timeout period and whether it's stateful or stateless.

public class SessionDescriptor extends DeploymentDescriptor {
// Public Constructors
public SessionDescriptor ();
// Public Constants
public static final int STATEFUL_SESSION ; =1
public static final int STATELESS_SESSION ; =0
// Public Instance Methods
public int getSessionTimeout (); default:0
public int getStateManagementType (); default:1
public void setSessionTimeout (int value);
public void setStateManagementType (int value);
}

Hierarchy: Object-->DeploymentDescriptor(Serializable)-->SessionDescriptor



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.