Saturday, May 21, 2011

Building and Deploying EJBs

Writing the EJB:

  • EJB must provide three required classes:
    • EJB implementation Class
    • Home Interface
    • Remote Interface
  • Each EJB must provided with a deployment descriptor
  • The deployment descriptor is serialized instance of a Java class that contains information about how to deploy the bean.
  • Two flavors of deployment descriptors:
    • Session Descriptors – apply to Session EJBs
    • Entity Descriptors – apply to Entity EJBs
  • A Deployment Descriptor contains information such as the following:
    • The name of the EJB Class
    • The name of the EJB Home Interface
    • The name of the EJB Remote Interface
    • ACLs of entities authorized to use each class or method.
    • For Entity Beans, a list of container – managed fields.
    • For Session Beans, a value denoting whether the bean is stateful or stateless.
  • Properties File may be generated, which contains environment properties that will be activated during runtime.
  • Manifest File is needed to create the ejb-jar file, which is the medium used to distribute EJBs.

    Name :

    Enterprise-Bean:True

Deploying the EJBs:

  • At the deployment time, the EJB container must read the ejb-jar file, create implementations for the home and remote interfaces.
  • Reads the deployment-descriptor and ensures that the bean has what it wants and ad the bean’s property settings to the environment so that they’re available to the bean at runtime.

Connecting to the EJB

  • The client can use either RMI or CORBA to connect to the EJB
  • The client looks up the EJB’s home interface using a naming service (JNDI or COS)
  • Invokes a find() or create() method on the home interface to get a reference to an EJB object.
  • And then uses the EJB object as if it were an ordinary object.

No comments:

Post a Comment