ICEfaces
  1. ICEfaces
  2. ICE-5434

Suggestions for Output Resource Component API

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.0-Alpha2
    • Fix Version/s: 2.0-Alpha3
    • Component/s: None
    • Labels:
      None
    • Environment:
      all
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Compatibility/Configuration

      Description

      Having used the OutputResource component for a services job, I found it to be unintuitive and at times clumsy. There are two main points:

      The Resource API defines an open() method but does not define a close() method. This means that ICEfaces is closing resources that it did not open (bad software engineering - can easily introduce side effects). This works in the trivial case but in the case of SFTP there are a number of other resources that must be closed as well. In order to use this API I had to Decorate the resources into an InputStream interface that overrode the close method to cleanup properly. This felt very clumsy and I think most developers would not come to this solution easily.

      Here is my proposal:

      Change the component contract to more reflect the streamingInputFile component contract. Let there be an attrubute "inputStream" that can value bind to a method that returns an input stream. The component should also allow a method binding to an actionListener. This action listener will get called on an error or on streaming finish. The actionListener should get called once and only once for every invocation of the input stream getter method. In this way, the stream can be safely opened in the getter (and any other associated resources can be maintained in the bean). The resources can then be properly cleaned up in the actionListener.

      Unless there is a good reason to use the Resource API I would suggest deprecating it in favor of this simpler API.

      Alternatively, if the Resource API is chosen as the path to use, an abstract close() method should be added that can be overridden to clean up an state associated with that resource.

        Activity

        Patrick Wilson created issue -
        Patrick Wilson made changes -
        Field Original Value New Value
        Summary Output Resource Component Usage Clumsy Suggestions for Output Resource Component API
        Salesforce Case []
        Ken Fyten made changes -
        Salesforce Case []
        Fix Version/s 2.0-Alpha3 [ 10032 ]
        Affects [Documentation (User Guide, Ref. Guide, etc.), Compatibility/Configuration]
        Assignee Priority P2
        Affects Version/s 2.0-Alpha2 [ 10214 ]
        Assignee Mircea Toma [ mircea.toma ]
        Mircea Toma made changes -
        Assignee Mircea Toma [ mircea.toma ] Ken Fyten [ ken.fyten ]
        Ken Fyten made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Priority P2
        Resolution Invalid [ 6 ]
        Assignee Ken Fyten [ ken.fyten ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Patrick Wilson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: