Hi, On Wed, Jan 8, 2014 at 10:21 PM, Buzzterrier <[email protected]> wrote: > ...It looks like mixins are the way to > go, but I am having trouble figuring them out. It looks like you create them > in a .cnd file. But where do you put the file? It would be slick to just > drop it somewhere in the sling OSGi structure and have it pick it up on > startup. Is that possible?...
Yes, if you actually need custom mixins (which is a a different question) you can supply the cnd files in bundles and have them picked up by Sling when your bundles starts, as part of Sling's content loading mechanism. See http://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html for docs, search for "Sling-Nodetypes" there. There's a number of examples in the Sling codebase, in bundles/jcr/resource for example. > ...Also I am a bit confused on what is the best way to create a mixin that > extends nt:file... If you want to add arbitrary properties to an nt:file your mixin doesn't need to extend it, it can just define the additional properties that you want to allow. There's a good explanation at http://stackoverflow.com/questions/5155764/store-metadata-into-jackrabbit-repository with an example mixin (custom:extensible) that allows setting any property on the nt:file. There's also a number of default mixins like mix:title which you can use for common things, see http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/nodetype/package-summary.html > ...Also, is there anything special I should know about using mixins with rest > calls? All of the examples add content with Mixins using the sling api... It's no different in http calls, the post servlet docs at http://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html have some info about using mixins. HTH, -Bertrand
