Examples of IJMessageDriven


Examples of org.ow2.util.ee.metadata.ejbjar.api.struct.IJMessageDriven

            }
        }


        // Listener interface already specified ?
        IJMessageDriven jMessageDriven = mdbBean.getJMessageDriven();
        if (jMessageDriven == null) {
            jMessageDriven = new JMessageDriven();
        }
        // Listener interface specified, no need to find it
        if (jMessageDriven.getMessageListenerInterface() != null) {
            return;
        }


        // The following interfaces are excluded when determining whether
        // the bean class has
        // more than one interface: java.io.Serializable;
        // java.io.Externalizable;
        // any of the interfaces defined by the javax.ejb package.
        String[] interfaces = mdbBean.getInterfaces();
        List<String> inheritedInterfaces = mdbBean.getInheritedInterfaces();

        int numberItfFound = 0;
        String itfFound = null;
        for (String itf : interfaces) {
            if (!itf.equals(java.io.Serializable.class.getName().replace(".", "/"))
                    && !itf.equals(java.io.Externalizable.class.getName().replace(".", "/")) && !itf.startsWith("javax/ejb")
                    // Should not be inherited
                    && !inheritedInterfaces.contains(itf)) {
                itfFound = itf;
                numberItfFound++;
            }
        }

        // No Listener interface found but there is only one inherited
        // interface, use it as listener interface
        if (numberItfFound == 0 && inheritedInterfaces != null && inheritedInterfaces.size() == 1) {
            itfFound = inheritedInterfaces.get(0);
            numberItfFound = 1;
        }

        // No Listener interface found in metadata
        if (numberItfFound == 0) {
            throw new IllegalStateException("No message listener interface has been found on bean class '"
                    + mdbBean.getClassName() + "' It needs to be specified with annotation or XML.");
        }

        if (numberItfFound > 1) {
            throw new IllegalStateException("More than 1 message listener interface on the class '" + mdbBean.getClassName()
                    + "' The message listener interface needs to be specified with annotation or XML..");
        }

        // If bean class implements a single interface, that interface is
        // assumed to be the listener interface of the bean
        jMessageDriven.setMessageListenerInterface(itfFound.replace("/", "."));

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.