Search in sources :

Example 1 with NotificationExecutionOptions

use of fish.payara.nucleus.notification.domain.NotificationExecutionOptions in project Payara by payara.

the class NotificationService method bootstrapNotificationService.

public void bootstrapNotificationService() {
    if (configuration != null) {
        executionOptions = new NotificationExecutionOptions();
        executionOptions.setEnabled(Boolean.parseBoolean(configuration.getEnabled()));
        for (NotifierConfiguration notifierConfiguration : configuration.getNotifierConfigurationList()) {
            NotifierType type = null;
            try {
                ConfigView view = ConfigSupport.getImpl(notifierConfiguration);
                NotifierConfigurationType annotation = view.getProxyType().getAnnotation(NotifierConfigurationType.class);
                type = annotation.type();
                executionOptions.addNotifierConfigurationExecutionOption(factoryStore.get(type).build(notifierConfiguration));
            } catch (UnsupportedEncodingException e) {
                logger.log(Level.SEVERE, "Notifier configuration with type " + type + " cannot be configured due to encoding problems in configuration parameters", e);
            }
        }
        if (executionOptions.isEnabled()) {
            logger.info("Payara Notification Service bootstrapped with configuration: " + executionOptions);
        }
    }
}
Also used : NotifierType(fish.payara.nucleus.notification.configuration.NotifierType) NotifierConfigurationType(fish.payara.nucleus.notification.configuration.NotifierConfigurationType) UnsupportedEncodingException(java.io.UnsupportedEncodingException) NotifierConfiguration(fish.payara.nucleus.notification.configuration.NotifierConfiguration) LogNotifierConfiguration(fish.payara.nucleus.notification.log.LogNotifierConfiguration) NotificationExecutionOptions(fish.payara.nucleus.notification.domain.NotificationExecutionOptions)

Example 2 with NotificationExecutionOptions

use of fish.payara.nucleus.notification.domain.NotificationExecutionOptions in project Payara by payara.

the class NotificationExecutionOptionsTest method logNotifierConfigurationExecutionOptionEnabledSuccessfully.

@Test
public void logNotifierConfigurationExecutionOptionEnabledSuccessfully() {
    NotificationExecutionOptions executionOptions = new NotificationExecutionOptions();
    LogNotifierConfigurationExecutionOptions logExecOptions = new LogNotifierConfigurationExecutionOptions();
    logExecOptions.setEnabled(true);
    executionOptions.addNotifierConfigurationExecutionOption(logExecOptions);
    assertNotNull(executionOptions.getNotifierConfigurationExecutionOptionsList());
    assertThat(executionOptions.isNotifierServiceEnabled(LOG), is(true));
}
Also used : LogNotifierConfigurationExecutionOptions(fish.payara.nucleus.notification.log.LogNotifierConfigurationExecutionOptions) NotificationExecutionOptions(fish.payara.nucleus.notification.domain.NotificationExecutionOptions) Test(org.junit.Test)

Aggregations

NotificationExecutionOptions (fish.payara.nucleus.notification.domain.NotificationExecutionOptions)2 NotifierConfiguration (fish.payara.nucleus.notification.configuration.NotifierConfiguration)1 NotifierConfigurationType (fish.payara.nucleus.notification.configuration.NotifierConfigurationType)1 NotifierType (fish.payara.nucleus.notification.configuration.NotifierType)1 LogNotifierConfiguration (fish.payara.nucleus.notification.log.LogNotifierConfiguration)1 LogNotifierConfigurationExecutionOptions (fish.payara.nucleus.notification.log.LogNotifierConfigurationExecutionOptions)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Test (org.junit.Test)1