Exemplo n.º 1
0
  /**
   * DB Connection ��ü�� ��ȯ�Ѵ�.
   *
   * @return
   */
  public static Connection getDB(String key) {

    ReadPropertiesAble rp = ReadProperties.getInstance();
    Connection conn = null;

    try {

      if (rp.getValue("was").equals("weblogic")) {

        try {
          conn = ConnectionFactory.getInstance().getConnectionWeblogic(rp.getValue(key));
        } catch (Exception e) {
          errorLog("weblogic DB ���ῡ�� :" + e.toString());
        }

      } else if (rp.getValue("was").equals("tomcat")) {

        try {
          conn =
              ConnectionFactory.getInstance()
                  .getConnectionTomcat(rp.getValue("JNDI"), rp.getValue(key));
          conn.setAutoCommit(true);

        } catch (Exception e) {
          errorLog("tomcat DB ���ῡ�� :" + e.toString());
        }
      }

    } catch (Exception e) {
      errorLog("��d���� ���� ���� :" + e.toString());
    }

    return conn;
  }
Exemplo n.º 2
0
  public static String[] getEncodeFromProperties() {

    String[] arrEncode = null;
    try {
      String rslt = ReadProperties.getInstance().getValue("propertiesEncode");
      arrEncode = rslt.split("\\>");

    } catch (Exception e) {
    }

    return arrEncode;
  }
Exemplo n.º 3
0
  /**
   * common.properties
   *
   * @param key
   * @param value
   */
  public static void setProperties(String key, String value) {

    String[] arrEncode = getEncodeFromProperties();

    String rslt = "";
    if (arrEncode.length == 2) {

      try {
        rslt = new String(value.getBytes(arrEncode[1]), arrEncode[0]);
        ReadProperties.getInstance().setProperties(key, rslt);
      } catch (Exception e) {
      }
    }
  }
Exemplo n.º 4
0
  /**
   * sql.properties ������ key �� ��; ��ȯ
   *
   * @param key
   * @return
   */
  public static String getSQL(String key) {

    String[] arrEncode = getDecodeFromProperties();

    String rslt = ReadProperties.getInstance().getSQL(key);
    if (arrEncode.length == 2) {

      try {
        rslt = new String(rslt.getBytes(arrEncode[0]), arrEncode[1]);
      } catch (Exception e) {
      }
    }
    return rslt;
  }
Exemplo n.º 5
0
  /**
   * ���׿� �α׸� ��� �Ѵ�.
   *
   * @param log
   */
  public static void debugLog(String log) {

    String[] arrEncode = getValue("logDecode").split("\\>");
    try {
      ReadPropertiesAble rp = ReadProperties.getInstance();
      if (rp.getValue("debugLog").equals("Y")) {

        String path = rp.getValue("debugLogPath");
        if (path == null || path.equals("")) path = rp.getPath();
        log = (arrEncode.length == 2) ? new String(log.getBytes(arrEncode[0]), arrEncode[1]) : log;
        // System.out.println(Log.getInstance().logDate()+" : "+log);
        Log.getInstance().println(path + "degug.log", log);
      }

    } catch (Exception e) {
    }
  }
Exemplo n.º 6
0
  public static void accessMwLog(String log) {

    String[] arrEncode = getValue("logDecode").split("\\>");
    try {
      ReadPropertiesAble rp = ReadProperties.getInstance();
      if (rp.getValue("accessMwLog").equals("Y")) {

        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat();
        sdf.applyPattern("yyyy-MM-dd");
        String path = rp.getValue("accessMwLogPath");
        if (path == null || path.equals("")) path = rp.getPath();
        log = (arrEncode.length == 2) ? new String(log.getBytes(arrEncode[0]), arrEncode[1]) : log;
        // System.out.println(Log.getInstance().logDate()+" : "+log);
        Log.getInstance()
            .println(path + "access_mw_" + sdf.format(cal.getTime()).toString() + ".log", log);
      }

    } catch (Exception e) {
    }
  }