com.plexobject.mail.bulk
Class SmtpServerLoader

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--com.plexobject.mail.bulk.SmtpServerLoader
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class SmtpServerLoader
extends org.xml.sax.helpers.DefaultHandler

SmtpServerLoader -- loads SmtpServer from XML file. Here is a sample XML configuration:

 <?xml version="1.0"?>
 <SmtpServers>
   <SmtpServer>
     <ServerName>mail1.yahoo.com</ServerName>
     <Port>25</Port>
     <SSL>false</SSL>
     <User></User>
     <Password></Password>
   </SmtpServer>
   <SmtpServer>
     <ServerName>mail1.aol.com</ServerName>
     <Port>25</Port>
     <SSL>false</SSL>
     <User></User>
     <Password></Password>
   </SmtpServer>
   <SmtpServer>
     <ServerName>mail1.earthlink.com</ServerName>
     <Port>25</Port>
     <SSL>false</SSL>
     <User></User>
     <Password></Password>
   </SmtpServer>
 </SmtpServers>
 


Field Summary
static java.lang.String SERVER_ELEMENT_NAME
          Name of element containing entire server.
 
Constructor Summary
SmtpServerLoader(java.io.File file)
          SmtpServerLoader constructors
SmtpServerLoader(java.io.InputStream in)
          SmtpServerLoader constructors
 
Method Summary
 void characters(char[] chars, int start, int length)
           
 void endElement(java.lang.String uri, java.lang.String lname, java.lang.String qname)
           
 java.util.ArrayList getSmtpServers()
          getSmtpServers - returns servers loaded from xml file
 com.plexobject.util.ResourcePool newResourcePool()
           
 void startDocument()
           
 void startElement(java.lang.String uri, java.lang.String lname, java.lang.String qname, org.xml.sax.Attributes attributes)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_ELEMENT_NAME

public static final java.lang.String SERVER_ELEMENT_NAME
Name of element containing entire server.

See Also:
Constant Field Values
Constructor Detail

SmtpServerLoader

public SmtpServerLoader(java.io.File file)
                 throws java.lang.Exception
SmtpServerLoader constructors


SmtpServerLoader

public SmtpServerLoader(java.io.InputStream in)
                 throws java.lang.Exception
SmtpServerLoader constructors

Method Detail

startDocument

public void startDocument()
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler

characters

public void characters(char[] chars,
                       int start,
                       int length)
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler

startElement

public void startElement(java.lang.String uri,
                         java.lang.String lname,
                         java.lang.String qname,
                         org.xml.sax.Attributes attributes)
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler

endElement

public void endElement(java.lang.String uri,
                       java.lang.String lname,
                       java.lang.String qname)
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler

getSmtpServers

public java.util.ArrayList getSmtpServers()
getSmtpServers - returns servers loaded from xml file

Returns:
- list of SmtpServerEntry

newResourcePool

public com.plexobject.util.ResourcePool newResourcePool()
                                                 throws java.lang.Exception
java.lang.Exception