Refactor rename error_500_cms_response to internal_server_error_cms_response
Added bad_request_error_cms_response
Updated code example to use the new internal_server_error_cms_response instead of error_500_cms_response class.
Removed class error_500_cms_response.
Updated cms setup and configuration design:
Removed CMS_SETUP.configuration: CMS_CONFIGURATION
Removed CMS_CONFIGURATION and replaced it by using the configuration library.
Added CMS_DEFAULT_SETUP.configuration: CONFIG_READER
Addec CMS_SETUP.text_item (name): detachable READABLE_STRING_32 ...
in order to access option not publish by the CMS_SETUP interface.
Removed CMS_SERVICE.configuration: CMS_CONFIGURATION since it was not used.
Moved configuration library from eiffel-lang to cms libraries.
Fixed issue related to ini config when parsing from string content,
and also issue related to section included in file via @include.
Updated cms setup and configuration design:
Removed CMS_SETUP.configuration: CMS_CONFIGURATION
Removed CMS_CONFIGURATION and replaced it by using the configuration library.
Added CMS_DEFAULT_SETUP.configuration: CONFIG_READER
Addec CMS_SETUP.text_item (name): detachable READABLE_STRING_32 ...
in order to access option not publish by the CMS_SETUP interface.
Removed CMS_SERVICE.configuration: CMS_CONFIGURATION since it was not used.
Improved the email service and related.
This commit is contained in:
121
library/configuration/src/config_reader.e
Normal file
121
library/configuration/src/config_reader.e
Normal file
@@ -0,0 +1,121 @@
|
||||
note
|
||||
description: "Summary description for {CONFIG_READER}."
|
||||
author: ""
|
||||
date: "$Date: 2014-12-18 12:37:11 -0300 (ju. 18 de dic. de 2014) $"
|
||||
revision: "$Revision: 96383 $"
|
||||
|
||||
deferred class
|
||||
CONFIG_READER
|
||||
|
||||
inherit
|
||||
SHARED_EXECUTION_ENVIRONMENT
|
||||
|
||||
feature -- Status report
|
||||
|
||||
has_item (k: READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- Has item associated with key `k'?
|
||||
deferred
|
||||
end
|
||||
|
||||
has_error: BOOLEAN
|
||||
-- Has error?
|
||||
--| Syntax error, source not found, ...
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
resolved_text_item (k: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
-- String item associated with key `k' and expanded to resolved variables ${varname}.
|
||||
do
|
||||
if attached text_item (k) as s then
|
||||
Result := resolved_expression (s)
|
||||
end
|
||||
end
|
||||
|
||||
text_item (k: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
-- String item associated with key `k'.
|
||||
deferred
|
||||
end
|
||||
|
||||
integer_item (k: READABLE_STRING_GENERAL): INTEGER
|
||||
-- Integer item associated with key `k'.
|
||||
deferred
|
||||
ensure
|
||||
not has_item (k) implies Result = 0
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
resolved_items: detachable STRING_TABLE [READABLE_STRING_32]
|
||||
-- Resolved items indexed by expression.
|
||||
|
||||
resolved_expression (exp: READABLE_STRING_GENERAL): STRING_32
|
||||
-- Resolved `exp' using `Current' or else environment variables.
|
||||
local
|
||||
i,n,b,e: INTEGER
|
||||
k: detachable READABLE_STRING_GENERAL
|
||||
c: CHARACTER_32
|
||||
l_resolved_items: like resolved_items
|
||||
l_text: detachable READABLE_STRING_GENERAL
|
||||
do
|
||||
from
|
||||
i := 1
|
||||
n := exp.count
|
||||
create Result.make (n)
|
||||
until
|
||||
i > n
|
||||
loop
|
||||
c := exp[i]
|
||||
if i + 1 < n and then c = '$' and then exp[i+1] = '{' then
|
||||
b := i + 2
|
||||
e := exp.index_of ('}', b) - 1
|
||||
if e > 0 then
|
||||
k := exp.substring (b, e)
|
||||
l_text := Void
|
||||
l_resolved_items := resolved_items
|
||||
if
|
||||
l_resolved_items /= Void and then
|
||||
attached l_resolved_items.item (k) as s
|
||||
then
|
||||
-- Already resolved, reuse value.
|
||||
l_text := s
|
||||
elseif attached text_item (k) as s then
|
||||
-- has such item
|
||||
l_text := s
|
||||
elseif attached execution_environment.item (k) as v then
|
||||
-- Or from environment
|
||||
l_text := v
|
||||
else
|
||||
l_text := exp.substring (i, e + 1)
|
||||
end
|
||||
i := e + 1
|
||||
Result.append_string_general (l_text)
|
||||
else
|
||||
Result.extend (c)
|
||||
end
|
||||
else
|
||||
Result.extend (c)
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Duplication
|
||||
|
||||
sub_config (k: READABLE_STRING_GENERAL): detachable CONFIG_READER
|
||||
-- Configuration representing a subset of Current for key `k'.
|
||||
deferred
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
Reference in New Issue
Block a user