use of io.joynr.runtime.JoynrApplicationModule in project joynr by bmwcarit.
the class ProviderApplication method main.
public static void main(String[] args) throws Exception {
if ((args.length != 1 && args.length != 2) || (args.length == 2 && !args[1].equals("runForever"))) {
LOG.error("\n\nUSAGE: java {} <local-domain> [runForever]\n\n NOTE: Providers are registered on the local domain.", ProviderApplication.class.getName());
return;
}
localDomain = args[0];
Properties joynrConfig = new Properties();
Module runtimeModule = getRuntimeModule(args, joynrConfig);
LOG.debug("Using the following runtime module: " + runtimeModule.getClass().getSimpleName());
LOG.debug("Registering provider on domain \"{}\"", localDomain);
joynrConfig.setProperty(MessagingPropertyKeys.PERSISTENCE_FILE, STATIC_PERSISTENCE_FILE);
joynrConfig.setProperty(PROPERTY_JOYNR_DOMAIN_LOCAL, localDomain);
Properties appConfig = new Properties();
// Use injected static provisioning of access control entries to allow access to anyone to this interface
provisionAccessControl(joynrConfig, localDomain);
JoynrApplication joynrApplication = new JoynrInjectorFactory(joynrConfig, runtimeModule, new StaticDomainAccessControlProvisioningModule()).createApplication(new JoynrApplicationModule(ProviderApplication.class, appConfig));
if (args.length == 2) {
runForever = true;
}
joynrApplication.run();
joynrApplication.shutdown();
}
use of io.joynr.runtime.JoynrApplicationModule in project joynr by bmwcarit.
the class IltProviderApplication method main.
public static void main(String[] args) throws Exception {
if (args.length != 1 && args.length != 2) {
LOG.error("\n\nUSAGE: java {} <local-domain>\n\n NOTE: Providers are registered on the local domain.", IltProviderApplication.class.getName());
return;
}
String localDomain = args[0];
LOG.debug("Registering provider on domain \"{}\"", localDomain);
Properties joynrConfig = new Properties();
Module runtimeModule = getRuntimeModule(args, joynrConfig);
LOG.debug("Using the following runtime module: " + runtimeModule.getClass().getSimpleName());
LOG.debug("Registering provider on domain \"{}\"", localDomain);
joynrConfig.setProperty(MessagingPropertyKeys.PERSISTENCE_FILE, STATIC_PERSISTENCE_FILE);
joynrConfig.setProperty(PROPERTY_JOYNR_DOMAIN_LOCAL, localDomain);
Properties appConfig = new Properties();
// Use injected static provisioning of access control entries to allow access to anyone to this interface
provisionAccessControl(joynrConfig, localDomain);
JoynrApplication joynrApplication = new JoynrInjectorFactory(joynrConfig, runtimeModule, new StaticDomainAccessControlProvisioningModule()).createApplication(new JoynrApplicationModule(IltProviderApplication.class, appConfig));
joynrApplication.run();
joynrApplication.shutdown();
}
use of io.joynr.runtime.JoynrApplicationModule in project joynr by bmwcarit.
the class EchoProviderApplication method createJoynrApplication.
private static JoynrApplication createJoynrApplication() throws Exception {
Module runtimeModule = Modules.override(getRuntimeModule()).with(getBackendModule());
Properties joynrConfig = createJoynrConfig();
Properties appConfig = createAppConfig();
JoynrInjectorFactory injectorFactory = new JoynrInjectorFactory(joynrConfig, runtimeModule, new StaticDomainAccessControlProvisioningModule());
JoynrApplication joynrApplication = injectorFactory.createApplication(new JoynrApplicationModule(EchoProviderApplication.class, appConfig));
return joynrApplication;
}
use of io.joynr.runtime.JoynrApplicationModule in project joynr by bmwcarit.
the class ConsumerApplication method main.
/**
* Main method.
*
* @throws IOException
*/
public static void main(String[] args) throws IOException {
if (args.length != 1 && args.length != 2) {
LOG.error("USAGE: java {} <provider-domain> [websocket]", ConsumerApplication.class.getName());
return;
}
String providerDomain = args[0];
LOG.debug("Searching for providers on domain \"{}\"", providerDomain);
Properties joynrConfig = new Properties();
Module runtimeModule = getRuntimeModule(args, joynrConfig);
LOG.debug("Using the following runtime module: " + runtimeModule.getClass().getSimpleName());
LOG.debug("Searching for providers on domain \"{}\"", providerDomain);
joynrConfig.setProperty(MessagingPropertyKeys.PERSISTENCE_FILE, STATIC_PERSISTENCE_FILE);
joynrConfig.setProperty(PROPERTY_JOYNR_DOMAIN_LOCAL, providerDomain);
Properties appConfig = new Properties();
appConfig.setProperty(SYSTEMINTEGRATIONTEST_PROVIDER_DOMAIN, providerDomain);
JoynrApplication myConsumerApp = new JoynrInjectorFactory(joynrConfig, runtimeModule).createApplication(new JoynrApplicationModule(ConsumerApplication.class, appConfig));
myConsumerApp.run();
myConsumerApp.shutdown();
}
use of io.joynr.runtime.JoynrApplicationModule in project joynr by bmwcarit.
the class GpsConsumerApplication method main.
/**
* Main method. This method is responsible for: 1. Instantiating the consumer application. 2. Injecting the instance
* with Guice bindings 3. Starting the application. 4. Ending the application so that the necessary clean up calls
* are made.
*
* @param args arguments give when calling the main method
*/
public static void main(String[] args) {
// mvn exec:java -Dexec.classpathScope="test" -Dexec.mainClass="io.joynr.public_examples.android_location_provider.GpsConsumerApplication" -Dexec.args="<provider-domain>"
if (args.length != 1) {
LOG.error("USAGE: java {} <provider-domain>", GpsConsumerApplication.class.getName());
return;
}
String providerDomain = args[0];
LOG.debug("Searching for providers on domain \"{}\"", providerDomain);
// joynr config properties are used to set joynr configuration at compile time. They are set on the
// JoynInjectorFactory.
Properties joynrConfig = new Properties();
// Set a custom static persistence file (default is joynr.properties in the working dir) to store
// joynr configuration. It allows for changing the joynr configuration at runtime. Custom persistence
// files support running the consumer and provider applications from within the same directory.
joynrConfig.setProperty(MessagingPropertyKeys.PERSISTENCE_FILE, STATIC_PERSISTENCE_FILE);
// How to use custom infrastructure elements:
// 1) Set them programmatically at compile time using the joynr configuration properties at the
// JoynInjectorFactory. E.g. uncomment the following lines to set a certain joynr server
// instance.
// joynrConfig.setProperty(MessagingPropertyKeys.BOUNCE_PROXY_URL, "http://localhost:8080/bounceproxy/");
// joynrConfig.setProperty(MessagingPropertyKeys.DISCOVERYDIRECTORYURL, "http://localhost:8080/discovery/channels/discoverydirectory_channelid/");
joynrConfig.setProperty(PROPERTY_JOYNR_DOMAIN_LOCAL, "test_consumer_local_domain");
// NOTE: When running this application to test the android-location-provider, you must use
// the concrete hostname (and _not_ localhost) in the bounceproxy URL, since this URL
// is registered in the global discovery directory and must be resolvable by the Android
// device.
// joynrConfig.setProperty(MessagingPropertyKeys.BOUNCE_PROXY_URL, "http://<concrete host>:8080/bounceproxy/");
// 2) Or set them in the static persistence file (default: joynr.properties in working dir) at
// runtime. If not available in the working dir, it will be created during the first launch
// of the application. Copy the following lines to the custom persistence file to set a
// certain joynr server instance.
// NOTE: This application uses a custom static persistence file consumer-joynr.properties.
// Copy the following lines to the custom persistence file to set a certain joynr server
// instance.
// joynr.messaging.bounceproxyurl=http://localhost:8080/bounceproxy/
// joynr.messaging.discoverydirectoryurl=http://localhost:8080/discovery/channels/discoverydirectory_channelid/
// 3) Or set them in Java System properties.
// -Djoynr.messaging.bounceProxyUrl=http://localhost:8080/bounceproxy/
// -Djoynr.messaging.capabilitiesDirectoryUrl=http://localhost:8080/discovery/channels/discoverydirectory_channelid/
// NOTE:
// Programmatically set configuration properties override properties set in the static persistence file.
// Java system properties override both
// Application-specific configuration properties are injected to the application by setting
// them on the JoynApplicationModule.
Properties appConfig = new Properties();
appConfig.setProperty(APP_CONFIG_PROVIDER_DOMAIN, providerDomain);
JoynrApplication gpsConsumerApp = new JoynrInjectorFactory(joynrConfig, Modules.override(new CCInProcessRuntimeModule()).with(new AtmosphereMessagingModule())).createApplication(new JoynrApplicationModule(GpsConsumerApplication.class, appConfig));
gpsConsumerApp.run();
pressQEnterToContinue();
gpsConsumerApp.shutdown();
}
Aggregations