本文整理匯總了Java中javax.mail.Store.addStoreListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Store.addStoreListener方法的具體用法?Java Store.addStoreListener怎麽用?Java Store.addStoreListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.mail.Store
的用法示例。
在下文中一共展示了Store.addStoreListener方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import javax.mail.Store; //導入方法依賴的package包/類
/**
* Start the container
*
* @return true if server started
* @throws org.ofbiz.base.container.ContainerException
*
*/
@Override
public boolean start() throws ContainerException {
ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile);
String dispatcherName = ContainerConfig.getPropertyValue(cfg, "dispatcher-name", "JavaMailDispatcher");
String delegatorName = ContainerConfig.getPropertyValue(cfg, "delegator-name", "default");
this.deleteMail = "true".equals(ContainerConfig.getPropertyValue(cfg, "delete-mail", "false"));
this.delegator = DelegatorFactory.getDelegator(delegatorName);
this.dispatcher = ServiceContainer.getLocalDispatcher(dispatcherName, delegator);
this.timerDelay = ContainerConfig.getPropertyValue(cfg, "poll-delay", 300000);
this.maxSize = ContainerConfig.getPropertyValue(cfg, "maxSize", 1000000); // maximum size in bytes
// load the userLogin object
String runAsUser = ContainerConfig.getPropertyValue(cfg, "run-as-user", "system");
try {
this.userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", runAsUser).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to load run-as-user UserLogin; cannot start container", module);
return false;
}
// load the MCA configuration
ServiceMcaUtil.readConfig();
// load the listeners
List<ContainerConfig.Container.Property> configs = cfg.getPropertiesWithValue("store-listener");
for (ContainerConfig.Container.Property prop: configs) {
Session session = this.makeSession(prop);
Store store = this.getStore(session);
if (store != null) {
stores.put(store, session);
store.addStoreListener(new LoggingStoreListener());
}
}
// start the polling timer
if (UtilValidate.isNotEmpty(stores)) {
pollTimer.scheduleAtFixedRate(new PollerTask(dispatcher, userLogin), timerDelay, timerDelay, TimeUnit.MILLISECONDS);
} else {
Debug.logWarning("No JavaMail Store(s) configured; poller disabled.", module);
}
return true;
}
示例2: start
import javax.mail.Store; //導入方法依賴的package包/類
/**
* Start the container
*
* @return true if server started
* @throws org.ofbiz.base.container.ContainerException
*
*/
public boolean start() throws ContainerException {
ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile);
String dispatcherName = ContainerConfig.getPropertyValue(cfg, "dispatcher-name", "JavaMailDispatcher");
String delegatorName = ContainerConfig.getPropertyValue(cfg, "delegator-name", "default");
this.deleteMail = "true".equals(ContainerConfig.getPropertyValue(cfg, "delete-mail", "false"));
this.delegator = DelegatorFactory.getDelegator(delegatorName);
this.dispatcher = ServiceContainer.getLocalDispatcher(dispatcherName, delegator);
this.timerDelay = ContainerConfig.getPropertyValue(cfg, "poll-delay", 300000);
this.maxSize = ContainerConfig.getPropertyValue(cfg, "maxSize", 1000000); // maximum size in bytes
// load the userLogin object
String runAsUser = ContainerConfig.getPropertyValue(cfg, "run-as-user", "system");
try {
this.userLogin = delegator.findOne("UserLogin", false, "userLoginId", runAsUser);
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to load run-as-user UserLogin; cannot start container", module);
return false;
}
// load the MCA configuration
ServiceMcaUtil.readConfig();
// load the listeners
List<ContainerConfig.Container.Property> configs = cfg.getPropertiesWithValue("store-listener");
for (ContainerConfig.Container.Property prop: configs) {
Session session = this.makeSession(prop);
Store store = this.getStore(session);
if (store != null) {
stores.put(store, session);
store.addStoreListener(new LoggingStoreListener());
}
}
// start the polling timer
if (UtilValidate.isNotEmpty(stores)) {
pollTimer.scheduleAtFixedRate(new PollerTask(dispatcher, userLogin), timerDelay, timerDelay, TimeUnit.MILLISECONDS);
} else {
Debug.logWarning("No JavaMail Store(s) configured; poller disabled.", module);
}
return true;
}