Uploaded image for project: '[Read Only] - Hippo Repository'
  1. [Read Only] - Hippo Repository
  2. REPO-1023

Add initialize item to import directory as nt:folder and nt:file hierarchy

Details

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 2.28.00
    • None
    • Sprint 86

    Description

      It should be possible to import a directory of web resources into the repository with one initialize item.

      For example, say we have the following files and directories in a packaged jar:

      webresources/
      css/
      main.css
      js/
      script.js
      hippoecm-extension.xml

      It should then be possible to define an initialize item in the hippoecm-extension.xml file that points to the directory 'webresources'. The repository should then be able to bootstrap a hierarchy of nt:folder and nt:file nodes that reflects that directory and all directories and files below it (recursively).

      Attachments

        Activity

          Be aware that when reviewing this issue ConfigurationTest has been moved to InitializationProcessorTest now.

          uhommes Unico Hommes (Inactive) added a comment - Be aware that when reviewing this issue ConfigurationTest has been moved to InitializationProcessorTest now.

          Looks good! Yet one edge case seems to log an error. First I've bootstrapped some webresources in the archetype under /webresources/site, using initialize item:

          <sv:node sv:name="gettingstarted-webresources">
          <sv:property sv:name="jcr:primaryType" sv:type="Name">
          <sv:value>hippo:initializeitem</sv:value>
          </sv:property>
          <sv:property sv:name="hippo:contentfolder" sv:type="String">
          <sv:value>webresources</sv:value>
          </sv:property>
          <sv:property sv:name="hippo:contentroot" sv:type="String">
          <sv:value>/</sv:value>
          </sv:property>
          <sv:property sv:name="hippo:sequence" sv:type="Double">
          <sv:value>31000</sv:value>
          </sv:property>
          </sv:node>

          Then I added some new webresources in the directory src/main/resources/webresources/newchannel, and created a separate initialize for them (use case: I only want to bootstrap the webresources of a new channel, without reload the existing ones). The initialize item I used was:

          <sv:node sv:name="gettingstarted-webresources-newchannel">
          <sv:property sv:name="jcr:primaryType" sv:type="Name">
          <sv:value>hippo:initializeitem</sv:value>
          </sv:property>
          <sv:property sv:name="hippo:contentfolder" sv:type="String">
          <sv:value>webresources/newchannel</sv:value>
          </sv:property>
          <sv:property sv:name="hippo:contentroot" sv:type="String">
          <sv:value>/webresources/</sv:value>
          </sv:property>
          <sv:property sv:name="hippo:sequence" sv:type="Double">
          <sv:value>31001</sv:value>
          </sv:property>
          </sv:node>

          During the bootstrap process the following error is then logged:

          [INFO] [talledLocalContainer] 08.08.2014 09:47:58 ERROR localhost-startStop-1 [InitializationProcessorImpl.processInitializeItems:260] configuration as specified by /hippo:configuration/hippo:initialize/gettingstarted-webresources-newchannel failed
          [INFO] [talledLocalContainer] javax.jcr.RepositoryException: Failed to resolve path relative to node /webresources
          [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.NodeImpl.resolveRelativePath(NodeImpl.java:240)
          [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.NodeImpl.resolveRelativeNodePath(NodeImpl.java:223)
          [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.NodeImpl.hasNode(NodeImpl.java:2281)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.decorating.NodeDecorator.hasNode(NodeDecorator.java:299)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.impl.InitializationProcessorImpl.processContentFolder(InitializationProcessorImpl.java:314)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.impl.InitializationProcessorImpl.processInitializeItems(InitializationProcessorImpl.java:231)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.impl.InitializationProcessorImpl.processInitializeItems(InitializationProcessorImpl.java:176)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.LocalHippoRepository.contentBootstrap(LocalHippoRepository.java:427)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.LocalHippoRepository.initializeStartup(LocalHippoRepository.java:336)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.LocalHippoRepository.initialize(LocalHippoRepository.java:263)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.LocalHippoRepository.create(LocalHippoRepository.java:130)
          [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          [INFO] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          [INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:606)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.HippoRepositoryFactory.getHippoRepository(HippoRepositoryFactory.java:178)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.RepositoryServlet.init(RepositoryServlet.java:191)
          [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
          [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
          [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
          [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210)
          [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493)
          [INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
          [INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
          [INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
          [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
          [INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
          [INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1880)
          [INFO] [talledLocalContainer] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
          [INFO] [talledLocalContainer] at java.util.concurrent.FutureTask.run(FutureTask.java:262)
          [INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          [INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          [INFO] [talledLocalContainer] at java.lang.Thread.run(Thread.java:744)
          [INFO] [talledLocalContainer] Caused by: org.apache.jackrabbit.spi.commons.conversion.MalformedPathException: empty path
          [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoPathParser.parse(HippoPathParser.java:219)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoPathParser.parse(HippoPathParser.java:177)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoPathParser.parse(HippoPathParser.java:149)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoPathParser.parse(HippoPathParser.java:68)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoCachingPathResolver.getQPath(HippoCachingPathResolver.java:53)
          [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoNamePathResolver.getQPath(HippoNamePathResolver.java:61)
          [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.SessionImpl.getQPath(SessionImpl.java:652)
          [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.session.SessionContext.getQPath(SessionContext.java:338)
          [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.NodeImpl.resolveRelativePath(NodeImpl.java:238)
          [INFO] [talledLocalContainer] ... 32 more

          However, the node hierarchy below /webresources/newchannel is created correctly, so the ERROR seems to be just noise that should not be there.

          mdenburger Mathijs den Burger (Inactive) added a comment - Looks good! Yet one edge case seems to log an error. First I've bootstrapped some webresources in the archetype under /webresources/site, using initialize item: <sv:node sv:name="gettingstarted-webresources"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>hippo:initializeitem</sv:value> </sv:property> <sv:property sv:name="hippo:contentfolder" sv:type="String"> <sv:value>webresources</sv:value> </sv:property> <sv:property sv:name="hippo:contentroot" sv:type="String"> <sv:value>/</sv:value> </sv:property> <sv:property sv:name="hippo:sequence" sv:type="Double"> <sv:value>31000</sv:value> </sv:property> </sv:node> Then I added some new webresources in the directory src/main/resources/webresources/newchannel, and created a separate initialize for them (use case: I only want to bootstrap the webresources of a new channel, without reload the existing ones). The initialize item I used was: <sv:node sv:name="gettingstarted-webresources-newchannel"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>hippo:initializeitem</sv:value> </sv:property> <sv:property sv:name="hippo:contentfolder" sv:type="String"> <sv:value>webresources/newchannel</sv:value> </sv:property> <sv:property sv:name="hippo:contentroot" sv:type="String"> <sv:value>/webresources/</sv:value> </sv:property> <sv:property sv:name="hippo:sequence" sv:type="Double"> <sv:value>31001</sv:value> </sv:property> </sv:node> During the bootstrap process the following error is then logged: [INFO] [talledLocalContainer] 08.08.2014 09:47:58 ERROR localhost-startStop-1 [InitializationProcessorImpl.processInitializeItems:260] configuration as specified by /hippo:configuration/hippo:initialize/gettingstarted-webresources-newchannel failed [INFO] [talledLocalContainer] javax.jcr.RepositoryException: Failed to resolve path relative to node /webresources [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.NodeImpl.resolveRelativePath(NodeImpl.java:240) [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.NodeImpl.resolveRelativeNodePath(NodeImpl.java:223) [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.NodeImpl.hasNode(NodeImpl.java:2281) [INFO] [talledLocalContainer] at org.hippoecm.repository.decorating.NodeDecorator.hasNode(NodeDecorator.java:299) [INFO] [talledLocalContainer] at org.hippoecm.repository.impl.InitializationProcessorImpl.processContentFolder(InitializationProcessorImpl.java:314) [INFO] [talledLocalContainer] at org.hippoecm.repository.impl.InitializationProcessorImpl.processInitializeItems(InitializationProcessorImpl.java:231) [INFO] [talledLocalContainer] at org.hippoecm.repository.impl.InitializationProcessorImpl.processInitializeItems(InitializationProcessorImpl.java:176) [INFO] [talledLocalContainer] at org.hippoecm.repository.LocalHippoRepository.contentBootstrap(LocalHippoRepository.java:427) [INFO] [talledLocalContainer] at org.hippoecm.repository.LocalHippoRepository.initializeStartup(LocalHippoRepository.java:336) [INFO] [talledLocalContainer] at org.hippoecm.repository.LocalHippoRepository.initialize(LocalHippoRepository.java:263) [INFO] [talledLocalContainer] at org.hippoecm.repository.LocalHippoRepository.create(LocalHippoRepository.java:130) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [INFO] [talledLocalContainer] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [INFO] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:606) [INFO] [talledLocalContainer] at org.hippoecm.repository.HippoRepositoryFactory.getHippoRepository(HippoRepositoryFactory.java:178) [INFO] [talledLocalContainer] at org.hippoecm.repository.RepositoryServlet.init(RepositoryServlet.java:191) [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210) [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493) [INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) [INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083) [INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1880) [INFO] [talledLocalContainer] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [INFO] [talledLocalContainer] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [INFO] [talledLocalContainer] at java.lang.Thread.run(Thread.java:744) [INFO] [talledLocalContainer] Caused by: org.apache.jackrabbit.spi.commons.conversion.MalformedPathException: empty path [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoPathParser.parse(HippoPathParser.java:219) [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoPathParser.parse(HippoPathParser.java:177) [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoPathParser.parse(HippoPathParser.java:149) [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoPathParser.parse(HippoPathParser.java:68) [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoCachingPathResolver.getQPath(HippoCachingPathResolver.java:53) [INFO] [talledLocalContainer] at org.hippoecm.repository.jackrabbit.HippoNamePathResolver.getQPath(HippoNamePathResolver.java:61) [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.SessionImpl.getQPath(SessionImpl.java:652) [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.session.SessionContext.getQPath(SessionContext.java:338) [INFO] [talledLocalContainer] at org.apache.jackrabbit.core.NodeImpl.resolveRelativePath(NodeImpl.java:238) [INFO] [talledLocalContainer] ... 32 more However, the node hierarchy below /webresources/newchannel is created correctly, so the ERROR seems to be just noise that should not be there.

          Fixed by making sure relative paths don't start with a slash

          uhommes Unico Hommes (Inactive) added a comment - Fixed by making sure relative paths don't start with a slash

          Tested with external files as now are available in the archetype project

          abanck Arent-Jan Banck (Inactive) added a comment - Tested with external files as now are available in the archetype project

          People

            Unassigned Unassigned
            mdenburger Mathijs den Burger (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: