[thrift] revert 61883
Summary: i suck at git/svn ... commited not enough and with no commitlog
Notes: YOU'RE DOING IT WRONG
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665283 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/src/thrift.erl b/lib/erl/src/thrift.erl
index 5dc8987..feabb1d 100644
--- a/lib/erl/src/thrift.erl
+++ b/lib/erl/src/thrift.erl
@@ -1,12 +1,13 @@
%%% Copyright (c) 2007- Facebook
%%% Distributed under the Thrift Software License
-%%%
+%%%
%%% See accompanying file LICENSE or visit the Thrift site at:
%%% http://developers.facebook.com/thrift/
-module(thrift).
--export([start/0, stop/0, config/1, config/2]).
+-export([start/2, shutdown/0, stop/1]).
+-behaviour(application).
-include("thrift.hrl").
@@ -14,56 +15,11 @@
%%% behavior definition
%%%
-start() ->
- application:start(thrift).
+start(Type, StartArgs) ->
+ ok.
-stop() ->
- application:stop(thrift).
+shutdown() ->
+ application:stop(?MODULE).
-%%%
-%%% configuration
-%%%
-
-%% go to the global file by default
-config(Path) ->
- config(Path, {file, ?CONFIG_FILE}).
-
-config(Path, Source) ->
- case config1(Path, Source) of
- {error, file_error, R} ->
- ?ERROR("error opening config ~p: ~p", [Source, R]),
- false;
- {error, bad_item, Tuple} ->
- ?ERROR("malformed config item ~p found at ~p in ~p", [Tuple, Path, Source]),
- false;
- {error, not_found} ->
- ?ERROR("config item ~p not found in ~p", [Path, Source]),
- false;
- {value, V} ->
- {value, V}
- end.
-
-%% go to a file
-config1(Path, {file, File}) ->
- case file:consult(File) of
- {error, R={_,_,_}} ->
- {error, file_error, file:format_error(R)};
- {error, Posix} ->
- {error, file_error, Posix};
- {ok, List} when is_list(List) ->
- config1(Path, List)
- end;
-
-%% go through a list from a file or a sublist
-config1([P|Ps], List) when is_list(List) ->
- case lists:keysearch(P, 1, List) of
- {value, Tuple} when size(Tuple) == 2 ->
- List1 = element(2, Tuple), %% either another list or, if Ps is [], the item itself
- config1(Ps, List1);
- {value, Tuple} ->
- {error, bad_item, Tuple};
- false ->
- {error, not_found}
- end;
-config1([], Item) -> {value, Item};
-config1(Item, Source) -> config1([Item], Source).
+stop(_State) ->
+ ok.