On Wed, Nov 12, 2014 at 6:43 PM, Bruce Edge <[email protected]> wrote: > Slowly working my way through all of the docs & advice. Thanks for all info > so far. This is very helpful. > > ...The real reason for this is we have a lot of media files that need to be > stored in a > hierarchy and referenced by the above POJOs. One of the initial tasks is to > create an > import mechanism that unpacks a zip and extracts it into the JCR at a > particular node path. > What's the accepted convention for ingesting bulk data?... > > You might create a custom POST servlet that gets the zip stream, > unpacks it (ideally streaming) and creates the corresponding nodes. Or > if it's relatively small zips, copy them in an "incoming" folder in > the repository via WebDAV or PUT requests and use observation to > detect and process them. Which is the two options that you suggested > ;-) > > Any pointers to samples for POST servlets that push data into the JCR? > > Or, an osgi module that populates the JCR, even with dummy data?
If you're using Maven, you can use the sling-servlet-archetype [1] to generate a simple bundle which exposes an OSGi component. Then change that component by - annotating it with @SlingServlet instead of @Component/@Service - making it extend SlingServlet and overriding doPost - getting a (javax.jcr) Session : request.getResourceResolver().adaptTo(Session.class) After that you're all set to start writing into the repository using the current user's privileges. Robert [1]: http://search.maven.org/#search|ga|1|a%3A%22sling-servlet-archetype%22 > > I'm better at cargo-culting than I am at starting from scratch. > > -Bruce
