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/04 04:31:52 UTC
Retrieve coded filename from datastore
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-datastore-tp3173010p3173010.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Retrieve coded filename from datastore
Posted by yun <zh...@ecquaria.com>.
Hi,
Thanks for the help!! I will try it out.
Regards,
Yun
On Tue, Jan 4, 2011 at 3:53 PM, Seidel. Robert [via Jackrabbit] <
ml-node+3173152-525469104-207249@n4.nabble.com<ml...@n4.nabble.com>
> wrote:
> Hi,
>
> There are two possibilities:
>
> First:
>
> Create your own helper class within the jackrabbit-core-...jar to access
> the non public BLOBFileValue class and its non public method
> getDataIdentifier.
>
> Second:
>
> Reimplement the jackrabbit mechanism:
>
> FileDataStore
>
> addRecord(InputStream input) {
> ...
> // Copy the stream to the temporary file and calculate the
> // stream length and the message digest of the stream
> long length = 0;
> MessageDigest digest = MessageDigest.getInstance(DIGEST);
> OutputStream output = new DigestOutputStream(
> new FileOutputStream(temporary), digest);
> try {
> length = IOUtils.copyLarge(input, output);
> } finally {
> output.close();
> }
> DataIdentifier identifier = new
> DataIdentifier(digest.digest());
> ...
>
> Kindly Regards, Robert ;)
>
> -----Ursprüngliche Nachricht-----
> Von: yun [mailto:[hidden email]<http://user/SendEmail.jtp?type=node&node=3173152&i=0>]
>
> Gesendet: Dienstag, 4. Januar 2011 04:32
> An: [hidden email] <http://user/SendEmail.jtp?type=node&node=3173152&i=1>
> Betreff: Retrieve coded filename from datastore
>
>
> 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-datastore-tp3173010p3173010.html<http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datastore-tp3173010p3173010.html?by-user=t>
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>
> ------------------------------
> View message @
> http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datastore-tp3173010p3173152.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-tp3173010p3173157.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
AW: Retrieve coded filename from datastore
Posted by "Seidel. Robert" <Ro...@aeb.de>.
Hi,
There are two possibilities:
First:
Create your own helper class within the jackrabbit-core-...jar to access the non public BLOBFileValue class and its non public method getDataIdentifier.
Second:
Reimplement the jackrabbit mechanism:
FileDataStore
addRecord(InputStream input) {
...
// Copy the stream to the temporary file and calculate the
// stream length and the message digest of the stream
long length = 0;
MessageDigest digest = MessageDigest.getInstance(DIGEST);
OutputStream output = new DigestOutputStream(
new FileOutputStream(temporary), digest);
try {
length = IOUtils.copyLarge(input, output);
} finally {
output.close();
}
DataIdentifier identifier = new DataIdentifier(digest.digest());
...
Kindly Regards, Robert ;)
-----Ursprüngliche Nachricht-----
Von: yun [mailto:zhiyun@ecquaria.com]
Gesendet: Dienstag, 4. Januar 2011 04:32
An: users@jackrabbit.apache.org
Betreff: Retrieve coded filename from datastore
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-datastore-tp3173010p3173010.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
AW: AW: Retrieve coded filename from datastore
Posted by "Seidel. Robert" <Ro...@aeb.de>.
Hi Yun,
sounds like you are using rmi. org.apache.jackrabbit.rmi.value.BinaryValue does not implement JackrabbitValue, so you can't use the public way here :/
Regards, Robert
-----Ursprüngliche Nachricht-----
Von: yun [mailto:zhiyun@ecquaria.com]
Gesendet: Dienstag, 4. Januar 2011 11:04
An: users@jackrabbit.apache.org
Betreff: Re: AW: Retrieve coded filename from datastore
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] <
ml-node+3173256-225441739-207249@n4.nabble.com<ml...@n4.nabble.com>
> 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.
Re: AW: Retrieve coded filename from datastore
Posted by Alexander Klimetschek <ak...@adobe.com>.
On 04.01.11 11:04, "yun" <zh...@ecquaria.com> wrote:
>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.
What version of jackrabbit are you using? The JackrabbitValue interface is
part of jackrabbit-api (it is a Jackrabbit-specific addition, hence not
part of the JCR standard/api).
Regards,
Alex
--
Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel
Re: AW: Retrieve coded filename from datastore
Posted by yun <zh...@ecquaria.com>.
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] <
ml-node+3173256-225441739-207249@n4.nabble.com<ml...@n4.nabble.com>
> 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.
Re: AW: Retrieve coded filename from datastore
Posted by Thomas Mueller <mu...@adobe.com>.
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" <Ro...@aeb.de> 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:zhiyun@ecquaria.com]
>Gesendet: Dienstag, 4. Januar 2011 09:57
>An: users@jackrabbit.apache.org
>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] <
>ml-node+3173162-140800278-207249@n4.nabble.com<ml-node%2B3173162-140800278
>-207249@n4.nabble.com>
>> 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
>>t<http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-dat
>>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
>>tore-tp3173010p3173162.html
>>
>> To unsubscribe from Retrieve coded filename from datastore, click
>>here<http://jackrabbit.510166.n4.nabble.com/template/NamlServlet.jtp?macr
>>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
>ore-tp3173010p3173207.html
>Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
AW: Retrieve coded filename from datastore
Posted by "Seidel. Robert" <Ro...@aeb.de>.
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:zhiyun@ecquaria.com]
Gesendet: Dienstag, 4. Januar 2011 09:57
An: users@jackrabbit.apache.org
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] <
ml-node+3173162-140800278-207249@n4.nabble.com<ml...@n4.nabble.com>
> 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-datast<http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datast?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-datastore-tp3173010p3173162.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-tp3173010p3173207.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Retrieve coded filename from datastore
Posted by yun <zh...@ecquaria.com>.
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] <
ml-node+3173162-140800278-207249@n4.nabble.com<ml...@n4.nabble.com>
> 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-datast<http://jackrabbit.510166.n4.nabble.com/Retrieve-coded-filename-from-datast?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-datastore-tp3173010p3173162.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-tp3173010p3173207.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Retrieve coded filename from datastore
Posted by Thomas Mueller <mu...@adobe.com>.
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" <zh...@ecquaria.com> 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-datast
>ore-tp3173010p3173010.html
>Sent from the Jackrabbit - Users mailing list archive at Nabble.com.