public void backupWiki() throws XWikiException, IOException { this.plugin.addAllWikiDocuments(getXWikiContext()); this.export(); }
export.setWithVersions(true); } else { export.setWithVersions(false); export.setAuthorName(author); export.setDescription(description); export.setLicence(licence); export.setVersion(version); export.setBackupPack(true); export.setName(name); export.backupWiki(); } else { if (pages != null) { iAction = 0; export.add(pageName, iAction); export.export();
response.setCharacterEncoding(encoding); XWikiAttachment packFile = doc.getAttachment(name); importer.Import(packFile.getContentInputStream(context)); String xml = importer.toXml(); byte[] result = xml.getBytes(encoding); response.setContentLength(result.length); importer.Import(packFile.getContentInputStream(context)); String all = request.get("all"); if (!"1".equals(all)) { if (pages != null) { List<DocumentInfoAPI> filelist = importer.getFiles(); for (DocumentInfoAPI dia : filelist) { dia.setAction(DocumentInfo.ACTION_SKIP); importer.setDocumentAction(docName, iAction); } else { importer.setDocumentAction(docName, language, iAction); importer.setPreserveVersion(false); importer.setWithVersions(false); importer.setPreserveVersion(false); importer.setWithVersions(true); importer.setPreserveVersion(true); importer.setWithVersions(false); importer.setBackupPack(true);
/** * Export an application into XAR using Packaging plugin. * * @param appName the name of the application to export. * @param recurse indicate if dependencies applications has to be included in the package. * @param withDocHistory indicate if history of documents is exported. * @param context the XWiki context. * @throws XWikiException error when : * <ul> * <li>getting application descriptor document to export.</li> * <li>or getting application's documents to export.</li> * <li>or when apply export.</li> * </ul> * @throws IOException error when apply export. */ public void exportApplicationXAR(String appName, boolean recurse, boolean withDocHistory, XWikiContext context) throws XWikiException, IOException { XWikiApplication app = this.applicationManager.getApplication(appName, context, true); PackageAPI export = ((PackageAPI) context.getWiki().getPluginApi(PACKAGEPLUGIN_NAME, context)); export.setName(app.getAppName() + "-" + app.getAppVersion()); Set<String> documents = app.getDocumentsNames(recurse, true); for (String documentName : documents) { export.add(documentName, DocumentInfo.ACTION_OVERWRITE); } export.setWithVersions(withDocHistory); export.export(); }
importer.Import(packFile.getContent(context)); } catch (IOException e) { throw new ApplicationManagerException(XWikiException.ERROR_XWIKI_UNKNOWN, if (importer.install() == DocumentInfo.INSTALL_IMPOSSIBLE) { throw new ApplicationManagerException(XWikiException.ERROR_XWIKI_UNKNOWN, this.localizationManager.getTranslationPlain(ApplicationManagerMessageTool.ERROR_IMORT_INSTALL, for (DocumentInfoAPI docinfo : importer.getFiles()) { XWikiDocument doc = docinfo.getDocInfo().getDoc();
public List<String> getErrors() { return this.plugin.getErrors(getXWikiContext()); }
public Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context) { try { return new PackageAPI(new Package(), context); } catch (PackageException e) { return null; } }
public List<String> getSkipped() { return this.plugin.getSkipped(getXWikiContext()); }
public String toXml() { return this.plugin.toXml(getXWikiContext()); }
public int getStatus() { return this.plugin.getStatus(getXWikiContext()); }
/** * @return a representation of this package under the JSON format * * @since 2.2M1 */ public JSONObject toJSON() { return this.plugin.toJSON(getXWikiContext()); }
public boolean add(String docFullName, int DefaultAction) throws XWikiException { return this.plugin.add(docFullName, DefaultAction, getXWikiContext()); }
public boolean add(String docFullName) throws XWikiException { return this.plugin.add(docFullName, getXWikiContext()); }
/** * Load a package in memory from a byte array. It may be installed later using {@link #install()}. * Your should prefer {@link #Import(InputStream, XWikiContext) which may avoid loading the package twice in memory. * * @param file an byte array containing a zipped package file * @return an empty string, useless. * @throws IOException while reading the ZipFile * @throws XWikiException when package content is broken */ public String Import(byte file[]) throws IOException, XWikiException { return this.plugin.Import(file, getXWikiContext()); }
public int install() throws XWikiException { return this.plugin.install(getXWikiContext()); }
public int testInstall() { return this.plugin.testInstall(false, getXWikiContext()); }
public int testInstall(boolean isAdmin) { return this.plugin.testInstall(isAdmin, getXWikiContext()); }
public List<String> getInstalled() { return this.plugin.getInstalled(getXWikiContext()); }
/** * Load a package in memory from an InputStream. It may be installed later using {@link #install()}. * * @param is an InputStream of a zipped package file * @return an empty string, useless. * @throws IOException while reading the ZipFile * @throws XWikiException when package content is broken * @since 2.3M2 */ public String Import(InputStream file) throws IOException, XWikiException { return this.plugin.Import(file, getXWikiContext()); }
public List<DocumentInfoAPI> getFiles() { List<DocumentInfo> files = this.plugin.getFiles(); ArrayList<DocumentInfoAPI> apiFiles = new ArrayList<DocumentInfoAPI>(files.size()); for (DocumentInfo docInfo : files) { apiFiles.add(new DocumentInfoAPI(docInfo, getXWikiContext())); } return apiFiles; }