Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
WikiMacroManager | 32 | 0 | - | 0 | 0 |
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.rendering.macro.wikibridge; | |
21 | ||
22 | import org.xwiki.component.annotation.Role; | |
23 | import org.xwiki.model.reference.DocumentReference; | |
24 | ||
25 | /** | |
26 | * Component interface responsible for managing wiki macro instances. | |
27 | * | |
28 | * @version $Id: 6222178e3e5320d19f00aaf8323d9228b8fd0693 $ | |
29 | * @since 2.0M2 | |
30 | */ | |
31 | @Role | |
32 | public interface WikiMacroManager | |
33 | { | |
34 | /** | |
35 | * Registers the given {@link WikiMacro} against the ComponentManager matching the Wiki Macro visibility defined | |
36 | * (Current User, Current Wiki, Global). For example Macros defined with a "Current User" visibility are | |
37 | * registered against the User Component Manager so that they are only visible from that Component Manager and not | |
38 | * from other Component Manager. | |
39 | * <p> | |
40 | * Note that the Execution Context must be set properly (the current user or the current wiki must be set) prior | |
41 | * to calling this API. | |
42 | * | |
43 | * @param documentReference the name of the document which contains the wiki macro | |
44 | * @param wikiMacro the {@link org.xwiki.rendering.macro.wikibridge.WikiMacro} instance | |
45 | * @exception InsufficientPrivilegesException if asked visibility is not allowed | |
46 | * @exception WikiMacroException if a problem happened when registering the macro (document doesn't exist, etc.) | |
47 | * @since 2.2.M1 | |
48 | */ | |
49 | void registerWikiMacro(DocumentReference documentReference, WikiMacro wikiMacro) | |
50 | throws InsufficientPrivilegesException, WikiMacroException; | |
51 | ||
52 | /** | |
53 | * Unregisters the wiki macro defined on the given document (if there is one). | |
54 | * | |
55 | * @param documentReference the name of the document which contains the wiki macro | |
56 | * @exception WikiMacroException if a problem happened when registering the macro (document doesn't exist, etc) | |
57 | * @since 2.2.M1 | |
58 | */ | |
59 | void unregisterWikiMacro(DocumentReference documentReference) throws WikiMacroException; | |
60 | ||
61 | /** | |
62 | * Utility method for querying {@link WikiMacroManager} to see if there is a {@link WikiMacro} already registered | |
63 | * for the given document. | |
64 | * | |
65 | * @param documentReference the name of the document which contains the wiki macro | |
66 | * @return true if there is already a macro registered under the given document name | |
67 | * @since 2.2.M1 | |
68 | */ | |
69 | boolean hasWikiMacro(DocumentReference documentReference); | |
70 | } |