String version = request.getParameter("version");
String format = request.getParameter("format");
PluginInstaller pluginInstaller = ManagementHelper.getManagementHelper(request).getPluginInstaller();
ServerArchiver archiver = ManagementHelper.getManagementHelper(request).getArchiver();
String[] configIds = request.getParameterValues("configId");
PluginListType list = getServerPluginList(request, pluginInstaller);
PluginListType installList = getPluginsFromIds(configIds, list);
// if the targetPath doesn't end with "/" or "\", add one.
if (targetPath.lastIndexOf("/") != targetPath.length()-1){
if (targetPath.lastIndexOf("\\") != targetPath.length()-1){
targetPath = targetPath + "/";
}
}
String targetBasePath = targetPath + groupId +"/";
String targetAssemblyPath = targetBasePath + artifactId+"-"+version;
String targetArchivePath = targetBasePath;
try {
DownloadResults downloadResults = pluginInstaller.installPluginList("repository", targetAssemblyPath, installList);
archiver.archive(targetAssemblyPath, targetArchivePath, new Artifact(groupId, artifactId, version, format));
} catch (Exception e) {
throw new PortletException("Could not assemble server", e);
}
response.setRenderParameter("assemblyFileLocation", targetBasePath);