|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avalon.framework.logger.AbstractLogEnabled org.apache.james.James
public class James
Core class for JAMES. Provides three primary services:
1) Instantiates resources, such as user repository, and protocol
handlers
2) Handles interactions between components
3) Provides container services for Mailets
Field Summary | |
---|---|
protected Mailet |
localDeliveryMailet
Currently used by storeMail to avoid code duplication (we moved store logic to that mailet). |
protected org.apache.avalon.framework.context.Context |
myContext
The Avalon context used by the instance |
Fields inherited from interface org.apache.james.services.MailServer |
---|
ALL, MDA, ROLE |
Constructor Summary | |
---|---|
James()
|
Method Summary | |
---|---|
boolean |
addUser(java.lang.String userName,
java.lang.String password)
Deprecated. we deprecated this in the MailServer interface and this is an implementation this component depends already depends on a UsersRepository: clients could directly use the addUser of the usersRepository. |
void |
bounce(Mail mail,
java.lang.String message)
This generates a response to the Return-Path address, or the address of the message's sender if the Return-Path is not available. |
void |
bounce(Mail mail,
java.lang.String message,
MailAddress bouncer)
This generates a response to the Return-Path address, or the address of the message's sender if the Return-Path is not available. |
void |
configure(org.apache.avalon.framework.configuration.Configuration conf)
|
void |
contextualize(org.apache.avalon.framework.context.Context context)
|
java.lang.Object |
getAttribute(java.lang.String key)
Returns the mailet container attribute with the given name, or null if there is no attribute by that name. |
java.util.Iterator |
getAttributeNames()
Returns an Iterator containing the attribute names available within this mailet context. |
java.lang.String |
getId()
Return a new mail id. |
java.util.Collection |
getMailServers(java.lang.String host)
Get the prioritized list of mail servers for a given host. |
int |
getMajorVersion()
Return the major version number for the server |
int |
getMinorVersion()
Return the minor version number for the server |
MailAddress |
getPostmaster()
Returns the address of the postmaster for this server. |
java.lang.String |
getServerInfo()
Return the type of the server |
java.util.Iterator |
getSMTPHostAddresses(java.lang.String domainName)
Performs DNS lookups as needed to find servers which should or might support SMTP. |
MailRepository |
getUserInbox(java.lang.String userName)
Retrieve the mail repository for a user For POP3 server only - at the moment. |
void |
initialize()
|
boolean |
isLocalServer(java.lang.String serverName)
Check whether the mail domain in question is to be handled by this server. |
boolean |
isLocalUser(java.lang.String name)
Returns whether that account has a local inbox on this server |
void |
log(java.lang.String message)
Log a message to the Mailet logger |
void |
log(java.lang.String message,
java.lang.Throwable t)
Log a message and a Throwable to the Mailet logger |
static void |
main(java.lang.String[] args)
The main method. |
void |
removeAttribute(java.lang.String key)
Removes the attribute with the given name from the mailet context. |
void |
sendMail(Mail mail)
Place a mail on the spool for processing |
void |
sendMail(MailAddress sender,
java.util.Collection recipients,
java.io.InputStream msg)
Place a mail on the spool for processing |
void |
sendMail(MailAddress sender,
java.util.Collection recipients,
javax.mail.internet.MimeMessage message)
Place a mail on the spool for processing |
void |
sendMail(MailAddress sender,
java.util.Collection recipients,
javax.mail.internet.MimeMessage message,
java.lang.String state)
Place a mail on the spool for processing |
void |
sendMail(javax.mail.internet.MimeMessage message)
Place a mail on the spool for processing |
void |
service(org.apache.avalon.framework.service.ServiceManager comp)
|
void |
setAttribute(java.lang.String key,
java.lang.Object object)
Binds an object to a given attribute name in this mailet context. |
void |
storeMail(MailAddress sender,
MailAddress recipient,
javax.mail.internet.MimeMessage msg)
Deprecated. since 2.2.0 look at the LocalDelivery code to find out how to do the local delivery. |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.apache.avalon.framework.context.Context myContext
protected Mailet localDeliveryMailet
Constructor Detail |
---|
public James()
Method Detail |
---|
public void contextualize(org.apache.avalon.framework.context.Context context)
contextualize
in interface org.apache.avalon.framework.context.Contextualizable
Contextualizable.contextualize(Context)
public void service(org.apache.avalon.framework.service.ServiceManager comp)
service
in interface org.apache.avalon.framework.service.Serviceable
Serviceable.service(ServiceManager)
public void configure(org.apache.avalon.framework.configuration.Configuration conf)
configure
in interface org.apache.avalon.framework.configuration.Configurable
Configurable.configure(Configuration)
public void initialize() throws java.lang.Exception
initialize
in interface org.apache.avalon.framework.activity.Initializable
java.lang.Exception
Initializable.initialize()
public void sendMail(javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
sendMail
in interface MailServer
sendMail
in interface MailetContext
message
- the message to send
javax.mail.MessagingException
- if an exception is caught while placing the mail
on the spoolpublic void sendMail(MailAddress sender, java.util.Collection recipients, javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
sendMail
in interface MailServer
sendMail
in interface MailetContext
sender
- the sender of the mailrecipients
- the recipients of the mailmessage
- the message to send
javax.mail.MessagingException
- if an exception is caught while placing the mail
on the spoolpublic void sendMail(MailAddress sender, java.util.Collection recipients, javax.mail.internet.MimeMessage message, java.lang.String state) throws javax.mail.MessagingException
sendMail
in interface MailetContext
sender
- the sender of the mailrecipients
- the recipients of the mailmessage
- the message to sendstate
- the state of the message
javax.mail.MessagingException
- if an exception is caught while placing the mail
on the spoolpublic void sendMail(MailAddress sender, java.util.Collection recipients, java.io.InputStream msg) throws javax.mail.MessagingException
sendMail
in interface MailServer
sender
- the sender of the mailrecipients
- the recipients of the mailmsg
- an InputStream
containing the message
javax.mail.MessagingException
- if an exception is caught while placing the mail
on the spoolpublic void sendMail(Mail mail) throws javax.mail.MessagingException
sendMail
in interface MailServer
sendMail
in interface MailetContext
mail
- the mail to place on the spool
javax.mail.MessagingException
- if an exception is caught while placing the mail
on the spoolpublic MailRepository getUserInbox(java.lang.String userName)
Retrieve the mail repository for a user
For POP3 server only - at the moment.
getUserInbox
in interface MailServer
userName
- the name of the user whose inbox is to be retrieved
public java.lang.String getId()
getId
in interface MailServer
public static void main(java.lang.String[] args)
args
- the command line argumentspublic java.util.Collection getMailServers(java.lang.String host)
Get the prioritized list of mail servers for a given host.
TODO: This needs to be made a more specific ordered subtype of Collection.
getMailServers
in interface MailetContext
host
-
public java.lang.Object getAttribute(java.lang.String key)
MailetContext
The attribute is returned as a java.lang.Object or some subclass. Attribute names should follow the same convention as package names. The Java Mailet API specification reserves names matching java.*, javax.*, and sun.*
getAttribute
in interface MailetContext
key
- - a String specifying the name of the attribute
public void setAttribute(java.lang.String key, java.lang.Object object)
MailetContext
Attribute names should follow the same convention as package names. The Java Mailet API specification reserves names matching java.*, javax.*, and sun.*.
setAttribute
in interface MailetContext
key
- - a String specifying the name of the attributeobject
- - an Object representing the attribute to be boundpublic void removeAttribute(java.lang.String key)
MailetContext
removeAttribute
in interface MailetContext
key
- - a String specifying the name of the attribute to be removedpublic java.util.Iterator getAttributeNames()
MailetContext
getAttributeNames
in interface MailetContext
public void bounce(Mail mail, java.lang.String message) throws javax.mail.MessagingException
bounce
in interface MailetContext
mail
- - the message that is to be bounced and sender to whom to return the messagemessage
- - a descriptive message as to why the message bounced
javax.mail.MessagingException
public void bounce(Mail mail, java.lang.String message, MailAddress bouncer) throws javax.mail.MessagingException
bounce
in interface MailetContext
mail
- - the message that is to be bounced and sender to whom to return the messagemessage
- - a descriptive message as to why the message bouncedbouncer
- - the address to give as the sender of the bounced message
javax.mail.MessagingException
public boolean isLocalUser(java.lang.String name)
isLocalUser
in interface MailetContext
name
- the name to be checked
public MailAddress getPostmaster()
getPostmaster
in interface MailetContext
MailAddress
for the postmasterpublic int getMajorVersion()
getMajorVersion
in interface MailetContext
public int getMinorVersion()
getMinorVersion
in interface MailetContext
public boolean isLocalServer(java.lang.String serverName)
isLocalServer
in interface MailServer
isLocalServer
in interface MailetContext
serverName
- the name of the server to check
public java.lang.String getServerInfo()
getServerInfo
in interface MailetContext
public void log(java.lang.String message)
log
in interface MailetContext
message
- the message to pass to the Mailet loggerpublic void log(java.lang.String message, java.lang.Throwable t)
log
in interface MailetContext
message
- the message to pass to the Mailet loggert
- the Throwable
to be loggedpublic boolean addUser(java.lang.String userName, java.lang.String password)
addUser
in interface JamesMBean
addUser
in interface MailServer
userName
- String representing user name, that is the portion of
an email address before the '@password
- String plaintext password
public java.util.Iterator getSMTPHostAddresses(java.lang.String domainName)
getSMTPHostAddresses
in interface MailetContext
domainName
- - the domain for which to find mail servers
org.apache.james.DNSServer#getSMTPHostAddresses(String)
public void storeMail(MailAddress sender, MailAddress recipient, javax.mail.internet.MimeMessage msg) throws javax.mail.MessagingException
storeMail
in interface MailetContext
sender
- - the sender of the incoming messagerecipient
- - the user who is receiving this message (as a complete email address)msg
- - the MimeMessage to store in a local mailbox
javax.mail.MessagingException
- - if the message fails to parseMailetContext.storeMail(org.apache.mailet.MailAddress, org.apache.mailet.MailAddress, javax.mail.internet.MimeMessage)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |