Package org.jboss.errai.bus.server

Examples of org.jboss.errai.bus.server.ErraiBootstrapFailure


        System.setProperty("errai.service_config_prefix_path", "org.jboss.errai.bus");
        loadServiceProperties();
        return;
      }

      throw new ErraiBootstrapFailure("Error reading from configuration. Did you include ErraiService.properties?", e);
    }
  }
View Full Code Here


            }

            return targets;
        }
        catch (Exception e) {
            throw new ErraiBootstrapFailure("could not locate config target paths", e);
        }
    }
View Full Code Here

                                    Make.Map.<String, Object>$()
                                            ._("implementationClassName", visit.getSimpleName() + "Impl")
                                            ._("interfaceClass", visit)._()));
                           }
                           catch (Throwable t) {
                               throw new ErraiBootstrapFailure(t);
                           }
                            System.out.println(s);
                        }
                    }
                }
View Full Code Here

        configurator.configure(processingContext, injectionContext, processorFactory);

        extensionConfigurators.add(configurator);
      }
      catch (Exception e) {
        throw new ErraiBootstrapFailure("unable to load IOC Extension Configurator: " + e.getMessage(), e);
      }
    }

    computeDependentScope(context, injectionContext);

    final Collection<MetaClass> bootstrapClassCollection = ClassScanner.getTypesAnnotatedWith(IOCBootstrapTask.class);
    for (final MetaClass clazz : bootstrapClassCollection) {
      final IOCBootstrapTask task = clazz.getAnnotation(IOCBootstrapTask.class);
      if (task.value() == TaskOrder.Before) {
        beforeTasks.add(clazz);
      }
      else {
        afterTasks.add(clazz);
      }
    }

    /**
     * CodeDecorator.class
     */
    final Set<Class<?>> decorators = scanner.getTypesAnnotatedWith(CodeDecorator.class);
    for (final Class<?> clazz : decorators) {
      try {
        final Class<? extends IOCDecoratorExtension> decoratorClass = clazz.asSubclass(IOCDecoratorExtension.class);

        Class<? extends Annotation> annoType = null;
        final Type t = decoratorClass.getGenericSuperclass();
        if (!(t instanceof ParameterizedType)) {
          throw new ErraiBootstrapFailure("code decorator must extend IOCDecoratorExtension<@AnnotationType>");
        }

        final ParameterizedType pType = (ParameterizedType) t;
        if (IOCDecoratorExtension.class.equals(pType.getRawType())) {
          if (pType.getActualTypeArguments().length == 0
              || !Annotation.class.isAssignableFrom((Class) pType.getActualTypeArguments()[0])) {
            throw new ErraiBootstrapFailure("code decorator must extend IOCDecoratorExtension<@AnnotationType>");
          }

          // noinspection unchecked
          annoType = ((Class) pType.getActualTypeArguments()[0]).asSubclass(Annotation.class);
        }

        injectionContext.registerDecorator(
            decoratorClass.getConstructor(new Class[]{Class.class}).newInstance(annoType)
        );
      }
      catch (Exception e) {
        throw new ErraiBootstrapFailure("unable to load code decorator: " + e.getMessage(), e);
      }
    }

    for (final IOCExtensionConfigurator extensionConfigurator : extensionConfigurators) {
      extensionConfigurator.afterInitialization(processingContext, injectionContext, processorFactory);
View Full Code Here

            resourceProviders.put("SessionProvider", sessionProvider);
        }
        catch (Throwable t) {
            logger.info("session factory did not build: " + t.getClass());           
            t.printStackTrace();
            throw new ErraiBootstrapFailure("could not load errai-persitence", t);
        }
    }
