PageRenderTime 2ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/ucengine/src/backends/db/mnesia/mnesia_db.erl

http://github.com/AF83/ucengine
Erlang | 40 lines | 17 code | 6 blank | 17 comment | 0 complexity | 565494e645b17b6c1a4c1d01b39aa007 MD5 | raw file
 1%%
 2%%  U.C.Engine - Unified Collaboration Engine
 3%%  Copyright (C) 2011 af83
 4%%
 5%%  This program is free software: you can redistribute it and/or modify
 6%%  it under the terms of the GNU Affero General Public License as published by
 7%%  the Free Software Foundation, either version 3 of the License, or
 8%%  (at your option) any later version.
 9%%
10%%  This program 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
13%%  GNU Affero General Public License for more details.
14%%
15%%  You should have received a copy of the GNU Affero General Public License
16%%  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17%%
18-module(mnesia_db).
19
20-export([init/2,
21         drop/0,
22         terminate/0]).
23
24-include("uce.hrl").
25
26call_mnesia_modules(Fun) ->
27    lists:foreach(fun(Module) ->
28                          (list_to_atom(lists:concat([Module, "_mnesia"]))):Fun()
29                  end,
30                  [uce_role, uce_user, uce_meeting, uce_file, uce_event]).
31
32init(_Domain, undefined) ->
33    call_mnesia_modules(init).
34
35drop() ->
36    call_mnesia_modules(drop),
37    ok.
38
39terminate() ->
40    ok.