cancel
Showing results for 
Search instead for 
Did you mean: 

Extending the root scoped CMIS object

tara-t
Champ in-the-making
Champ in-the-making
Hi All,

Can anyone tell me where the spring context file is that defines the root-scoped CMIS object?  I am trying to create a web script that adds and edits custom aspects. From the CMIS webinar by Jeff Potts, I have an example in the Foundation API of what I need to do - add the Alfresco-created OpenCMIS extension as a parameter. In Java it looks like this:

// Set the alfresco object factory
// Used when using the CMIS extension for Alfresco for working with aspects
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

I think I will either have to extend the CMIS root object Java class or create my own CMIS root object - can someone point me to where this is configured?

Also, what is the difference between adding web scripts in the share (web-extension) and the alfresco (extension) directories?  Alfresco web scripts seem to have access to a much greater list of root scoped objects, so I'm wondering why a web script would be placed in the web-extension directory.

Thanks,
Tara
3 REPLIES 3

zladuric
Champ on-the-rise
Champ on-the-rise
I don't know about CMIS, but I can tell you about extension folders:
classes/alfresco/extension is extending repository (localhost/alfresco context) and
classes/alfresco/web-extension is extending share (localhost/share context).

So if you put a component in web-extension, somewhere in site-webscripts subdirectory, you will have a new Share webscript, perhaps a dashlet. If you put it instead in extension directory, under templates/webscripts directory, you have a backend webscript.

The webscripts you see in services index is from those (respective) subdirectories when you unpack alfresco.war and share.war.
Ie. unpack share.war and you will see WEB-INF/classes/alfresco/site-webscripts. There are all the share webscripts. Anything in the shared classloader path (TOMCAT/shared/classses/alfresco/web-extension) is overriding the defaults. Similar goes for Alfresco.war.

Additionally, you mention root-scoped objects. Those are defined in spring XML config files, in various components and beans, you could create your own Java bean and through spring bean configuration expose it to your webscripts.
Are you asking about anything particular there?

pmverma
Champ in-the-making
Champ in-the-making
Hi, Tara-T

Not all but one.

For root-scoped object from alfresco side webscripts, you can see following file how it is there.

tomcat\webapps\alfresco\WEB-INF\classes\alfresco\script-services-context.xml

tara-t
Champ in-the-making
Champ in-the-making
Thanks for your responses. I have found where the CMIS root scoped bean is set up and the associated Java class is: CMISLocalConnectionManagerImpl.java  When I looked at the source of this class I found that it already added the Alfresco CMIS extension as a parameter.  I had a web script that I was getting errors updating custom aspects so I assumed that the bean did not have the Alfresco CMIS extension set up.  It turned out I just had an error in my web script.

Regarding share vs backend web scripts, I've placed my web script in the extensions folder as it accesses the repository and retrieves data.