|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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 org.apache.mailet.Mailet |
localDeliveryMailet
Currently used by storeMail to avoid code duplication (we moved store logic to that mailet). |
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(org.apache.mailet.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(org.apache.mailet.Mail mail,
java.lang.String message,
org.apache.mailet.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)
|
java.lang.Object |
getAttribute(java.lang.String key)
|
java.util.Iterator |
getAttributeNames()
|
java.lang.String |
getDefaultDomain()
Return the default domain which will get used to deliver mail to if only the localpart was given on rcpt to. |
java.lang.String |
getHelloName()
Return the helloName which should use for all services by default |
java.lang.String |
getId()
Note that this method ensures that James cannot be run in a distributed fashion. |
java.util.Collection |
getMailServers(java.lang.String host)
|
int |
getMajorVersion()
|
int |
getMinorVersion()
|
org.apache.mailet.MailAddress |
getPostmaster()
|
java.lang.String |
getServerInfo()
|
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 primary mailbox for userName. |
void |
initialize()
|
boolean |
isLocalEmail(org.apache.mailet.MailAddress mailAddress)
|
boolean |
isLocalServer(java.lang.String serverName)
Checks if a server is serviced by mail context |
boolean |
isLocalUser(java.lang.String name)
|
void |
log(java.lang.String message)
|
void |
log(java.lang.String message,
java.lang.Throwable t)
|
protected DNSService |
lookupDNSServer()
|
static void |
main(java.lang.String[] args)
The main method. |
void |
removeAttribute(java.lang.String key)
|
void |
sendMail(org.apache.mailet.Mail mail)
Pass a Mail to this MailServer for processing |
void |
sendMail(org.apache.mailet.MailAddress sender,
java.util.Collection recipients,
java.io.InputStream msg)
Pass a MimeMessage to this MailServer for processing |
void |
sendMail(org.apache.mailet.MailAddress sender,
java.util.Collection recipients,
javax.mail.internet.MimeMessage message)
Pass a MimeMessage to this MailServer for processing |
void |
sendMail(org.apache.mailet.MailAddress sender,
java.util.Collection recipients,
javax.mail.internet.MimeMessage message,
java.lang.String state)
|
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)
|
void |
setLocalusers(UsersRepository localusers)
Set the UsersRepository to use |
void |
setSpool(SpoolRepository spool)
Set the SpoolRepository to use |
void |
setStore(org.apache.avalon.cornerstone.services.store.Store store)
Set Store to use |
void |
storeMail(org.apache.mailet.MailAddress sender,
org.apache.mailet.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. |
boolean |
supportVirtualHosting()
Return true if virtualHosting support is enabled, otherwise false |
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.mailet.Mailet localDeliveryMailet
Constructor Detail |
---|
public James()
Method Detail |
---|
public void service(org.apache.avalon.framework.service.ServiceManager comp) throws org.apache.avalon.framework.service.ServiceException
service
in interface org.apache.avalon.framework.service.Serviceable
org.apache.avalon.framework.service.ServiceException
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 setStore(org.apache.avalon.cornerstone.services.store.Store store)
store
- the Store to usepublic void setSpool(SpoolRepository spool)
spool
- the SpoleRepository to usepublic void setLocalusers(UsersRepository localusers)
localusers
- the UserRepository to usepublic void sendMail(javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
sendMail
in interface MailServer
sendMail
in interface org.apache.mailet.MailetContext
message
- the message to send
javax.mail.MessagingException
- if an exception is caught while placing the mail
on the spoolpublic void sendMail(org.apache.mailet.MailAddress sender, java.util.Collection recipients, javax.mail.internet.MimeMessage message) throws javax.mail.MessagingException
MailServer
sendMail
in interface MailServer
sendMail
in interface org.apache.mailet.MailetContext
sender
- - the sender of the messagerecipients
- - a Collection of String objects of recipientsmessage
- - the MimeMessage of the headers and body content of
the outgoing message
javax.mail.MessagingException
- - if the message fails to parseMailServer.sendMail(MailAddress, Collection, MimeMessage)
public void sendMail(org.apache.mailet.MailAddress sender, java.util.Collection recipients, javax.mail.internet.MimeMessage message, java.lang.String state) throws javax.mail.MessagingException
sendMail
in interface org.apache.mailet.MailetContext
javax.mail.MessagingException
MailetContext.sendMail(MailAddress, Collection, MimeMessage, String)
public void sendMail(org.apache.mailet.MailAddress sender, java.util.Collection recipients, java.io.InputStream msg) throws javax.mail.MessagingException
MailServer
sendMail
in interface MailServer
sender
- - the sender of the messagerecipients
- - a Collection of String objects of recipientsmsg
- - an InputStream containing the headers and body content of
the outgoing message
javax.mail.MessagingException
- - if the message fails to parseMailServer.sendMail(MailAddress, Collection, InputStream)
public void sendMail(org.apache.mailet.Mail mail) throws javax.mail.MessagingException
MailServer
sendMail
in interface MailServer
sendMail
in interface org.apache.mailet.MailetContext
mail
- the Mail to be processed
javax.mail.MessagingException
MailServer.sendMail(Mail)
public MailRepository getUserInbox(java.lang.String userName)
MailServer
getUserInbox
in interface MailServer
userName
- - the name of the user
MailServer.getUserInbox(java.lang.String)
public java.lang.String getId()
Note that this method ensures that James cannot be run in a distributed fashion.
Two instances may return the same ID. There are various ways that this could be fixed. The most obvious would be to add a unique prefix. The best approach would be for each instance to be configured with a name which would then be combined with the network address (for example, james.name@mail.example.org) to create a unique James instance identifier.
Alternatively, using a data store backed identifier (for example, from a sequence when DB backed) should be enough to gaurantee uniqueness. This would imply that the Mail interface or the spool store should be responsible for creating new Mail implementations with ID preassigned.
It would be useful for each James cluster to have a unique name. Perhaps a random number could be generated by the spool store upon first initialisation.
This ID is most likely to be used as message ID so this is probably useful in any case.
getId
in interface MailServer
MailServer.getId()
public static void main(java.lang.String[] args)
args
- the command line argumentspublic java.util.Collection getMailServers(java.lang.String host)
getMailServers
in interface org.apache.mailet.MailetContext
MailetContext.getMailServers(String)
public java.lang.Object getAttribute(java.lang.String key)
getAttribute
in interface org.apache.mailet.MailetContext
MailetContext.getAttribute(java.lang.String)
public void setAttribute(java.lang.String key, java.lang.Object object)
setAttribute
in interface org.apache.mailet.MailetContext
MailetContext.setAttribute(java.lang.String, java.lang.Object)
public void removeAttribute(java.lang.String key)
removeAttribute
in interface org.apache.mailet.MailetContext
MailetContext.removeAttribute(java.lang.String)
public java.util.Iterator getAttributeNames()
getAttributeNames
in interface org.apache.mailet.MailetContext
MailetContext.getAttributeNames()
public void bounce(org.apache.mailet.Mail mail, java.lang.String message) throws javax.mail.MessagingException
bounce
in interface org.apache.mailet.MailetContext
javax.mail.MessagingException
MailetContext.bounce(Mail, String)
public void bounce(org.apache.mailet.Mail mail, java.lang.String message, org.apache.mailet.MailAddress bouncer) throws javax.mail.MessagingException
bounce
in interface org.apache.mailet.MailetContext
javax.mail.MessagingException
MailetContext.bounce(Mail, String, MailAddress)
public boolean isLocalUser(java.lang.String name)
isLocalUser
in interface org.apache.mailet.MailetContext
MailetContext.isLocalUser(String)
public boolean isLocalEmail(org.apache.mailet.MailAddress mailAddress)
isLocalEmail
in interface org.apache.mailet.MailetContext
MailetContext.isLocalEmail(org.apache.mailet.MailAddress)
public org.apache.mailet.MailAddress getPostmaster()
getPostmaster
in interface org.apache.mailet.MailetContext
MailetContext.getPostmaster()
public int getMajorVersion()
getMajorVersion
in interface org.apache.mailet.MailetContext
MailetContext.getMajorVersion()
public int getMinorVersion()
getMinorVersion
in interface org.apache.mailet.MailetContext
MailetContext.getMinorVersion()
public boolean isLocalServer(java.lang.String serverName)
MailServer
isLocalServer
in interface MailServer
isLocalServer
in interface org.apache.mailet.MailetContext
serverName
- - name of server.
MailServer.isLocalServer(java.lang.String)
public java.lang.String getServerInfo()
getServerInfo
in interface org.apache.mailet.MailetContext
MailetContext.getServerInfo()
public void log(java.lang.String message)
log
in interface org.apache.mailet.MailetContext
MailetContext.log(java.lang.String)
public void log(java.lang.String message, java.lang.Throwable t)
log
in interface org.apache.mailet.MailetContext
MailetContext.log(java.lang.String, java.lang.Throwable)
public boolean addUser(java.lang.String userName, java.lang.String password)
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 org.apache.mailet.MailetContext
domainName
- - the domain for which to find mail servers
DNSService.getSMTPHostAddresses(String)
protected DNSService lookupDNSServer()
public void storeMail(org.apache.mailet.MailAddress sender, org.apache.mailet.MailAddress recipient, javax.mail.internet.MimeMessage msg) throws javax.mail.MessagingException
storeMail
in interface org.apache.mailet.MailetContext
javax.mail.MessagingException
MailetContext.storeMail(org.apache.mailet.MailAddress, org.apache.mailet.MailAddress, javax.mail.internet.MimeMessage)
public boolean supportVirtualHosting()
MailServer
supportVirtualHosting
in interface MailServer
MailServer.supportVirtualHosting()
public java.lang.String getDefaultDomain()
MailServer
getDefaultDomain
in interface MailServer
MailServer.getDefaultDomain()
public java.lang.String getHelloName()
MailServer
getHelloName
in interface MailServer
MailServer.getHelloName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |