KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > puppycrawl > tools > checkstyle > checks > j2ee > MessageBeanCheck


1 ////////////////////////////////////////////////////////////////////////////////
2
// checkstyle: Checks Java source code for adherence to a set of rules.
3
// Copyright (C) 2001-2005 Oliver Burn
4
//
5
// This library is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation; either
8
// version 2.1 of the License, or (at your option) any later version.
9
//
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with this library; if not, write to the Free Software
17
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
////////////////////////////////////////////////////////////////////////////////
19
package com.puppycrawl.tools.checkstyle.checks.j2ee;
20
21 import com.puppycrawl.tools.checkstyle.api.DetailAST;
22
23 /**
24  * Checks that a MessageBean implementation satisfies MessageBean
25  * requirements. Such as:
26  * <ul>
27  * <li>The class is defined as <code>public</code>.</li>
28  * <li>The class cannot be defined as <code>abstract</code> or
29  * <code>final</code>.</li>
30  * <li>It implements one ejbCreate method.</li>
31  * <li>It contains a <code>public</code> constructor with no parameters.</li>
32  * <li>It must not define the <code>finalize</code> method.</li>
33  * </ul>
34  * Reference: Enterprise JavaBeansTM Specification,Version 2.0, section 15.7
35  * http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/MDB4.html#69040
36  * @author Rick Giles
37  */

38 public class MessageBeanCheck
39     extends AbstractBeanCheck
40 {
41     /**
42      * Constructs a <code>MessageBeanCheck</code>.
43      *
44      */

45     public MessageBeanCheck()
46     {
47         setMethodChecker(new MessageBeanMethodChecker(this));
48     }
49
50     /**
51      * {@inheritDoc}
52      */

53     public void visitToken(DetailAST aAST)
54     {
55         if (Utils.hasImplements(aAST, "javax.ejb.MessageDrivenBean")
56             && Utils.hasImplements(aAST, "javax.jms.MessageListener"))
57         {
58             checkBean(aAST, "Message bean", false);
59             getMethodChecker().checkMethods(aAST);
60         }
61     }
62 }
63
Popular Tags