Examples of InputFiles


Examples of org.jitterbit.plugin.sdk.InputFiles

        des.add(now);
    }

    private void logInputFiles(PipelinePluginInput input, PipelinePluginContext context) {
        // Loop over each input file and write the filename to the plugin log:
        InputFiles files = input.getInputFiles();
        Logger log = getDefaultLogger(context);
        for (InputFile file : files.getFiles()) {
            log.info("Now handling the file: " + file.getFile().getName());
        }
    }
View Full Code Here

Examples of org.jitterbit.plugin.sdk.InputFiles

   
    if ( dataElements.contains("OutputExtension", DataType.STRING) ) {
      outputExtension = dataElements.get("OutputExtension", DataType.STRING).getValueAsString();
    }
   
    InputFiles inputFiles = input.getInputFiles();
    OutputFiles outputFiles = output.getOutputFiles();
    for( InputFile inputFile : inputFiles.getFiles() ) {
      File file = inputFile.getFile();
      CommandArgs commandArg = RunCommand.run(command, arg, file);
      if ( commandArg.hasOutputFileInArgument() ) {
        if ( outputExtension != null ) {
          // The output file has a special extension.
View Full Code Here

Examples of org.jitterbit.plugin.sdk.InputFiles

    @Override
    public PluginResult run(PipelinePluginInput input,
                            PipelinePluginOutput output,
                            PipelinePluginContext context) throws Exception {

        final InputFiles files = input.getInputFiles();
        if ( files.isEmpty() )
          return PluginResult.SUCCESS;
       
        // Get the variables needed to determine the maximum file size.
        int records_per_file = 1000;
        String header_segment = "";
        DataElements dataElements = context.getDataElements();
        if ( dataElements.contains(RECORDS_PER_FILE_DE_NAME, DataType.INTEGER) ) {
          records_per_file = dataElements.get(RECORDS_PER_FILE_DE_NAME, DataType.INTEGER).getValue();
        }
        if ( dataElements.contains(HEADER_DE_NAME, DataType.STRING) ) {
          header_segment = dataElements.get(HEADER_DE_NAME, DataType.STRING).getValue();
        }
        if ( header_segment.isEmpty() ) {
          throw new PipelinePluginException("No segment header was specified. Not enough information to perform splitting.");
        }
               
        // Loop over input files.
        for (InputFile plugin_input_file : files.getFiles()) {
          final File input_file = plugin_input_file.getFile();
         
          int iFile = 1;
          final BufferedReader br = new BufferedReader(new FileReader(input_file));
      File output_file = new File(getOutputFileName(input_file, iFile));
View Full Code Here

Examples of org.jitterbit.plugin.sdk.InputFiles

    @Override
    public PluginResult run(PipelinePluginInput input,
                            PipelinePluginOutput output,
                            PipelinePluginContext context) throws Exception {

        InputFiles files = input.getInputFiles();
        if ( files.isEmpty() )
          return PluginResult.SUCCESS;
       
        // Get the variables needed to determine the maximum file size.
        DataElements dataElements = context.getDataElements();  
        if ( dataElements.contains(MAX_LINES_DE_NAME, DataType.INTEGER) )
          maxLines = dataElements.get(MAX_LINES_DE_NAME, DataType.INTEGER).getValue();
        if ( dataElements.contains(MAX_SIZE_DE_NAME, DataType.INTEGER) )
          maxSizeKb = dataElements.get(MAX_SIZE_DE_NAME, DataType.INTEGER).getValue();
       
        String fileName = files.getFiles().iterator().next().getFile().getName();
        dataElements.add(DataElementFactory.newDataElement("OriginalFileName", DataType.STRING, fileName));

        // Check if there is any potential splitting to be done.
        if ( maxLines <= 0 && maxSizeKb <= 0 )
          return PluginResult.SUCCESS;
       
        for (InputFile file : files.getFiles()) {
          SplitFile(file, output.getOutputFiles());
        }
       
        return PluginResult.SUCCESS;
       
View Full Code Here

Examples of org.jitterbit.plugin.sdk.InputFiles

        writeOutput(inputFile, output);
        return PluginResult.SUCCESS;
    }
   
    private InputFile loadOriginalRequest(PipelinePluginInput input) throws Exception {
        InputFiles inputFiles = input.getInputFiles();
        for (InputFile inputFile : inputFiles.getFiles()) {
            requestDoc = loadDocument(inputFile.getFile());
            return inputFile;
        }
        throw new PipelinePluginException("Invalid input. No input file was given.");
    }
View Full Code Here

Examples of org.jitterbit.plugin.sdk.InputFiles

    public PluginResult run(PipelinePluginInput input,
                            PipelinePluginOutput output,
                            PipelinePluginContext context) throws Exception {

      logger = getDefaultLogger(context);
        final InputFiles files = input.getInputFiles();
        if ( files.isEmpty() )
          return PluginResult.SUCCESS;
       
        // Get the variables needed to determine the maximum file size.
        int records_per_file = 1000;
        String field_separator = ":", array_element_separator = ";";
        int field_index = 2, array_index = 2;
        String header_record_identifier = "MSH", key_record_identifier = "PID";

        DataElements dataElements = context.getDataElements();
        if ( dataElements.contains(HEADER_DE_NAME, DataType.STRING) ) {
          header_record_identifier = dataElements.get(HEADER_DE_NAME, DataType.STRING).getValue();
        }
        if ( dataElements.contains(KEY_DE_NAME, DataType.STRING) ) {
          key_record_identifier = dataElements.get(KEY_DE_NAME, DataType.STRING).getValue();
        }
        if ( dataElements.contains(FIELD_SEPARATOR, DataType.STRING) ) {
          field_separator = dataElements.get(FIELD_SEPARATOR, DataType.STRING).getValue();
        }
        if ( dataElements.contains(ARRAY_ELEMENT_SEPARATOR, DataType.STRING) ) {
          array_element_separator = dataElements.get(ARRAY_ELEMENT_SEPARATOR, DataType.STRING).getValue();
        }
        if ( dataElements.contains(FIELD_INDEX, DataType.INTEGER) ) {
          // this is 0-based index
          field_index = dataElements.get(FIELD_INDEX, DataType.INTEGER).getValue();
        }
        if ( dataElements.contains(ARRAY_INDEX, DataType.INTEGER) ) {
          // this is 0-base index
          array_index = dataElements.get(ARRAY_INDEX, DataType.INTEGER).getValue();
        }
        if ( dataElements.contains(RECORDS_PER_FILE_DE_NAME, DataType.INTEGER) ) {
          records_per_file = dataElements.get(RECORDS_PER_FILE_DE_NAME, DataType.INTEGER).getValue();
        }

        if ( header_record_identifier.isEmpty() ) {
          throw new PipelinePluginException("No segment header was specified. Not enough information to perform splitting.");
        }
        String header_segment = header_record_identifier+field_separator, key_segment = key_record_identifier+field_separator;
        char delimiter=':', separator=';';
        if(field_separator.length() == 1)delimiter = field_separator.charAt(0);
        if(array_element_separator.length() == 1)separator = array_element_separator.charAt(0);
       
        // Loop over input files.
        for (InputFile plugin_input_file : files.getFiles()) {
          final File input_file = plugin_input_file.getFile();
          Date start_t = new Date();
         
          RandomAccessFile raf = new RandomAccessFile(input_file, "r");
//      System.out.println("read raf: "+input_file);
View Full Code Here

Examples of org.jitterbit.plugin.sdk.InputFiles

            writeLogMessage(log, xml);
        }
    }
   
    private void writeFileOrigin(OutputFile file, XmlStringBuilder xml) {
        InputFiles origin = file.getOriginFiles();
        if (origin.isEmpty()) {
            return;
        }
        xml.addElement("Origin");
        for (InputFile f : origin.getFiles()) {
            xml.addElement("File");
            xml.addAttribute("Name", f.getFile().getAbsolutePath());
            xml.closeElement();
        }
        xml.closeElement();
View Full Code Here

Examples of org.jitterbit.plugin.sdk.InputFiles

   
    @Override
    public final PluginResult run(PipelinePluginInput input,
                                  PipelinePluginOutput output,
                                  PipelinePluginContext context) throws Exception {
        InputFiles inputFiles = input.getInputFiles();
        OutputFiles outputFiles = output.getOutputFiles();
        InputFileReader reader = new InputFileReader();
        OutputFileWriter writer = new OutputFileWriter();
        for (InputFile file : inputFiles.getFiles()) {
            getDefaultLogger(context).fine("Now handling the file " + file.getFile());
            String content = reader.read(file);
            String newContent = content.replaceAll(m_regex, m_replacement);
            if (content == newContent) {
                getDefaultLogger(context).fine("The file did not change.");
View Full Code Here

Examples of org.jitterbit.plugin.sdk.InputFiles

     */
    @Override
    public final PluginResult run(PipelinePluginInput input,
                                  PipelinePluginOutput output,
                                  PipelinePluginContext context) throws Exception {
        InputFiles inputFiles = input.getInputFiles();
        OutputFiles outputFiles = output.getOutputFiles();
        for (InputFile inputFile : inputFiles.getFiles()) {
            OutputFile outputFile = handle(inputFile);
            outputFiles.add(outputFile);
        }
        return PluginResult.SUCCESS;
    }
View Full Code Here

Examples of org.jitterbit.plugin.sdk.InputFiles

    @Override
    public PluginResult run(PipelinePluginInput input,
                            PipelinePluginOutput output,
                            PipelinePluginContext context) throws Exception {

        InputFiles files = input.getInputFiles();
        if ( files.isEmpty() )
          return PluginResult.SUCCESS;
       
        // Get the variables needed to determine the maximum file size.
        String separator = ",";
        String segments = "";
        DataElements dataElements = context.getDataElements();
        if ( dataElements.contains(SEPARATOR_DE_NAME, DataType.STRING) )
          separator = dataElements.get(SEPARATOR_DE_NAME, DataType.STRING).getValue();
        if ( dataElements.contains(SEGMENTS_DE_NAME, DataType.STRING) )
          segments = dataElements.get(SEGMENTS_DE_NAME, DataType.STRING).getValue();
        if ( segments.isEmpty() ) {
          throw new PipelinePluginException("No segment list was specified. Not enough information to perform line break cleanup");
        }
       
        String[] segment_arr = segments.split(separator);
        Set<String> segmentSet = new HashSet<String>(segment_arr.length);
        for( String s : segment_arr ) {
          if ( s == null || s.isEmpty() || s.equals(separator) ) {
            continue;
          }
          segmentSet.add(s);
        }
        if ( segmentSet.isEmpty() ) {
          throw new PipelinePluginException("No segments were defined. Segment variable was '" + segments + ",");
        }
       
        OutputFiles outputFiles = output.getOutputFiles();
       
        for (InputFile plugin_input_file : files.getFiles()) {
          final File input_file = plugin_input_file.getFile();
          final File output_file = new File( input_file.getCanonicalPath() + "-line-break-plugin" );
          BufferedReader br = null;
          BufferedWriter bw = null;
          try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.