throws RepositoryException, IOException {
Node node = parent.addNode(Text.getName(pid.getInstallationPath() + ".zip"), JcrConstants.NT_FILE);
Node content = node.addNode(JcrConstants.JCR_CONTENT, JcrConstants.NT_RESOURCE);
content.addMixin(NT_VLT_PACKAGE);
Node defNode = content.addNode(NN_VLT_DEFINITION);
JcrPackageDefinition def = new JcrPackageDefinitionImpl(defNode);
def.set(JcrPackageDefinition.PN_NAME, pid.getName(), false);
def.set(JcrPackageDefinition.PN_GROUP, pid.getGroup(), false);
def.set(JcrPackageDefinition.PN_VERSION, pid.getVersionString(), false);
def.touch(null, false);
content.setProperty(JcrConstants.JCR_LASTMODIFIED, Calendar.getInstance());
content.setProperty(JcrConstants.JCR_MIMETYPE, MIME_TYPE);
InputStream in = new ByteArrayInputStream(new byte[0]);
try {
if (pack != null && pack.getFile() != null) {
in = FileUtils.openInputStream(pack.getFile());
}
// stay jcr 1.0 compatible
//noinspection deprecation
content.setProperty(JcrConstants.JCR_DATA, in);
if (pack != null) {
def.unwrap(pack, true, false);
}
if (autoSave) {
parent.save();
}
} finally {