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

📄 loader.java

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

  /**
   * Read value of logFileName attribute.
   * @return value of attribute.
   */
  public String getLogFileName() {
    return this.strLogFileName;
  }

  /**
   * This method sets value of logFileName attribute.
   * @param logFileName value of attribute.
   */
  public void setLogFileName(String logFileName) {
    this.strLogFileName = logFileName;
  }

  /**
   * Read value of restartIndicator attribute.
   * @return value of attribute.
   */
  public boolean getRestartIndicator() {
    return this.bRestartIndicator;
  }

  /**
   * This method sets value of restartIndicator attribute.
   * @param restartIndicator value of attribute.
   */
  public void setRestartIndicator(boolean restartIndicator) {
    this.bRestartIndicator = restartIndicator;
  }

  /**
   * Read value of variableValues attribute.
   * @return value of attribute.
   */
  public Map getVariableValues() {
    return this.mapVariableValues;
  }

  /**
   * This method sets value of variableValues attribute.
   * @param variableValue value of attribute.
   */
  public void setVariableValues(Map variableValue) {
    this.mapVariableValues = variableValue;
  }

  /**
   * Read value of vendorFileName.
   * @return value of attribute.
   */
  public String getVendorFileName() {
    return this.strVendorFileName;
  }

  /**
   * This method sets value of vendorFileName attribute.
   * @param vendorFileName value of attribute.
   */
  public void setVendorFileName(String vendorFileName) {
    this.strVendorFileName = vendorFileName;
  }

  /**
   * read value of onErrorContinue attribute.
   * @return value of attribute.
   */
  public boolean getOnErrorContinue() {
    return this.bOnErrorContinue;
  }

  /**
   * This method sets value of onErrorContinue attribute.
   * @param onErrorContinue value of attribute.
   */
  public void setOnErrorContinue(boolean onErrorContinue) {
    this.bOnErrorContinue = onErrorContinue;
  }

  /**
   * Read value of additionalPaths attribute.
   * @return value of attribute.
   */
  public String getAdditionalPaths() {
    return this.strAdditionalPaths;
  }

  /**
   * This method sets value of additionalPaths attribute.
   * @param additionalPaths value of attribute.
   */
  public void setAdditionalPaths(String additionalPaths) {
    this.strAdditionalPaths = additionalPaths;
    String strClassPath = System.getProperty("java.class.path");
    strClassPath = this.addClassPath(strClassPath, this.strAdditionalPaths);
    try {
      this.getClass().getClassLoader().loadClass(strClassPath);
    }
    catch (ClassNotFoundException ne) {
      ne.printStackTrace();
    }
//    System.setProperty("java.class.path", strClassPath);
  }

  /**
   * Read value of commitCount attribute.
   * @return value of attribute.
   */
  public int getCommitCount() {
    return importDefinitionElement.iCommitCount;
  }

  /**
   * This method sets value of commitCount attribute.
   * @param commitCount value of attribute.
   */
  public void setCommitCount(int commitCount) {
    importDefinitionElement.iCommitCount = commitCount;
  }

  /**
   * Read value of default error return code attribute.
   * @return value of attribute.
   */
  public int getDefaultReturnCode() {
    return ReturnCode.getDefaultErrorReturnCode();
  }

  /**
   * This method sets value of default error return code attribute.
   * @param code is value of attribute.
   */
  public void setDefaultReturnCode(int code) {
    ReturnCode.setDefaultErrorReturnCode(code);
  }

  /**
   * This method set value of includeJobs parameter
   * @param include_Tables is value of parameter
   */
  public void setIncludedJobs(String include_Tables[]) {
    for (int i = 0; i < include_Tables.length; i++) {
      includeTables.add(include_Tables[i]);
    }
  }

  /**
   * This method read value of includeJobs parameter
   * @return value of parameter
   */
  public String[] getIncludedJobs() {
    String ret[] = new String[this.includeTables.size()];
    for (int i = 0; i < includeTables.size(); i++) {
      ret[i] = includeTables.get(i).toString();
    }
    return ret;
  }
  /**
	 * This method read value of confJarStructure parameter
	 * @return value of parameter
	 */
  public String getConfJarStructure(){ 
  
     return this.confJarStructure;
  }
  /**
   * This method read value of defaultLogMode parameter
   * @return value of parameter
   */
  public String getDefaultLogMode(){ 
  
	   return this.defaultLogMode;
  }
  /**
   * Main method Loader with an associated XML, restart mode (optional) i user (optional).
   * Main method controls parameters, it they are OK starts load method, but if
   * they aren't makes alert.
   *  Usage: java org.webdocwf.util.loader.Loader [options] loadJob_xml_filename");
   *  Options:
       *  -m defines the default logmode. Possible values are 'none', 'normal' (is the default) and 'full'.
   *  -r starts the Loader in restart mode after abnormal termination in a prior execution.
   *  -u defines the current UserID used in UserID value columns.
   *  -v defines variables used in variable columns.
   *  -l defines the logfile directory. The default is the current working directory.
   *  -f defines the logfile name. The default is 'LoaderLog-YYYY-MM-DD-HH-mm-SS.txt'.
       *  -d the filename of the XML DB-vendor configuration file. The default is 'OctopusDBVendors.xml'.
   *  -e defines to set the default of 'onErrorContinue' to 'true'. Is false otherwise.
   *  -p Extend the classpath with additional paths.
   *  -c Sets the default commit count. System default is '100'.
   *  -rc Sets the default error return code. System default is '1'.
   *  -it Sets the table names which will be proccesed
   * @param argv represents input parmeters
   */
  public static void main(String argv[]) {
    String loadJobFileName = null;
    String mode = null;
    String userID = null;
    String logDirName = null;
    String logFileName = null;
    boolean restartIndicator = false;
    Map variableValues = null;
    String strVariableValues = null;
    String vendorFileName = null;
    boolean onErrorContinue = false;
    String additionalPaths = null;
    int defaultReturnCode = 1;
    int commitCount = 0;
    String[] includeTables = null;
    String confJarStructure = null;

    if (argv.length > 0 && argv.length < 26) {
      loadJobFileName = argv[argv.length - 1];
      for (int i = 0; i < argv.length - 1; i = i + 1) {
        if (argv[i].equalsIgnoreCase("-m"))
          mode = argv[++i];
        else if (argv[i].equalsIgnoreCase("-r"))
          restartIndicator = true;
        else if (argv[i].equalsIgnoreCase("-u"))
          userID = argv[++i];
        else if (argv[i].equalsIgnoreCase("-l"))
          logDirName = argv[++i];
        else if (argv[i].equalsIgnoreCase("-f"))
          logFileName = argv[++i];
        else if (argv[i].equalsIgnoreCase("-d"))
          vendorFileName = argv[++i];
        else if (argv[i].equalsIgnoreCase("-e"))
          onErrorContinue = true;
        else if (argv[i].equalsIgnoreCase("-p"))
          additionalPaths = argv[++i];
        else if (argv[i].equalsIgnoreCase("-c"))
          commitCount = (new Integer(argv[++i])).intValue();
        else if (argv[i].equalsIgnoreCase("-v")) {
          strVariableValues = argv[++i];
          variableValues = new HashMap(convertToMap(strVariableValues));
        } else if (argv[i].equalsIgnoreCase("-rc")) {
          defaultReturnCode = (new Integer(argv[++i])).intValue();
          ReturnCode.isParameter = true;
        } else if (argv[i].equalsIgnoreCase("-it")) {
          String array = argv[++i];
          StringTokenizer st = new StringTokenizer(array, ";");
          includeTables = new String[st.countTokens()];
          int pos = 0;
          while (st.hasMoreTokens()) {
            includeTables[pos] = st.nextToken();
            pos++;
          }
        } else if (argv[i].equalsIgnoreCase("-cjs")) {
          confJarStructure = argv[++i];
        }
      }
    } else
      printUsage();
    Loader l = new Loader(loadJobFileName, mode, userID, logDirName,
               logFileName, restartIndicator, variableValues, vendorFileName,
               onErrorContinue, additionalPaths, commitCount, defaultReturnCode,
               includeTables, confJarStructure);
    try {
      l.load();
      BufferOctopusClass.getInstance().writeToBuffer(String.valueOf(ReturnCode.getOKReturnCode()));
    }
    catch (LoaderException le) {
      BufferOctopusClass.getInstance().writeToBuffer(le.getCause() + "\n");
      BufferOctopusClass.getInstance().writeToBuffer(String.valueOf(ReturnCode.getErrorReturnCode()));
      System.exit(ReturnCode.getErrorReturnCode());
    }
  }

  /**
   * put your documentation comment here
   */
  static void printUsage() {
    System.out.println("Usage: java org.webdocwf.util.loader.Loader [options] loadJob_xml_filename");
    System.out.println(" Options:");
    System.out.println(
        " -m defines the default logmode. Possible values are 'none', 'normal' (is the default) and 'full'.");
    System.out.println(
        " -r starts the Loader in restart mode after abnormal termination in a prior execution. \n");
    System.out.println(" -u defines the current UserID used in UserID value columns. \n");
    System.out.println(" -v defines variables used in variable columns.  \n");
    System.out.println(
        " -l defines the logfile directory. The default is the current working directory.   \n");
    System.out.println(
        " -f defines the logfile name. The default is 'LoaderLog-YYYY-MM-DD-HH-mm-SS.txt'. \n");
    System.out.println(" -d the filename of the XML DB-vendor configuration file. The default is 'OctopusDBVendors.xml'. \n");
    System.out.println(
        " -e defines to set the default of 'onErrorContinue' to 'true'. Is false otherwise. \n");
    System.out.println(" -p Extend the classpath with additional paths \n");
    System.out.println(" -c Sets the default commit count. System default is '100'.  \n");
    System.out.println(" -rc Sets the default error return code. System default is '1'.  \n");
    System.out.println(" -it Sets the table names which will be proccesed ");
    System.exit(ReturnCode.getErrorReturnCode());
  }

  /**
   * Method load is main method in class Loader. It is used to load data from the source table into
   * target tables and(or) execute SQL statements. Loading parameters are set in XML file. During loading,
   * load status is printed on the screen and also put into log file.
   * If there is an error Exception "LoaderException" is thrown.
   * @throws LoaderException
   */
  public void load() throws LoaderException {
    int iImportJobs = 0;
    int iCopyTable = 0;
    int iConnection = 0;
    int iSqlTags = 0;
    int iEchoElements = 0;
    int iLastImportDefinition = 0;

⌨️ 快捷键说明

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