use of org.nhindirect.gateway.smtp.provider.DefaultSmtpAgentProvider in project nhin-d by DirectProject.
the class WSSmtpAgentConfig method buildAgentInjector.
protected Injector buildAgentInjector() {
// build the domain list and trust anchors
buildDomains();
// build the public cert store
buildPublicCertStore();
// build the private cert store
buildPrivateCertStore();
// build the MDN settings
buildMDNSettings();
// build raw message settings
buildMessageSettings(MESSAGE_SETTING_RAW);
// build incoming message settings
buildMessageSettings(MESSAGE_SETTING_INCOMING);
// build outgoing message settings
buildMessageSettings(MESSAGE_SETTING_OUTGOING);
// build bad message settings
buildMessageSettings(MESSAGE_SETTING_BAD);
// build policy resolver modules
buildPolicyResolvers();
SmtpAgentSettings settings = new SmtpAgentSettings(domainPostmasters, rawSettings, outgoingSettings, incomingSettings, badSettings, notificationProducer);
if (smtpAgentProvider == null)
smtpAgentProvider = new DefaultSmtpAgentProvider(settings);
AgentModule agentModule;
if (agentProvider == null)
agentModule = AgentModule.create(domains, publicCertModule, privateCertModule, certAnchorModule, null, publicPolicyResolverModule, privatePolicyResolverModule, trustPolicyResolverModule);
else
agentModule = AgentModule.create(agentProvider);
return Guice.createInjector(agentModule, SmtpAgentModule.create(smtpAgentProvider));
}
use of org.nhindirect.gateway.smtp.provider.DefaultSmtpAgentProvider in project nhin-d by DirectProject.
the class XMLSmtpAgentConfig method buildAgentInjector.
/*
* Initializes all of the modules needed to build an agent using this configuration
* This is implemented using a simple DOM document loaded from a know XML schema
* Later versions may use POJOs build from XML (JAXB) or other configuration methods
*/
private Injector buildAgentInjector() {
// simple node iteration
Node docNode = doc.getFirstChild().getFirstChild();
do {
/*
* Domain information
*/
if (docNode.getNodeName().equalsIgnoreCase("domains")) {
buildDomains(docNode);
} else /*
* public cert store
*/
if (docNode.getNodeName().equalsIgnoreCase("publiccertstore")) {
buildPublicCertStore(docNode);
publicCertModule = new PublicCertStoreModule(resolverProviders);
} else /*
* public cert store
*/
if (docNode.getNodeName().equalsIgnoreCase("publiccertstores")) {
buildPublicCertStores(docNode);
publicCertModule = new PublicCertStoreModule(resolverProviders);
} else /*
* private cert store
*/
if (docNode.getNodeName().equalsIgnoreCase("privatecertstore")) {
buildPrivateCertStore(docNode);
} else /*
* Raw messages
*/
if (docNode.getNodeName().equalsIgnoreCase("rawmessagesettings")) {
buildRawMessageSettings(docNode);
} else /*
* Incoming messages
*/
if (docNode.getNodeName().equalsIgnoreCase("incomingmessagessettings")) {
buildIncomingMessageSettings(docNode);
} else /*
* Outgoing messages
*/
if (docNode.getNodeName().equalsIgnoreCase("outgoingmessagessettings")) {
buildOutgoingMessageSettings(docNode);
} else /*
* Bad messages
*/
if (docNode.getNodeName().equalsIgnoreCase("badmessagessettings")) {
buildBadMessageSettings(docNode);
} else /*
* MDN settings
*/
if (docNode.getNodeName().equalsIgnoreCase("mdnsettings")) {
buildMDNSettings(docNode);
}
docNode = docNode.getNextSibling();
} while (docNode != null);
if (domains == null)
throw new SmtpAgentException(SmtpAgentError.MissingDomains);
SmtpAgentSettings settings = new SmtpAgentSettings(domainPostmasters, rawSettings, outgoingSettings, incomingSettings, badSettings, notificationProducer);
if (smtpAgentProvider == null)
smtpAgentProvider = new DefaultSmtpAgentProvider(settings);
AgentModule agentModule;
if (agentProvider == null)
agentModule = AgentModule.create(domains, publicCertModule, privateCertModule, certAnchorModule);
else
agentModule = AgentModule.create(agentProvider);
return Guice.createInjector(agentModule, SmtpAgentModule.create(smtpAgentProvider));
}
Aggregations