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

📄 loader.java

📁 数据仓库工具
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
  

  /**
   * Construct object Loader with an associated parameters.
   * @param loadJobFileName defines xml input file.
   * @param mode defines the default logmode. Possible values are "none", "normal" (is the default) and "full". Is "normal" otherwise -m none
   * @param userID String which is name of user. This argument is used for writing userID into variable columns.
   * If it is 'null' there is no define userID columns.
   * @param logDirName defines the logfile directory. The default is the current working directory.
       * @param logFileName defines the logfile name. The default is "LoaderLog-YYYY-MM-DD-HH-mm-SS.txt".
   * @param restartIndicator which is true if "restart" mode and false if "new" mode.
   * @param variableValues Map defines variables used in variable columns.
   * @param vendorFileName the filename of the XML DB-vendor configuration file. The default is "OctopusDBVendors.xml".
   * @param onErrorContinue defines to set the default of "onErrorContinue" to "true". Is false otherwise.
   * @param additionalPaths	Extend the classpath with additional paths.
   * @param commitCount Sets the default commit count. System default is "100".
   * @param returnCode Sets the default error return code. System default is "1".
   * @param includeTables defines tables which will be processed
   */
  public Loader(String loadJobFileName, String mode, String userID,
      String logDirName, String logFileName, boolean restartIndicator,
      Map variableValues, String vendorFileName, boolean onErrorContinue,
      String additionalPaths, int commitCount, int returnCode,
      String[] includeTables, String confJarStructure) {
    this.strLoaderJobFileName = loadJobFileName;
    //defines the log mode,
    if (mode != null) {
      if ( mode.equalsIgnoreCase("none")   || 
      	  mode.equalsIgnoreCase("normal") ||
           mode.equalsIgnoreCase("full") )     
      {
//        importDefinitionElement.strLogMode = mode;
		  this.defaultLogMode = mode;
//        sqlElement.strLogMode = mode;
      } //else {
//        importDefinitionElement.strLogMode = "";
//        sqlElement.strLogMode = "";
    }

    if (userID != null) {
      this.strUserID = userID;
      this.hasUserID = true;
    } else
      this.hasUserID = false;
    if (logDirName != null)
      this.strLogDirName = logDirName;
    else {
      File fCurrent = new File("");
      this.strLogDirName = fCurrent.getAbsolutePath();
    }
    if (logFileName != null) {
      this.strLogFileName = logFileName;
    } else
      this.strLogFileName = "default";
    this.bRestartIndicator = restartIndicator;
    if (this.bRestartIndicator == true)
      this.hasRestartCounter = true;
    else
      this.hasRestartCounter = false;
    this.mapVariableValues = variableValues;
    if (vendorFileName != null) {
      this.strVendorFileName = vendorFileName;
    }
    this.bOnErrorContinue = onErrorContinue;
    if (additionalPaths != null) {
      try {
        this.strAdditionalPaths = additionalPaths;
        StringTokenizer st = new StringTokenizer(this.strAdditionalPaths, ";");
        URL[] urls = new URL[st.countTokens()];
        int count = 0;
        while (st.hasMoreTokens()) {
          urls[count] = new File(st.nextElement().toString()).toURL();
          count++;
        }
        for (int i = 0; i < urls.length; i++) {
          OctopusClassLoader.addURL(urls[i]);
        }
      }
      catch (Exception ne) {
        ne.printStackTrace();
      }
    }
    if (includeTables != null) {
      for (int i = 0; i < includeTables.length; i++) {
        this.includeTables.add(includeTables[i]);
      }
    }
    importDefinitionElement.iCommitCount = commitCount;
    ReturnCode.setDefaultErrorReturnCode(returnCode);
    this.confJarStructure = confJarStructure;
  }

  /**
   * Construct object Loader with an associated parameters.
   * @param loadJobFileName defines xml input file.
   * @param mode defines the default logmode. Possible values are "none", "normal" (is the default) and "full". Is "normal" otherwise -m none
   * @param userID String which is name of user. This argument is used for writing userID into variable columns.
   * If it is 'null' there is no define userID columns.
   * @param logDirName defines the logfile directory. The default is the current working directory.
       * @param logFileName defines the logfile name. The default is "LoaderLog-YYYY-MM-DD-HH-mm-SS.txt".
   * @param restartIndicator which is true if "restart" mode and false if "new" mode.
   * @param variableValues Map defines variables used in variable columns.
   * @param vendorFileName the filename of the XML DB-vendor configuration file. The default is "OctopusDBVendors.xml".
   * @param onErrorContinue defines to set the default of "onErrorContinue" to "true". Is false otherwise.
   * @param additionalPaths	Extend the classpath with additional paths.
   * @param commitCount Sets the default commit count. System default is "100".
   * @param returnCode Sets the default error return code. System default is "1".
   */
  public Loader(String loadJobFileName, String mode, String userID,
      String logDirName,
      String logFileName, boolean restartIndicator,
      Map variableValues,
      String vendorFileName, boolean onErrorContinue,
      String additionalPaths,
      int commitCount, int returnCode) {

    this(loadJobFileName, mode, userID, logDirName, logFileName, restartIndicator,
        variableValues, vendorFileName, onErrorContinue, additionalPaths,
        commitCount, returnCode, null, null);

  }

  /**
   * Construct object Loader with an associated parameters.
   * @param loadJobFileName defines xml input file.
   * @param mode defines the default logmode. Possible values are "none", "normal" (is the default) and "full". Is "normal" otherwise -m none
   * @param userID String which is name of user. This argument is used for writing userID into variable columns.
   * If it is 'null' there is no define userID columns.
   * @param logDirName defines the logfile directory. The default is the current working directory.
       * @param logFileName defines the logfile name. The default is "LoaderLog-YYYY-MM-DD-HH-mm-SS.txt".
   * @param restartIndicator which is true if "restart" mode and false if "new" mode.
   * @param variableValues Map defines variables used in variable columns.
   * @param vendorFileName the filename of the XML DB-vendor configuration file. The default is "OctopusDBVendors.xml".
   * @param onErrorContinue defines to set the default of "onErrorContinue" to "true". Is false otherwise.
   * @param additionalPaths	Extend the classpath with additional paths.
   * @param commitCount Sets the default commit count. System default is "100".
   * @param returnCode Sets the default error return code. System default is "1".
   */
  public Loader(String loadJobFileName, String mode, String userID,
      String logDirName,
      String logFileName, boolean restartIndicator,
      Map variableValues,
      String vendorFileName, boolean onErrorContinue,
      String additionalPaths,
      int commitCount, int returnCode, String[] includeTables) {

    this(loadJobFileName, mode, userID, logDirName, logFileName, restartIndicator,
        variableValues, vendorFileName, onErrorContinue, additionalPaths,
        commitCount, returnCode, includeTables, null);

  }

  /**
   * Construct object Loader with an associated parameters.
   * @param loadJobFileName defines xml input file.
   * @param mode defines the default logmode. Possible values are "none", "normal" (is the default) and "full". Is "normal" otherwise -m none
   * @param userID String which is name of user. This argument is used for writing userID into variable columns.
   * If it is 'null' there is no define userID columns.
   * @param logDirName defines the logfile directory. The default is the current working directory.
       * @param logFileName defines the logfile name. The default is "LoaderLog-YYYY-MM-DD-HH-mm-SS.txt".
   * @param restartIndicator which is true if "restart" mode and false if "new" mode.
   * @param variableValues Map defines variables used in variable columns.
   * @param vendorFileName the filename of the XML DB-vendor configuration file. The default is "OctopusDBVendors.xml".
   * @param onErrorContinue defines to set the default of "onErrorContinue" to "true". Is false otherwise.
   * @param additionalPaths	Extend the classpath with additional paths.
   * @param commitCount Sets the default commit count. System default is "100".
   * @param returnCode Sets the default error return code. System default is "1".
   */
  public Loader(String loadJobFileName, String mode, String userID,
      String logDirName,
      String logFileName, boolean restartIndicator,
      Map variableValues,
      String vendorFileName, boolean onErrorContinue,
      String additionalPaths,
      int commitCount, int returnCode, String confJarStructure) {

    this(loadJobFileName, mode, userID, logDirName, logFileName, restartIndicator,
        variableValues, vendorFileName, onErrorContinue, additionalPaths,
        commitCount, returnCode, null, confJarStructure);

  }

  /**
   * Method addClassPath adds additional class paths into system classpath property
   * @param oldClassPath - System classpath;
   * @param add - additional class paths.
   * @return value of parameter classPath
   */
  private String addClassPath(String oldClassPath, String add) {

    String classPath = oldClassPath;
    if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
      if (!classPath.trim().endsWith(";"))
        classPath += ";";
      add = add.replace('\n', '\\');
      add = add.replace('\t', '\\');
      add = add.replace('\b', '\\');
      add = add.replace('\r', '\\');
      add = add.replace('\f', '\\');
      classPath = classPath.concat(add);
    } else {
      if (!classPath.trim().endsWith(":"))
        classPath += ":";
      add = add.replace('\n', '/');
      add = add.replace('\t', '/');
      add = add.replace('\b', '/');
      add = add.replace('\r', '/');
      add = add.replace('\f', '/');
      classPath = classPath.concat(add);

    }
    return classPath;
  }

  /**
   * Public constructor of Loader class. Constructor set value for loadJobFileName attribute.
   * Class set all other attributes to the default values.
   * @param loadJobFileName Name of loadJob import XML file.
   *
   */
  public Loader(String loadJobFileName) {
    this(loadJobFileName, null);
  }

  /**
   * Public constructor of Loader class. Constructor set value for loadJobFileName attribute.
   * Class set all other attributes to the default values.
   * @param loadJobFileName Name of loadJob import XML file.
   *
   */
  public Loader(String loadJobFileName, String confJarStructure) {
    this.strLoaderJobFileName = loadJobFileName;
//    importDefinitionElement.strLogMode = "";
    this.hasUserID = false;
    File fCurrent = new File("");
    this.strLogDirName = fCurrent.getAbsolutePath();
    this.strLogFileName = "default";
    this.bRestartIndicator = false;
    this.hasRestartCounter = false;
    this.bOnErrorContinue = false;
    importDefinitionElement.iCommitCount = 100;
    ReturnCode.setDefaultErrorReturnCode(1);
    this.confJarStructure = confJarStructure;
  }

  /**
   * Read value of loadJobFileName attribute.
   * @return String value of loadFileName attribute
   */
  public String getLoadJobFileName() {
    return this.strLoaderJobFileName;
  }

  /**
   * This method sets value of loadJobFileName attribute.
   * @param loadJobFileName loadJob XML file name
   */
  public void setLoadJobFileName(String loadJobFileName) {
    this.strLoaderJobFileName = loadJobFileName;
  }

  /**
   * Read value of Mode(LogMode) attribute.
   * @return value of attribute.
   */
//  public String getMode() {
//    return importDefinitionElement.strLogMode;
//  }

  /**
   * This method sets value of Mode attribute.
   * @param mode define Log mode. Possible values are:
   * Loader.LOGMODE_NONE, Loader.LOGMODE_NORMAL, Loader.LOGMODE_FULL.
   */
//  public void setMode(String mode) {
//    importDefinitionElement.strLogMode = mode;
//  }

  /**
   * Read value of userID attribute.
   * @return value of attribute.
   */
  public String getUserID() {
    return this.strUserID;
  }

  /**
   * This method sets value of userID attribute.
   * @param userID attribute.
   */
  public void setUserID(String userID) {
    this.strUserID = userID;
  }

  /**
   * Read value of logDirName attribute
   * @return value of attribute
   */
  public String getLogDirName() {
    return this.strLogDirName;
  }

  /**
   * This method sets value of logDirName attribute.
   * @param logDirName value of attribute.
   */
  public void setLogDirName(String logDirName) {
    this.strLogDirName = logDirName;
  }

⌨️ 快捷键说明

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