Examples of ConfigVisitor


Examples of org.jboss.errai.bus.server.util.ConfigVisitor

            autoScanModules = Boolean.parseBoolean(properties.get("errai.auto_scan_modules"));
        }
        if (autoScanModules) {

            // Search for Errai extensions.
            visitAllTargets(configRootTargets, new ConfigVisitor() {
                public void visit(Class<?> loadClass) {
                    if (ErraiConfigExtension.class.isAssignableFrom(loadClass)
                            && loadClass.isAnnotationPresent(ExtensionComponent.class) && !loadedComponents.contains(loadClass.getName())) {

                        loadedComponents.add(loadClass.getName());

                        // We have an annotated ErraiConfigExtension.  So let's configure it.
                        final Class<? extends ErraiConfigExtension> clazz =
                                loadClass.asSubclass(ErraiConfigExtension.class);


                        log.info("found extension " + clazz.getName());

                        try {

                            final Runnable create = new Runnable() {
                                public void run() {
                                    AbstractModule module = new AbstractModule() {
                                        @Override
                                        protected void configure() {
                                            bind(ErraiConfigExtension.class).to(clazz);
                                            bind(ErraiServiceConfigurator.class).toInstance(configInst);
                                            bind(MessageBus.class).toInstance(bus);

                                            // Add any extension bindings.
                                            for (Map.Entry<Class, Provider> entry : extensionBindings.entrySet()) {
                                                bind(entry.getKey()).toProvider(entry.getValue());
                                            }
                                        }
                                    };
                                    Guice.createInjector(module)
                                            .getInstance(ErraiConfigExtension.class)
                                            .configure(extensionBindings, resourceProviders);
                                }
                            };

                            try {
                                create.run();
                            }
                            catch (CreationException e) {
                                log.info("extension " + clazz.getName() + " cannot be bound yet, deferring ...");
                                deferred.add(create);
                            }

                        }
                        catch (Throwable e) {
                            throw new ErraiBootstrapFailure("could not initialize extension: " + loadClass.getName(), e);
                        }
                    }
                }
            });


            for (Class bindingType : extensionBindings.keySet()) {
                log.info("added extension binding: " + bindingType.getName());
            }

            log.info("total extension binding: " + extensionBindings.keySet().size());

            visitAllTargets(configRootTargets,
                    new ConfigVisitor() {
                        public void visit(final Class<?> loadClass) {
                            if (loadedComponents.contains(loadClass.getName())) return;


                            if (Module.class.isAssignableFrom(loadClass)) {
View Full Code Here

Examples of org.jboss.errai.bus.server.util.ConfigVisitor

            autoScanModules = Boolean.parseBoolean(properties.get("errai.auto_scan_modules"));
        }
        if (autoScanModules) {

            // Search for Errai extensions.
            visitAllTargets(configRootTargets, new ConfigVisitor() {
                public void visit(Class<?> loadClass) {
                    if (ErraiConfigExtension.class.isAssignableFrom(loadClass)
                            && loadClass.isAnnotationPresent(ExtensionComponent.class) && !loadedComponents.contains(loadClass.getName())) {

                        loadedComponents.add(loadClass.getName());

                        // We have an annotated ErraiConfigExtension.  So let's configure it.
                        final Class<? extends ErraiConfigExtension> clazz =
                                loadClass.asSubclass(ErraiConfigExtension.class);


                        log.info("found extension " + clazz.getName());

                        try {

                            final Runnable create = new Runnable() {
                                public void run() {
                                    AbstractModule module = new AbstractModule() {
                                        @Override
                                        protected void configure() {
                                            bind(ErraiConfigExtension.class).to(clazz);
                                            bind(ErraiServiceConfigurator.class).toInstance(configInst);
                                            bind(MessageBus.class).toInstance(bus);

                                            // Add any extension bindings.
                                            for (Map.Entry<Class, Provider> entry : extensionBindings.entrySet()) {
                                                bind(entry.getKey()).toProvider(entry.getValue());
                                            }
                                        }
                                    };
                                    Guice.createInjector(module)
                                            .getInstance(ErraiConfigExtension.class)
                                            .configure(extensionBindings, resourceProviders);
                                }
                            };

                            try {
                                create.run();
                            }
                            catch (CreationException e) {
                                log.info("extension " + clazz.getName() + " cannot be bound yet, deferring ...");
                                deferred.add(create);
                            }

                        }
                        catch (Throwable e) {
                            throw new ErraiBootstrapFailure("could not initialize extension: " + loadClass.getName(), e);
                        }
                    }
                }
            });


            visitAllTargets(configRootTargets,
                    new ConfigVisitor() {
                        public void visit(final Class<?> loadClass) {
                            if (loadedComponents.contains(loadClass.getName())) return;


                            if (Module.class.isAssignableFrom(loadClass)) {
View Full Code Here

Examples of org.jboss.errai.bus.server.util.ConfigVisitor

        cfg.setProperty("hibernate.hbm2ddl.auto", "update");

        List<File> roots = config.getConfigurationRoots();

        logger.info("begin scan for annotated classes.");
        ConfigUtil.visitAllTargets(roots, new ConfigVisitor() {
            public void visit(Class<?> clazz) {
                if (clazz.isAnnotationPresent(Entity.class)) {
                    cfg.addAnnotatedClass(clazz);
                }
            }
View Full Code Here

Examples of org.jboss.errai.bus.server.util.ConfigVisitor

        this.configurator = configurator;
        this.bus = bus;

        try {
        visitAllTargets(configurator.getConfigurationRoots(),
                new ConfigVisitor() {
                    public void visit(Class<?> clazz) {
                        if (clazz.isAnnotationPresent(AuthUserEntity.class)) {
                            if (userEntity != null) {
                                throw new ErraiBootstrapFailure("More than one @AuthUserEntity defined in classpath (" + userEntity.getName() + " and " + clazz.getName() + " cannot co-exist)");
                            }
View Full Code Here

Examples of org.jboss.errai.bus.server.util.ConfigVisitor

      log.info("beging searching for services ...");

      List<File> configRootTargets = ConfigUtil.findAllConfigTargets();

      visitAllTargets(configRootTargets,
          new ConfigVisitor() {
            public void visit(final Class<?> loadClass) {
              if (loadedComponents.contains(loadClass.getName())) return;


              if (Module.class.isAssignableFrom(loadClass)) {
View Full Code Here

Examples of org.jboss.errai.bus.server.util.ConfigVisitor

        }
      };

      // Search for Errai extensions.
      List<File> configRootTargets = context.getConfigTargets();
      visitAllTargets(configRootTargets, new ConfigVisitor() {
        public void visit(Class<?> loadClass) {
          if (ErraiConfigExtension.class.isAssignableFrom(loadClass)
              && loadClass.isAnnotationPresent(ExtensionComponent.class) && !loadedComponents.contains(loadClass.getName())) {

            loadedComponents.add(loadClass.getName());
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.