org.apache.geronimo.mail
Class NNTPTransportGBean

java.lang.Object
  extended by org.apache.geronimo.mail.ProtocolGBean
      extended by org.apache.geronimo.mail.NNTPTransportGBean
All Implemented Interfaces:
GBeanLifecycle, NNTPGBeanConstants

public class NNTPTransportGBean
extends ProtocolGBean
implements NNTPGBeanConstants

A GBean that provides for the configuration of a JavaMail NNTP transport protocol.

NNTP transport properties that are common to all NNTP transports are provided via member variables of this class. Values that are set in the individual member variables will override any of the corresponding values that have been set in the properties set.

See Also:
MailGBean

Field Summary
static GBeanInfo GBEAN_INFO
           
 
Fields inherited from class org.apache.geronimo.mail.ProtocolGBean
GBEAN_ADD_OVERRIDES, GBEAN_AUTH, GBEAN_CONNECTION_TIMEOUT, GBEAN_FACTORY_CLASS, GBEAN_FACTORY_FALLBACK, GBEAN_FACTORY_PORT, GBEAN_FROM, GBEAN_HOST, GBEAN_LOCALADDRESS, GBEAN_LOCALHOST, GBEAN_LOCALPORT, GBEAN_OBJECTNAME, GBEAN_PORT, GBEAN_PROPERTIES, GBEAN_PROTOCOL, GBEAN_QUITWAIT, GBEAN_REALM, GBEAN_TIMEOUT, GBEAN_USER
 
Fields inherited from interface org.apache.geronimo.mail.NNTPGBeanConstants
NNTP_AUTH, NNTP_CONNECTION_TIMEOUT, NNTP_FACTORY_CLASS, NNTP_FACTORY_FALLBACK, NNTP_FACTORY_PORT, NNTP_FROM, NNTP_PORT, NNTP_QUITWAIT, NNTP_REALM, NNTP_TIMEOUT, NNTPS_AUTH, NNTPS_CONNECTION_TIMEOUT, NNTPS_FACTORY_CLASS, NNTPS_FACTORY_FALLBACK, NNTPS_FACTORY_PORT, NNTPS_FROM, NNTPS_PORT, NNTPS_QUITWAIT, NNTPS_REALM, NNTPS_TIMEOUT
 
Constructor Summary
NNTPTransportGBean(String objectName, Properties properties, String host, String user, Integer port, Integer connectionTimeout, Integer timeout, String from, Boolean auth, String saslRealm, Boolean quitWait, String socketFactoryClass, Boolean socketFactoryFallback, Integer socketFactoryPort)
          Construct an instance of NNTPTransportGBean

Values that are set in the individual member variables will override any of the corresponding values that have been set in the properties set.

 
Method Summary
 void addOverrides(Properties props)
          Add the overrides from the member variables to the properties file.
 void doFail()
          Fails the GBean.
 void doStart()
          Starts the GBean.
 void doStop()
          Stops the target.
 Boolean getAuth()
          Returns whether an attempt will be made to authenticate the user

Defaults to false.

 Integer getConnectionTimeout()
          Returns the socket connection timeout value in milliseconds.
 String getFrom()
          Returns the email address to use for NNTP POST command.
static GBeanInfo getGBeanInfo()
           
 Integer getPort()
          Returns the NNTP server port to connect to, if the connect() method doesn't explicitly specify one.
 Boolean getQuitWait()
          Returns whether the transport will wait for the response to the QUIT command.
 String getSaslRealm()
          Returns the realm to use with DIGEST-MD5 authentication.
 String getSocketFactoryClass()
          Returns the class that will be used to create NNTP sockets.
 Boolean getSocketFactoryFallback()
          Returns whether java.net.Socket class will be created if the specified socket factory class cannot be created.
 Integer getSocketFactoryPort()
          Returns the port to connect to when using the specified socket factory.
 Integer getTimeout()
          Returns the socket I/O timeout value in milliseconds.
 void setAuth(Boolean auth)
          Sets whether an attempt will be made to authenticate the user.
 void setConnectionTimeout(Integer connectionTimeout)
          Sets the socket connection timeout value in milliseconds.
 void setFrom(String from)
          Sets the email address to use for NNTP POST command

