use of org.xwiki.extension.script.ScriptExtensionRewriter in project xwiki-platform by xwiki.
the class AbstractExtensionDistributionStep method install.
protected void install(ExtensionId extensionId, String namespace, boolean jarOnRoot) throws JobException, InterruptedException {
// Install the default UI
InstallRequest installRequest = new InstallRequest();
installRequest.setId(ExtensionRequest.getJobId(ExtensionRequest.JOBID_ACTION_PREFIX, extensionId.getId(), namespace));
installRequest.addExtension(extensionId);
installRequest.addNamespace(namespace);
// Indicate it's allowed to do modification on root namespace
installRequest.setRootModificationsAllowed(true);
// Make sure the job is no interactive
installRequest.setInteractive(false);
if (jarOnRoot) {
// Make sure jars are installed on root
// TODO: use a less script oriented class
ScriptExtensionRewriter rewriter = new ScriptExtensionRewriter();
rewriter.installExtensionTypeOnRootNamespace("jar");
rewriter.installExtensionTypeOnRootNamespace("webjar");
installRequest.setRewriter(rewriter);
}
// Set the author to use
installRequest.setProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, new DocumentReference("xwiki", "XWiki", XWikiRightService.SUPERADMIN_USER));
installRequest.setExtensionProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, XWikiRightService.SUPERADMIN_USER_FULLNAME);
this.jobExecutor.execute(InstallJob.JOBTYPE, installRequest).join();
}
use of org.xwiki.extension.script.ScriptExtensionRewriter in project xwiki-platform by xwiki.
the class DataMojo method executeInternal.
@Override
public void executeInternal() throws MojoExecutionException {
InstallRequest installRequest = new InstallRequest();
// Allow modifying root namespace
installRequest.setRootModificationsAllowed(true);
// Make sure jars are installed on root
// TODO: use a less script oriented class
ScriptExtensionRewriter rewriter = new ScriptExtensionRewriter();
rewriter.installExtensionTypeOnRootNamespace("jar");
rewriter.installExtensionTypeOnRootNamespace("webjar");
installRequest.setRewriter(rewriter);
// Use superadmin as pages author
installRequest.setProperty(AbstractExtensionValidator.PROPERTY_USERREFERENCE, new DocumentReference("xwiki", "XWiki", XWikiRightService.SUPERADMIN_USER));
this.extensionHelper.install(this.includes, installRequest, "wiki:xwiki", null);
}
Aggregations