cancel
Showing results for 
Search instead for 
Did you mean: 

Share Site namespace constants in Java

mcox
Champ in-the-making
Champ in-the-making
The NamespaceService Java interface includes constants for common namespaces and namespace prefixes such as CONTENT_MODEL_1_0_URI and CONTENT_MODEL_PREFIX but nothing for the Share site namespace "http://www.alfresco.org/model/site/1.0" and prefix "st".

I have found
org.alfresco.repo.site.SiteModel
which defines SITE_MODEL_PREFIX as "st" but confusingly rather than SITE_MODEL_1_0_URI as might be extrapolated it has SITE_MODEL_URL for "http://www.alfresco.org/model/site/1.0".

Does anyone understand the convention of where and how these namespace constants are supposed to be defined?

(NB in the first version of this there was a mistake in the package org.alfresco.repo.site which I have corrected..)
3 REPLIES 3

jpotts
World-Class Innovator
World-Class Innovator
I don't know why that constant is missing from the NamespaceService interface. That SiteModel class you found appears to be in a proprietary package–it is not an Alfresco class. So someone created those constants and didn't use the same naming convention for the constant names.

You may already know, but just in case, the namespaces are defined in the content model. For example, the one you are identifying here is defined in $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco/model/siteModel.xml.

Jeff

mcox
Champ in-the-making
Champ in-the-making
Thanks! Yes, I just noticed that SiteModel class is our own code! I look at tidying it up so that it at least uses the same naming convention. (Edit: NB it turned out that there was a typo in the package name i originally quoted, and that SiteModel is an Alfresco interface after all.)

I presume it was created because the values aren't defined in NamespaceService.

I am aware of the classes/alfresco/model XML files but I need to access these values in Java. Is there a straightforward way to do this? Presumably they are read by the Alfresco system at start-up and should be available programmatically somehow?

mcox
Champ in-the-making
Champ in-the-making
Actually that was a typo in the package I quoted..

It should have been
org.alfresco.repo.site.SiteModel
, so it is an Alfresco interface rather than a proprietary class.