Search in sources :

Example 11 with CCInProcessRuntimeModule

use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.

the class ConsumerApplication method getRuntimeModule.

private static Module getRuntimeModule(Properties joynrConfig) {
    Module runtimeModule;
    Module backendTransportModules = Modules.EMPTY_MODULE;
    if (invocationParameters.getRuntimeMode() == RuntimeConfig.WEBSOCKET) {
        joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_HOST, invocationParameters.getCcHost());
        joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PORT, invocationParameters.getCcPort());
        joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PROTOCOL, "ws");
        joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PATH, "");
        joynrConfig.setProperty(MessagingPropertyKeys.PERSISTENCE_FILE, STATIC_PERSISTENCE_FILE);
        runtimeModule = new LibjoynrWebSocketRuntimeModule();
    } else {
        runtimeModule = new CCInProcessRuntimeModule();
        if (invocationParameters.getBackendTransportMode() == BackendConfig.MQTT) {
            joynrConfig.put("joynr.messaging.mqtt.brokerUri", invocationParameters.getMqttBrokerUri());
            joynrConfig.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
            backendTransportModules = Modules.combine(backendTransportModules, new MqttPahoModule());
        } else {
            // HTTP
            backendTransportModules = Modules.combine(backendTransportModules, new AtmosphereMessagingModule());
        }
    }
    return Modules.override(runtimeModule).with(backendTransportModules);
}
Also used : LibjoynrWebSocketRuntimeModule(io.joynr.runtime.LibjoynrWebSocketRuntimeModule) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) Module(com.google.inject.Module) LibjoynrWebSocketRuntimeModule(io.joynr.runtime.LibjoynrWebSocketRuntimeModule) StaticDomainAccessControlProvisioningModule(io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) JoynrApplicationModule(io.joynr.runtime.JoynrApplicationModule) WebsocketModule(io.joynr.messaging.websocket.WebsocketModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule)

Example 12 with CCInProcessRuntimeModule

use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.

the class IltProviderApplication method getRuntimeModule.

private static Module getRuntimeModule(String[] args, Properties joynrConfig) {
    Module runtimeModule;
    if (args.length > 1) {
        String transport = args[1].toLowerCase();
        if (transport.contains("websocketcc")) {
            configureWebSocket(joynrConfig);
            runtimeModule = new CCWebSocketRuntimeModule();
        } else if (transport.contains("websocket")) {
            configureWebSocket(joynrConfig);
            runtimeModule = new LibjoynrWebSocketRuntimeModule();
        } else {
            runtimeModule = new CCInProcessRuntimeModule();
        }
        Module backendTransportModules = Modules.EMPTY_MODULE;
        if (transport.contains("http")) {
            LOG.info("Configuring HTTP...");
            backendTransportModules = Modules.combine(backendTransportModules, new AtmosphereMessagingModule());
        }
        if (transport.contains("mqtt")) {
            LOG.info("Configuring MQTT...");
            joynrConfig.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
            backendTransportModules = Modules.combine(backendTransportModules, new MqttPahoModule());
        }
        return Modules.override(runtimeModule).with(backendTransportModules);
    }
    return Modules.override(new CCInProcessRuntimeModule()).with(new AtmosphereMessagingModule());
}
Also used : LibjoynrWebSocketRuntimeModule(io.joynr.runtime.LibjoynrWebSocketRuntimeModule) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) CCWebSocketRuntimeModule(io.joynr.runtime.CCWebSocketRuntimeModule) Module(com.google.inject.Module) CCWebSocketRuntimeModule(io.joynr.runtime.CCWebSocketRuntimeModule) LibjoynrWebSocketRuntimeModule(io.joynr.runtime.LibjoynrWebSocketRuntimeModule) StaticDomainAccessControlProvisioningModule(io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule) MqttPahoModule(io.joynr.messaging.mqtt.paho.client.MqttPahoModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) JoynrApplicationModule(io.joynr.runtime.JoynrApplicationModule) WebsocketModule(io.joynr.messaging.websocket.WebsocketModule) AtmosphereMessagingModule(io.joynr.messaging.AtmosphereMessagingModule)

Example 13 with CCInProcessRuntimeModule

use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.

the class ShortCircuitTest method setup.

@Before
public void setup() throws Exception {
    Module runtimeModule = Modules.override(new CCInProcessRuntimeModule()).with(new TestGlobalAddressModule());
    Properties joynrConfig = new Properties();
    DummyJoynrApplication application = (DummyJoynrApplication) new JoynrInjectorFactory(joynrConfig, runtimeModule).createApplication(DummyJoynrApplication.class);
    runtime = application.getRuntime();
    DiscoveryQos discoveryQos = new DiscoveryQos(CONST_DEFAULT_TEST_TIMEOUT, ArbitrationStrategy.HighestPriority, DiscoveryQos.NO_MAX_AGE, DiscoveryScope.LOCAL_ONLY);
    ProxyBuilder<EchoProxy> proxyBuilder = runtime.getProxyBuilder(DOMAIN, EchoProxy.class).setDiscoveryQos(discoveryQos);
    echoProxy = proxyBuilder.build();
    EchoProvider echoProvider = new EchoProviderImpl();
    ProviderQos providerQos = new ProviderQos();
    providerQos.setPriority(System.currentTimeMillis());
    providerQos.setScope(ProviderScope.LOCAL);
    runtime.registerProvider(DOMAIN, echoProvider, providerQos);
    // warmup
    for (int i = 0; i < 100; i++) {
        echoProxy.echoString("warmup");
        echoProxy.echoByteArray(new Byte[1]);
    }
}
Also used : TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) DummyJoynrApplication(io.joynr.integration.util.DummyJoynrApplication) EchoProvider(joynr.tests.performance.EchoProvider) Properties(java.util.Properties) DiscoveryQos(io.joynr.arbitration.DiscoveryQos) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) Module(com.google.inject.Module) TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) AbstractModule(com.google.inject.AbstractModule) EchoProxy(joynr.tests.performance.EchoProxy) ProviderQos(joynr.types.ProviderQos) Before(org.junit.Before)

Example 14 with CCInProcessRuntimeModule

use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.

the class DefaultJoynrRuntimeFactory method getInjector.

@Override
public Injector getInjector() {
    if (fInjector == null) {
        Module jeeModule = override(new CCInProcessRuntimeModule()).with(new JeeJoynrIntegrationModule(scheduledExecutorService));
        Module finalModule = override(jeeModule).with(new AbstractModule() {

            @Override
            protected void configure() {
                bind(RawMessagingPreprocessor.class).toInstance(rawMessagePreprocessor);
                if (mqttClientIdProvider != null) {
                    bind(MqttClientIdProvider.class).toInstance(mqttClientIdProvider);
                }
                bind(MqttStatusReceiver.class).toInstance(mqttStatusReceiver);
                bind(StatusReceiver.class).toInstance(statusReceiver);
            }
        });
        fInjector = new JoynrInjectorFactory(joynrProperties, new StaticDomainAccessControlProvisioningModule(), getMessageProcessorsModule(), finalModule).getInjector();
    }
    return fInjector;
}
Also used : CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) Module(com.google.inject.Module) StaticDomainAccessControlProvisioningModule(io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) AbstractModule(com.google.inject.AbstractModule) StaticDomainAccessControlProvisioningModule(io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule) AbstractModule(com.google.inject.AbstractModule) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory)

Example 15 with CCInProcessRuntimeModule

use of io.joynr.runtime.CCInProcessRuntimeModule in project joynr by bmwcarit.

the class ShutdownTest method setup.

@Before
public void setup() {
    Properties factoryPropertiesProvider = new Properties();
    factoryPropertiesProvider.put(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL, "localdomain");
    factoryPropertiesProvider.put(MessagingPropertyKeys.CHANNELID, "ShutdownTestChannelId");
    MockitoAnnotations.initMocks(this);
    Module runtimeModule = Modules.override(new CCInProcessRuntimeModule()).with(new TestGlobalAddressModule());
    dummyApplication = (DummyJoynrApplication) new JoynrInjectorFactory(factoryPropertiesProvider, runtimeModule).createApplication(DummyJoynrApplication.class);
    provider = new DefaulttestProvider();
    providerQos = new ProviderQos();
    providerQos.setScope(ProviderScope.LOCAL);
    providerQos.setPriority(System.currentTimeMillis());
}
Also used : TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) DefaulttestProvider(joynr.tests.DefaulttestProvider) Properties(java.util.Properties) Module(com.google.inject.Module) TestGlobalAddressModule(io.joynr.messaging.routing.TestGlobalAddressModule) CCInProcessRuntimeModule(io.joynr.runtime.CCInProcessRuntimeModule) ProviderQos(joynr.types.ProviderQos) JoynrInjectorFactory(io.joynr.runtime.JoynrInjectorFactory) Before(org.junit.Before)

Aggregations

CCInProcessRuntimeModule (io.joynr.runtime.CCInProcessRuntimeModule)20 Module (com.google.inject.Module)17 JoynrInjectorFactory (io.joynr.runtime.JoynrInjectorFactory)15 AtmosphereMessagingModule (io.joynr.messaging.AtmosphereMessagingModule)10 DummyJoynrApplication (io.joynr.integration.util.DummyJoynrApplication)8 MqttPahoModule (io.joynr.messaging.mqtt.paho.client.MqttPahoModule)8 Properties (java.util.Properties)8 JoynrApplicationModule (io.joynr.runtime.JoynrApplicationModule)7 WebsocketModule (io.joynr.messaging.websocket.WebsocketModule)6 LibjoynrWebSocketRuntimeModule (io.joynr.runtime.LibjoynrWebSocketRuntimeModule)6 AbstractModule (com.google.inject.AbstractModule)5 StaticDomainAccessControlProvisioningModule (io.joynr.accesscontrol.StaticDomainAccessControlProvisioningModule)5 TestGlobalAddressModule (io.joynr.messaging.routing.TestGlobalAddressModule)5 MqttModule (io.joynr.messaging.mqtt.MqttModule)3 AbstractJoynrApplication (io.joynr.runtime.AbstractJoynrApplication)3 JoynrApplication (io.joynr.runtime.JoynrApplication)3 Before (org.junit.Before)3 CCWebSocketRuntimeModule (io.joynr.runtime.CCWebSocketRuntimeModule)2 ProviderQos (joynr.types.ProviderQos)2 Injector (com.google.inject.Injector)1