mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-30 18:15:39 +00:00
19151: SAIL-298: Implemented subsystem changes. - We didn't remove the cifs.serverName property because it is independent of host/port/context/protocol. Applied following corrections - Removed the email 'chain'. OutboundSMTP and InboundSMTP are separate subsystems and don't need to be chained - Added the ability for multiple Spring-initialized subsystems to share the same category - No need to expose mailService outside of the OutboundSMTP subsystem as far as I can tell - GlobalDeskTopActionConfigBean doesn't need dependencies and no longer exposes the webpath property - Fixed construction of contexts in ContentDiskDriver. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19266 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
120 lines
3.5 KiB
Java
120 lines
3.5 KiB
Java
/*
|
|
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
|
*
|
|
* This file is part of Alfresco
|
|
*
|
|
* Alfresco is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Alfresco is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package org.alfresco.repo.imap;
|
|
|
|
import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
|
import org.alfresco.repo.admin.SysAdminParams;
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.LogFactory;
|
|
import org.springframework.context.ApplicationEvent;
|
|
|
|
import com.icegreen.greenmail.Managers;
|
|
import com.icegreen.greenmail.imap.ImapHostManager;
|
|
import com.icegreen.greenmail.imap.ImapServer;
|
|
import com.icegreen.greenmail.user.UserManager;
|
|
import com.icegreen.greenmail.util.ServerSetup;
|
|
|
|
/**
|
|
* @author Mike Shavnev
|
|
*/
|
|
public class AlfrescoImapServer extends AbstractLifecycleBean
|
|
{
|
|
|
|
private static Log logger = LogFactory.getLog(AlfrescoImapServer.class);
|
|
|
|
private ImapServer serverImpl;
|
|
private SysAdminParams sysAdminParams;
|
|
|
|
private int port = 143;
|
|
private ImapHostManager imapHostManager;
|
|
|
|
private UserManager imapUserManager;
|
|
|
|
private boolean imapServerEnabled;
|
|
|
|
|
|
public void setSysAdminParams(SysAdminParams sysAdminParams)
|
|
{
|
|
this.sysAdminParams = sysAdminParams;
|
|
}
|
|
|
|
public void setImapServerEnabled(boolean imapServerEnabled)
|
|
{
|
|
this.imapServerEnabled = imapServerEnabled;
|
|
}
|
|
|
|
public void setPort(int port)
|
|
{
|
|
this.port = port;
|
|
}
|
|
|
|
public void setImapHostManager(ImapHostManager imapHostManager)
|
|
{
|
|
this.imapHostManager = imapHostManager;
|
|
}
|
|
|
|
public void setImapUserManager(UserManager imapUserManager)
|
|
{
|
|
this.imapUserManager = imapUserManager;
|
|
}
|
|
|
|
protected void onBootstrap(ApplicationEvent event)
|
|
{
|
|
if (imapServerEnabled)
|
|
{
|
|
Managers imapManagers = new Managers()
|
|
{
|
|
public ImapHostManager getImapHostManager()
|
|
{
|
|
return imapHostManager;
|
|
}
|
|
|
|
public UserManager getUserManager()
|
|
{
|
|
return imapUserManager;
|
|
}
|
|
};
|
|
String currentHost = sysAdminParams.getAlfrescoHost();
|
|
|
|
serverImpl = new ImapServer(new ServerSetup(port, currentHost, ServerSetup.PROTOCOL_IMAP), imapManagers);
|
|
serverImpl.startService(null);
|
|
if (logger.isInfoEnabled())
|
|
{
|
|
logger.info("IMAP service started on host:port " + currentHost + ":" + this.port + ".");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (logger.isDebugEnabled())
|
|
{
|
|
logger.debug("IMAP service is disabled.");
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void onShutdown(ApplicationEvent event)
|
|
{
|
|
if (serverImpl != null)
|
|
{
|
|
serverImpl.stopService(null);
|
|
}
|
|
}
|
|
|
|
}
|