cancel
Showing results for 
Search instead for 
Did you mean: 

Path of a file stored in Alfresco

camillo
Champ in-the-making
Champ in-the-making
Hi all,

I must develop a java application able to parse an xml file stored in Alfresco.
But, when i want to know the path of the file i received this string for the file named my_file.xml:
/{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/content/1....

followed by an java.io.FileNotFoundException because i can't open the xml file.
Does anybody can help me to solve this problem?
thanks in advance
10 REPLIES 10

mikeh
Star Contributor
Star Contributor
You've got an xpath there - I suspect you're after a display path instead.

Thanks,
Mike

camillo
Champ in-the-making
Champ in-the-making
so, how can i obtain a path in order to parse the xml file?

mikeh
Star Contributor
Star Contributor
How are you getting the xpath?

Mike

camillo
Champ in-the-making
Champ in-the-making
I call a method getPath which is in APIs written by some friends of mine (that are unreachable now)
So, the question is now: how can i get the path of a resource, e.g a file xml, in order to open it?
Thanks very much for your time!

camillo
Champ in-the-making
Champ in-the-making
In this moment, i can open my xml using this path:
/opt/alfresco/alf_data/contentstore/2009/3/17/11/0/79bd40db-12da-11de-a552-c534a6742d03.bin
where 79bd40db-12da-11de-a552-c534a6742d03.bin is the node representing my xml file.
Now i would like a method or a property that allows me to be free from my filesystem.
So…what's the property or the method i have to call in order to obtain the path for my alf_data directory?
I have a method that returns /2009/3/17/11/0/79bd40db-12da-11de-a552-c534a6742d03.bin, so I need the method that returns /opt/alfresco/alf_data/contentstore
Thanks one more!

jpfi
Champ in-the-making
Champ in-the-making
Hi Camillo,
I must develop a java application able to parse an xml file stored in Alfresco.
What you're doing via your getPath-API call is to find out where the content file in the Alfresco content store is stored…
But, normally you doesn't want to do this. Alfresco provides sth. called repository. This Repo encapsulates a content file (stored in content store) and its metadata (stored in DB).
You can access the content or its metadata using one of the Alfresco APIs.
cheers, Jan

camillo
Champ in-the-making
Champ in-the-making
Hi Jan,

thank for your answer.
In my application i would like know where is the contentstore directory used by alfresco
I know the path of this directory using the repository.properties file, but the problem is I want know this directory using a method called from my java application.
I'm reading Alfresco Repository APIs but I don't find any method or classes that help me.
Can you tell me some classes/methods that could solve my problem?
Thanks

zaizi
Champ in-the-making
Champ in-the-making
You can get the input stream for the XML file by
ContentReader reader = this.contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);

where the nodeRef is the NodeRef of the XML file.

camillo
Champ in-the-making
Champ in-the-making
You can get the input stream for the XML file by
ContentReader reader = this.contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);

where the nodeRef is the NodeRef of the XML file.

i would link a File object instead of a ContentReader object.
Is this possible?