You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by yun <zh...@ecquaria.com> on 2011/01/10 04:59:55 UTC

rmi.value.binaryvalue and JackrabbitValue

Hi,

I am trying to solve this problem as I need the encoded file name that
jackrabbit creates for backup purposes.

Example of a filename in "../repository/datastore/c3/e3/39" is
"c3e33992d6ed39e888754ceab1b72592df2ca398".

I could use .getContentIdentity() from JackrabbitValue but as I am using rmi
repository, the following error occurs.

ERROR:
org.apache.jackrabbit.rmi.value.BinaryValue cannot be cast to
org.apache.jackrabbit.api.JackrabbitValue


This is due to rmi.value.BinaryValue does not implement
jackrabbit.api.JackrabbitValue.

I could create a trancient repository to get the encoded filename as a same
filestream always produces a same encoded file name, but I think it is too
slow and not right to do so. Is there a way to change the BinaryValue to a
JackrabbitValue or a method that could obtain the encoded filename from the
BinaryValue.

Thanks,
Yun



-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/rmi-value-binaryvalue-and-JackrabbitValue-tp3206588p3206588.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

AW: rmi.value.binaryvalue and JackrabbitValue

Posted by "Seidel. Robert" <Ro...@aeb.de>.
Hi,

We've implemented some mechanism, that stores the structure of a node (inclusive some file sub nodes) in the data store as xml. This allows us to restore the database from the data store. But for this, we need the filename of the binaries for a node, so we are using getContentIdentity().
If this behavior should be changed as you say, we will use getDataIdentifier from the BlobFileValue directly.

Regards, Robert

-----Ursprüngliche Nachricht-----
Von: Jukka Zitting [mailto:jukka.zitting@gmail.com] 
Gesendet: Montag, 10. Januar 2011 10:40
An: users@jackrabbit.apache.org
Betreff: Re: rmi.value.binaryvalue and JackrabbitValue

Hi,

On Mon, Jan 10, 2011 at 10:42 AM, yun <zh...@ecquaria.com> wrote:
> In case when the repository is down, I would be able to find the file by
> looking at the database.

Note that the fact that the content hash returned by
JackrabbitValue.getContentIdentity() maps directly to the underlying
file name is an implementation detail that might well change in a
future Jackrabbit release. You should not rely on it in client code.

If you need your binaries to be available even when the repository is
down, a better solution would be to store them separately in the file
system, and just store the file path in both the repository and your
database.

BR,

Jukka Zitting

Re: rmi.value.binaryvalue and JackrabbitValue

Posted by Alexander Klimetschek <ak...@adobe.com>.
On 10.01.11 10:39, "Jukka Zitting" <ju...@gmail.com> wrote:
>On Mon, Jan 10, 2011 at 10:42 AM, yun <zh...@ecquaria.com> wrote:
>> In case when the repository is down, I would be able to find the file by
>> looking at the database.
>
>If you need your binaries to be available even when the repository is
>down, a better solution would be to store them separately in the file
>system, and just store the file path in both the repository and your
>database.

The more interesting question is why should the repository be down?
Because that is part of the overall system (use case?) or just because of
a "fear" that the repository might go down (then it doesn't make sense,
just as you don't write something complex to access the files of a RDMBS
in case "it goes down") ?

Regards,
Alex

-- 
Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel





Re: rmi.value.binaryvalue and JackrabbitValue

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Mon, Jan 10, 2011 at 10:42 AM, yun <zh...@ecquaria.com> wrote:
> In case when the repository is down, I would be able to find the file by
> looking at the database.

Note that the fact that the content hash returned by
JackrabbitValue.getContentIdentity() maps directly to the underlying
file name is an implementation detail that might well change in a
future Jackrabbit release. You should not rely on it in client code.

If you need your binaries to be available even when the repository is
down, a better solution would be to store them separately in the file
system, and just store the file path in both the repository and your
database.

BR,

Jukka Zitting

Re: rmi.value.binaryvalue and JackrabbitValue

Posted by yun <zh...@ecquaria.com>.
Hi,

Thanks for your help.

Regards,
Yun

On Mon, Jan 10, 2011 at 4:53 PM, Thomas Mueller [via Jackrabbit] <
ml-node+3206770-1755091672-207249@n4.nabble.com<ml...@n4.nabble.com>
> wrote:

> Hi,
>
> > In case when the repository is down, I would be able to find the file by
> > looking at the database.
>
> OK, I understand now.
>
> > Problem with the JCR API is that,
> > org.apache.jackrabbit.rmi.value.BinaryValue cannot be cast to
> > org.apache.jackrabbit.api.JackrabbitValue
>
>
> Yes, as far as I know the RMI layer doesn't currently support
> JackrabbitValue. I guess either you need to patch the RMI layer yourself
> (patches are always welcome), wait for somebody else to do it, or use
> another API. The local (non-remote) API works for sure. Unfortunately, I
> don't know if DavEx remoting supports JackrabbitValue. About remoting, see
> also: http://wiki.apache.org/jackrabbit/RemoteAccess
>
> Regards,
> Thomas
>
>
>
> ------------------------------
> View message @
> http://jackrabbit.510166.n4.nabble.com/rmi-value-binaryvalue-and-JackrabbitValue-tp3206588p3206770.html
>
> To unsubscribe from rmi.value.binaryvalue and JackrabbitValue, click here<http://jackrabbit.510166.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3206588&code=emhpeXVuQGVjcXVhcmlhLmNvbXwzMjA2NTg4fC0xNTk3ODk3NTc5>.
>
>

