Class MailServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.platform.mail.service.MailServiceImpl
-
- All Implemented Interfaces:
MailService
,Adaptable
,Component
,Extensible
,TimestampedService
public class MailServiceImpl extends DefaultComponent implements MailService
- Author:
- Alexandre Russel
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,javax.mail.Session>
sessions
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description MailServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.mail.Store
getConnectedStore(String name)
Returns a connected store for this factory.javax.mail.Store
getConnectedStore(String name, Map<String,Object> context)
javax.mail.Transport
getConnectedTransport(String name)
Returns a connected transport for this factory.javax.mail.Transport
getConnectedTransport(String name, Map<String,Object> context)
PropertiesFetcher
getFetcher(String name)
MailBoxActions
getMailBoxActions(String factoryName, String folderName)
Returns an actions pipe configured with this factory.MailBoxActions
getMailBoxActions(String factoryName, String folderName, Map<String,Object> context)
MessageActionPipe
getPipe(String name)
Gets the pipe of actions for given namejavax.mail.Session
getSession(String name)
Returns a session for this factory, using the context to find the session or the default if no context is provided.javax.mail.Session
getSession(String name, Map<String,Object> context)
protected javax.mail.Session
newSession(Properties props)
void
registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
void
sendMail(String text, String subject, String factory, javax.mail.Address[] recipients)
Sends a mail using the setting of this factory to this recipients.void
sendMail(String text, String subject, String factory, javax.mail.Address[] recipients, Map<String,Object> context)
void
stop(ComponentContext context)
Stop the component.void
unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, unregister, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
-
-
-
Method Detail
-
stop
public void stop(ComponentContext context)
Description copied from interface:Component
Stop the component.- Specified by:
stop
in interfaceComponent
- Overrides:
stop
in classDefaultComponent
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContribution
in classDefaultComponent
-
getConnectedStore
public javax.mail.Store getConnectedStore(String name) throws javax.mail.MessagingException
Description copied from interface:MailService
Returns a connected store for this factory. The store needs to be closed after use.- Specified by:
getConnectedStore
in interfaceMailService
- Parameters:
name
- The name of the factory that provides the properties.- Returns:
- the store.
- Throws:
javax.mail.MessagingException
-
getConnectedStore
public javax.mail.Store getConnectedStore(String name, Map<String,Object> context) throws javax.mail.MessagingException
- Specified by:
getConnectedStore
in interfaceMailService
- Throws:
javax.mail.MessagingException
-
getConnectedTransport
public javax.mail.Transport getConnectedTransport(String name) throws javax.mail.MessagingException
Description copied from interface:MailService
Returns a connected transport for this factory. The transport needs to be closed after use.- Specified by:
getConnectedTransport
in interfaceMailService
- Parameters:
name
- the name of the factory that provides the properties.- Returns:
- the transport.
- Throws:
javax.mail.MessagingException
-
getConnectedTransport
public javax.mail.Transport getConnectedTransport(String name, Map<String,Object> context) throws javax.mail.MessagingException
- Specified by:
getConnectedTransport
in interfaceMailService
- Throws:
javax.mail.MessagingException
-
getSession
public javax.mail.Session getSession(String name)
Description copied from interface:MailService
Returns a session for this factory, using the context to find the session or the default if no context is provided.- Specified by:
getSession
in interfaceMailService
-
getSession
public javax.mail.Session getSession(String name, Map<String,Object> context)
- Specified by:
getSession
in interfaceMailService
-
getMailBoxActions
public MailBoxActions getMailBoxActions(String factoryName, String folderName) throws javax.mail.MessagingException
Description copied from interface:MailService
Returns an actions pipe configured with this factory.The actions will start from this folder. The context is be passed to the sessionFactory to be able to find the session. Use the default session if context is not used.
- Specified by:
getMailBoxActions
in interfaceMailService
- Throws:
javax.mail.MessagingException
-
getMailBoxActions
public MailBoxActions getMailBoxActions(String factoryName, String folderName, Map<String,Object> context) throws javax.mail.MessagingException
- Specified by:
getMailBoxActions
in interfaceMailService
- Throws:
javax.mail.MessagingException
-
sendMail
public void sendMail(String text, String subject, String factory, javax.mail.Address[] recipients)
Description copied from interface:MailService
Sends a mail using the setting of this factory to this recipients.The context is passed to the sessionFactory to be able to find the session. Use the default session if context is not used. This template is used, replacing variables with the ones from this variables.
- Specified by:
sendMail
in interfaceMailService
-
sendMail
public void sendMail(String text, String subject, String factory, javax.mail.Address[] recipients, Map<String,Object> context)
- Specified by:
sendMail
in interfaceMailService
-
getFetcher
public PropertiesFetcher getFetcher(String name)
- Specified by:
getFetcher
in interfaceMailService
-
getPipe
public MessageActionPipe getPipe(String name)
Description copied from interface:MailService
Gets the pipe of actions for given name- Specified by:
getPipe
in interfaceMailService
-
newSession
protected javax.mail.Session newSession(Properties props)
-
-