01: /**
02: * EasyBeans
03: * Copyright (C) 2006 Bull S.A.S.
04: * Contact: easybeans@ow2.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * --------------------------------------------------------------------------
22: * $Id: MDBInterface00.java 1970 2007-10-16 11:49:25Z benoitf $
23: * --------------------------------------------------------------------------
24: */package org.ow2.easybeans.tests.common.ejbs.mdb.containermanaged.mdbinterface;
25:
26: import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.UNDEFINED;
27: import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.OperationType.MESSAGE_DRIVEN_CONTEXT;
28:
29: import javax.ejb.ActivationConfigProperty;
30: import javax.ejb.EJBException;
31: import javax.ejb.MessageDriven;
32: import javax.ejb.MessageDrivenBean;
33: import javax.ejb.MessageDrivenContext;
34: import javax.jms.Message;
35: import javax.jms.MessageListener;
36:
37: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.BaseInsertOperation;
38: import org.ow2.easybeans.tests.common.jms.JMSManager;
39:
40: /**
41: * This bean test optional MessageDrivenBean interface.
42: * @author Eduardo Studzinski Estima de Castro
43: * @author Gisele Pinheiro Souza
44: */
45: @MessageDriven(messageListenerInterface=MessageListener.class,activationConfig={@ActivationConfigProperty(propertyName="destinationType",propertyValue="javax.jms.Queue"),@ActivationConfigProperty(propertyName="destination",propertyValue=JMSManager.DEFAULT_QUEUE),@ActivationConfigProperty(propertyName="messageSelector",propertyValue="TYPE = 'org.ow2.easybeans.tests.common.ejbs.mdb.containermanaged.mdbinterface.MDBInterface00'")})
46: public class MDBInterface00 extends BaseInsertOperation implements
47: MessageDrivenBean {
48:
49: /**
50: * Message type.
51: */
52: public static final String MESSAGE_TYPE = "org.ow2.easybeans.tests.common.ejbs.mdb."
53: + "containermanaged.mdbinterface.MDBInterface00";
54:
55: /**
56: * ID.
57: */
58: private static final long serialVersionUID = 4108218174206348937L;
59:
60: /**
61: * Context.
62: */
63: private MessageDrivenContext ctx;
64:
65: /**
66: * Remove method.
67: * @throws EJBException if a problem occurs.
68: */
69: public void ejbRemove() throws EJBException {
70: // TODO: test
71: }
72:
73: /**
74: * Sets the message driven context.
75: * @param ctx context
76: */
77: public void setMessageDrivenContext(MessageDrivenContext ctx)
78: throws EJBException {
79: this .ctx = ctx;
80: }
81:
82: /**
83: * Verifies MessageDrivenContext methods.
84: * @param message msg
85: */
86: public void onMessage(final Message message) {
87: if (ctx != null) {
88: super .log(MDBInterface00.class, UNDEFINED,
89: MDBInterface00.class, MESSAGE_DRIVEN_CONTEXT);
90: }
91: }
92:
93: }
|