Search in sources :

Example 1 with RemotingContextImpl

use of com.canoo.dp.impl.server.context.RemotingContextImpl in project dolphin-platform by canoo.

the class RemotingCdiBeanFactory method createRemotingContext.

@Produces
@ClientScoped
public RemotingContext createRemotingContext(RemotingEventBus eventBus) {
    Assert.requireNonNull(eventBus, "eventBus");
    final DolphinContextProvider contextProvider = PlatformBootstrap.getServerCoreComponents().getInstance(DolphinContextProvider.class);
    Assert.requireNonNull(contextProvider, "contextProvider");
    final DolphinContext context = contextProvider.getCurrentDolphinContext();
    Assert.requireNonNull(context, "context");
    return new RemotingContextImpl(context, eventBus);
}
Also used : DolphinContext(com.canoo.dp.impl.server.context.DolphinContext) DolphinContextProvider(com.canoo.dp.impl.server.context.DolphinContextProvider) RemotingContextImpl(com.canoo.dp.impl.server.context.RemotingContextImpl) Produces(javax.enterprise.inject.Produces) ClientScoped(com.canoo.platform.server.javaee.ClientScoped)

Example 2 with RemotingContextImpl

use of com.canoo.dp.impl.server.context.RemotingContextImpl in project dolphin-platform by canoo.

the class RemotingSpringBeanFactory method createRemotingContext.

@Bean(name = "remotingContext")
@ClientScope
protected RemotingContext createRemotingContext(RemotingEventBus eventBus) {
    Assert.requireNonNull(eventBus, "eventBus");
    final DolphinContextProvider contextProvider = PlatformBootstrap.getServerCoreComponents().getInstance(DolphinContextProvider.class);
    Assert.requireNonNull(contextProvider, "contextProvider");
    final DolphinContext context = contextProvider.getCurrentDolphinContext();
    Assert.requireNonNull(context, "context");
    return new RemotingContextImpl(context, eventBus);
}
Also used : DolphinContext(com.canoo.dp.impl.server.context.DolphinContext) DolphinContextProvider(com.canoo.dp.impl.server.context.DolphinContextProvider) RemotingContextImpl(com.canoo.dp.impl.server.context.RemotingContextImpl) ClientScope(com.canoo.platform.server.spring.ClientScope) Bean(org.springframework.context.annotation.Bean)

Aggregations

DolphinContext (com.canoo.dp.impl.server.context.DolphinContext)2 DolphinContextProvider (com.canoo.dp.impl.server.context.DolphinContextProvider)2 RemotingContextImpl (com.canoo.dp.impl.server.context.RemotingContextImpl)2 ClientScoped (com.canoo.platform.server.javaee.ClientScoped)1 ClientScope (com.canoo.platform.server.spring.ClientScope)1 Produces (javax.enterprise.inject.Produces)1 Bean (org.springframework.context.annotation.Bean)1