1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.extension.handler

File ExtensionValidator.java

 

Code metrics

0
0
0
1
67
13
0
-
-
0
-

Classes

Class Line # Actions
ExtensionValidator 40 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.extension.handler;
21   
22    import org.xwiki.component.annotation.Role;
23    import org.xwiki.extension.Extension;
24    import org.xwiki.extension.InstallException;
25    import org.xwiki.extension.InstalledExtension;
26    import org.xwiki.extension.UninstallException;
27    import org.xwiki.job.Request;
28   
29    /**
30    * Check if executing a given action on a passed extension is allowed.
31    * <p>
32    * Mostly used for default behavior when {@link ExtensionHandler} does not have any special check for its type. The goal
33    * is to make easy for any environment using commons-extension module to have a default restriction on all extensions
34    * types (for example in XWiki unless the type has special checking you need programming right to install an extension).
35    *
36    * @version $Id: dfa9ed14ccebd50bbf7305a1067f58dde656222f $
37    * @since 4.2M2
38    */
39    @Role
 
40    public interface ExtensionValidator
41    {
42    /**
43    * Check if installing the passed extension is allowed.
44    * <p>
45    * It is generally used to do some non generic checking of whether or not it is possible to install the passed
46    * extension (not the right environment, not enough rights, etc.).
47    *
48    * @param extension the extension to install
49    * @param namespace the namespace from where to install
50    * @param request extra parameters
51    * @throws InstallException installing the extension will fail
52    */
53    void checkInstall(Extension extension, String namespace, Request request) throws InstallException;
54   
55    /**
56    * Check if uninstalling the passed extension is allowed.
57    * <p>
58    * It is generally used to do some non generic checking of whether or not it is possible to uninstall the passed
59    * extension (not the right environment, not enough rights, etc.).
60    *
61    * @param extension the extension to uninstall
62    * @param namespace the namespace from where to uninstall
63    * @param request extra parameters
64    * @throws UninstallException uninstalling the extension will fail
65    */
66    void checkUninstall(InstalledExtension extension, String namespace, Request request) throws UninstallException;
67    }