当前位置: 首页>>代码示例>>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;未经允许,请勿转载。