Expand my Community achievements bar.

SOLVED

How to create name space programatically

Avatar

Level 9

Using the following URL http://servername:port/crx/explorer/nodetypes/index.jsp I can create namespaces manually. I believe namespace will be created as a folder under /libs/dam/options/metadata.

Can I use application specific namespace instead of the /libs/dam/options/metadata folder? If so what configurations and changes are required.

How do I create this programatically using API,  Are there any specific apis to create namespaces? What are the permissions needed when I create namespace through a workflow process.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

Sorry, I don't see anywhere in that page where it suggests that creating a namespace modifies nodes in /libs/dam/options/metadata. 

You should create a namespace as part of your deployment process, not during a workflow. The most common approach is by using the Sling-Namespaces bundle manifest header. Your deployed project would also (if necessary) be responsible for adding the nodes under /libs/dam/options/metadata and (most likely) the custom fields in the DAM Asset Editor (unless you are using Asset Share in which case you would be more likely to author these fields as described in the linked documentation).

Again, don't use workflow for this.

Regards,

Justin

View solution in original post

4 Replies

Avatar

Employee

Hi,

Creating a JCR namespace does not modify nodes under /libs/dam/options/metadata. Where did you read that?

Programmatic namespace registration is described in section 10.12 of the JCR spec: http://www.day.com/specs/jcr/2.0/10_Writing.html. Also see the JavaDoc: http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/NamespaceRegistry.html

There is a specific privledge associated with this: jcr:namespaceManagement.

It would be very strange to create a new namespace in the context of a workflow process. Why do you want to do that? Most projects never need one custom namespace, let alone so many that you need a workflow for it.

Keep in mind that once you create a namespace, it is very difficult to remove it.

Justin

Avatar

Level 9

Here is where I see this http://docs.adobe.com/docs/en/cq/current/dam/customizing_and_extendingcq5dam.html

You can modify the namespaces available in the metadata form.

Currently available metadata are defined in /libs/dam/options/metadata:

  • The first level inside this directory contains the namespaces.
  • The items inside each namespace represents a metadata, such as results in a local part item.
  • The metadata content contains the information for the type and the multi-value options.

My objective is to extend dam fields with some custom additional fields. In order to have this field added in asseteditor, we need to have custom namespace.

We want to automate the process if the namespace is available, we use it otherwise we have to create it.

Avatar

Correct answer by
Employee

Hi,

Sorry, I don't see anywhere in that page where it suggests that creating a namespace modifies nodes in /libs/dam/options/metadata. 

You should create a namespace as part of your deployment process, not during a workflow. The most common approach is by using the Sling-Namespaces bundle manifest header. Your deployed project would also (if necessary) be responsible for adding the nodes under /libs/dam/options/metadata and (most likely) the custom fields in the DAM Asset Editor (unless you are using Asset Share in which case you would be more likely to author these fields as described in the linked documentation).

Again, don't use workflow for this.

Regards,

Justin

Avatar

Community Advisor

I strongly agree with what Justin mentioned and proposed.

Also custom namespace creation is going to be one time process, hence there is no point of putting it in workflow, you can trigger creation of namespace from your content package.

- Runal