1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 1997-2016. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20
21%%
22-module(mnesia_config_event).
23-author('peterl@erix.ericsson.se').
24
25-behaviour(gen_event).
26
27%%
28%% This module was stolen from Mnesia
29%%
30
31
32%% gen_event callback interface
33-export([init/1, handle_event/2, handle_call/2, handle_info/2,
34	 terminate/2, code_change/3]).
35
36
37init(_Args) ->
38    {ok, []}.
39
40handle_event(Msg, State) ->
41    handle_any_event(Msg, State).
42
43handle_info(Msg, State) ->
44    handle_any_event(Msg, State).
45
46
47handle_call(Msg, State) ->
48    handle_any_event(Msg, State).
49
50
51%% The main...
52
53handle_any_event({get_log, Pid}, State) ->
54    Pid ! {log, State},
55    {ok, State};
56handle_any_event(Msg, State) ->
57    io:format("Got event: ~p~n", [Msg]),
58    {ok, [Msg | State]}.
59
60%%-----------------------------------------------------------------
61%% terminate(Reason, State) ->
62%%     AnyVal
63%%-----------------------------------------------------------------
64
65terminate(_Reason, _State) ->
66    ok.
67
68%%----------------------------------------------------------------------
69%% Func: code_change/3
70%% Purpose: Upgrade process when its code is to be changed
71%% Returns: {ok, NewState}
72%%----------------------------------------------------------------------
73code_change(_OldVsn, _State, _Extra) ->
74    exit(not_supported).
75
76