./ct_report/coverage/gen_pubsub_nodetree.COVER.html

1 %%% ====================================================================
2 %%% ``The contents of this file are subject to the Erlang Public License,
3 %%% Version 1.1, (the "License"); you may not use this file except in
4 %%% compliance with the License. You should have received a copy of the
5 %%% Erlang Public License along with this software. If not, it can be
6 %%% retrieved via the world wide web at http://www.erlang.org/.
7 %%%
8 %%% Software distributed under the License is distributed on an "AS IS"
9 %%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
10 %%% the License for the specific language governing rights and limitations
11 %%% under the License.
12 %%%
13 %%% The Initial Developer of the Original Code is ProcessOne.
14 %%% Portions created by ProcessOne are Copyright 2006-2015, ProcessOne
15 %%% All Rights Reserved.''
16 %%% This software is copyright 2006-2015, ProcessOne.
17 %%%
18 %%%
19 %%% @copyright 2006-2015 ProcessOne
20 %%% @author Christophe Romain <christophe.romain@process-one.net>
21 %%% [http://www.process-one.net/]
22 %%% @end
23 %%% ====================================================================
24
25 %%% @private
26 %%% @doc <p>The module <strong>{@module}</strong> defines the PubSub node
27 %%% tree plugin behaviour. This behaviour is used to check that a PubSub
28 %%% node tree plugin respects the current ejabberd PubSub plugin API.</p>
29
30 -module(gen_pubsub_nodetree).
31
32 -include("jlib.hrl").
33
34 -export([init/3, terminate/3, set_node/2, get_node/3, get_node/2,
35 get_nodes/3, get_parentnodes_tree/4,
36 get_subnodes/4, create_node/7, delete_node/3]).
37
38 -ignore_xref([behaviour_info/1, create_node/7, delete_node/3, get_node/3,
39 get_nodes/3, get_parentnodes_tree/4, get_subnodes/4, set_node/2]).
40
41 -type(host() :: mod_pubsub:host()).
42 -type(nodeId() :: mod_pubsub:nodeId()).
43 -type(nodeIdx() :: mod_pubsub:nodeIdx()).
44 -type(pubsubNode() :: mod_pubsub:pubsubNode()).
45 -type(nodeOptions() :: mod_pubsub:nodeOptions()).
46
47 %% ---------------------------------------------------------------
48 %% Callbacks
49 %% ---------------------------------------------------------------
50
51 -callback init(HostType :: mongooseim:host_type(), Opts :: [any()]) -> atom().
52
53 -callback terminate(Host :: host(), ServerHost :: binary()) -> atom().
54
55 -callback set_node(PubsubNode :: pubsubNode()) ->
56 {ok, NodeIdx::nodeIdx()} | {error, exml:element()}.
57
58 -callback get_node(Host :: host(), NodeId :: nodeId()) -> pubsubNode() | {error, exml:element()}.
59
60 -callback get_node(NodeIdx :: nodeIdx()) -> pubsubNode() | {error, exml:element()}.
61
62 -callback get_nodes(Host :: host(), From :: jid:jid()) -> [pubsubNode()].
63
64 -callback get_parentnodes_tree(Host :: host(), NodeId :: nodeId(), From :: jid:jid()) ->
65 [{0, [pubsubNode(), ...]}].
66
67 -callback get_subnodes(Host :: host(), NodeId :: nodeId(), From :: jid:jid()) -> [pubsubNode()].
68
69 -callback create_node(Host :: host(),
70 NodeId :: nodeId(),
71 Type :: binary(),
72 Owner :: jid:jid(),
73 Options :: nodeOptions(),
74 Parents :: [nodeId()]) ->
75 {ok, NodeIdx::nodeIdx()} | {error, exml:element()} | {error, {virtual, {host(), nodeId()}}}.
76
77 -callback delete_node(Host :: host(), NodeId :: nodeId()) -> [pubsubNode()].
78
79 %% ---------------------------------------------------------------
80 %% API
81 %% ---------------------------------------------------------------
82
83 init(Mod, HostType, Opts) ->
84 39 Mod:init(HostType, Opts).
85
86 terminate(Mod, Host, ServerHost) ->
87 39 Mod:terminate(Host, ServerHost).
88
89 set_node(Mod, PubsubNode) ->
90
:-(
Mod:set_node(PubsubNode).
91
92 get_node(Mod, Host, NodeId) ->
93
:-(
Mod:get_node(Host, NodeId).
94
95 get_node(Mod, NodeIdx) ->
96 220 Mod:get_node(NodeIdx).
97
98 get_nodes(Mod, Host, From) ->
99
:-(
Mod:get_nodes(Host, From).
100
101 get_parentnodes_tree(Mod, Host, NodeId, From) ->
102
:-(
Mod:get_parentnodes_tree(Host, NodeId, From).
103
104 get_subnodes(Mod, Host, NodeId, From) ->
105
:-(
Mod:get_subnodes(Host, NodeId, From).
106
107 create_node(Mod, Host, NodeId, Type, Owner, Options, Parents) ->
108
:-(
Mod:create_node(Host, NodeId, Type, Owner, Options, Parents).
109
110 delete_node(Mod, Host, NodeId) ->
111
:-(
Mod:delete_node(Host, NodeId).
112
Line Hits Source