Module lama

This module implements LAMA - Log and Alarm Management Applicaiton.

Version: $Rev: 540 $ $LastChangedDate: 2006-02-23 16:36:33 -0500 (Thu, 23 Feb 2006) $

Behaviours: application.

Authors: Serge Aleynikov (serge@hq.idt.net).

Description

This module implements LAMA - Log and Alarm Management Applicaiton. This module provides interface functions for .

Data Types

expected_type()

expected_type() = ExpectedType

option()

option() = {Option::atom(), Value::term()}

options()

options() = [Option::option()]

typed_option()

typed_option() = {Option::atom(), Value::term(), ExpType::expected_type()}

typed_options()

typed_options() = [TypedOption::typed_option()]

Function Index

add_alarm_trap/3Add an alarm to trap mapping to the internal #state.alarm_map list.
bytestring_to_hexstring/1Converts a byte string to a list of hexadecimal digits (one byte will be represented as two hex digits).
check_alarm/2Based on the return value of Fun set or clear an Alarm.
clear_alarm/1Clear alarm that was previously set by set_alarm/1.
create_release_file/2Create a release file given a release template file.
get_alarms/0Get currently active alarms.
get_app_env/3Fetch a value of the application's environment variable Key.
get_app_env/4Fetch a value of the application's environment variable Key.
get_app_opt/3Same as get_app_env/3, but returns an Option tuple {Key, Value} rather than just a Value.
get_app_opt/4Same as get_app_env/4 but returns a tuple {Key, Value} rather than a Value.
get_app_options/3Look up TypedOptions in the environment.
get_app_options2/3Same as get_app_options/3, but will override environment options with values in the Overrides list, instead of using them as defaults.
get_opt/2Fetch the Option's value from the Options list.
get_opt/3Same as get_opt/2, but instead of throwing an error, it returns a Default value if the Opt is not in the Options list.
hexstring_to_bytestring/1Converts a hex string to a list of integers.
is_string/1Returns true if S is a string.
os_path/1Perform replacement of environment variable values in the OsPath.
set_alarm/1Set alarm.
start/0Start LAMA application.
stop/0Stop LAMA application.
throw_error/3
verify_config/1For each Option in the Options list perform type verification.
verify_config/2Fetch selected options from the application's environment and perform type verification.

Function Details

add_alarm_trap/3

add_alarm_trap(AlarmID::atom(), Trap::atom(), Varbinds::list()) -> ok

Add an alarm to trap mapping to the internal #state.alarm_map list. Same as lama_alarm_h:add_alarm_trap/3.

See also: lama_alarm_h:add_alarm_trap/3.

bytestring_to_hexstring/1

bytestring_to_hexstring(ByteString::list()) -> string()

Converts a byte string to a list of hexadecimal digits (one byte will be represented as two hex digits).

check_alarm/2

check_alarm(Fun::function(), Alarm::alarm()) -> ok

Based on the return value of Fun set or clear an Alarm.

clear_alarm/1

clear_alarm(AlarmId::alarm_id()) -> ok

Clear alarm that was previously set by set_alarm/1. This function is equivalent to lama_alarm_h:clear_alarm/1.

See also: check_alarm/2, lama_alarm_h:clear_alarm/1.

create_release_file/2

create_release_file(TemplateRelFile, OutRelFile) -> ok

Create a release file given a release template file. The release template file should have the same structure as the release file. This function will ensure that latest application versions are included in the release. It will also ensure that the latest erts version is specified in the release file. Note that both arguments may contain the ".rel" extension, however the actual TemplateRelFile must have a ".rel" extension. The TemplateRelFile doesn't need to contain application version numbers - an empty string will do: {kernel, ""}. This function will populate the version number with current version of the application.

  Example:
    lama:create_release_file(".drp.template.rel", "./ebin/drp.rel").

get_alarms/0

get_alarms() -> Alarms

Get currently active alarms.

get_app_env/3

get_app_env(App::atom(), Key::atom(), Default::term()) -> Value::term()

Fetch a value of the application's environment variable Key. Use Default if that value is not set.

get_app_env/4

get_app_env(App::atom(), Key::atom(), Default::term(), ExpectedType::expected_type()) -> Value::term()

Fetch a value of the application's environment variable Key. Use Default if that value is not set. Perform validation of value type given ExpectedType.

See also: get_app_env/5.

get_app_opt/3

get_app_opt(App::atom(), Key::atom(), Default::term()) -> Option::option()

Same as get_app_env/3, but returns an Option tuple {Key, Value} rather than just a Value.

get_app_opt/4

get_app_opt(App::atom(), Key::atom(), Default::term(), ExpectedType::expected_type()) -> Option::option()

Same as get_app_env/4 but returns a tuple {Key, Value} rather than a Value.

See also: get_app_env/4, get_opt/2, get_opt/3.

get_app_options/3

get_app_options(App::atom(), DefOptions::options(), TypedOptions::typed_options()) -> Options::options()

Look up TypedOptions in the environment. If not found use defaults in the DefOptions list, and if not found there, use the default value from a TypedOption's tuple: {_Key, DefaultValue, _Type}.

  Example:
     start_application(StartArgs) ->
         get_app_options(test, StartArgs, [{file, "bar", string}]),
         ... .
 
     start_application([])              ->   [{file, "bar"}]
     start_application([{file, "foo"}]) ->   [{file, "foo"}]
 
     If application's environment had {file, "zzz"}, than this tuple
     would've been returned instead.

See also: get_app_env/4.

get_app_options2/3

get_app_options2(App::atom(), Overrides::options(), TypedOptions::typed_options()) -> Options::options()

Same as get_app_options/3, but will override environment options with values in the Overrides list, instead of using them as defaults.

get_opt/2

get_opt(Opt::atom(), Options) -> term() | throw({error, Reason})

Fetch the Option's value from the Options list

See also: get_app_env/4, get_app_env/5, get_opt/3.

get_opt/3

get_opt(Opt::atom(), Options, Default::term()) -> term()

Same as get_opt/2, but instead of throwing an error, it returns a Default value if the Opt is not in the Options list.

See also: get_app_env/4, get_app_env/5, get_opt/2.

hexstring_to_bytestring/1

hexstring_to_bytestring(HexString::list()) -> list()

Converts a hex string to a list of integers.

is_string/1

is_string(S::term()) -> boolean()

Returns true if S is a string.

os_path/1

os_path(OsPath::string()) -> Path::string()

Perform replacement of environment variable values in the OsPath.

     Example:
        lama:os_path("$ROOTDIR/myapp") -> "/usr/local/lib/erlang/myapp"

See also: os:getenv/1.

set_alarm/1

set_alarm(Alarm::alarm()) -> ok

Set alarm. This function is equivalent to lama_alarm_h:set_alarm/1.

See also: check_alarm/2, lama_alarm_h:set_alarm/1.

start/0

start() -> ok | {error, Reason}

Start LAMA application. This is a shortcut for application:start/1.

See also: application:start/1.

stop/0

stop() -> ok | {error, Reason}

Stop LAMA application. This is a shortcut for application:stop/1.

See also: application:stop/1.

throw_error/3

throw_error(Tag, Val, Reason) -> term()

verify_config/1

verify_config(TypedOptions::typed_options()) -> Options::options() | throw({error, Reason})

For each Option in the Options list perform type verification.

verify_config/2

verify_config(App::atom(), Options::TypedOptions) -> ok | throw({error, Reason})

Fetch selected options from the application's environment and perform type verification.

See also: get_app_env/4.