Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.5.1.1
    • Fix Version/s: 10.5.1.1
    • Component/s: JDBC
    • Labels:
      None

      Description

      Add an interface for streams that are aware of their position and that can reposition itself on request.
      Initially there will be two such stream objects; PositionedStoreStream and LOBInputStream.

      The interface will be used to allow the Clob implementation (including UTF8Reader) to handle the various internal Clob representations in a consistent manner when it comes to positioning the underlying byte stream.

      1. derby-3935-1b-PositionedStream.diff
        6 kB
        Kristian Waagan
      2. derby-3935-1a-PositionedStream.diff
        6 kB
        Kristian Waagan

        Activity

        Hide
        Kristian Waagan added a comment -

        'derby-3935-1a-PositionedStream.diff' is the first revision of the PositionedStream interface.
        Two streams implement the interface: PositionedStoreStream and LOBInputStream.

        The interface has the following methods:

        • asInputStream() : convenience method to return a reference to the stream as InputStream.
        • getPosition() : returns the current position of the stream.
        • reposition(long) : repositions the stream to the requested position.

        Patch ready for review.

        Show
        Kristian Waagan added a comment - 'derby-3935-1a-PositionedStream.diff' is the first revision of the PositionedStream interface. Two streams implement the interface: PositionedStoreStream and LOBInputStream. The interface has the following methods: asInputStream() : convenience method to return a reference to the stream as InputStream. getPosition() : returns the current position of the stream. reposition(long) : repositions the stream to the requested position. Patch ready for review.
        Hide
        Knut Anders Hatlen added a comment -

        The patch looks fine to me. +1 to commit.

        (Tiny nit: LOBInputStream.reposition() doesn't need to be declared as throws EOFException since it's also declared to throw IOException. Keeping both the @throws tags in the comment is fine, though.)

        Show
        Knut Anders Hatlen added a comment - The patch looks fine to me. +1 to commit. (Tiny nit: LOBInputStream.reposition() doesn't need to be declared as throws EOFException since it's also declared to throw IOException. Keeping both the @throws tags in the comment is fine, though.)
        Hide
        Knut Anders Hatlen added a comment -

        By the way, would it make sense at some point to merge the PositionedStream interface with Resetable? Or perhaps make PositionedStream extend Resetable? Resetable.resetStream() is just a special case of PositionedStream.reposition(), and it seems like both PositionStoreStream and LOBInputStream have methods that match the functionality defined by Resetable (PSS actually implements Resetable).

        Show
        Knut Anders Hatlen added a comment - By the way, would it make sense at some point to merge the PositionedStream interface with Resetable? Or perhaps make PositionedStream extend Resetable? Resetable.resetStream() is just a special case of PositionedStream.reposition(), and it seems like both PositionStoreStream and LOBInputStream have methods that match the functionality defined by Resetable (PSS actually implements Resetable).
        Hide
        Kristian Waagan added a comment -

        Removing the patch available flag, as it is very likely that a new patch will be attached soon.
        I need to consider the options, and the throws clause needs to be fixed anyway.

        Show
        Kristian Waagan added a comment - Removing the patch available flag, as it is very likely that a new patch will be attached soon. I need to consider the options, and the throws clause needs to be fixed anyway.
        Hide
        Kristian Waagan added a comment -

        Regarding Resetable and PositionedStream (PS), the former is more tightly bound to store.
        For instance, initStream handles locking, which is probably not required for data streams outside of store. I don't see any immediate need to add the three methods resetStream, initStream and closeStream to LOBInputStream.
        I'm opting for committing what I have now, and look at combining the interfaces later if it turns out that is the best thing to do.

        I attached revision 1b, which adds two debug blocks (checking for a negative requested position), removed the throws clause for EOFException and fixed some errors in the JavaDoc.
        After rerunning the tests, I intend to commit patch 1b.

        Show
        Kristian Waagan added a comment - Regarding Resetable and PositionedStream (PS), the former is more tightly bound to store. For instance, initStream handles locking, which is probably not required for data streams outside of store. I don't see any immediate need to add the three methods resetStream, initStream and closeStream to LOBInputStream. I'm opting for committing what I have now, and look at combining the interfaces later if it turns out that is the best thing to do. I attached revision 1b, which adds two debug blocks (checking for a negative requested position), removed the throws clause for EOFException and fixed some errors in the JavaDoc. After rerunning the tests, I intend to commit patch 1b.
        Hide
        Kristian Waagan added a comment -

        Committed patch 1b (with one modification) to trunk with revision 720517.
        I removed the final keyword from the method signature of reposition in the interface.

        I'm keeping the issue open for a while, as there might be more changes to be done.

        Show
        Kristian Waagan added a comment - Committed patch 1b (with one modification) to trunk with revision 720517. I removed the final keyword from the method signature of reposition in the interface. I'm keeping the issue open for a while, as there might be more changes to be done.
        Hide
        Kristian Waagan added a comment -

        I don't expect to work more on this issue, but I filed DERBY-4002 for the task of merging the two interfaces.

        Show
        Kristian Waagan added a comment - I don't expect to work more on this issue, but I filed DERBY-4002 for the task of merging the two interfaces.
        Hide
        Kristian Waagan added a comment -

        Closing issue, no more required changes have been identified. If the interface still needs to be changed, it will happen under the issue requiring the change.

        Show
        Kristian Waagan added a comment - Closing issue, no more required changes have been identified. If the interface still needs to be changed, it will happen under the issue requiring the change.

          People

          • Assignee:
            Kristian Waagan
            Reporter:
            Kristian Waagan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development