You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2008/02/19 13:34:44 UTC

[jira] Created: (JCR-1395) Use Commons IO 1.4

Use Commons IO 1.4
------------------

                 Key: JCR-1395
                 URL: https://issues.apache.org/jira/browse/JCR-1395
             Project: Jackrabbit
          Issue Type: Improvement
          Components: jackrabbit-core
            Reporter: Jukka Zitting
            Priority: Minor
             Fix For: 1.5


Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1395) Use Commons IO 1.4

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570453#action_12570453 ] 

Jukka Zitting commented on JCR-1395:
------------------------------------

Just to avoid misunderstandings, I don't prefer to apply the above patch as-is. It's probably better to just introduce the Commons IO dependency, and then incrementally migrate the code to using it. A mass upgrade like the above patch risks introducing unintended errors to known-good code.

> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: io.patch
>
>
> Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (JCR-1395) Use Commons IO 1.4

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting reassigned JCR-1395:
----------------------------------

    Assignee: Jukka Zitting

> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Assignee: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: io.patch, JCR-1395-closers.patch
>
>
> Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1395) Use Commons IO 1.4

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570231#action_12570231 ] 

Marcel Reutegger commented on JCR-1395:
---------------------------------------

I think in general we should keep the number of dependencies as low as possible, but if there is a significant amount of code or complexity that we can remove from jackrabbit-core then I think we should do it.

What kind of utilities are there that you think are useful?

> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>
> Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1395) Use Commons IO 1.4

Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570475#action_12570475 ] 

Tobias Bocanegra commented on JCR-1395:
---------------------------------------

i agree with jukka that commons-io is a worthy dependency since it covers a lot of useful code that a I/O intensive application like jackrabbit needs.

so +1 for adding commons-io as dependency and using where appropriate

> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: io.patch
>
>
> Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1395) Use Commons IO 1.4

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570455#action_12570455 ] 

Thomas Mueller commented on JCR-1395:
-------------------------------------

I also like to keep the number of dependencies as low as possible. Dependencies mean additional complexity because it means more work for a Jackrabbit user (installation), and because he could depend on a different version of the same library. This can be solved by 'refactoring' the package name of the dependency (complex) or using special class loaders or OSGi (also very complex).

I would prefer if we maintain our own utility classes. It is more work and also a bit risky (I don't think it's that bad actually), but easier for the user and less complex. One extreme is to have no dependencies (only depend on the JDK). I know some view it as 're-inventing the wheel' and they are right.

If we don't want to maintain our own utility classes (and I think we didn't do a very good job at that so far), using Commons IO is a good solution. It's much better than copy & paste source code. So adding Commons IO is OK for me.

> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: io.patch
>
>
> Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1395) Use Commons IO 1.4

Posted by "Esteban Franqueiro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571038#action_12571038 ] 

Esteban Franqueiro commented on JCR-1395:
-----------------------------------------

I agree with Thomas that we don't do a good job with maintaining the utility classes, and also we have som duplicated code (eg, in BundleDbPersistenceManager there's a closeResultSet() method, and also a few direct calls to ResultSet.close(). The same happens with InputStream's. I think we should have a common DbHelper with methods like close(ResultSet), close(Statement), close(Connection/ConnectionRecoveryManager) (that's because I don't like to call methods closeResultSet or closeSilently since it's obvious by the signature). Like that, I think we should have a common StreamHelper. I don't have a formed opinion on whether we should maintain them or if we should use another component, but we should definitely have one or the other. I'll try to write a DbHelper class and patch for this.
Still, I think that some of examples mentioned by Jukka are actually very useful. In particular, I think that #5 would be very useful for the DbDataStore and the DbResources/DbInputStream I posted in JCR-1388.

> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: io.patch
>
>
> Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1395) Use Commons IO 1.4

Posted by "Esteban Franqueiro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Esteban Franqueiro updated JCR-1395:
------------------------------------

    Attachment: JCR-1395-closers.patch

Same patch, but I deleted some methods but did not replace them. Also added some javadocs.

> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: io.patch, JCR-1395-closers.patch
>
>
> Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1395) Use Commons IO 1.4

Posted by "Esteban Franqueiro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Esteban Franqueiro updated JCR-1395:
------------------------------------

    Attachment: closers.patch

This patch replaces the calls to closing funcions and explicit calls to close() with a call to new unified closing functions. This is juast a PoC, and if there's interest in pursuing this way, I can continue working on it. WDYT?

> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: closers.patch, io.patch
>
>
> Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1395) Use Commons IO 1.4

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-1395:
-------------------------------

    Attachment: io.patch

Attached is a quick example patch (io.patch) I put together based mostly on searching for InputStream use within jackrabbit-core. It should illustrate the kinds of benefits we'd see with code-io.

> I think in general we should keep the number of dependencies as low as possible, but if there is a
> significant amount of code or complexity that we can remove from jackrabbit-core then I think we should do it.

Agreed. Commons IO is probably a borderline case in that we can well live without it, but on the other hand it's relatively small jar (about 100kB) and has no transitive dependencies, so the drawbacks aren't that bad.

> What kind of utilities are there that you think are useful?

Some examples:

1) We have a number of places where we copy streams around using a loop with a temporary buffer. IOUtils.copy() could do such looping and low level buffering for us.

2) We have quite a lot of code that manages temporary files for spooling streams. DeferredFileOutputStream is a perfect utility class for such needs.

3) In a number of places we count the length of a stream. CountingInputStream and CountingOutputStream could do that for us.

4) Even though I personally don't like the idiom "if (stream != null) { try { stream.close(); } catch (IOException e) { } }" (I'd rather do just "stream.close()" and deal with any exceptions), it is quite widely used within Jackrabbit. IOUtils.closeQuietly(stream) does the same thing.

5) The AutoCloseInputStream class would help us make sure that all streams we pass to a client will be properly closed when fully read or no longer used.


> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: io.patch
>
>
> Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1395) Use Commons IO 1.4

Posted by "Esteban Franqueiro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Esteban Franqueiro updated JCR-1395:
------------------------------------

    Attachment:     (was: closers.patch)

> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: io.patch, JCR-1395-closers.patch
>
>
> Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-1395) Use Commons IO 1.4

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting resolved JCR-1395.
--------------------------------

    Resolution: Fixed

Added the Commons IO dependency and applied a few of the more obvious code simplifications.

Resolving as Fixed.

> Use Commons IO 1.4
> ------------------
>
>                 Key: JCR-1395
>                 URL: https://issues.apache.org/jira/browse/JCR-1395
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Assignee: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: io.patch, JCR-1395-closers.patch
>
>
> Commons IO contains a number of utility classes and methods for working with files and streams. Many of those utilities would be quite useful in Jackrabbit, so I'd like to introduce commons-io 1.4 as a dependency to jackrabbit-core.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.