Examples of AnnotationFinder


Examples of org.apache.xbean.finder.AnnotationFinder

            Set<Class<?>> parents = new HashSet<Class<?>>();
            for (Class<?> clazz : classes) {
                parents.addAll(ancestors(clazz));
            }

            return new AnnotationFinder(new ClassesArchive(parents)).link();
        }
View Full Code Here

Examples of org.apache.xbean.finder.AnnotationFinder

    public IAnnotationFinder create(DeploymentModule module) throws Exception {
        if (module instanceof WebModule) {
            WebModule webModule = (WebModule) module;
            final ClassLoader webClassLoader = webModule.getClassLoader();
            return new AnnotationFinder(new AggregatedArchive(webClassLoader, webModule.getUrls())).link();
        }
       
        if (module instanceof ConnectorModule) {
          ConnectorModule connectorModule = (ConnectorModule) module;
          final ClassLoader connectorClassLoader = connectorModule.getClassLoader();
          return new AnnotationFinder(new ClasspathArchive(connectorClassLoader, connectorModule.getLibraries())).link();
        }

        if (module.getJarLocation() != null) {
            String location = module.getJarLocation();
            File file = new File(location);

            URL url;
            if (file.exists()) {
                url = file.toURI().toURL();
               
                File webInfClassesFolder = new File(file, "WEB-INF/classes");
        if (webInfClassesFolder.exists() && webInfClassesFolder.isDirectory()) {
                  url = webInfClassesFolder.toURI().toURL();
                }
            } else {
                url = new URL(location);
            }
            return new AnnotationFinder(new ClasspathArchive(module.getClassLoader(), url)).link();
        } else {
            return new AnnotationFinder(new ClassesArchive()).link();
        }
    }
View Full Code Here

Examples of org.apache.xbean.finder.AnnotationFinder

            //  more classes than actually apply to CDI.  This can "pollute"
            //  the CDI class space and break injection points

            if (!(finder instanceof AnnotationFinder)) return finder.getAnnotatedClassNames();

            final AnnotationFinder annotationFinder = (AnnotationFinder) finder;

            final Archive archive = annotationFinder.getArchive();

            if (!(archive instanceof AggregatedArchive)) return finder.getAnnotatedClassNames();

            final List<String> classes = new ArrayList<String>();
View Full Code Here

Examples of org.apache.xbean.finder.AnnotationFinder

    public IAnnotationFinder create(DeploymentModule module) throws Exception {
        if (module instanceof WebModule) {
            WebModule webModule = (WebModule) module;
            final ClassLoader webClassLoader = webModule.getClassLoader();
            return new AnnotationFinder(new AggregatedArchive(webClassLoader, webModule.getScannableUrls())).link();
        }
       
        if (module instanceof ConnectorModule) {
          ConnectorModule connectorModule = (ConnectorModule) module;
          final ClassLoader connectorClassLoader = connectorModule.getClassLoader();
          return new AnnotationFinder(new ClasspathArchive(connectorClassLoader, connectorModule.getLibraries())).link();
        }

        if (module.getJarLocation() != null) {
            String location = module.getJarLocation();
            File file = new File(location);

            URL url;
            if (file.exists()) {
                url = file.toURI().toURL();
               
                File webInfClassesFolder = new File(file, "WEB-INF/classes");
        if (webInfClassesFolder.exists() && webInfClassesFolder.isDirectory()) {
                  url = webInfClassesFolder.toURI().toURL();
                }
            } else {
                url = new URL(location);
            }
            return new AnnotationFinder(new ClasspathArchive(module.getClassLoader(), url)).link();
        } else {
            return new AnnotationFinder(new ClassesArchive()).link();
        }
    }
View Full Code Here

Examples of org.apache.xbean.finder.AnnotationFinder

        public static final String STRICT_INTERFACE_DECLARATION = "openejb.strict.interface.declaration";

        public void deploy(CdiBeanInfo beanInfo) throws OpenEJBException{

            AnnotationFinder annotationFinder = createFinder(beanInfo.getBeanClass());
            /*
             * @EJB
             * @Resource
             * @WebServiceRef
             * @PersistenceUnit
 
View Full Code Here

Examples of org.apache.xbean.finder.AnnotationFinder

                Class clazz;
                try {
                    clazz = classLoader.loadClass(className);
                    remoteClients.add(clazz);

                    AnnotationFinder annotationFinder = createFinder(clazz);

                    buildAnnotatedRefs(client, annotationFinder, classLoader);
                } catch (ClassNotFoundException e) {
                    /**
                     * Some ClientModule are discovered only because the jar uses a Main-Class
                     * entry in the MANIFEST.MF file.  Lots of jars do this that are not used as
                     * java ee application clients, so lets not make this a failure unless it
                     * has a META-INF/application-client.xml which tells us it is in fact
                     * expected to be a ClientModule and not just some random jar.
                     */
                    if (clientModule.getAltDDs().containsKey("application-client.xml")) {
                        getValidationContext().fail("client", "client.missingMainClass", className);
                    } else {
                        getValidationContext().warn("client", "client.missingMainClass", className);
                    }
                }
            }

            for (String rawClassName : clientModule.getRemoteClients()) {
                final String className = realClassName(rawClassName);
                Class clazz;
                try {
                    clazz = classLoader.loadClass(className);
                    remoteClients.add(clazz);
                } catch (ClassNotFoundException e) {
                    throw new OpenEJBException("Unable to load RemoteClient class: " + className, e);
                }

                AnnotationFinder annotationFinder = createFinder(clazz);

                buildAnnotatedRefs(client, annotationFinder, classLoader);
            }

            for (String rawClassName : clientModule.getLocalClients()) {
                final String className = realClassName(rawClassName);
                Class clazz;
                try {
                    clazz = classLoader.loadClass(className);
                } catch (ClassNotFoundException e) {
                    throw new OpenEJBException("Unable to load LocalClient class: " + className, e);
                }

                AnnotationFinder annotationFinder = createFinder(clazz);

                buildAnnotatedRefs(client, annotationFinder, classLoader);
            }

            validateRemoteClientRefs(classLoader, client, remoteClients);
View Full Code Here

Examples of org.apache.xbean.finder.AnnotationFinder

                        logger.debug(String.format("%s: Unable to load class for scanning: %s", e.getClass().getName(), className));
                    }
                }
            }

            AnnotationFinder annotationFinder = createFinder(classes.toArray(new Class<?>[classes.size()]));

            /*
             * @EJB
             * @Resource
             * @WebServiceRef
 
View Full Code Here

Examples of org.jbehave.core.configuration.AnnotationFinder

  }

  @Override
  public Configuration buildConfiguration() throws AnnotationRequired {

    final AnnotationFinder finder = annotationFinder();

    if (finder.isAnnotationPresent(UsingSteps.class)) {
      stepsClasses.addAll(finder.getAnnotatedClasses(UsingSteps.class, Object.class, "instances"));
    }

    if (finder.isAnnotationPresent(UsingNeedle.class)) {

      @SuppressWarnings("rawtypes")
      final List<Class> supplierClasses = finder.getAnnotatedValues(UsingNeedle.class, Class.class, "supplier");
      for (Class<InjectionProviderInstancesSupplier> supplierClass : supplierClasses) {
        provider.addAll(CreateInstanceByDefaultConstructor.INSTANCE.apply(supplierClass).get());
      }

      @SuppressWarnings("rawtypes")
      final List<Class> providerClasses = finder.getAnnotatedValues(UsingNeedle.class, Class.class, "provider");
      for (Class<InjectionProvider<?>> providerClass : providerClasses) {
        provider.add(CreateInstanceByDefaultConstructor.INSTANCE.apply(providerClass));
      }

    } else {
View Full Code Here

Examples of org.jbehave.core.configuration.AnnotationFinder

        super(annotatedClass, annotationMonitor);
    }

    public Configuration buildConfiguration() throws AnnotationRequired {

        AnnotationFinder finder = annotationFinder();
        if (finder.isAnnotationPresent(UsingGuice.class)) {
            @SuppressWarnings("rawtypes")
            List<Class> moduleClasses = finder.getAnnotatedValues(UsingGuice.class, Class.class, "modules");
            List<Module> modules = new ArrayList<Module>();
            for (Class<Module> moduleClass : moduleClasses) {
                try {
                    modules.add(moduleClass.newInstance());
                } catch (Exception e) {
View Full Code Here

Examples of org.jbehave.core.configuration.AnnotationFinder

    public PicoAnnotationBuilder(Class<?> annotatedClass, AnnotationMonitor annotationMonitor) {
        super(annotatedClass, annotationMonitor);
    }

    public Configuration buildConfiguration() throws AnnotationRequired {
        AnnotationFinder finder = annotationFinder();
        if (finder.isAnnotationPresent(UsingPico.class)) {
            @SuppressWarnings("rawtypes")
            List<Class> moduleClasses = finder.getAnnotatedValues(UsingPico.class, Class.class, "modules");
            List<PicoModule> modules = new ArrayList<PicoModule>();
            for (Class<PicoModule> moduleClass : moduleClasses) {
                try {
                    modules.add(moduleClass.newInstance());
                } catch (Exception e) {
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.