}
protected void activate(ComponentContext ctxt) {
ConfigurationContext configContext;
Properties props;
MailTransportService mailTransport;
log.debug("******* Mail Transport bundle is activated ******* ");
try {
if (contextService != null) {
// Getting server's configContext instance
configContext = contextService.getServerConfigContext();
} else {
log.error("ConfigurationContext is not found while loading org.wso2.carbon.transport.mail bundle");
throw new Exception("ConfigurationContext is not found");
}
BundleContext bundleCtx = ctxt.getBundleContext();
// Save the transport config in the registry if not already done so
URL configURL = bundleCtx.getBundle().getResource(MailTransportService.TRANSPORT_CONF);
new TransportPersistenceManager(configContext.getAxisConfiguration()).
saveTransportConfiguration(MailTransportService.TRANSPORT_NAME, configURL);
TransportAxis2ConfigurationContextObserver cfgCtxObserver =
new TransportAxis2ConfigurationContextObserver(MailTransportService.TRANSPORT_NAME, configURL);
bundleCtx.registerService(Axis2ConfigurationContextObserver.class.getName(),
cfgCtxObserver, null);
// Instantiate MailTransportService.
mailTransport = new MailTransportService();
// This should ideally contain properties of MailTransportService as a collection of
// key/value pair. Here we do not require to add any elements.
props = new Properties();