Package org.jboss.errai.bus.server

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


      }

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

    log.info("Created Errai-CDI context: " + uuid);
  }
View Full Code Here


      }
      catch (ErraiBootstrapFailure e) {
        throw e;
      }
      catch (Exception e) {
        throw new ErraiBootstrapFailure("cannot configure authentication adapter", e);
      }
    }


    /*** Dispatcher ***/

    RequestDispatcher dispatcher = createInjector(new AbstractModule() {

      @Override
      protected void configure() {
        Class<? extends RequestDispatcher> dispatcherImplementation = SimpleDispatcher.class;

        if (config.hasProperty(ErraiServiceConfigurator.ERRAI_DISPATCHER_IMPLEMENTATION)) {
          try {
            dispatcherImplementation = Class.forName(config.getProperty(ErraiServiceConfigurator.ERRAI_DISPATCHER_IMPLEMENTATION))
                .asSubclass(RequestDispatcher.class);
          }
          catch (Exception e) {
            throw new ErraiBootstrapFailure("could not load request dispatcher implementation class", e);
          }
        }

        log.info("using dispatcher implementation: " + dispatcherImplementation.getName());

        bind(RequestDispatcher.class).to(dispatcherImplementation);
        bind(ErraiService.class).toInstance(context.getService());
        bind(MessageBus.class).toInstance(context.getBus());
        bind(ErraiServiceConfigurator.class).toInstance(config);
      }
    }).getInstance(RequestDispatcher.class);

    context.getService().setDispatcher(dispatcher);

    /*** Session Provider ***/

    SessionProvider sessionProvider = createInjector(new AbstractModule() {
      @Override
      protected void configure() {
        Class<? extends SessionProvider> sessionProviderImplementation = HttpSessionProvider.class;

        if (config.hasProperty(ErraiServiceConfigurator.ERRAI_SESSION_PROVIDER_IMPLEMENTATION)) {
          try {
            sessionProviderImplementation = Class.forName(config.getProperty(ErraiServiceConfigurator.ERRAI_SESSION_PROVIDER_IMPLEMENTATION))
                .asSubclass(SessionProvider.class);
          }
          catch (Exception e) {
            throw new ErraiBootstrapFailure("could not load session provider implementation class", e);
          }
        }

        log.info("using session provider implementation: " + sessionProviderImplementation.getName());

View Full Code Here

              context.defer(create);
            }

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

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

    computeDependentScope(context, injectionContext);

    final Set<Class<?>> bootstrappers = scanner.getTypesAnnotatedWith(IOCBootstrapTask.class);
    for (final Class<?> clazz : bootstrappers) {
      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(procContext, injectionContext, procFactory);
View Full Code Here

      MetaDataScanner scanner = configurator.getMetaDataScanner();
      Set<Class<?>> userEntities = scanner.getTypesAnnotatedWith(AuthUserEntity.class);
      for(Class<?> clazz : userEntities)
      {
        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

      }

      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

                ._("implementationClassName", type.getName() + "Impl")
                ._("interfaceClass", Class.forName(type.getQualifiedSourceName()))
                ._()));
      }
      catch (Throwable t) {
        throw new ErraiBootstrapFailure(t);
      }
    }

    Properties props = scanner.getProperties("ErraiApp.properties");
    if (props != null) {
      logger.log(TreeLogger.Type.INFO, "Checking ErraiApp.properties for configured types ...");

      for (Object o : props.keySet()) {
        String key = (String) o;
        /**
         * Types configuration
         */
        if (ErraiServiceConfigurator.CONFIG_ERRAI_SERIALIZABLE_TYPE.equals(key)) {
          for (String s : props.getProperty(key).split(" ")) {
            try {
              generateMarshaller(oracle.getType(s.trim()), logger, writer);
            }
            catch (Exception e) {
              e.printStackTrace();
              throw new ErraiBootstrapFailure(e);
            }
          }
        }

        /**
         * Entity configuration
         */
        else if (ErraiServiceConfigurator.CONFIG_ERRAI_SERIALIZABLE_TYPE.equals(key)) {
          for (String s : props.getProperty(key).split(" ")) {
            try {
              generateMarshaller(oracle.getType(s.trim()), logger, writer);
            }
            catch (Exception e) {
              e.printStackTrace();
              throw new ErraiBootstrapFailure(e);
            }
          }
        }
      }
    }
View Full Code Here

                                                ._("implementationClassName", visit.getSimpleName() + "Impl")
                                                ._("interfaceClass", visit)
                                                ._()));
                            }
                            catch (Throwable t) {
                                throw new ErraiBootstrapFailure(t);
                            }
                        }
                    }
                }
        );

        try {
            ResourceBundle bundle = ResourceBundle.getBundle("ErraiApp");
            if (bundle != null) {
                logger.log(TreeLogger.Type.INFO, "checking ErraiApp.properties for configured types ...");

              Enumeration<String> keys = bundle.getKeys();

              while(keys.hasMoreElements()) {
                String key = keys.nextElement();
                if(ErraiServiceConfigurator.CONFIG_ERRAI_SERIALIZABLE_TYPE.equals(key))
                {
                  for (String s : bundle.getString(key).split(" ")) {
                    try {
                      Class<?> cls = Class.forName(s.trim());
                      generateMarshaller(cls, logger, writer);
                    }
                    catch (Exception e) {
                      throw new ErraiBootstrapFailure(e);
                    }
                  }
                }
              }
            }
        }
        catch (MissingResourceException exception) {
            throw new ErraiBootstrapFailure("Unable to find ErraiApp.properties in the classpath");
        }


        //  generateMarshaller(CommandMessage.class, logger, writer);
    }
View Full Code Here

            }

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

        key = keys.nextElement();
        properties.put(key, erraiServiceConfig.getString(key));
      }
    }
    catch (Exception e) {
      throw new ErraiBootstrapFailure("Error reading from configuration. Did you include ErraiService.properties?", e);
    }
  }
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.