org.apache.geronimo.javamail.transport.nntp
Class NNTPTransport

java.lang.Object
  extended by javax.mail.Service
      extended by javax.mail.Transport
          extended by org.apache.geronimo.javamail.transport.nntp.NNTPTransport
Direct Known Subclasses:
NNTPSSLTransport

public class NNTPTransport
extends Transport

Simple implementation of NNTP transport. Just does plain RFC977-ish delivery.

There is no way to indicate failure for a given recipient (it's possible to have a recipient address rejected). The sun impl throws exceptions even if others successful), but maybe we do a different way...

Version:
$Rev: 673649 $ $Date: 2008-07-03 06:37:56 -0400 (Thu, 03 Jul 2008) $

Field Summary
protected  NNTPConnection connection
           
protected static int DEFAULT_NNTP_PORT
           
protected static int DEFAULT_NNTP_SSL_PORT
           
protected static String NNTP_FROM
          property keys for protocol properties.
protected  ProtocolProperties props
           
 
Fields inherited from class javax.mail.Service
debug, session, url
 
Constructor Summary
  NNTPTransport(Session session, URLName name)
          Normal constructor for an NNTPTransport() object.
protected NNTPTransport(Session session, URLName name, String protocol, int defaultPort, boolean sslConnection)
          Common constructor used by the POP3Store and POP3SSLStore classes to do common initialization of defaults.
 
Method Summary
 void close()
          Close the connection.
protected  boolean protocolConnect(String host, int port, String username, String password)
          Do the protocol connection for an NNTP transport.
 void sendMessage(Message message, Address[] addresses)
          Send a message to multiple addressees.
 
Methods inherited from class javax.mail.Transport
addTransportListener, notifyTransportListeners, removeTransportListener, send, send
 
Methods inherited from class javax.mail.Service
addConnectionListener, connect, connect, connect, connect, finalize, getURLName, isConnected, notifyConnectionListeners, queueEvent, removeConnectionListener, setConnected, setURLName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NNTP_FROM

protected static final String NNTP_FROM
property keys for protocol properties.

See Also:
Constant Field Values

DEFAULT_NNTP_PORT

protected static final int DEFAULT_NNTP_PORT
See Also:
Constant Field Values

DEFAULT_NNTP_SSL_PORT

protected static final int DEFAULT_NNTP_SSL_PORT
See Also:
Constant Field Values

props

protected ProtocolProperties props

connection

protected NNTPConnection connection
Constructor Detail

NNTPTransport

public NNTPTransport(Session session,
                     URLName name)
Normal constructor for an NNTPTransport() object. This constructor is used to build a transport instance for the "smtp" protocol.

Parameters:
session - The attached session.
name - An optional URLName object containing target information.

NNTPTransport

protected NNTPTransport(Session session,
                        URLName name,
                        String protocol,
                        int defaultPort,
                        boolean sslConnection)
Common constructor used by the POP3Store and POP3SSLStore classes to do common initialization of defaults.

Parameters:
session - The host session instance.
name - The URLName of the target.
protocol - The protocol type ("pop3"). This helps us in retrieving protocol-specific session properties.
defaultPort - The default port used by this protocol. For pop3, this will be 110. The default for pop3 with ssl is 995.
sslConnection - Indicates whether an SSL connection should be used to initial contact the server. This is different from the STARTTLS support, which switches the connection to SSL after the initial startup.
Method Detail

protocolConnect

protected boolean protocolConnect(String host,
                                  int port,
                                  String username,
                                  String password)
                           throws MessagingException
Do the protocol connection for an NNTP transport. This handles server authentication, if possible. Returns false if unable to connect to the server.

Overrides:
protocolConnect in class Service
Parameters:
host - The target host name.
port - The server port number.
user - The authentication user (if any).
password - The server password. Might not be sent directly if more sophisticated authentication is used.
Returns:
true if we were able to connect to the server properly, false for any failures.
Throws:
MessagingException

sendMessage

public void sendMessage(Message message,
                        Address[] addresses)
                 throws MessagingException
Send a message to multiple addressees.

Specified by:
sendMessage in class Transport
Parameters:
message - The message we're sending.
addresses - An array of addresses to send to.
Throws:
MessagingException

close

public void close()
           throws MessagingException
Close the connection. On completion, we'll be disconnected from the server and unable to send more data.

Overrides:
close in class Service
Throws:
MessagingException


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.