Package org.apache.xbean.finder

Examples of org.apache.xbean.finder.ClassFinder


                throw new DeploymentException("AbstractWebModuleBuilder: Could not load filter class: " + cls.getStringValue(), e);
            }
            addClass(classes, clas);
        }

        return new ClassFinder(classes);
    }
View Full Code Here


                    } catch (OpenEJBException e) {
                        //ignore ?
                    }
                }
            } else {
                ClassFinder classFinder = new ClassFinder(ejbClass);
                for (Method method : classFinder.findAnnotatedMethods(Asynchronous.class)) {
                    ignoredMethodAnnotation("Asynchronous", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
                }
                if (ejbClass.getAnnotation(Asynchronous.class) != null) {
                    ignoredClassAnnotation("Asynchronous", bean, bean.getEjbClass(), bean.getClass().getSimpleName());
                }
View Full Code Here

        tag = Strings.lcfirst(Strings.camelCase(tag));

        if (isValidInterface(b, interfce, beanClass, tag));

        ClassFinder finder = new ClassFinder(interfce);

        for (Class<? extends Annotation> annotation : beanOnlyAnnotations) {

            if (interfce.isAnnotationPresent(annotation)){
                warn(b, "interface.beanOnlyAnnotation", annotation.getSimpleName(), interfce.getName(), b.getEjbClass());
            }

            for (Method method : finder.findAnnotatedMethods(annotation)) {
                warn(b, "interfaceMethod.beanOnlyAnnotation", annotation.getSimpleName(), interfce.getName(), method.getName(), b.getEjbClass());
            }
        }

    }
View Full Code Here

            for (LifecycleCallback callback : bean.getPreDestroy()) {
                checkCallback(ejbClass, "PreDestroy", callback, bean);
            }

            ClassFinder finder = new ClassFinder(ejbClass);

            if (bean instanceof Session ) {
                SessionBean session = (SessionBean) bean;

                if (session.getSessionType() == SessionType.STATEFUL ) {

                    for (LifecycleCallback callback : session.getPrePassivate()) {
                        checkCallback(ejbClass, "PrePassivate", callback, bean);
                    }

                    for (LifecycleCallback callback : session.getPostActivate()) {
                        checkCallback(ejbClass, "PostActivate", callback, bean);
                    }

                    checkSessionSynchronization(ejbClass, session);

                    for (LifecycleCallback callback : session.getAfterBegin()) {
                        checkCallback(ejbClass, "AfterBegin", callback, bean);
                    }

                    for (LifecycleCallback callback : session.getBeforeCompletion()) {
                        checkCallback(ejbClass, "BeforeCompletion", callback, bean);
                    }

                    for (LifecycleCallback callback : session.getAfterCompletion()) {
                        checkCallback(ejbClass, "AfterCompletion", callback, bean, boolean.class);
                    }
//                    for (LifecycleCallback callback : session.getAfterCompletion()) {
//                        checkCallback(ejbClass, "Init", callback, bean, boolean.class);
//                    }

                    for (AroundTimeout aroundTimeout : session.getAroundTimeout()) {
                        ignoredMethodAnnotation("AroundTimeout", bean, bean.getEjbClass(), aroundTimeout.getMethodName(), SessionType.STATEFUL.getName());
                    }

                    for (Timer timer : session.getTimer()) {
                        ignoredMethodAnnotation("Schedule/Schedules", bean, bean.getEjbClass(), timer.getTimeoutMethod().getMethodName(), SessionType.STATEFUL.getName());
                    }

                } else {

                    for (LifecycleCallback callback : session.getAfterBegin()) {
                        ignoredMethodAnnotation("AfterBegin", bean, bean.getEjbClass(), callback.getMethodName(), session.getSessionType().getName());
                    }

                    for (LifecycleCallback callback : session.getBeforeCompletion()) {
                        ignoredMethodAnnotation("BeforeCompletion", bean, bean.getEjbClass(), callback.getMethodName(), session.getSessionType().getName());
                    }

                    for (LifecycleCallback callback : session.getAfterCompletion()) {
                        ignoredMethodAnnotation("AfterCompletion", bean, bean.getEjbClass(), callback.getMethodName(), session.getSessionType().getName());
                    }

                    for (LifecycleCallback callback : session.getPrePassivate()) {
                        ignoredMethodAnnotation("PrePassivate", bean, bean.getEjbClass(), callback.getMethodName(), session.getSessionType().getName());
                    }

                    for (LifecycleCallback callback : session.getPostActivate()) {
                        ignoredMethodAnnotation("PostActivate", bean, bean.getEjbClass(), callback.getMethodName(), session.getSessionType().getName());
                    }

                    for (RemoveMethod method : session.getRemoveMethod()) {
                        ignoredMethodAnnotation("Remove", bean, bean.getEjbClass(), method.getBeanMethod().getMethodName(), session.getSessionType().getName());
                    }

                    for (InitMethod method : session.getInitMethod()) {
                        ignoredMethodAnnotation("Init", bean, bean.getEjbClass(), method.getBeanMethod().getMethodName(), session.getSessionType().getName());
                    }
                }
            } else {

                for (Method method : finder.findAnnotatedMethods(PrePassivate.class)) {
                    ignoredMethodAnnotation("PrePassivate", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
                }

                for (Method method : finder.findAnnotatedMethods(PostActivate.class)) {
                    ignoredMethodAnnotation("PostActivate", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
                }

                for (Method method : finder.findAnnotatedMethods(Remove.class)) {
                    ignoredMethodAnnotation("Remove", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
                }

                for (Method method : finder.findAnnotatedMethods(Init.class)) {
                    ignoredMethodAnnotation("Init", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
                }

                for (Method method : finder.findAnnotatedMethods(AfterBegin.class)) {
                    ignoredMethodAnnotation("AfterBegin", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
                }

                for (Method method : finder.findAnnotatedMethods(BeforeCompletion.class)) {
                    ignoredMethodAnnotation("BeforeCompletion", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
                }

                for (Method method : finder.findAnnotatedMethods(AfterCompletion.class)) {
                    ignoredMethodAnnotation("AfterCompletion", bean, bean.getEjbClass(), method.getName(), bean.getClass().getSimpleName());
                }
            }

//            if (bean instanceof TimerConsumer) {
View Full Code Here

    private void checkSessionSynchronization(Class ejbClass, SessionBean bean) {
        if (SessionSynchronization.class.isAssignableFrom(ejbClass)) {
            if (bean.getAfterBeginMethod() != null || bean.getBeforeCompletionMethod() != null || bean.getAfterCompletionMethod() != null) {
                fail(bean, "callback.sessionSynchronization.invalidUse", ejbClass.getName());
            } else {
                ClassFinder classFinder = new ClassFinder(ejbClass);
                if (classFinder.findAnnotatedMethods(AfterBegin.class).size() > 0 || classFinder.findAnnotatedMethods(BeforeCompletion.class).size() > 0
                        || classFinder.findAnnotatedMethods(AfterCompletion.class).size() > 0) {
                    fail(bean, "callback.sessionSynchronization.invalidUse", ejbClass.getName());
                }
            }
        }
    }
View Full Code Here

        // skip ejb modules... they have alreayd been processed
        if (module.getType() == ConfigurationModuleType.EJB) {
            return;
        }

        ClassFinder classFinder = module.getClassFinder();
        AnnotatedApp annotatedApp = module.getAnnotatedApp();
        if (annotatedApp == null) {
            throw new NullPointerException("No AnnotatedApp supplied");
        }
        Map<String, LifecycleCallbackType> postConstructMap = mapLifecycleCallbacks(annotatedApp.getPostConstructArray(), annotatedApp.getComponentType());
        Map<String, LifecycleCallbackType> preDestroyMap = mapLifecycleCallbacks(annotatedApp.getPreDestroyArray(), annotatedApp.getComponentType());
        if (module.getClassFinder() != null) {
            List<Method> postConstructs = classFinder.findAnnotatedMethods(PostConstruct.class);
            for (Method m : postConstructs) {
                String methodName = m.getName();
                String className = m.getDeclaringClass().getName();
                if (!postConstructMap.containsKey(className)) {
                    LifecycleCallbackType callback = annotatedApp.addPostConstruct();
                    FullyQualifiedClassType classType = callback.addNewLifecycleCallbackClass();
                    classType.setStringValue(className);
                    JavaIdentifierType method = callback.addNewLifecycleCallbackMethod();
                    method.setStringValue(methodName);
                    postConstructMap.put(className, callback);
                }
            }
            List<Method> preDestroys = classFinder.findAnnotatedMethods(PreDestroy.class);
            for (Method m : preDestroys) {
                String methodName = m.getName();
                String className = m.getDeclaringClass().getName();
                if (!preDestroyMap.containsKey(className)) {
                    LifecycleCallbackType callback = annotatedApp.addPreDestroy();
View Full Code Here

            }
        }
       
        URL[] urls = urlList.toArray(new URL[] {});
        JarFileClassLoader tempClassLoader = new JarFileClassLoader(null, urls, this.getClass().getClassLoader());
        ClassFinder classFinder = new ClassFinder(tempClassLoader, urlList);

        List<Class> classes = new ArrayList<Class>();

        classes.addAll(classFinder.findAnnotatedClasses(WebService.class));
        classes.addAll(classFinder.findAnnotatedClasses(WebServiceProvider.class));      

        tempClassLoader.destroy();

        if (tmpDir != null) {
            DeploymentUtil.recursiveDelete(tmpDir);
View Full Code Here

                throw new DeploymentException("AbstractWebModuleBuilder: Could not load filter class: " + cls.getStringValue(), e);
            }
            addClass(classes, clas);
        }

        return new ClassFinder(classes);
    }
View Full Code Here

                throw new DeploymentException("AppClientModuleBuilder: Could not load callback-handler class: " + cls.getStringValue(), e);
            }
            classes.add(clas);
        }

        return new ClassFinder(classes);
    }
View Full Code Here

        Configuration earConfiguration = earContext.getConfiguration();

        Set<String> listenerNames = new HashSet<String>();

        ClassFinder classFinder = createJspClassFinder(webApp, webModule, listenerNames);
        webModule.setClassFinder(classFinder);

        namingBuilders.buildNaming(webApp, jettyWebApp, webModule, buildingContext);

        //only try to install it if reference will work.
View Full Code Here

TOP

Related Classes of org.apache.xbean.finder.ClassFinder

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.