-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/rmi-value-binaryvalue-and-JackrabbitValue-tp3206588p3208332.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: rmi.value.binaryvalue and JackrabbitValue

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

> In case when the repository is down, I would be able to find the file by
> looking at the database.

OK, I understand now.

> Problem with the JCR API is that,
> org.apache.jackrabbit.rmi.value.BinaryValue cannot be cast to
> org.apache.jackrabbit.api.JackrabbitValue


Yes, as far as I know the RMI layer doesn't currently support
JackrabbitValue. I guess either you need to patch the RMI layer yourself
(patches are always welcome), wait for somebody else to do it, or use
another API. The local (non-remote) API works for sure. Unfortunately, I
don't know if DavEx remoting supports JackrabbitValue. About remoting, see
also: http://wiki.apache.org/jackrabbit/RemoteAccess

Regards,
Thomas


Re: rmi.value.binaryvalue and JackrabbitValue

Posted by yun <zh...@ecquaria.com>.
Hi,

In case when the repository is down, I would be able to find the file by
looking at the database.

Regards,
Yun

On Mon, Jan 10, 2011 at 4:35 PM, Thomas Mueller [via Jackrabbit] <
ml-node+3206754-1550853736-207249@n4.nabble.com<ml...@n4.nabble.com>
> wrote:

> Hi,
>
> >I am trying to store the endcoded file name in my database along with
> >names
> >and other data of each file.
>
> Yes... but: *why* do you want to store the encoded file name?
>
> Regards,
> Thomas
>
>
>
> ------------------------------
>  View message @
> http://jackrabbit.510166.n4.nabble.com/rmi-value-binaryvalue-and-JackrabbitValue-tp3206588p3206754.html
>
> To unsubscribe from rmi.value.binaryvalue and JackrabbitValue, click here<http://jackrabbit.510166.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3206588&code=emhpeXVuQGVjcXVhcmlhLmNvbXwzMjA2NTg4fC0xNTk3ODk3NTc5>.
>
>

-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/rmi-value-binaryvalue-and-JackrabbitValue-tp3206588p3206760.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: rmi.value.binaryvalue and JackrabbitValue

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>I am trying to store the endcoded file name in my database along with
>names
>and other data of each file.

Yes... but: *why* do you want to store the encoded file name?

Regards,
Thomas


Re: rmi.value.binaryvalue and JackrabbitValue

Posted by yun <zh...@ecquaria.com>.
Hi,

I am trying to store the endcoded file name in my database along with names
and other data of each file.  Problem with the JCR API is that,

org.apache.jackrabbit.rmi.value.BinaryValue cannot be cast to
org.apache.jackrabbit.api.JackrabbitValue

Value va =
fileNode.getNode("jcr:content").getProperty("jcr:data").getValue();
JackrabbitValue v = (JackrabbitValue)(va);   //Error occurs here
String rawFileName = v.getContentIdentity();


my repository is a remote repository.

Regards,
Yun

On Mon, Jan 10, 2011 at 4:15 PM, Thomas Mueller [via Jackrabbit] <
ml-node+3206732-244639452-207249@n4.nabble.com<ml...@n4.nabble.com>
> wrote:

> Hi,
>
> >I am trying to solve this problem as I need the encoded file name that
> >jackrabbit creates for backup purposes.
>
> I don't understand. Do you want to backup a few binary values only? If yes
> why don't you use the JCR API? If not, then why don't you backup the whole
> datastore directory?
>
> Regards,
> Thomas
>
>
>
> ------------------------------
>  View message @
> http://jackrabbit.510166.n4.nabble.com/rmi-value-binaryvalue-and-JackrabbitValue-tp3206588p3206732.html
> To unsubscribe from rmi.value.binaryvalue and JackrabbitValue, click here<http://jackrabbit.510166.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3206588&code=emhpeXVuQGVjcXVhcmlhLmNvbXwzMjA2NTg4fC0xNTk3ODk3NTc5>.
>
>

-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/rmi-value-binaryvalue-and-JackrabbitValue-tp3206588p3206740.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: rmi.value.binaryvalue and JackrabbitValue

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>I am trying to solve this problem as I need the encoded file name that
>jackrabbit creates for backup purposes.

I don't understand. Do you want to backup a few binary values only? If yes
why don't you use the JCR API? If not, then why don't you backup the whole
datastore directory?

Regards,
Thomas