⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 packageapi.java

📁 xwiki 源码
💻 JAVA
字号:
/** * =================================================================== * * Copyright (c) 2005 XpertNet, All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details, published at * http://www.gnu.org/copyleft/gpl.html or in gpl.txt in the * root folder of this distribution. */package com.xpn.xwiki.plugin.packaging;import com.xpn.xwiki.api.Api;import com.xpn.xwiki.XWikiContext;import com.xpn.xwiki.XWikiException;import com.xpn.xwiki.XWiki;import java.util.List;import java.util.ArrayList;import java.io.IOException;public class PackageAPI   extends Api {    Package plugin;    public PackageAPI(Package plugin, XWikiContext context) throws PackageException {        super(context);        if (!hasAdminRights())            throw new PackageException(PackageException.ERROR_XWIKI_ACCESS_DENIED, "Admin right is needed to use this plugin");        setPlugin(plugin);    }    private void setPlugin(Package plugin) {        this.plugin = plugin;    }    public String getName() {        return plugin.getName();    }    public void setName(String name) {        plugin.setName(name);    }    public Package getPackage()    {        if (hasProgrammingRights())            return plugin;        return null;    }    public String getDescription() {        return plugin.getDescription();    }    public void setDescription(String description) {        plugin.setDescription(description);    }    public String getVersion() {        return plugin.getVersion();    }    public void setVersion(String version) {        plugin.setVersion(version);    }    public String getLicence() {        return plugin.getLicence();    }    public void setLicence(String licence) {        plugin.setLicence(licence);    }    public String getAuthorName() {        return plugin.getAuthorName();    }    public void setAuthorName(String authorName) {        plugin.setAuthorName(authorName);    }    public boolean isBackupPack() {        return plugin.isBackupPack();    }    public void setBackupPack(boolean backupPack) {        plugin.setBackupPack(backupPack);    }    public boolean isWithVersions() {         return plugin.isWithVersions();     }    public void setWithVersions(boolean withVersions) {         plugin.setWithVersions(withVersions);     }    public List getFiles() {        List files =  plugin.getFiles();        ArrayList APIfiles = new ArrayList(files.size());        for (int i = 0; i < files.size(); i++)            APIfiles.add(new DocumentInfoAPI((DocumentInfo) files.get(i), context));        return APIfiles;    }    public boolean add(String docFullName, int DefaultAction) throws XWikiException {        return plugin.add(docFullName, DefaultAction, context);    }    public boolean add(String docFullName) throws XWikiException {        return plugin.add(docFullName, context);    }    public String export() throws IOException, XWikiException {        context.getResponse().setContentType("application/zip");        context.getResponse().addHeader("Content-disposition", "attachment; filename=" + XWiki.getURLEncoded(plugin.getName()) + ".xar");        context.setFinished(true);        return  plugin.export(context.getResponse().getOutputStream(), context);    }    public String Import(byte file[]) throws IOException, XWikiException {        return plugin.Import(file, context);    }    public int testInstall()    {        return plugin.testInstall(context);    }    public void backupWiki() throws XWikiException, IOException {        plugin.addAllWikiDocuments(context);        this.export();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -