You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Julian Reschke <ju...@gmx.de> on 2006/11/01 18:28:24 UTC

SPI: ValueFactory vs Level-1 implementations (part 2)

Hi,

I just hit another problem with respect to an SPI implementation that is 
Level-1 (for now), when accessed by JCR2SPI.

Previously, this would fail early because JCR2SPI just assumed that it 
could get the ValueFactory from SessionInfo. Now, it keeps going, but 
doesn't have the ValueFactory later on.

This results in NullPointerExceptions once the ValueFactory is needed 
later, such as in

         at 
org.apache.jackrabbit.value.ValueFormat.getJCRValue(ValueFormat.java: 122)
         at 
org.apache.jackrabbit.jcr2spi.PropertyImpl.getValue(PropertyImpl.java
:276)

So maybe we should just state that for SPI, a Level-1 implementation 
*does* not to supply a ValueFactory, after all? The alternative probably 
would be to instantiate a simple ValueFactory internally, if the SPI 
implementation doesn't have one.

Feedback appreciated...

Best regards, Julian




Re: SPI: ValueFactory vs Level-1 implementations (part 2)

Posted by Julian Reschke <ju...@gmx.de>.
Angela Schreiber schrieb:
> hi julian
> 
> why do you think the ValueFactory comes from the SessionInfo?

Because I was confused :-) (and had been looking at JCR's Session 
interface immediately before).

> as far as i know, the ValueFactory is retrieved from the
> configuration. so, perhaps you simply don't provide one in
> your config.

Correct.

> am i missing something?

No.

> angela
> 
> btw: there is a simple ValueFactory in the jackrabbit-commons
> package. you may use this one or provide your own.

Thanks for the pointer.

Best regards, Julian


Re: SPI: ValueFactory vs Level-1 implementations (part 2)

Posted by Julian Reschke <ju...@gmx.de>.
Angela Schreiber schrieb:
> hi julian
> 
> that was exactly the reason for not 'hardcoding' the
> ValueFactoryImpl as it is the case in jackrabbit.
> 
> if you look at the spi2dav project you will find
> a slightly modified ValueFactoryImpl, that deals
> with exactly this issue.
> 
> however i would argue, that it depends on the spi
> implementation what kind of ValueFactory it wants
> to use. and that was exactly the point, where i
> added the ValueFactory to the config together with
> the service.

Understood and agreed. The SPI should provide it's own (and that's what 
I'm doing now...).

Best regards, Julian

Re: SPI: ValueFactory vs Level-1 implementations (part 2)

Posted by Angela Schreiber <an...@day.com>.
hi julian

that was exactly the reason for not 'hardcoding' the
ValueFactoryImpl as it is the case in jackrabbit.

if you look at the spi2dav project you will find
a slightly modified ValueFactoryImpl, that deals
with exactly this issue.

however i would argue, that it depends on the spi
implementation what kind of ValueFactory it wants
to use. and that was exactly the point, where i
added the ValueFactory to the config together with
the service.

regards
angela

Julian Reschke wrote:
> Angela Schreiber schrieb:
> 
>> ...
>> btw: there is a simple ValueFactory in the jackrabbit-commons
>> package. you may use this one or provide your own.
> 
> 
> BTW:
> 
> That ValueFactory unfortunately isn't as generic as I would like: it 
> enforces Reference properties to use UUID syntax, which of course isn't 
> always true.
> 
> Would it make sense to lift that restriction?
> 
> Best regards, Julian
> 
> 


Re: SPI: ValueFactory vs Level-1 implementations (part 2)

Posted by Julian Reschke <ju...@gmx.de>.
Angela Schreiber schrieb:
> ...
> btw: there is a simple ValueFactory in the jackrabbit-commons
> package. you may use this one or provide your own.

BTW:

That ValueFactory unfortunately isn't as generic as I would like: it 
enforces Reference properties to use UUID syntax, which of course isn't 
always true.

Would it make sense to lift that restriction?

Best regards, Julian



Re: SPI: ValueFactory vs Level-1 implementations (part 2)

Posted by Angela Schreiber <an...@day.com>.
hi julian

why do you think the ValueFactory comes from the SessionInfo?

as far as i know, the ValueFactory is retrieved from the
configuration. so, perhaps you simply don't provide one in
your config.

am i missing something?

angela

btw: there is a simple ValueFactory in the jackrabbit-commons
package. you may use this one or provide your own.