Email address to use for NNTP POST command.

 void setPort(Integer port)
          Sets the NNTP server port to connect to, if the connect() method doesn't explicitly specify one.
 void setQuitWait(Boolean quitWait)
          Sets whether the transport will wait for the response to the QUIT command

If set to true, causes the transport to wait for the response to the QUIT command.

 void setSaslRealm(String saslRealm)
          Sets the realm to use with DIGEST-MD5 authentication.
 void setSocketFactoryClass(String socketFactoryClass)
          Sets the class that will be used to create NNTP sockets.
 void setSocketFactoryFallback(Boolean socketFactoryFallback)
          Sets whether java.net.Socket class will be created if the specified socket factory class cannot be created.
 void setSocketFactoryPort(Integer socketFactoryPort)
          Sets the port to connect to when using the specified socket factory.
 void setTimeout(Integer timeout)
          Sets the socket I/O timeout value in milliseconds.
 
Methods inherited from class org.apache.geronimo.mail.ProtocolGBean
getHost, getObjectName, getProperties, getProtocol, getUser, setHost, setProperties, setUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GBEAN_INFO

public static final GBeanInfo GBEAN_INFO
Constructor Detail

NNTPTransportGBean

public NNTPTransportGBean(String objectName,
                          Properties properties,
                          String host,
                          String user,
                          Integer port,
                          Integer connectionTimeout,
                          Integer timeout,
                          String from,
                          Boolean auth,
                          String saslRealm,
                          Boolean quitWait,
                          String socketFactoryClass,
                          Boolean socketFactoryFallback,
                          Integer socketFactoryPort)
Construct an instance of NNTPTransportGBean

Values that are set in the individual member variables will override any of the corresponding values that have been set in the properties set.

Parameters:
objectName - the object name of the protocol
properties - the set of default properties for the protocol
host - the host the protocol connects to
user - the default name for the protocol
port - the NNTP server port
connectionTimeout - the socket connection timeout value in milliseconds
timeout - the socket I/O timeout value in milliseconds
from - the email address to use for NNTP POST command
auth - whether an attempt will be made to authenticate the user
saslRealm - the realm to use with DIGEST-MD5 authentication
quitWait - whether the transport will wait for the response to the QUIT command
socketFactoryClass - the class that will be used to create NNTP sockets
socketFactoryFallback - whether java.net.Socket class will be created if the specified socket factory class cannot be created
socketFactoryPort - whether java.net.Socket class will be created if the specified socket factory class cannot be created
Method Detail

getPort

public Integer getPort()
Returns the NNTP server port to connect to, if the connect() method doesn't explicitly specify one.


setPort

public void setPort(Integer port)
Sets the NNTP server port to connect to, if the connect() method doesn't explicitly specify one.

Defaults to 25.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
port - the NNTP server port to connect to

getConnectionTimeout

public Integer getConnectionTimeout()
Returns the socket connection timeout value in milliseconds.


setConnectionTimeout

public void setConnectionTimeout(Integer connectionTimeout)
Sets the socket connection timeout value in milliseconds.

Default is infinite timeout.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
connectionTimeout - the socket connection timeout value in milliseconds.

getTimeout

public Integer getTimeout()
Returns the socket I/O timeout value in milliseconds.


setTimeout

public void setTimeout(Integer timeout)
Sets the socket I/O timeout value in milliseconds.

Default is infinite timeout.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
timeout - the socket I/O timeout value in milliseconds

getFrom

public String getFrom()
Returns the email address to use for NNTP POST command.


setFrom

public void setFrom(String from)
Sets the email address to use for NNTP POST command

Email address to use for NNTP POST command. This sets the envelope return address. Defaults to msg.getFrom() or InternetAddress.getLocalAddress().

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
from - the email address to use for NNTP POST command

getAuth

public Boolean getAuth()
Returns whether an attempt will be made to authenticate the user

Defaults to false.


setAuth

public void setAuth(Boolean auth)
Sets whether an attempt will be made to authenticate the user.

Defaults to false.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
auth - whether an attempt will be made to authenticate the user.

getSaslRealm

public String getSaslRealm()
Returns the realm to use with DIGEST-MD5 authentication.


setSaslRealm

public void setSaslRealm(String saslRealm)
Sets the realm to use with DIGEST-MD5 authentication.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
saslRealm - the realm to use with DIGEST-MD5 authentication

getQuitWait

public Boolean getQuitWait()
Returns whether the transport will wait for the response to the QUIT command.

If set to true, causes the transport to wait for the response to the QUIT command. If set to false (the default), the QUIT command is sent and the connection is immediately closed.


setQuitWait

public void setQuitWait(Boolean quitWait)
Sets whether the transport will wait for the response to the QUIT command

If set to true, causes the transport to wait for the response to the QUIT command. If set to false (the default), the QUIT command is sent and the connection is immediately closed.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
quitWait - whether the transport will wait for the response to the QUIT command

getSocketFactoryClass

public String getSocketFactoryClass()
Returns the class that will be used to create NNTP sockets.

If set, specifies the name of a class that implements the javax.net.SocketFactory interface. This class will be used to create NNTP sockets.


setSocketFactoryClass

public void setSocketFactoryClass(String socketFactoryClass)
Sets the class that will be used to create NNTP sockets.

If set, specifies the name of a class that implements the javax.net.SocketFactory interface. This class will be used to create NNTP sockets.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
socketFactoryClass - the class that will be used to create NNTP sockets

getSocketFactoryFallback

public Boolean getSocketFactoryFallback()
Returns whether java.net.Socket class will be created if the specified socket factory class cannot be created.

If set to true, failure to create a socket using the specified socket factory class will cause the socket to be created using the java.net.Socket class. Defaults to true.


setSocketFactoryFallback

public void setSocketFactoryFallback(Boolean socketFactoryFallback)
Sets whether java.net.Socket class will be created if the specified socket factory class cannot be created.

If set to true, failure to create a socket using the specified socket factory class will cause the socket to be created using the java.net.Socket class. Defaults to true.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
socketFactoryFallback - whether java.net.Socket class will be created if the specified socket factory class cannot be created

getSocketFactoryPort

public Integer getSocketFactoryPort()
Returns the port to connect to when using the specified socket factory.

Specifies the port to connect to when using the specified socket factory. If not set, the default port will be used.


setSocketFactoryPort

public void setSocketFactoryPort(Integer socketFactoryPort)
Sets the port to connect to when using the specified socket factory.

Specifies the port to connect to when using the specified socket factory. If not set, the default port will be used.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
socketFactoryPort - the port to connect to when using the specified socket factory

addOverrides

public void addOverrides(Properties props)
Add the overrides from the member variables to the properties file.

Overrides:
addOverrides in class ProtocolGBean

doStart

public void doStart()
             throws Exception
Description copied from interface: GBeanLifecycle
Starts the GBean. This informs the GBean that it is about to transition to the running state.

Specified by:
doStart in interface GBeanLifecycle
Overrides:
doStart in class ProtocolGBean
Throws:
Exception - if the target failed to start; this will cause a transition to the failed state

doStop

public void doStop()
            throws Exception
Description copied from interface: GBeanLifecycle
Stops the target. This informs the GBean that it is about to transition to the stopped state.

Specified by:
doStop in interface GBeanLifecycle
Overrides:
doStop in class ProtocolGBean
Throws:
Exception - if the target failed to stop; this will cause a transition to the failed state

doFail

public void doFail()
Description copied from interface: GBeanLifecycle
Fails the GBean. This informs the GBean that it is about to transition to the failed state.

Specified by:
doFail in interface GBeanLifecycle
Overrides:
doFail in class ProtocolGBean

getGBeanInfo

public static GBeanInfo getGBeanInfo()


Copyright © 2003-2008 The Apache Geronimo development community. All Rights Reserved.