6 Replies Latest reply: Nov 4, 2010 2:35 PM by Tim Conrad RSS

Custom properties on nodes

Tim Conrad Newbie

Hi.

 

I am trying to get the "Custom properties on nt:file and nt:folder nodes" (http://modeshape.wordpress.com/2010/09/01/custom-properties-on-ntfile-and-ntfolder-nodes/) running on a JBOSS AS 5.1 / Modeshape 2.3 software stack.

 

So I created a "acme.cnd" file and now need to tell Modeshape to find it and add this to the namespace.

 

My first idea was to put an additional line into the "<jcr:nodeTypes>" section in the "modeshape-services.jar/modeshape-config.xml" file.

 

But whatever I tried so far, Modeshape doesn't see the file or the contained infos.

 

Can someone please point out where to put the file or what I am doing wrong here?

 

 

Cheers

Tim

  • 1. Re: Custom properties on nodes
    Brian Carothers Apprentice

    You should be able to add this to your configuration file inside the mode:repository tag for your JCR repository, assuming that acme.cnd is located in some location where it is accessible with a resource path of "/acme.cnd".  If this doesn't work for you, please post your config file so that we can try it out.

     

                <!--

                     Import the custom node types defined in the named resource (a file at a classpath-relative

                     path).  If there was more than one file with custom node types, we could either add successive

                     <jcr:nodeTypes ... /> elements or just add all of the files as a comma-delimited string in the

                     mode:resource property.

                 -->

                <jcr:nodeTypes mode:resource="/acme.cnd" />

     

  • 2. Re: Custom properties on nodes
    Tim Conrad Newbie

    Hi.

     

    That was pretty much my (newbie) quuestion: in which folder would Modeshape (JBOSS-AS) look into if I specify "/acme.cnd"?

     

    Cheers

    Tim

  • 3. Re: Custom properties on nodes
    Brian Carothers Apprentice

    Actually, now that I look at it, 'Shape will first treat the path as a resource path.  If it can't find anything at that resource path, it will try to load a file from that file path.  If that doesn't work either, it will throw an exception.  Sorry for the half-answer before.

  • 4. Re: Custom properties on nodes
    Tim Conrad Newbie

    OK - and what (file-)path would it look for?

     

    Say my JBOSS-AS is located at "/servers/jbossas/server/default/" and Modeshape's "modeshape-config.xml" resists inside "/server/default/deploy/modeshape-services.jar/". If I now have the "<jcr:nodeTypes mode:resource="/acme.cnd" />" in this config file - in which directory should I place the "acme.cnd" file?

  • 5. Re: Custom properties on nodes
    Brian Carothers Apprentice

    Since you're deploying ModeShape as a JAR, you have to either have acme.cnd in a directory that's on the classpath either implicitly (like /server/default/conf) or explicitly (like some directory you put into your JBOSS_CLASSPATH environment variable before starting up the server).

     

    Alternatively, you could treat "/acme.cnd" as a file path and put it in the root directory of your filesystem, but there are some obvious flaws with that deployment mechanism.

     

    If it were me and I wanted to externalize 'Shape from any particular webapp or service running on the app server, I would probably make a modeshape directory under /server/default/conf and stick my CND files in there.  That way I could patch versions of modeshape-services.jar without overwriting my custom node types. 

     

    People who spend more time administering JBoss may be able to find flaws with that approach though.

  • 6. Re: Custom properties on nodes
    Tim Conrad Newbie

    Alright - that was the missing piece... I thought the path would be relative to something.

     

    Thanks Brian for making it clear =)

     

    Cheers

    Tim