View Full Code Here

        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)");
                            }

                            userEntity = clazz;
                            for (Field f : clazz.getDeclaredFields()) {
                                if (f.isAnnotationPresent(AuthUsernameField.class)) {
                                    if (f.getType() != String.class) {
                                        throw new ErraiBootstrapFailure("@AuthUsernameField must annotated a String field");
                                    }
                                    userField = f.getName();
                                } else if (f.isAnnotationPresent(AuthPasswordField.class)) {
                                    if (f.getType() != String.class) {
                                        System.out.println("Stopping B");
                                        throw new ErraiBootstrapFailure("@AuthPasswordField must annotated a String field");
                                    }
                                    passworldField = f.getName();
                                } else if (f.isAnnotationPresent(AuthRolesField.class)) {
                                    rolesField = f.getName();
                                }
                            }
                        }
                    }
                });

        }
        catch (Throwable t) {
            throw new ErraiBootstrapFailure("error configuring " + this.getClass().getSimpleName(), t);
        }

        if (userEntity == null) {
            throw new RuntimeException("You have not specified a @AuthUserEntity for the hibernate security extension.");
        } else if (userField == null) {
View Full Code Here

        configurator.configure(procContext, injectionContext, procFactory);

        extensionConfigurators.add(configurator);
      }
      catch (Exception e) {
        throw new ErraiBootstrapFailure("unable to load IOC Extension Configurator: " + e.getMessage(), e);
      }
    }

    Set<Class<?>> bootstrappers = scanner.getTypesAnnotatedWith(IOCBootstrapTask.class);
    for (Class<?> clazz : bootstrappers) {
      IOCBootstrapTask task = clazz.getAnnotation(IOCBootstrapTask.class);
      if (task.value() == TaskOrder.Before) {
        beforeTasks.add(clazz);
      }
      else {
        afterTasks.add(clazz);
      }
    }

    /**
     * CodeDecorator.class
     */
    Set<Class<?>> decorators = scanner.getTypesAnnotatedWith(CodeDecorator.class);
    for (Class<?> clazz : decorators) {
      try {
        Class<? extends IOCDecoratorExtension> decoratorClass = clazz.asSubclass(IOCDecoratorExtension.class);

        Class<? extends Annotation> annoType = null;
        Type t = decoratorClass.getGenericSuperclass();
        if (!(t instanceof ParameterizedType)) {
          throw new ErraiBootstrapFailure("code decorator must extend IOCDecoratorExtension<@AnnotationType>");
        }

        ParameterizedType pType = (ParameterizedType) t;
        if (IOCDecoratorExtension.class.equals(pType.getRawType())) {
          if (pType.getActualTypeArguments().length == 0
                  || !Annotation.class.isAssignableFrom((Class) pType.getActualTypeArguments()[0])) {
            throw new ErraiBootstrapFailure("code decorator must extend IOCDecoratorExtension<@AnnotationType>");
          }

          // noinspection unchecked
          annoType = ((Class) pType.getActualTypeArguments()[0]).asSubclass(Annotation.class);
        }

        injectionContext.registerDecorator(
                decoratorClass.getConstructor(new Class[]{Class.class}).newInstance(annoType));
      }
      catch (Exception e) {
        throw new ErraiBootstrapFailure("unable to load code decorator: " + e.getMessage(), e);
      }
    }

    for (IOCExtensionConfigurator extensionConfigurator : extensionConfigurators) {
      extensionConfigurator.afterInitialization(procContext, injectionContext, procFactory);
View Full Code Here

      }

      final String dispatchImplKey = "errai.dispatcher_implementation";
      if (erraiServiceConfig.containsKey(dispatchImplKey)) {
        if (AsyncDispatcher.class.getName().equals(erraiServiceConfig.getString(dispatchImplKey))) {
          throw new ErraiBootstrapFailure("Cannot start Errai CDI. You have have configured the service to use the " +
                  AsyncDispatcher.class.getName() + " dispatcher implementation. Due to limitations of Weld, you must use the " +
                  SimpleDispatcher.class.getName() + " in order to use this module.");
        }
      }
    }
    catch (ErraiBootstrapFailure e) {
      throw e;
    }
    catch (Exception e) {
      throw new ErraiBootstrapFailure("Error reading from configuration. Did you include ErraiService.properties?", e);
    }
  }
