Uploaded image for project: 'YADE - Yet Another Data Exchange Tool'
  1. YADE - Yet Another Data Exchange Tool
  2. YADE-518

${scheduler_file_name} should be substituted when used for FILE_PATH

    XMLWordPrintable

Details

    • Fix
    • Status: Released (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 1.12.5
    • YADE JITL Jobs
    • None

    Description

      Current Situation

      It is possible to set the value of FILE_PATH to ${scheduler_file_path}. That will be substituted with the actual parameter value of SCHEDULER_FILE_PATH. With this it is possible to use a file order source in a job chain. An YADE job that is part of the job chain will then transfer any incoming file.

      When the path is not correct in SCHEDULER_FILE_PATH this does not work. This can happen when using the SMB protocol for the source protocol and the the file order source is assigned to a remote Universal Agent. Then the incoming file has a name like c:/path/name but the transfer must address the file with /c$/path/name.

      Desired Behavior

      When specifying ${scheduler_file_name} as the value for FILE_PATH this should be substituted with the basename of SCHEDULER_FILE_PATH. The value of DIRECTORY should then be added to FILE_PATH. With this the configuration can specify

      FILE_PATH=${scheduler_file_name}
      DIRECTORY=/c$/path

      With the parameter SCHEDULER_FILE_PATH=c:/path/name this will be set to /c$/path/name

      Workaround

      The correct value can be set in the preprocessor of the YADE job. See this example. The basename will be extracted from the original name. Then the original name is set to directory + basename. Plesae not that the value for the directory must be set in the params for the order or the job.

      The original value is restored in the spooler_process_after method.

      function spooler_process_before(){
       		 
          var params = spooler_task.params;
          params.merge( spooler_task.order.params );
          var dir = params.value("directory");
      
         	var Paths = Java.type( 'java.nio.file.Paths' );
          var incomingFile = Paths.get( spooler_task.order.params.value( 'scheduler_file_path' ) );
             
      	incomingFileBasename = String( incomingFile.getFileName() );
          spooler_task.order.params.set_var('scheduler_file_path_original',spooler_task.order.params.value('scheduler_file_path'));
          spooler_log.info("basename" + incomingFileBasename);
          spooler_task.order.params.set_var('scheduler_file_path',dir + "/" + incomingFileBasename);
      	return true;
      }
      
      function spooler_process_after(spooler_process_result){
          spooler_task.order.params.set_var('scheduler_file_path',spooler_task.order.params.value('scheduler_file_path_original'));
      	return true;
      }
      
      

      Attachments

        Activity

          People

            ur Uwe Risse
            ur Uwe Risse
            Mahendra Patidar Mahendra Patidar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: