Package org.ow2.easybeans.deployment.metadata.ejbjar

Examples of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarDeployableFactory


            // Get meta data of the super class
            EasyBeansEjbJarClassMetadata superClassMetadata = beanclassAnnotationMetadata.getLinkedClassMetadata(superClass);

            if (superClassMetadata == null) {
                // TODO : I18n
                throw new ResolverException("The class " + beanclassAnnotationMetadata + " extends the class " + superClass
                        + "but this class seems to be outside of the ejb-jar");
            }

            // Takes method metadata of the super class and adds them to the
            // bean class
View Full Code Here


            if (superClass.equals(JAVA_LANG_OBJECT)) {
                return;
            }

            // Get meta data of the super class
            EasyBeansEjbJarClassMetadata superClassMetadata = beanclassAnnotationMetadata.getLinkedClassMetadata(superClass);

            if (superClassMetadata == null) {
                // TODO : I18n
                throw new ResolverException("The class " + beanclassAnnotationMetadata + " extends the class " + superClass
                        + "but this class seems to be outside of the ejb-jar");
            }

            // Takes method metadata of the super class and adds them to the
            // bean class
            // Note : the flag inherited is set to true
            for (EasyBeansEjbJarMethodMetadata methodAnnotationMetadata : superClassMetadata.getMethodMetadataCollection()) {
                // check that the method has not be redefined
                JMethod method = methodAnnotationMetadata.getJMethod();

                EasyBeansEjbJarMethodMetadata beanMethod = beanclassAnnotationMetadata.getMethodMetadata(method);
View Full Code Here

            }
            // add as visited
            visitedInterfaces.add(itf);

            // get meta data of the interface
            EasyBeansEjbJarClassMetadata itfMetadata = visitingclassAnnotationMetadata.getLinkedClassMetadata(itf);

            if (itfMetadata == null) {
                logger.warn("No class was found for interface {0}.", itf);
                continue;
            }

            // for each method of the interface, set the business method to true
            // in bean
            for (EasyBeansEjbJarMethodMetadata methodData : itfMetadata.getMethodMetadataCollection()) {
                JMethod itfMethod = methodData.getJMethod();

                // Ignore class init method
                if (itfMethod.getName().equals(CLASS_INIT) || itfMethod.getName().equals(CONST_INIT)) {
                    continue;
                }

                // take the method from the bean class
                EasyBeansEjbJarMethodMetadata beanMethod = beanclassAnnotationMetadata.getMethodMetadata(itfMethod);
                if (beanMethod == null) {
                    // TODO: I18n
                    throw new IllegalStateException("No method was found for method " + itfMethod + " in class "
                            + beanclassAnnotationMetadata.getClassName());
                }
                beanMethod.setBusinessMethod(true);
            }

            // loop again
            if (itfMetadata.getInterfaces() != null) {
                loop(beanclassAnnotationMetadata, itfMetadata, visitedInterfaces);
            }
        }
    }
View Full Code Here

        ClassLoader loader = Thread.currentThread().getContextClassLoader();

        IArchive archive = new ArchiveInMemory(loader, classesToEnhance);

        EasyBeansEjbJarDeployableFactory deployableFactory = new EasyBeansEjbJarDeployableFactory();
        EjbJarArchiveMetadata ejbJarAnnotationMetadata = deployableFactory
                .createDeployableMetadata(EJB3Deployable.class.cast(DeployableHelper.getDeployable(archive)));


        ResolverHelper.resolve(ejbJarAnnotationMetadata, null);
View Full Code Here

    public void init() throws ScanException, DeployableMetadataException, DeployableHelperException, ResolverException {
        MemoryArchive memoryArchive = new MemoryArchive();
        memoryArchive.addClassResource(getClass().getClassLoader(), Arrays.asList(MyEjb.class.getName(), WebserviceSLSB.class.getName()));
        memoryArchive.addResource("META-INF/easybeans.xml", TestMetadata.class.getResource("test-ws-easybeans.xml"));

        EasyBeansEjbJarDeployableFactory deployableFactory = new EasyBeansEjbJarDeployableFactory();
        this.ejbJarAnnotationMetadata = deployableFactory.createDeployableMetadata(EJB3Deployable.class.cast(DeployableHelper.getDeployable(memoryArchive)));

        // ResolverHelper.resolve(this.ejbJarAnnotationMetadata);
    }
View Full Code Here

    @SuppressWarnings("boxing")
    public void analyze(final ClassLoader classLoader) throws ScanException, ResolverException,
            DeployableHelperException, DeployableMetadataException {

        // Create metadata
        EasyBeansEjbJarDeployableFactory deployableFactory = getDeployableFactory();

        // TODO gaellalire : metadata should be contruct directly with ear
        List<IClassesLocator> lib = null;

        if (this.extraArchives != null) {
            lib = new ArrayList<IClassesLocator>();
            for (IArchive archive : this.extraArchives) {
                lib.add(new ArchiveClassesLocator(archive));
            }
        }
        if (classLoader != null) {
            if (lib == null) {
                lib = new ArrayList<IClassesLocator>();
            }
            lib.add(new ClassLoaderClassesLocator(classLoader));
        }

        this.ejbJarArchiveMetadata = deployableFactory.createDeployableMetadata(EJB3Deployable.class.cast(DeployableHelper
                .getDeployable(this.archive, false)), lib);

        // Complete metadata
        long tResolverStart = System.currentTimeMillis();
        ResolverHelper.resolve(this.ejbJarArchiveMetadata, this.configuration.getEZBServer());
View Full Code Here

    /**
     * @return Deployable factory.
     */
    protected EasyBeansEjbJarDeployableFactory getDeployableFactory() {
        // Allows to override this factory
        return new EasyBeansEjbJarDeployableFactory();
    }
View Full Code Here

        mv.visitMaxs(0, 0);
        mv.visitEnd();

        // add method in the class metadata
        JMethod method = new JMethod(ACC_PUBLIC, generatedMethodName, "()V", null, null);
        EasyBeansEjbJarMethodMetadata generatedMetadata = new EasyBeansEjbJarMethodMetadata(method, classMetaData);

        // Set value
        switch (interceptorType) {
            case POST_CONSTRUCT:
                generatedMetadata.setPostConstruct(true);
                break;
            case PRE_DESTROY:
                generatedMetadata.setPreDestroy(true);
                break;
            case PRE_PASSIVATE:
                generatedMetadata.setPrePassivate(true);
                break;
            case POST_ACTIVATE:
                generatedMetadata.setPostActivate(true);
                break;
            default:
                    throw new RuntimeException("No generated method name found for interceptorType '" + interceptorType + "'");
        }
View Full Code Here

        if (isInjectedMethod(jMethod)) {
            return false;
        }

        // get method metadata
        EasyBeansEjbJarMethodMetadata method = this.classAnnotationMetadata.getMethodMetadata(jMethod);
        if (method == null) {
            throw new IllegalStateException("Cannot find a method " + jMethod + " in class "
                    + this.classAnnotationMetadata.getClassName());
        }
        return method.isBusinessMethod();
    }
View Full Code Here

     * @param jMethod object to check
     * @return true if the given method is an interceptor method (ie AroundInvoke, PostConstruct, etc).
     */
    private boolean isInterceptorMethod(final JMethod jMethod) {
        // get method metadata
        EasyBeansEjbJarMethodMetadata method = this.classAnnotationMetadata.getMethodMetadata(jMethod);
        if (method == null) {
            throw new IllegalStateException("Cannot find a method " + jMethod + " in class "
                    + this.classAnnotationMetadata.getClassName());
        }
        return (method.isAroundInvoke() || method.isLifeCycleMethod());
    }
View Full Code Here

TOP

Related Classes of org.ow2.easybeans.deployment.metadata.ejbjar.EasyBeansEjbJarDeployableFactory

Copyright © 2018 www.massapicom. 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.