當前位置: 首頁>>代碼示例>>Java>>正文


Java Store.addStoreListener方法代碼示例

本文整理匯總了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;
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:52,代碼來源:JavaMailContainer.java

示例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;
}
 
開發者ID:gildaslemoal,項目名稱:elpi,代碼行數:51,代碼來源:JavaMailContainer.java


注:本文中的javax.mail.Store.addStoreListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。