Spring Batch
  1. Spring Batch
  2. BATCH-152

Add facility for calling system commands via a Tasklet

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-m2
    • Fix Version/s: 1.1.0
    • Component/s: Infrastructure
    • Security Level: Public (Public Issues)
    • Labels:
      None

      Description

      Framework should provide in infrastructure a common way to run external commands on the native filesystem, eg. via some sort of SystemCommandTasklet

      Required features:
      1.) Untaint user input
      2.) Allow user to specify via injection a means of mapping return codes to appropriate ExitStatus for Tasklet
      3.) Allow user to provider program name, arguments, environment overrides, working directory

      Optional (but fairly simple to implement and potentially useful) features:
      3.) Provide callbacks to handle program output from standard output or standard error
      4.) Provide a facility to link an ItemProvider or InputSource to standard input

      ie.

      execute() throws IOException, InterruptedException, UnmappedExitCodeException {
      // check command, args and environment specified by user for 'tainted' input

      Runtime rt = Runtime.getRuntime();
      Process p = rt.exec( ... );

      OutputStream inStream = p.getOutputStream();

      // pipe in input from an item provider or input source

      InputStream errStream = p.getErrorStream();
      InputStream outStream = p.getInputStream(); // this is named weirdly

      // register callbacks

      int result = p.waitFor();

      // execute callbacks

      // map result to ExitStatus.FINISHED or ExitStatus.FAILED and return
      }

      1. SystemCommandTasklet.patch
        11 kB
        Robert Kasanicky
      2. SystemCommandTasklet-17-10-2007.patch
        12 kB
        Robert Kasanicky
      3. SystemCommandTasklet-17-10-2007-aftercleanup.patch
        12 kB
        Robert Kasanicky
      4. SystemCommandTasklet-23-10-2007.patch
        18 kB
        Robert Kasanicky
      5. SystemCommandTasklet-23-10-2007.patch
        18 kB
        Robert Kasanicky
      6. SystemCommandTasklet-31-10-2007.patch
        22 kB
        Robert Kasanicky

        Activity

        Hide
        Robert Kasanicky added a comment -

        Closing this issue as we now have the SystemCommandTasklet in the samples - BATCH-632 is a follow up on the packaging issue.

        Show
        Robert Kasanicky added a comment - Closing this issue as we now have the SystemCommandTasklet in the samples - BATCH-632 is a follow up on the packaging issue.
        Hide
        Douglas C. Kaminsky added a comment -

        I disagree with the concept of putting things in "samples" that are actually going to end up in production. You're basically asking users to introduce risk into their code and have to potentially deprecate it or change package names later - create a sandbox module and put things where they would actually be in the real release package-wise.

        Show
        Douglas C. Kaminsky added a comment - I disagree with the concept of putting things in "samples" that are actually going to end up in production. You're basically asking users to introduce risk into their code and have to potentially deprecate it or change package names later - create a sandbox module and put things where they would actually be in the real release package-wise.
        Hide
        Douglas C. Kaminsky added a comment -

        Additionally, I feel it's just incorrect from an organizational standpoint -
        a) the SystemCommandTasklet is not a sample, it's a new feature
        b) the Samples package is considered a "production" level package - it's part of the official release, it should not be a de facto "beta" package

        I'm going to register a new issue about this...

        Show
        Douglas C. Kaminsky added a comment - Additionally, I feel it's just incorrect from an organizational standpoint - a) the SystemCommandTasklet is not a sample, it's a new feature b) the Samples package is considered a "production" level package - it's part of the official release, it should not be a de facto "beta" package I'm going to register a new issue about this...
        Hide
        Douglas C. Kaminsky added a comment -
        Show
        Douglas C. Kaminsky added a comment - BATCH-633
        Hide
        Dave Syer added a comment -

        Assume closed as resolved and released

        Show
        Dave Syer added a comment - Assume closed as resolved and released

          People

          • Assignee:
            Robert Kasanicky
            Reporter:
            Douglas C. Kaminsky
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: