|
|||||||||||
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
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 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(String userName,
String password)
Adds a user to this mail server. |
void |
bounce(Mail mail,
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,
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 |
compose(ComponentManager comp)
|
void |
configure(Configuration conf)
|
void |
contextualize(Context context)
|
Object |
getAttribute(String key)
Returns the mailet container attribute with the given name, or null if there is no attribute by that name. |
Iterator |
getAttributeNames()
Returns an Iterator containing the attribute names available within this mailet context. |
String |
getId()
Return a new mail id. |
Collection |
getMailServers(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. |
String |
getServerInfo()
Return the type of the server |
MailRepository |
getUserInbox(String userName)
Retrieve the mail repository for a user For POP3 server only - at the moment. |
void |
initialize()
|
boolean |
isLocalServer(String serverName)
Check whether the mail domain in question is to be handled by this server. |
boolean |
isLocalUser(String name)
Returns whether that account has a local inbox on this server |
void |
log(String message)
Log a message to the Mailet logger |
void |
log(String message,
Throwable t)
Log a message and a Throwable to the Mailet logger |
static void |
main(String[] args)
The main method. |
void |
removeAttribute(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,
Collection recipients,
InputStream msg)
Place a mail on the spool for processing |
void |
sendMail(MailAddress sender,
Collection recipients,
MimeMessage message)
Place a mail on the spool for processing |
void |
sendMail(MailAddress sender,
Collection recipients,
MimeMessage message,
String state)
Place a mail on the spool for processing |
void |
sendMail(MimeMessage message)
Place a mail on the spool for processing |
void |
setAttribute(String key,
Object object)
Binds an object to a given attribute name in this mailet context. |
void |
storeMail(MailAddress sender,
MailAddress recipient,
MimeMessage message)
Stores mail into local accounts (POP3 by default) |
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 Context myContext
Constructor Detail |
public James()
Method Detail |
public void contextualize(Context context)
contextualize
in interface Contextualizable
Contextualizable.contextualize(Context)
public void compose(ComponentManager comp)
compose
in interface Composable
Composable.compose(ComponentManager)
public void configure(Configuration conf)
configure
in interface Configurable
Configurable.configure(Configuration)
public void initialize() throws Exception
initialize
in interface Initializable
Exception
Initializable.initialize()
public void sendMail(MimeMessage message) throws MessagingException
sendMail
in interface MailServer
message
- the message to send
MessagingException
- if an exception is caught while placing the mail
on the spoolpublic void sendMail(MailAddress sender, Collection recipients, MimeMessage message) throws MessagingException
sendMail
in interface MailServer
sender
- the sender of the mailrecipients
- the recipients of the mailmessage
- the message to send
MessagingException
- if an exception is caught while placing the mail
on the spoolpublic void sendMail(MailAddress sender, Collection recipients, MimeMessage message, String state) throws 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
MessagingException
- if an exception is caught while placing the mail
on the spoolpublic void sendMail(MailAddress sender, Collection recipients, InputStream msg) throws MessagingException
sendMail
in interface MailServer
sender
- the sender of the mailrecipients
- the recipients of the mailmsg
- an InputStream
containing the message
MessagingException
- if an exception is caught while placing the mail
on the spoolpublic void sendMail(Mail mail) throws MessagingException
sendMail
in interface MailServer
mail
- the mail to place on the spool
MessagingException
- if an exception is caught while placing the mail
on the spoolpublic MailRepository getUserInbox(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 String getId()
getId
in interface MailServer
public static void main(String[] args)
args
- the command line argumentspublic Collection getMailServers(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 Object getAttribute(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(String key, 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(String key)
MailetContext
removeAttribute
in interface MailetContext
key
- - a String specifying the name of the attribute to be removedpublic Iterator getAttributeNames()
MailetContext
getAttributeNames
in interface MailetContext
public void bounce(Mail mail, String message) throws 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
MessagingException
public void bounce(Mail mail, String message, MailAddress bouncer) throws 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
MessagingException
public boolean isLocalUser(String name)
isLocalUser
in interface MailetContext
name
- the name to be checked
public MailAddress getPostmaster()
getPostmaster
in interface MailetContext
MailAddress
for the postmasterpublic void storeMail(MailAddress sender, MailAddress recipient, MimeMessage message) throws MessagingException
MailetContext
storeMail
in interface MailetContext
sender
- - the sender of the incoming messagerecipient
- - the user who is receiving this message (as a complete email address)message
- - the MimeMessage to store in a local mailbox
MessagingException
- - if the message fails to parsepublic int getMajorVersion()
getMajorVersion
in interface MailetContext
public int getMinorVersion()
getMinorVersion
in interface MailetContext
public boolean isLocalServer(String serverName)
isLocalServer
in interface MailServer
serverName
- the name of the server to check
public String getServerInfo()
getServerInfo
in interface MailetContext
public void log(String message)
log
in interface MailetContext
message
- the message to pass to the Mailet loggerpublic void log(String message, Throwable t)
log
in interface MailetContext
message
- the message to pass to the Mailet loggert
- the Throwable
to be loggedpublic boolean addUser(String userName, String password)
addUser
in interface JamesMBean
userName
- String representing user name, that is the portion of
an email address before the '@password
- String plaintext password
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |