⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 connectionparams.java

📁 Oracle的J2EE Sample
💻 JAVA
字号:
/*
 * @author  Elangovan
 * @version 1.0
 *
 * Name of the Application        :  ConnectionParams.java
 * Creation/Modification History  :
 *
 *    Elangovan       26-Apr-2002      Created
 *
 */
package oracle.otnsamples.ibfbs.utils;

// Necessary support classes
import java.util.Properties;

// Loading Properties file
import oracle.otnsamples.ibfbs.utils.FileUtils;

/**
 * This class, loads the connection parameters from 'Connection.properties' file
 * and initializes the static members of the class.
 *
 */
public class ConnectionParams {

  /** Proxy server host name */
  public static String proxyHost                = null;

  /**  Proxy server port */
  public static String proxyPort                = null;

  /**  Mail server host name  */
  public static String smtpHost                 = null;

  /** Google search key  */
  public static String googleSearchKey          = null;

  /** End Point URL for FBS Stock Quote */
  public static String endpointURL              = null;

  /** Mail Id for Upload Status notification */
  public static String notificationMailId       = null;

  /** Alert Queue JNDI name */
  public final static String alertQueue               = "jms/AlertQueue";
  
  /** Alert Queue Connection Factory JNDI name */
  public final static String alertQueueConnFactory    = "jms/AlertQueueConnectionFactory";
  
  /** Exchange Queue JNDI name */
  public final static String exchangeQueue            = "jms/ExchangeQueue";
  
  /** Exchange Queue Connection Factory JNDI name */
  public final static String exchangeQueueConnFactory = "jms/ExchangeQueueConnectionFactory";

  static {

    // If properties are not intialized
    if (endpointURL == null) {

      Properties conValues = null;

      try {

        // Parse the Connection.properties file and extract the details
        conValues = FileUtils.loadParams("Connection");

        // Get the details from the Properties
        proxyHost                = (String) conValues.getProperty("PROXY_HOST");
        proxyPort                = (String) conValues.getProperty("PROXY_PORT");
        googleSearchKey          = (String) conValues.getProperty("GOOGLE_KEY");
        smtpHost                 = (String) conValues.getProperty("SMTP_HOST");
        endpointURL              =
          (String) conValues.getProperty("ENDPOINTURL");
        notificationMailId       =
          (String) conValues.getProperty("UPLOADSTATUSNOTIFICATIONMAILID");

      } catch (Exception ex) {
        System.out.println(" Fatal Error : Couldn't Read Properties file : "
                           + ex.toString());
        endpointURL = "http://localhost:8888/fbsws/StockQuoteServicePort";
        
      } finally {

        // If proxy server is used, load the proxy properties into system
        if (proxyHost != null && !"".equals(proxyHost)) {
          Properties sysProps = System.getProperties();
          sysProps.put("proxySet", "true");
          sysProps.put("proxyHost", proxyHost);
          sysProps.put("proxyPort", proxyPort);
          sysProps.put("http.proxyHost", proxyHost);
          sysProps.put("http.proxyPort", proxyPort);
          sysProps.put("mail.smtp.host", smtpHost);
          System.setProperties(sysProps);
        }

        // Clear properties
        conValues.clear();
        conValues = null;
      }
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -