Search code examples
jbossjcrmodeshape

Modeshape initial content creation


I try to add initial content to my repository. But in the log I can see :

10:12:46.934 DEBUG o.m.jcr.InitialContentImporter - Importing node at path /{}accounts
10:12:46.941 DEBUG o.m.jcr.InitialContentImporter - Importing node at path /{}users
10:12:46.941 DEBUG o.m.jcr.InitialContentImporter - Importing node at path /{}accounts/{}foo

why it add {} ? Cause of that (I guess) I have nothing initialized in my repo

My modeshape config and xml file for initial content look like this

json file :

{
  "name": "cloud-repository-dev",
  "workspaces": {
    "predefined": ["otherWorkspace"],
    "default": "default",
    "allowCreation": true,
    "initialContent": {
      "otherWorkspace": "conf/initialContent/init.xml"
    }
  },
  "security": {
    "anonymous": {
      "roles": [
        "readonly",
        "readwrite",
        "admin"
      ],
      "useOnFailedLogin": false
    }
  },
  "storage": {
    "cacheConfiguration": "conf/infinispan-configuration-dev.xml",
    "cacheName": "persisted_repository",
    "binaryStorage": {
      "type": "file",
      "directory": "binaries",
      "minimumBinarySizeInBytes": 999
    }
  },
  "node-types": ["conf/cnd/cloud.cnd"]
}

xml file

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0">
    <accounts>
        <account1 jcr:name="foo" email="[email protected]"/>
    </accounts>
    <users></users>
</jcr:root>

Solution

  • There is nothing wrong with ModeShape or your content.

    ModeShape sometimes prints out node names or paths by wrapping the namespace URI within braces. So in your case, the {} denotes the node names use the "blank" namespace, as specified in your import XML file:

    <accounts>
        <account1 jcr:name="foo" email="[email protected]"/>
    </accounts>
    <users></users>
    

    If you use the JCR API to look at your content, you'd see that the braces don't actually appear in the node names.