View Full Code Here

            try {
                Class<? extends IOCExtensionConfigurator> configuratorClass = clazz.asSubclass(IOCExtensionConfigurator.class);
                configuratorClass.newInstance().configure(procContext, injectFactory, procFactory);
            }
            catch (Exception e) {
                throw new ErraiBootstrapFailure("unable to load IOC Extension Configurator: " + e.getMessage(), e);
            }
        }

        /**
         * CodeDecorator.class
         */
        Set<Class<?>> decorators = scanner.getTypesAnnotatedWith(CodeDecorator.class);
        for (Class<?> clazz : decorators) {
            try {
                Class<? extends Decorator> decoratorClass = clazz.asSubclass(Decorator.class);

                Class<? extends Annotation> annoType = null;
                Type t = decoratorClass.getGenericSuperclass();
                if (!(t instanceof ParameterizedType)) {
                    throw new ErraiBootstrapFailure("code decorator must extend Decorator<@AnnotationType>");
                }

                ParameterizedType pType = (ParameterizedType) t;
                if (Decorator.class.equals(pType.getRawType())) {
                    if (pType.getActualTypeArguments().length == 0 || !Annotation.class.isAssignableFrom((Class) pType.getActualTypeArguments()[0])) {
                        throw new ErraiBootstrapFailure("code decorator must extend Decorator<@AnnotationType>");
                    }

                    annoType = ((Class) pType.getActualTypeArguments()[0]).asSubclass(Annotation.class);
                }

                injectFactory.getInjectionContext().registerDecorator(decoratorClass.getConstructor(new Class[]{Class.class}).newInstance(annoType));
            }
            catch (Exception e) {
                throw new ErraiBootstrapFailure("unable to load code decorator: " + e.getMessage(), e);
            }
        }

        /**
         * Provider.class
         */
        Set<Class<?>> providers = scanner.getTypesAnnotatedWith(Provider.class);
        for (Class<?> clazz : providers) {
            JClassType bindType = null;
            JClassType type = loadType(typeOracle, clazz);

            boolean contextual = false;
            for (JClassType iface : type.getImplementedInterfaces()) {
                if (iface.getQualifiedSourceName().equals(ContextualTypeProvider.class.getName())) {
                    contextual = true;

                    JParameterizedType pType = iface.isParameterized();

                    if (pType == null) {
                        throw new InjectionFailure("could not determine the bind type for the Provider class: " + type.getQualifiedSourceName());
                    }

                    bindType = pType.getTypeArgs()[0];
                    break;
                }
            }

            if (bindType == null) {
                for (JClassType iface : type.getImplementedInterfaces()) {
                    if (!typeProviderCls.isAssignableFrom(iface)) {
                        continue;
                    }

                    JParameterizedType pType = iface.isParameterized();

                    if (pType == null) {
                        throw new InjectionFailure("could not determine the bind type for the Provider class: " + type.getQualifiedSourceName());
                    }

                    bindType = pType.getTypeArgs()[0];
                }
            }

            if (bindType == null) {
                throw new InjectionFailure("the annotated provider class does not appear to implement " +
                        TypeProvider.class.getName() + ": " + type.getQualifiedSourceName());
            }

            final JClassType finalBindType = bindType;

            if (contextual) {
                injectFactory.addInjector(new ContextualProviderInjector(finalBindType, type));

            } else {
                injectFactory.addInjector(new ProviderInjector(finalBindType, type));
            }
        }


        /**
         * GeneratedBy.class
         */
        Set<Class<?>> generatedBys = scanner.getTypesAnnotatedWith(GeneratedBy.class);
        for (Class<?> clazz : generatedBys) {
            JClassType type = loadType(typeOracle, clazz);
            GeneratedBy anno = type.getAnnotation(GeneratedBy.class);
            Class<? extends ContextualTypeProvider> injectorClass = anno.value();

            try {
                injectFactory.addInjector(new ContextualProviderInjector(type, getJClassType(injectorClass)));
            }
            catch (Exception e) {
                throw new ErraiBootstrapFailure("could not load injector: " + e.getMessage(), e);
            }
        }

    }
View Full Code Here

    }

    final String dispatchImplKey = "errai.dispatcher_implementation";
    if (erraiServiceConfig.containsKey(dispatchImplKey)) {
      if (AsyncDispatcher.class.getName().equals(erraiServiceConfig.getString(dispatchImplKey))) {
        throw new ErraiBootstrapFailure("Cannot start Errai CDI. You have have configured the service to use the " +
                  AsyncDispatcher.class.getName()
            + " dispatcher implementation. Due to limitations of Weld, you must use the " +
                  SimpleDispatcher.class.getName() + " in order to use this module.");
      }
    }
View Full Code Here

TOP

Related Classes of org.jboss.errai.bus.server.ErraiBootstrapFailure

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.