cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving metadata from a wcm avm.

boneill
Star Contributor
Star Contributor
Hi All,

I asked this question on WCM Development forum but as yet have had no reply so I though I would try here as it is specically about calling a webscript from a website that is managed via alfresco wcm.

My webscript needs to connect to a users wcm avm (repository) and retrieve metadata from all objects of a specific webform.  The AVM api for both javascript and ftl have methods to retrieve content from the repository given a specific storeid and webproject path.  My question is using either the javascript api or ftl api:

1) How do you determine what the storeid is for a specific webproject user.
2) How do you determine the path within the avm for the files I am trying to access assuming they are in the /Root/products/my product directory.

I would really appreciate some example code for this if anyone has any or even a pointer to information on how I determine these values.  Any wiki doco on the apis so far have not been very clear about how to determine these values.

Regards

Brian
3 REPLIES 3

pmonks
Star Contributor
Star Contributor
This is exactly the kind of thing that the NodeBrowser is useful for.  If you haven't played with it a little bit, I'd definitely recommend spending some time to familiarise yourself with it.  It's found in the Administration Console.

The storeId of a user sandbox is "WebProjectDNSName–UserId", where "WebProjectDNSName" is the DNS name you configured the Web Project with when you created it, and "UserId" is the user id that the user logs in with.  So for example if I have a Web Project with a DNS name of "test" and my user id is "pmonks", my user sandbox in that Web Project (assuming I'd been invited to it) would be "test–pmonks".

Your directories will be exactly as you created them, but with two "synthetic" directories added to the front:
"/www/avm_webapps".  So in your example, the full directory path would be "/www/avm_webapps/ROOT/products/myproduct" and the full AVM NodeRef (using my example user sandbox above) would be "test–pmonks:/www/avm_webapps/ROOT/products/myproduct".

I'm not sure why the Web Client UI creates these synthetic directories, but they are a minor nuisance when interacting with the AVM via CIFS, FTP and/or the APIs (where they are visible - the Web Client itself hides them).  Perhaps one of the engineers can enlighten us?

Cheers,
Peter

boneill
Star Contributor
Star Contributor
Peter,
Thankyou very much for providing this response.  Its going to make my day a hell of a lot easier.  I have to admit I am a little frustrated about not being able to find the documentation on this stuff.  How did you determine the make up of the store id and path.  Was it trial and error or is it documented somewhere.  I am used to using javadoc for this sort of stuff but as the apis are for javascript or ftl there is no javadoc.  I will check out the component you mentioned.

Regards

Brian

pmonks
Star Contributor
Star Contributor
I figured this out by looking at the raw repository via the Node Browser, hence my suggestion to familiarise yourself with it - it's an invaluable investigation / troubleshooting tool.

The Javascript API is documented at http://wiki.alfresco.com/wiki/JavaScript_API, but it doesn't describe some of these low level concepts (the format for NodeRefs, StoreRefs etc.).  Some of these are documented in the Java API Javadoc (http://dev.alfresco.com/resource/docs/java/repository/index.html), but not all.  Note that the Javascript API is a fairly thin facade around the native Java API, so I find myself referring to both even when I'm implementing something exclusively in Javascript.

Cheers,
Peter