Examples of ErraiService


Examples of org.jboss.errai.bus.server.service.ErraiService

  }

  private static ErraiService backupSingleton;

  private static ErraiService _lookupErraiService(InitialContext ctx) {
    ErraiService errai;
    if ((errai = tryLookup(ctx, ErraiService.ERRAI_DEFAULT_JNDI)) != null) {
      return errai;
    }

    if ((errai = tryLookup(ctx, ERRAI_STANDARD_SERVICE_JNDI)) != null) {
View Full Code Here

Examples of org.jboss.errai.bus.server.service.ErraiService

    return null;
  }

  public static ErraiService lookupErraiService() {
    InitialContext ctx = null;
    ErraiService errai = null;

    boolean bound = false;
    try {
      ctx = new InitialContext();
    }
View Full Code Here

Examples of org.jboss.errai.bus.server.service.ErraiService

  }

  private static ErraiService tryLookup(Context ctx, String addr) {

    ErraiService errai;
    try {
      errai = (ErraiService) ctx.lookup(addr);
      log.info("found ErraiService bound at: " + addr);

      return errai;
View Full Code Here

Examples of org.jboss.errai.bus.server.service.ErraiService

            synchronized (context)
            {
                managedJndiName = context.getInitParameter("jndiName") !=null ?
                        context.getInitParameter("jndiName") : DEFAULT_JNDI_NAME;

                ErraiService service = null;

                try {
                    service = new JNDIServiceLocator(managedJndiName).locateService();

                    log.info("Service exists. Attaching to " + managedJndiName);
View Full Code Here

Examples of org.jboss.errai.bus.server.service.ErraiService

    }

    @Deprecated
    public static MessageBus lookupMessageBus() {
        InitialContext ctx = null;
        ErraiService errai = null;

        try {
            ctx = new InitialContext();
            errai = (ErraiService) ctx.lookup("java:/Errai");
        } catch (NamingException e) {
            if (ctx != null) {
                try {
                    errai = (ErraiService) ctx.lookup("java:comp/env/Errai"); // development mode
                } catch (NamingException e1) {
                }
            }

            if (null == errai)
                throw new RuntimeException("Failed to locate Errai service instance", e);
        }

        return errai.getBus();
    }
View Full Code Here

Examples of org.jboss.errai.bus.server.service.ErraiService

    }

    public static ErraiService lookupErraiService() {

        InitialContext ctx = null;
        ErraiService erraiService = null;

        try {
            ctx = new InitialContext();
            erraiService = (ErraiService) ctx.lookup(ERRAI_SERVICE_JNDI);
        } catch (NamingException e) {
View Full Code Here

Examples of org.jboss.errai.bus.server.service.ErraiService

    }
  }

  @SuppressWarnings({"UnusedDeclaration", "CdiInjectionPointsInspection"})
  public void afterBeanDiscovery(@Observes final AfterBeanDiscovery abd, final BeanManager bm) {
    final ErraiService service = ErraiServiceSingleton.getService();
    final MessageBus bus = service.getBus();

    if (bus.isSubscribed(CDI.SERVER_DISPATCHER_SUBJECT)) {
      return;
    }

    final byte[] randBytes = new byte[32];
    final Random random = new Random(System.currentTimeMillis());

    random.nextBytes(randBytes);

    abd.addBean(new ErraiServiceBean(bm, SecureHashUtil.hashToHexString(randBytes)));

    final Set<ObserversMarshallingExtension.ObserverPoint> observerPoints
            = new HashSet<ObserversMarshallingExtension.ObserverPoint>();

    for (EventConsumer ec : eventConsumers) {
      if (ec.getEventBeanType() != null) {
        abd.addBean(new ConversationalEventBean(ec.getEventBeanType(), (BeanManagerImpl) bm, bus));
      }

      observerPoints.add(new ObserversMarshallingExtension.ObserverPoint(ec.getRawType(), ec.getQualifiers()));
    }

    observerPoints.addAll(org.jboss.errai.enterprise.rebind.ObserversMarshallingExtension.scanForObserverPointsInClassPath());

    for (org.jboss.errai.enterprise.rebind.ObserversMarshallingExtension.ObserverPoint observerPoint :
            observerPoints) {

      if (org.jboss.errai.common.rebind.EnvUtil.isPortableType(observerPoint.getObservedType())) {
        if (observerPoint.getObservedType().isAnnotationPresent(Conversational.class)) {
          abd.addObserverMethod(new ConversationalEventObserverMethod(observerPoint.getObservedType(), bus, observerPoint.getQualifiers()));
        }
        else {
          abd.addObserverMethod(new EventObserverMethod(observerPoint.getObservedType(), bus, observerPoint.getQualifiers()));
        }
      }
    }

    for (MessageSender ms : messageSenders) {
      abd.addBean(new SenderBean(ms.getSenderType(), ms.getQualifiers(), bus));
    }

    final EventDispatcher eventDispatcher = new EventDispatcher(bm, observableEvents, eventQualifiers);

    bus.subscribe(CDI.SERVER_DISPATCHER_SUBJECT, eventDispatcher);

    // Errai bus injection
    abd.addBean(new MessageBusBean(bus));

    // Support to inject the request dispatcher.
    abd.addBean(new RequestDispatcherMetaData(bm, service.getDispatcher()));

    // Register observers
    abd.addObserverMethod(new ShutdownEventObserver(managedTypes, bus));

    // subscribe service and rpc endpoints
View Full Code Here

Examples of org.jboss.errai.bus.server.service.ErraiService

    }
  }

  @SuppressWarnings({ "UnusedDeclaration", "CdiInjectionPointsInspection" })
  public void afterBeanDiscovery(@Observes final AfterBeanDiscovery abd, final BeanManager bm) {
    final ErraiService service = ErraiServiceSingleton.getService();
    final MessageBus bus = service.getBus();
    final EventRoutingTable eventRoutingTable = new EventRoutingTable();

    if (bus.isSubscribed(CDI.SERVER_DISPATCHER_SUBJECT)) {
      return;
    }

    final byte[] randBytes = new byte[32];
    final Random random = new Random(System.currentTimeMillis());

    random.nextBytes(randBytes);

    abd.addBean(new ErraiServiceBean(bm, SecureHashUtil.hashToHexString(randBytes)));

    for (final MessageSender ms : messageSenders) {
      abd.addBean(new SenderBean(ms.getSenderType(), ms.getQualifiers(), bus));
    }

    // Errai bus injection
    abd.addBean(new MessageBusBean(bus));

    // Support to inject the request dispatcher.
    abd.addBean(new RequestDispatcherMetaData(bm, service.getDispatcher()));

    // Register observers
    abd.addObserverMethod(new ShutdownEventObserver(managedTypes, bus));

    // subscribe service and rpc endpoints
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.