picture.addMixin("mix:versionable");
Node res = picture.addNode("jcr:content", "nt:resource");
res.setProperty("jcr:lastModified", Calendar.getInstance());
res.setProperty("jcr:data", new ByteArrayInputStream("bla bla".getBytes()));
MimeTypeResolver mimres = new MimeTypeResolver();
res.setProperty("jcr:mimeType", mimres.getMimeType("screen.txt"));
root.save();
Node subNode1 = medias.addNode("subnode1", "nt:folder");
subNode1.addMixin("mix:versionable");
root.save();