use of org.nhindirect.gateway.smtp.ReliableDispatchedNotificationProducer in project nhin-d by DirectProject.
the class TimelyAndReliableLocalDelivery method init.
/**
* {@inheritDoc}
*/
public void init() throws MessagingException {
super.init();
try {
final String sDispatchedDelay = GatewayConfiguration.getConfigurationParam(DISPATCHED_MDN_DELAY, this, "0");
try {
dispatchedMDNDelay = Integer.valueOf(sDispatchedDelay).intValue();
} catch (NumberFormatException e) {
// in case of parsing exceptions
dispatchedMDNDelay = 0;
}
// create an instance of the local delivery if we can
localDeliveryMailet = createLocalDeliveryClass();
final Method initMethod = Mailet.class.getDeclaredMethod("init", MailetConfig.class);
serviceMethod = Mailet.class.getDeclaredMethod("service", Mail.class);
// set private objects if they exist
final Class<?> localDeliveryMailetClass = localDeliveryMailet.getClass();
Field field = getDeclaredFieldQuietly(localDeliveryMailetClass, "rrt");
if (field != null) {
field.setAccessible(true);
field.set(localDeliveryMailet, rrt);
}
field = getDeclaredFieldQuietly(localDeliveryMailetClass, "usersRepository");
if (field != null) {
field.setAccessible(true);
field.set(localDeliveryMailet, usersRepository);
}
field = getDeclaredFieldQuietly(localDeliveryMailetClass, "mailboxManager");
if (field != null) {
field.setAccessible(true);
field.set(localDeliveryMailet, mailboxManager);
}
field = getDeclaredFieldQuietly(localDeliveryMailetClass, "domainList");
if (field != null) {
field.setAccessible(true);
field.set(localDeliveryMailet, domainList);
}
field = getDeclaredFieldQuietly(localDeliveryMailetClass, "fileSystem");
if (field != null) {
field.setAccessible(true);
field.set(localDeliveryMailet, fileSystem);
}
initMethod.invoke(localDeliveryMailet, this.getMailetConfig());
} catch (Exception e) {
throw new MessagingException("Failed to initialize TimelyAndReliableLocalDelivery.", e);
}
notificationProducer = new ReliableDispatchedNotificationProducer(new NotificationSettings(true, "Local Direct Delivery Agent", "Your message was successfully dispatched."));
}
use of org.nhindirect.gateway.smtp.ReliableDispatchedNotificationProducer in project nhin-d by DirectProject.
the class DirectXdMailet method init.
/*
* (non-Javadoc)
*
* @see org.apache.mailet.base.GenericMailet#init()
*/
@Override
public void init() throws MessagingException {
LOGGER.info("Initializing DirectXdMailet");
super.init();
// Get the endpoint URL
endpointUrl = getInitParameter("EndpointURL");
if (StringUtils.isBlank(endpointUrl)) {
LOGGER.error("DirectXdMailet endpoint URL cannot be empty or null.");
throw new MessagingException("DirectXdMailet endpoint URL cannot be empty or null.");
}
// Get the config-service URL
try {
configServiceUrl = getInitParameter("ConfigURL");
} catch (Exception e) {
// eat it
}
notificationProducer = new ReliableDispatchedNotificationProducer(new NotificationSettings(true, "Direct XD Delivery Agent", "Your message was successfully dispatched."));
}
Aggregations