Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Enterprise JavaBeans™ Specification, Version 2.0 - Sun Microsystems.pdf
Скачиваний:
14
Добавлен:
24.05.2014
Размер:
2.71 Mб
Скачать

Sun Microsystems Inc

The responsibilities of the bean provider

Enterprise JavaBeans 2.0, Public Draft

Message-driven Bean Component Contract

Figure 63 OID for a container removing an instance of MESSAGE-DRIVEN bean from ready pool

container-provided classes

container messagesynchroinstance transaction driven nization service context

ejbRemove()

14.7 The responsibilities of the bean provider

This section describes the responsibilities of the message-driven bean provider to ensure that a mes- sage-driven bean can be deployed in any EJB Container.

14.7.1 Classes and interfaces

The message-driven bean provider is responsible for providing the following class files:

Message-driven bean class.

14.7.2 Message-driven bean class

The following are the requirements for the message-driven bean class:

The class must implement, directly or indirectly, the javax.ejb.MessageDrivenBean interface.

The class must be defined as public, must not be final, and must not be abstract.

The class must have a public constructor that takes no arguments. The Container uses this constructor to create instances of the message-driven bean class.

The class must not define the finalize() method.

291

5/31/00

Sun Microsystems Inc.

Message-driven Bean Component Contract

Enterprise JavaBeans 2.0, Public Draft

The responsibilities of the bean provider

The class must implement the ejbCreate() method.

The message-driven bean class may have superclasses and/or superinterfaces. If the message-driven bean has superclasses, the ejbCreate method, and the methods of the MessageDrivenBean interface may be defined in the message-driven bean class, or any of its superclasses.

The message-driven bean class is allowed to implement other methods (for example, helper methods invoked internally by the onMessage method) in addition to the methods required by the EJB specification.

14.7.3 ejbCreate method

The message-driven bean class must define one ejbCreate() method whose signature must follow these rules:

The method name must be ejbCreate.

The method must be declared as public.

The method must not be declared as final or static.

The return type must be void.

The method must have no arguments.

The throws clause must not define any application exceptions.

14.7.4 onMessage method

The message-driven bean class must define one onMessage method whose signature must follow these rules:

The method must be declared as public.

The method must not be declared as final or static.

The return type must be void.

The method must have a single argument of type javax.jms.Message.

The throws clause must not define any application exceptions.

14.7.5 ejbRemove method

The message-driven bean class must define one ejbRemove() method whose signature must follow these rules:

5/31/00

292