Package org.jgrapes.mail
Class MailComponent
java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jgrapes.mail.MailComponent
- All Implemented Interfaces:
Iterable<ComponentType>
,Channel
,ComponentType
,Eligible
,Manager
- Direct Known Subclasses:
MailConnectionManager
,SystemMailSender
A base class for mail handling components.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jgrapes.core.Channel
Channel.Default
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new component with its channel set to itself.MailComponent
(Channel componentChannel) Creates a new component base with its channel set to the given channel.MailComponent
(Channel componentChannel, HandlerDefinition.ChannelReplacements channelReplacements) Creates a new component base likeMailComponent(Channel)
but with channel mappings forHandler
annotations. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
configureComponent
(Map<String, String> values) Configure the component specific values.void
Configure the component.setMailProperties
(Map<String, String> props) Sets the mail properties.toString()
If a name has been set for this component (seeManager.setName(String)
), return the name, else return the object name provided byComponents.objectName(Object)
, usingComponentVertex.component()
as argument.Methods inherited from class org.jgrapes.core.Component
channel, component, defaultCriterion, isEligibleFor, setName
Methods inherited from class org.jgrapes.core.internal.ComponentVertex
activeEventPipeline, addHandler, attach, children, componentPath, componentVertex, detach, fire, initComponentsHandlers, iterator, name, newEventPipeline, newEventPipeline, parent, registerAsGenerator, root, unregisterAsGenerator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
mailProps
-
-
Constructor Details
-
MailComponent
public MailComponent()Creates a new component with its channel set to itself. -
MailComponent
Creates a new component base with its channel set to the given channel.As a special case
Channel.SELF
can be passed to the constructor to make the component use itself as channel. The special value is necessary as you obviously cannot pass an object to be constructed to its constructor.- Parameters:
componentChannel
- the channel that the component’s handlers listen on by default and thatManager.fire(Event, Channel...)
sends the event to
-
MailComponent
public MailComponent(Channel componentChannel, HandlerDefinition.ChannelReplacements channelReplacements) Creates a new component base likeMailComponent(Channel)
but with channel mappings forHandler
annotations.- Parameters:
componentChannel
- the channel that the component’s handlers listen on by default and thatManager.fire(Event, Channel...)
sends the event tochannelReplacements
- the channel replacements to apply to thechannels
elements of theHandler
annotations
-
-
Method Details
-
setMailProperties
Sets the mail properties.See the Jakarta Mail documentation for available settings. The given properties are merged with the already existing properties.
- Parameters:
props
- the props- Returns:
- the mail monitor
-
onConfigUpdate
Configure the component.Attempts to access all paths specified in the package description in sequence as described in
org.jgrapes.mail
. For each path, merges themail
properties and invokesconfigureComponent(java.util.Map<java.lang.String, java.lang.String>)
with the available key/value pairs.- Parameters:
event
- the event
-
configureComponent
Configure the component specific values.- Parameters:
values
- the values
-
toString
Description copied from class:ComponentVertex
If a name has been set for this component (seeManager.setName(String)
), return the name, else return the object name provided byComponents.objectName(Object)
, usingComponentVertex.component()
as argument.- Overrides:
toString
in classComponentVertex
-