Examples of MailConfiguration


Examples of com.esri.gpt.framework.mail.MailConfiguration

*           indicates a programming error, bad XPath
*/
private void loadMail(ApplicationConfiguration appConfig, Document dom,
    Node root) throws XPathExpressionException {
  XPath xpath = XPathFactory.newInstance().newXPath();
  MailConfiguration mcfg = appConfig.getMailConfiguration();
  mcfg.put(
      xpath.evaluate("mail/@smtpHost", root),
      xpath.evaluate("mail/@smtpPort", root),
      xpath.evaluate("mail/@siteEmailAddress", root),
      xpath.evaluate("mail/@siteEmailAddress", root));
  mcfg.setEmailAddressRegexp(xpath.evaluate("mail/@emailAddressRegexp", root));

  Node ndAuth = (Node) xpath.evaluate("mail/smtpAuth", root, XPathConstants.NODE);
  if (ndAuth != null) {
    String sUser = Val.chkStr(xpath.evaluate("@username", ndAuth));
    String sPwd = xpath.evaluate("@password", ndAuth);
    boolean bEncrypted = Val.chkBool(xpath.evaluate("@encrypted", ndAuth), false);
    if (bEncrypted) {
      try {
        String sDecrypted = PC1_Encryptor.decrypt(sPwd);
        sPwd = sDecrypted;
      } catch (Exception e) {
        this.getLogger().log(Level.SEVERE, "The smptAuth password failed to decrypt.", e);
      }
    }
    if ((sUser != null) && (sUser.length() > 0) && (sPwd != null) && (sPwd.length() > 0)) {
      mcfg.setPasswordAuthentication(new javax.mail.PasswordAuthentication(sUser, sPwd));
    }
  }
}
View Full Code Here

Examples of com.esri.gpt.framework.mail.MailConfiguration

public ApplicationConfiguration() {
  super();
  setDatabaseReferences(new DatabaseReferences());
  setIdentityConfiguration(new IdentityConfiguration());
  setCatalogConfiguration(new CatalogConfiguration());
  setMailConfiguration(new MailConfiguration());
  setThreadSchedulerConfiguration(new ThreadSchedulerConfiguration());
  setDownloadDataConfiguration(new DownloadConfiguration());
  setMetadataAccessPolicy(new MetadataAccessPolicy());
}
View Full Code Here

Examples of com.esri.gpt.framework.mail.MailConfiguration

* @param configuration the mail configuration
*/
private void setMailConfiguration(MailConfiguration configuration) {
  _mailConfiguration = configuration;
  if (_mailConfiguration == null) {
    _mailConfiguration = new MailConfiguration();
  }
}
View Full Code Here

Examples of com.sun.enterprise.deployment.MailConfiguration

     * @return Session
     *         Mail session to use for this action
     */
    private void invokeSession(Notification event) throws NamingException {       
       
        MailConfiguration mailConfiguration = null;
    
        if (mailResource != null) {
            InitialContext ic = new InitialContext();
         
            /*
             *Currently an internal object is returned by ic lookup.
             *This jndi lookup needs to be fixed to return Session type.
             */                   
            //mailSession = (Session) ic.lookup(mailResource);
            mailConfiguration = (MailConfiguration) ic.lookup(mailResource);
            mailSession = Session.getInstance(mailConfiguration.getMailProperties(),
                                              null);           
        } else {
            mailSession = Session.getDefaultInstance(new Properties());
        }   
    }
View Full Code Here

Examples of com.sun.enterprise.deployment.MailConfiguration

       
    /**
     * notification of the end of XML parsing for this node
     */
    public void postParsing() {
        getParentNode().addDescriptor(new MailConfiguration(name, mail_from, mail_host));                   
    }
View Full Code Here

Examples of com.sun.enterprise.deployment.MailConfiguration

        Reference ref = (Reference) obj;
        if(_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE,"MailNamingObjectFactory: " + ref +
                " Name:" + name);
        }
        MailConfiguration config = (MailConfiguration) ref.get(0).getContent();

        // Note: javax.mail.Session is not serializable,
        // but we need to get a new instance on every lookup.
        Properties props = config.getMailProperties();
        javax.mail.Session s = javax.mail.Session.getInstance(props, new MailSessionAuthenticator(props));
        if("smtps".equals(props.getProperty("mail.transport.protocol"))) {
            s.setProtocolForAddress("rfc822", "smtps");
        }
        s.setDebugOut(new PrintStream(new MailLogOutputStream()));
View Full Code Here

Examples of com.sun.enterprise.deployment.MailConfiguration

       
    /**
     * notification of the end of XML parsing for this node
     */
    public void postParsing() {
        getParentNode().addDescriptor(new MailConfiguration(name, mail_from, mail_host));                   
    }
View Full Code Here

Examples of com.sun.enterprise.deployment.MailConfiguration

       
    /**
     * notification of the end of XML parsing for this node
     */
    public void postParsing() {
        getParentNode().addDescriptor(new MailConfiguration(name, mail_from, mail_host));                   
    }
View Full Code Here

Examples of com.sun.enterprise.deployment.MailConfiguration

     */
    public void installMailResource(org.glassfish.resources.javamail.beans.MailResource mailResource, ResourceInfo resourceInfo) {

        try {

            MailConfiguration config = new MailConfiguration(mailResource);

            javax.naming.Reference ref = new javax.naming.Reference(javax.mail.Session.class.getName(),
                    MailNamingObjectFactory.class.getName(), null);
            SerializableObjectRefAddr serializableRefAddr = new SerializableObjectRefAddr("jndiName", config);
            ref.add(serializableRefAddr);
View Full Code Here

Examples of com.sun.enterprise.deployment.MailConfiguration

        Reference ref = (Reference) obj;
        if(_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE,"MailNamingObjectFactory: " + ref +
                " Name:" + name);
        }
        MailConfiguration config = (MailConfiguration) ref.get(0).getContent();

        // Note: javax.mail.Session is not serializable,
        // but we need to get a new instance on every lookup.
        Properties props = config.getMailProperties();
        javax.mail.Session s = javax.mail.Session.getInstance(props, new MailSessionAuthenticator(props));
        if("smtps".equals(props.getProperty("mail.transport.protocol"))) {
            s.setProtocolForAddress("rfc822", "smtps");
        }
        s.setDebugOut(new PrintStream(new MailLogOutputStream()));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.