Removed a few obsolete calls related to JSON library.

+ cosmetic
This commit is contained in:
2014-11-20 15:14:34 +01:00
parent d082326784
commit 09e5dc4032

View File

@@ -1,7 +1,7 @@
note note
description: "Provide access to json configuration" description: "Provide access to json configuration"
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $" date: "$Date: 2014-11-20 15:03:29 +0100 (jeu., 20 nov. 2014) $"
revision: "$Revision: 95678 $" revision: "$Revision: 96138 $"
class class
JSON_CONFIGURATION JSON_CONFIGURATION
@@ -15,12 +15,16 @@ feature -- Application Configuration
do do
Result := "" Result := ""
if attached json_file_from (a_path) as json_file then if attached json_file_from (a_path) as json_file then
l_parser := new_json_parser (json_file) l_parser := new_json_parser (json_file)
if attached {JSON_OBJECT} l_parser.parse as jv and then l_parser.is_parsed and then l_parser.parse_content
attached {JSON_OBJECT} jv.item ("smtp") as l_smtp and then if
attached {JSON_STRING} l_smtp.item ("server") as l_server then l_parser.is_valid and then
Result := l_server.item attached {JSON_OBJECT} l_parser.parsed_json_value as jv and then
end attached {JSON_OBJECT} jv.item ("smtp") as l_smtp and then
attached {JSON_STRING} l_smtp.item ("server") as l_server
then
Result := l_server.item
end
end end
end end
@@ -30,21 +34,24 @@ feature -- Application Configuration
l_parser: JSON_PARSER l_parser: JSON_PARSER
do do
if attached json_file_from (a_path) as json_file then if attached json_file_from (a_path) as json_file then
l_parser := new_json_parser (json_file) l_parser := new_json_parser (json_file)
if attached {JSON_OBJECT} l_parser.parse as jv and then l_parser.is_parsed and then l_parser.parse_content
attached {JSON_OBJECT} jv.item ("database") as l_database and then if
attached {JSON_OBJECT} l_database.item ("datasource") as l_datasource and then l_parser.is_valid and then
attached {JSON_STRING} l_datasource.item ("driver") as l_driver and then attached {JSON_OBJECT} l_parser.parsed_json_value as jv and then
attached {JSON_STRING} l_datasource.item ("environment") as l_envrionment and then attached {JSON_OBJECT} jv.item ("database") as l_database and then
attached {JSON_OBJECT} l_database.item ("environments") as l_environments and then attached {JSON_OBJECT} l_database.item ("datasource") as l_datasource and then
attached {JSON_OBJECT} l_environments.item (l_envrionment.item) as l_environment_selected and then attached {JSON_STRING} l_datasource.item ("driver") as l_driver and then
attached {JSON_STRING} l_environment_selected.item ("connection_string") as l_connection_string then attached {JSON_STRING} l_datasource.item ("environment") as l_envrionment and then
create Result.make (l_driver.item, l_connection_string.unescaped_string_8) attached {JSON_OBJECT} l_database.item ("environments") as l_environments and then
end attached {JSON_OBJECT} l_environments.item (l_envrionment.item) as l_environment_selected and then
attached {JSON_STRING} l_environment_selected.item ("connection_string") as l_connection_string
then
create Result.make (l_driver.item, l_connection_string.unescaped_string_8)
end
end end
end end
new_logger_level_configuration (a_path: PATH): READABLE_STRING_32 new_logger_level_configuration (a_path: PATH): READABLE_STRING_32
-- Retrieve a new logger level configuration. -- Retrieve a new logger level configuration.
-- By default, level is set to `DEBUG'. -- By default, level is set to `DEBUG'.
@@ -53,12 +60,16 @@ feature -- Application Configuration
do do
Result := "DEBUG" Result := "DEBUG"
if attached json_file_from (a_path) as json_file then if attached json_file_from (a_path) as json_file then
l_parser := new_json_parser (json_file) l_parser := new_json_parser (json_file)
if attached {JSON_OBJECT} l_parser.parse as jv and then l_parser.is_parsed and then l_parser.parse_content
attached {JSON_OBJECT} jv.item ("logger") as l_logger and then if
attached {JSON_STRING} l_logger.item ("level") as l_level then l_parser.is_valid and then
Result := l_level.item attached {JSON_OBJECT} l_parser.parsed_json_value as jv and then
end attached {JSON_OBJECT} jv.item ("logger") as l_logger and then
attached {JSON_STRING} l_logger.item ("level") as l_level
then
Result := l_level.item
end
end end
end end
@@ -68,23 +79,27 @@ feature -- Application Configuration
l_parser: JSON_PARSER l_parser: JSON_PARSER
do do
if attached json_file_from (a_path) as json_file then if attached json_file_from (a_path) as json_file then
l_parser := new_json_parser (json_file) l_parser := new_json_parser (json_file)
if attached {JSON_OBJECT} l_parser.parse as jv and then l_parser.is_parsed and then l_parser.parse_content
attached {JSON_OBJECT} jv.item ("database") as l_database and then if
attached {JSON_OBJECT} l_database.item ("datasource") as l_datasource and then l_parser.is_valid and then
attached {JSON_STRING} l_datasource.item ("driver") as l_driver and then attached {JSON_OBJECT} l_parser.parsed_json_value as jv and then
attached {JSON_STRING} l_datasource.item ("environment") as l_envrionment and then l_parser.is_parsed and then
attached {JSON_STRING} l_datasource.item ("trusted") as l_trusted and then attached {JSON_OBJECT} jv.item ("database") as l_database and then
attached {JSON_OBJECT} l_database.item ("environments") as l_environments and then attached {JSON_OBJECT} l_database.item ("datasource") as l_datasource and then
attached {JSON_OBJECT} l_environments.item ("test") as l_environment_selected and then attached {JSON_STRING} l_datasource.item ("driver") as l_driver and then
attached {JSON_STRING} l_environment_selected.item ("connection_string") as l_connection_string and then attached {JSON_STRING} l_datasource.item ("environment") as l_envrionment and then
attached {JSON_STRING} l_environment_selected.item ("name") as l_name then attached {JSON_STRING} l_datasource.item ("trusted") as l_trusted and then
create Result.make (l_driver.item, l_connection_string.unescaped_string_8) attached {JSON_OBJECT} l_database.item ("environments") as l_environments and then
end attached {JSON_OBJECT} l_environments.item ("test") as l_environment_selected and then
attached {JSON_STRING} l_environment_selected.item ("connection_string") as l_connection_string and then
attached {JSON_STRING} l_environment_selected.item ("name") as l_name
then
create Result.make (l_driver.item, l_connection_string.unescaped_string_8)
end
end end
end end
feature {NONE} -- JSON feature {NONE} -- JSON
json_file_from (a_fn: PATH): detachable STRING json_file_from (a_fn: PATH): detachable STRING
@@ -100,4 +115,5 @@ feature {NONE} -- JSON
note note
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end end