Search in sources :

Example 6 with ServerRuntime

use of org.apache.cayenne.configuration.server.ServerRuntime in project cayenne by apache.

the class Http2ROPServlet method init.

@Override
public void init(ServletConfig configuration) throws ServletException {
    checkAlreadyConfigured(configuration.getServletContext());
    this.servletContext = configuration.getServletContext();
    WebConfiguration configAdapter = new WebConfiguration(configuration);
    String configurationLocation = configAdapter.getConfigurationLocation();
    Map<String, String> eventBridgeParameters = configAdapter.getOtherParameters();
    Collection<Module> modules = configAdapter.createModules(new ROPServerModule(eventBridgeParameters), new ProtostuffModule());
    ServerRuntime runtime = ServerRuntime.builder().addConfig(configurationLocation).addModules(modules).build();
    this.remoteService = runtime.getInjector().getInstance(RemoteService.class);
    this.serializationService = runtime.getInjector().getInstance(ROPSerializationService.class);
    WebUtil.setCayenneRuntime(servletContext, runtime);
}
Also used : ProtostuffModule(org.apache.cayenne.configuration.rop.client.ProtostuffModule) RemoteService(org.apache.cayenne.remote.RemoteService) ServerRuntime(org.apache.cayenne.configuration.server.ServerRuntime) ROPSerializationService(org.apache.cayenne.rop.ROPSerializationService) ROPServerModule(org.apache.cayenne.configuration.rop.server.ROPServerModule) ProtostuffModule(org.apache.cayenne.configuration.rop.client.ProtostuffModule) Module(org.apache.cayenne.di.Module) ROPServerModule(org.apache.cayenne.configuration.rop.server.ROPServerModule) WebConfiguration(org.apache.cayenne.configuration.web.WebConfiguration)

Example 7 with ServerRuntime

use of org.apache.cayenne.configuration.server.ServerRuntime in project cayenne by apache.

the class ClientCaseSelfIT method testServerSetup_TearDown_Runtime.

@Test
public void testServerSetup_TearDown_Runtime() throws Exception {
    ServerRuntime local = this.runtime;
    assertNotNull(local);
    assertSame(local, runtimeProvider.get());
    tearDownLifecycleManager();
    setUpLifecycleManager();
    assertNotSame(local, this.runtime);
}
Also used : ServerRuntime(org.apache.cayenne.configuration.server.ServerRuntime) UseServerRuntime(org.apache.cayenne.unit.di.server.UseServerRuntime) Test(org.junit.Test)

Example 8 with ServerRuntime

use of org.apache.cayenne.configuration.server.ServerRuntime in project cayenne by apache.

the class CayenneFilter method init.

public void init(FilterConfig config) throws ServletException {
    checkAlreadyConfigured(config.getServletContext());
    this.servletContext = config.getServletContext();
    WebConfiguration configAdapter = new WebConfiguration(config);
    String configurationLocation = configAdapter.getConfigurationLocation();
    Collection<Module> modules = configAdapter.createModules();
    modules.addAll(getAdditionalModules());
    ServerRuntime runtime = ServerRuntime.builder().addConfig(configurationLocation).addModules(modules).build();
    WebUtil.setCayenneRuntime(config.getServletContext(), runtime);
}
Also used : ServerRuntime(org.apache.cayenne.configuration.server.ServerRuntime) Module(org.apache.cayenne.di.Module) ServerModule(org.apache.cayenne.configuration.server.ServerModule)

Aggregations

ServerRuntime (org.apache.cayenne.configuration.server.ServerRuntime)8 Module (org.apache.cayenne.di.Module)3 Test (org.junit.Test)3 ROPServerModule (org.apache.cayenne.configuration.rop.server.ROPServerModule)2 WebConfiguration (org.apache.cayenne.configuration.web.WebConfiguration)2 RemoteService (org.apache.cayenne.remote.RemoteService)2 UseServerRuntime (org.apache.cayenne.unit.di.server.UseServerRuntime)2 ObjectContext (org.apache.cayenne.ObjectContext)1 ProtostuffModule (org.apache.cayenne.configuration.rop.client.ProtostuffModule)1 ServerModule (org.apache.cayenne.configuration.server.ServerModule)1 ROPSerializationService (org.apache.cayenne.rop.ROPSerializationService)1 BeforeClass (org.junit.BeforeClass)1