Hi Thomas, I tried using the codes. I would get this error if i remove the if() condition.
JackrabbitValue jv = (JackrabbitValue) value; //the error line org.apache.jackrabbit.rmi.value.BinaryValue cannot be cast to org.apache.jackrabbit.api.JackrabbitValue I am currently using jcr 2.0.jar but could not find an import that works. I think that BinaryValue would not be able to cast to a jackrabbitValue. Thanks. Regards, Yun On Tue, Jan 4, 2011 at 5:42 PM, Thomas Mueller [via Jackrabbit] < [email protected]<ml-node%[email protected]> > wrote: > Hi, > > I have updated the wiki page at > http://wiki.apache.org/jackrabbit/DataStore#Retrieve_the_Identifier > > Regards, > Thomas > > > On 1/4/11 10:16 AM, "Seidel. Robert" <[hidden > email]<http://user/SendEmail.jtp?type=node&node=3173256&i=0>> > wrote: > > >Hi Yun, > > > >I think it should work this way... > > > > (resNode is a nt:resource node, input is the input stream and > >jcr_data is jcr:data) > > > > resNode.setProperty(JcrConstants.JCR_DATA, resNode.getSession() > > .getValueFactory().createBinary(input)); > > Value value = > >resNode.getProperty(JcrConstants.JCR_DATA).getValue(); > > if (value instanceof JackrabbitValue) { > > JackrabbitValue j = (JackrabbitValue) value; > > ... j.getContentIdentity(); > > } > > > >But I didn't have the time to test it yet, I'll try it later and change > >my code to the official way ;) > > > >Regards, Robert > > > >-----Ursprüngliche Nachricht----- > >Von: yun [mailto:[hidden > >email]<http://user/SendEmail.jtp?type=node&node=3173256&i=1>] > > >Gesendet: Dienstag, 4. Januar 2011 09:57 > >An: [hidden email] <http://user/SendEmail.jtp?type=node&node=3173256&i=2> > >Betreff: Re: Retrieve coded filename from datastore > > > > > >Hi Thomas, > > > >I am having trouble in geting the JackrabbitValue from the Jackrabbit > >repository. I do not understand how to get the jackrabbitvalue from > >jackrabbit when I am inputting a file into the jackrabbit repository. > > > >Regards, > >Yun > >On Tue, Jan 4, 2011 at 4:04 PM, Thomas Mueller [via Jackrabbit] < > >[hidden email] > ><http://user/SendEmail.jtp?type=node&node=3173256&i=3><ml-node%2B3173162-140800278 > > >-[hidden email] <http://user/SendEmail.jtp?type=node&node=3173256&i=4>> > >> wrote: > > > >> Hi, > >> > >> As documented in http://wiki.apache.org/jackrabbit/DataStore#API you > can > >> retrieve the identifier using > >> > >> JackrabbitValue.getContentIdentity() > >> > >> > >> JackrabbitValue is the public Jackrabbit API. Using non-public classes > >>or > >> methods or re-implementing things in Jackrabbit is not required. > >> > >> Regards, > >> Thomas > >> > >> > >> > >> On 1/4/11 4:31 AM, "yun" <[hidden > >>email]<http://user/SendEmail.jtp?type=node&node=3173162&i=0>> > >> wrote: > >> > >> > > >> >Hi, > >> > > >> >I know that we are not suppose to get the coded file from > >> >"jackrabbit\repository\datastore" folder where the raw files are > >>stored by > >> > >> >the jack rabbit repository. Example of a filename would be: > >> >52cd141937e037b89c8989d1411f63e98bcb7981 > >> > > >> >The file name is named by using the "52\cd\14" in > >> >"repository\datastore\52\cd\14" which is the folder where the file is > >> >stored. > >> > > >> >Question: > >> > > >> >Is there a way to obtain this name through some java codes when writing > > >> >the > >> >file to the repository? > >> > > >> >I need this file name as a backup option if ever the repository is > >> >corrupted, I would still have an option to retrieve the file from the > >> >folders according to the filename. Thanks. > >> >-- > >> >View this message in context: > >> > > >> > >> > http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datas<http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datas?by-user=t> > >>t< > http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-dat<http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-dat?by-user=t> > > >>ast?by-user=t> > >> >ore-tp3173010p3173010.html > >> >Sent from the Jackrabbit - Users mailing list archive at Nabble.com. > >> > >> > >> > >> ------------------------------ > >> View message @ > >> > >> > http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datas<http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datas?by-user=t> > >>tore-tp3173010p3173162.html > >> > >> To unsubscribe from Retrieve coded filename from datastore, click > >>here< > http://jackrabbit.510166.n4.nabble.com/template/NamlServlet.jtp?macr<http://jackrabbit.510166.n4.nabble.com/template/NamlServlet.jtp?macr&by-user=t> > >>o=unsubscribe_by_code&node=3173010&code=emhpeXVuQGVjcXVhcmlhLmNvbXwzMTczM > > >>DEwfC0xNTk3ODk3NTc5>. > >> > >> > > > >-- > >View this message in context: > > > http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datast<http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datast?by-user=t> > >ore-tp3173010p3173207.html > >Sent from the Jackrabbit - Users mailing list archive at Nabble.com. > > > > ------------------------------ > View message @ > http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datastore-tp3173010p3173256.html > > To unsubscribe from Retrieve coded filename from datastore, click > here<http://jackrabbit.510166.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3173010&code=emhpeXVuQGVjcXVhcmlhLmNvbXwzMTczMDEwfC0xNTk3ODk3NTc5>. > > -- View this message in context: http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datastore-tp3173010p3173279.html Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
