Hi Marc,
Marc Speck schrieb:
1. Is it possible to load files with <Sling-Initial-Content> into a custom
node type? When I try it with foo.png and foo.xml (which contains the
definitions), jcr:data is always 0.
This is definitely not good. My question: should the node be called foo
or foo.png ? In case it should be called foo, the only solution I have
out of my belly is to prefill the data into the repository and export it
with system view export to re-import it through the bundle. The other
mechanisms have IIRC no way of easily importing binary data.
Ehrm, thinking of it, there might be a way: How about naming your image
file as foo instead of foo.png. This way the node foo would be created
and additional settings would be taking from foo.xml.
If the node should be called foo.png, the descriptor should be foo.png.xml.
1.1 How can I debug the loading of initial content? I install the bundle
from Eclipse with maven autoInstallBundle but breakpoints e.g. in
org.apache.sling.jcr.contentloader.internal.Loader.registerBundleInternal()
are never met. Debuging servlet calls works fine.
The registerBundleInternal is called when a new bundle is installed -
e.g. on system startup or by BundleContext.install as per an BundleEvent.
I usually run Sling from the standalone launcher with debugging enabled
and connecting from Eclipse I can easily set a breakpoint and get landed.
2. WebDav: create custom node types
When adding files with WebDav, I want to put the files into a customized
node type (that inherits from nt:resource). The only way to do is, is
writing a handler like:
public class NodeTypeHandler extends
org.apache.jackrabbit.server.io.DefaultHandler
Yes, this is the intent of the SimpleWebDAVServlet.
and add in file webdav-resource-config.xml of bundle
org.apache.sling.jcr.webdav something like
That is the current state. My intention is to have this configurable in
a more flexible way, than hacking up the bundle (this is not really a
good solution, right ;-) ).
But currently, it is unfortunately the only solution due to lack of time
of finding a better one. If you come up with a better more flexible
solution (e.g. by some ConfigurationAdmin configuration or so), you are
very welcome to hint at it.
Hope this helps a bit.
Regards
Felix
<iomanager>
<iohandler>
<class name="NodeTypeHandler" />
</iohandler>
.....
</iomanager>
<propertymanager>
<propertyhandler>
<class name="NodeTypeHandler " />
</propertyhandler>
.....
</propertymanager>
or is there a easier way? I first thought of a quick hack: adding a listener
to NODE_ADDED and add a mixin to new nodes. But this is somewhat a waste of
resources and also does not allow to have custom node types. Converting node
types is not possible with jackrabbit as far as I know.