Package org.jSyncManager.SJS.Adapters.SMTPServer.Config

Examples of org.jSyncManager.SJS.Adapters.SMTPServer.Config.ConfigDAO


   /**
    * Load configuration values, setup mailbox
    */
   public void init() {
      DAOFactory factory = DAOFactory.instance(DAOFactory.DEFAULT);
      ConfigDAO configDAO = factory.getConfigDAO();
     
      // possible locations for smtp_server.xml
      String propertyfile = System.getProperty("sjs.smtpserver.propertyfile");
      File option1 = null;
      if (propertyfile != null) {
         option1 = new File(propertyfile);
      }
      File option2 = new File("../property_files/smtp_server.xml");
      File option3 = new File("~/.sjs/smtp_server.xml");
      File option4 = new File("./property_files/smtp_server.xml");

      // determine which location is correct, else throw exception
      String smtpServerXML = "";
      if (option1 != null && option1.exists()) {
         try {
      smtpServerXML = option1.getCanonicalPath();
         } catch (IOException e) {
            throw new RuntimeException("Cannot find smtp_server.xml!");
         }
      } else if (option2 != null && option2.exists()) {
        smtpServerXML = "../property_files/smtp_server.xml";
      } else if (option3 != null && option3.exists()) {
        smtpServerXML = "~/.sjs/smtp_server.xml";
      } else if (option4 != null && option4.exists()) {
        smtpServerXML = "./property_files/smtp_server.xml";
      } else {
          throw new RuntimeException("Cannot find smtp_server.xml!");
      }
     
      // load the xml
      config = configDAO.loadConfig(smtpServerXML);

      // on error, throw new exception
      if (config == null) {
         throw new RuntimeException("Error retrieving smtp_server.xml!");
      }   // end if
View Full Code Here


   /**
    * The post condition for getConfigDAO method
    */
   public void post_getConfigDAO() {
      ConfigDAO output = (ConfigDAO) super.getReturnValue();
      assert output != null;
   }   // end post_getConfigDAO()
View Full Code Here

    * There is no post condition for instatiateDAO method
    *
    * @param daoClass parameter value
    */
   public void post_instantiateDAO(Class daoClass) {
      ConfigDAO output = (ConfigDAO) super.getReturnValue();
      assert output != null;
   }   // end post_instantiateDAO()
View Full Code Here

TOP

Related Classes of org.jSyncManager.SJS.Adapters.SMTPServer.Config.ConfigDAO

Copyright © 2018 www.massapicom. 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.