You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Angela Schreiber <an...@adobe.com> on 2012/04/27 12:08:06 UTC
Consolidate oak Utilities
hi all
yesterday i came across the oak-core/Paths utility and found
out that it just delegates calls to the mk/PathUtils.
having a closer look i got the impression that we have quite
some very similar or identical utilities in the various
modules. this looks a bit troublesome to me and i would
like to clean this up.
currently i can think of the following approaches:
a) create oak-commons module and move the various utilities
used in multiple projects there... including merging
redundant/duplicate/very-similar code.
benefit: oak specific commons module which is small and
doesn't contain stuff that we don't need.
drawback: yet another module.
b) move the utilities to jcr-commons. since we use jcr
standard form in all oak layers this would allow even
a broader audience to take advantage of those utilities.
benefit: no extra oak-commons module
drawback: dependency to all the other stuff in jcr-commons
that e.g. in the mk project isn't needed.
which one would you prefer?
kind regards
angela
Re: Consolidate oak Utilities
Posted by Stefan Guggisberg <st...@gmail.com>.
On Fri, Apr 27, 2012 at 12:08 PM, Angela Schreiber <an...@adobe.com> wrote:
> hi all
>
> yesterday i came across the oak-core/Paths utility and found
> out that it just delegates calls to the mk/PathUtils.
>
> having a closer look i got the impression that we have quite
> some very similar or identical utilities in the various
> modules. this looks a bit troublesome to me and i would
> like to clean this up.
>
> currently i can think of the following approaches:
>
> a) create oak-commons module and move the various utilities
> used in multiple projects there... including merging
> redundant/duplicate/very-similar code.
> benefit: oak specific commons module which is small and
> doesn't contain stuff that we don't need.
> drawback: yet another module.
>
> b) move the utilities to jcr-commons. since we use jcr
> standard form in all oak layers this would allow even
> a broader audience to take advantage of those utilities.
> benefit: no extra oak-commons module
> drawback: dependency to all the other stuff in jcr-commons
> that e.g. in the mk project isn't needed.
>
> which one would you prefer?
thanks for bringing this up,
+1 for a lean oak-commons
cheers
stefan
>
> kind regards
> angela
Re: Consolidate oak Utilities
Posted by Angela Schreiber <an...@adobe.com>.
hi all
i created the oak-commons module and as of now moved
mk-PathUtils and mk-ArrayUtils there. that's an intermediate
state, more to come.
consequently i merged the Arrays utility in oak-jcr to the
ArrayUtils (include getting rid of duplicate unused methods).
with that step the Paths utility got reduced to just the toOak
and toJcr methods and i decided to change the utility
to a PathMapper interface + implementation according to the
one we have for the name mapping and adjusted SessionContext and
the various usages accordingly.
hope that's fine with everyone :)
kind regards
angela
ps: while working on the latter i got a tck-test-failure due
to namemapper throwing illegalargumentexception instead of
NamespaceException... don't know why that passed before.
anyway: i commented the test-case for now.
the exception handling stuff is in fact covered by another
thread but due to the progress we made during the last
days this now all comes together :)
On 4/27/12 4:02 PM, Angela Schreiber wrote:
> hi all
>
> ok... i will give it a try and create a oak-commons module.
> i think this will help removing obvious redundancies and cleanup
> code... we can still drop it later on or move things to a
> generic jackrabbit-commons package if we find it isn't useful.
>
>> On Fri, Apr 27, 2012 at 12:08 PM, Angela Schreiber<an...@adobe.com> wrote:
>>> a) create oak-commons module and move the various utilities
>>> used in multiple projects there... including merging
>>> redundant/duplicate/very-similar code.
>>
>> +1 for cases where there's obvious duplication of code across
>> components. However, to me many such cases seem like warning signs of
>> potentially broken interface design, so it would be good to review
>> such cases (possibly after they've been moved to a shared commons
>> component).
>
> agreed.
>
>> For example (and I know this has been discussed at length already),
>> much of the path and json/p handling code shared between -core and -mk
>> is just there to first generate jsop strings and then parse them
>> again. It's obviously good to avoid duplicating such code, but even
>> better if we could avoid it in the first place.
>>
>>> b) move the utilities to jcr-commons. since we use jcr
>>> standard form in all oak layers this would allow even
>>> a broader audience to take advantage of those utilities.
>>
>> +1 to things that are needed in oak-jcr and some of the JCR-specific
>> plugins (name and type validation, etc.) in oak-core.
>
> that's yet another story... the problem is that jcr-commons isn't
> just about jcr-specific stuff but contains all kind of utilities
> that have nothing to do with JCR.
> i will just focus on the plain utilities in a first step
>
> angela
>
>> BR,
>>
>> Jukka Zitting
Re: Consolidate oak Utilities
Posted by Angela Schreiber <an...@adobe.com>.
hi all
ok... i will give it a try and create a oak-commons module.
i think this will help removing obvious redundancies and cleanup
code... we can still drop it later on or move things to a
generic jackrabbit-commons package if we find it isn't useful.
> On Fri, Apr 27, 2012 at 12:08 PM, Angela Schreiber<an...@adobe.com> wrote:
>> a) create oak-commons module and move the various utilities
>> used in multiple projects there... including merging
>> redundant/duplicate/very-similar code.
>
> +1 for cases where there's obvious duplication of code across
> components. However, to me many such cases seem like warning signs of
> potentially broken interface design, so it would be good to review
> such cases (possibly after they've been moved to a shared commons
> component).
agreed.
> For example (and I know this has been discussed at length already),
> much of the path and json/p handling code shared between -core and -mk
> is just there to first generate jsop strings and then parse them
> again. It's obviously good to avoid duplicating such code, but even
> better if we could avoid it in the first place.
>
>> b) move the utilities to jcr-commons. since we use jcr
>> standard form in all oak layers this would allow even
>> a broader audience to take advantage of those utilities.
>
> +1 to things that are needed in oak-jcr and some of the JCR-specific
> plugins (name and type validation, etc.) in oak-core.
that's yet another story... the problem is that jcr-commons isn't
just about jcr-specific stuff but contains all kind of utilities
that have nothing to do with JCR.
i will just focus on the plain utilities in a first step
angela
> BR,
>
> Jukka Zitting
Re: Consolidate oak Utilities
Posted by Felix Meschberger <fm...@adobe.com>.
Hi,
Am 27.04.2012 um 12:39 schrieb Jukka Zitting:
> For example (and I know this has been discussed at length already),
> much of the path and json/p handling code shared between -core and -mk
> is just there to first generate jsop strings and then parse them
> again. It's obviously good to avoid duplicating such code, but even
> better if we could avoid it in the first place.
Which would be an argument of non-stringly typed MK API and leave serialization stuff to be internals of any MK API implementation -- be it for actual persistence or for a remoting layer...
Regards
Felix
Re: Consolidate oak Utilities
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On Fri, Apr 27, 2012 at 12:08 PM, Angela Schreiber <an...@adobe.com> wrote:
> a) create oak-commons module and move the various utilities
> used in multiple projects there... including merging
> redundant/duplicate/very-similar code.
+1 for cases where there's obvious duplication of code across
components. However, to me many such cases seem like warning signs of
potentially broken interface design, so it would be good to review
such cases (possibly after they've been moved to a shared commons
component).
For example (and I know this has been discussed at length already),
much of the path and json/p handling code shared between -core and -mk
is just there to first generate jsop strings and then parse them
again. It's obviously good to avoid duplicating such code, but even
better if we could avoid it in the first place.
> b) move the utilities to jcr-commons. since we use jcr
> standard form in all oak layers this would allow even
> a broader audience to take advantage of those utilities.
+1 to things that are needed in oak-jcr and some of the JCR-specific
plugins (name and type validation, etc.) in oak-core.
BR,
Jukka Zitting