"
- mesg.set_body (s)
- --| We should html encode this name
- --| but to keep the example simple, we don't do that for now.
- else
- --| Otherwise, ask for name
- s := (create {HTML_ENCODER}).encoded_string ({STRING_32} "Hello / ahoj / नमस्ते / Ciào / مرحبا / Hola / 你好 / Hallo / Selam / Bonjour ")
- s.append ("[
-
-
-
-
- ]"
- )
- mesg.set_body (s)
- end
- res.send (mesg)
- end
-
-feature {NONE} -- Initialization
-
- initialize
- do
- --| The following line is to be able to load options from the file ewf.ini
- create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file ("ewf.ini")
-
- --| If you don't need any custom options, you are not obliged to redefine `initialize'
- Precursor
-
- --| Initialize router
- initialize_router
- end
-
-end
diff --git a/tools/ise_wizard/resources/ewf_application.e b/tools/ise_wizard/resources/ewf_application.e
deleted file mode 100644
index 929cd433..00000000
--- a/tools/ise_wizard/resources/ewf_application.e
+++ /dev/null
@@ -1,47 +0,0 @@
-note
- description: "[
- This class implements the web service
-
- It inherits from WSF_DEFAULT_SERVICE to get default EWF connector ready
- It just implements `execute'
-
- `initialize' can be redefine to provide custom options if needed.
- ]"
-
-class
- EWF_APPLICATION
-
-inherit
- WSF_DEFAULT_SERVICE
- redefine
- initialize
- end
-
-create
- make_and_launch
-
-feature -- Execution
-
- execute (req: WSF_REQUEST; res: WSF_RESPONSE)
- -- Default request handler if no other are relevant
- local
- mesg: WSF_HTML_PAGE_RESPONSE
- do
- create mesg.make
- mesg.set_title ("Hello World!")
- mesg.set_body ("
Hello World!
")
- res.send (mesg)
- end
-
-feature {NONE} -- Initialization
-
- initialize
- do
- --| The following line is to be able to load options from the file ewf.ini
- create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file ("ewf.ini")
-
- --| If you don't need any custom options, you are not obliged to redefine `initialize'
- Precursor
- end
-
-end
diff --git a/tools/ise_wizard/resources/template.ecf b/tools/ise_wizard/resources/template.ecf
deleted file mode 100644
index 85c46659..00000000
--- a/tools/ise_wizard/resources/template.ecf
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
- /EIFGENs$
- /CVS$
- /.svn$
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tools/ise_wizard/ewf.dsc b/tools/ise_wizard/rootdir/ewf.dsc
similarity index 100%
rename from tools/ise_wizard/ewf.dsc
rename to tools/ise_wizard/rootdir/ewf.dsc
diff --git a/tools/ise_wizard/rootdir/resources/${APP_NAME}-safe.ecf b/tools/ise_wizard/rootdir/resources/${APP_NAME}-safe.ecf
new file mode 100644
index 00000000..f30460a5
--- /dev/null
+++ b/tools/ise_wizard/rootdir/resources/${APP_NAME}-safe.ecf
@@ -0,0 +1,63 @@
+
+
+
+
+ /EIFGENs$
+ /CVS$
+ /.svn$
+
+
+
+
+
+
+
+
+ {if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}{/if}
+ {if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}{/if}
+ {if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{/if}
+
+
+ /default$
+
+
+
+
+{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}
+
+
+
+
+
+ /any$
+
+
+
+ {/if}
+{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}
+
+
+
+
+
+ /any$
+
+
+
+ {/if}
+{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}
+
+
+
+
+
+ /any$
+
+
+
+ {/if}
+
+
+
diff --git a/tools/ise_wizard/rootdir/resources/_vars.e b/tools/ise_wizard/rootdir/resources/_vars.e
new file mode 100644
index 00000000..052e9854
--- /dev/null
+++ b/tools/ise_wizard/rootdir/resources/_vars.e
@@ -0,0 +1,6 @@
+Wizard data values:
+{foreach key="k" item="v" from="$WIZ"}
+ + Page #{$k/}
+ {foreach key="pk" item="pv" from="$v"}- {$pk/}={$pv/}
+ {/foreach}
+{/foreach}
diff --git a/tools/ise_wizard/rootdir/resources/ewf.ini b/tools/ise_wizard/rootdir/resources/ewf.ini
new file mode 100644
index 00000000..ab5f2498
--- /dev/null
+++ b/tools/ise_wizard/rootdir/resources/ewf.ini
@@ -0,0 +1,4 @@
+# For nino connector, use port {$WIZ.standalone_connector.port/}
+port={$WIZ.standalone_connector.port/}
+
+#verbose=true
diff --git a/tools/ise_wizard/rootdir/resources/launcher/any/application_launcher_i.e b/tools/ise_wizard/rootdir/resources/launcher/any/application_launcher_i.e
new file mode 100644
index 00000000..58f5e2ba
--- /dev/null
+++ b/tools/ise_wizard/rootdir/resources/launcher/any/application_launcher_i.e
@@ -0,0 +1,84 @@
+note
+ description: "[
+ Specific application launcher
+
+ DO NOT EDIT THIS CLASS
+
+ you can customize APPLICATION_LAUNCHER
+ ]"
+ date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
+ revision: "$Revision: 36 $"
+
+deferred class
+ APPLICATION_LAUNCHER_I
+
+feature -- Execution
+
+ launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
+ -- Launch Web Server Application using `a_service' and optionals `opts'.
+ local
+ l_id: like launcher_id
+ launcher: WSF_SERVICE_LAUNCHER
+ do
+ l_id := launcher_id
+ if l_id = Void then
+{unless condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
+ io.error.put_string ("Application launcher not found!%N")
+ (create {EXCEPTIONS}).die (-1){/literal}{/unless}
+{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
+ -- Choose a default -> standalone
+ create {WSF_NINO_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
+{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}{literal}
+ elseif is_libfcgi_launcher_id (l_id) then
+ create {WSF_LIBFCGI_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
+{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}{literal}
+ elseif is_cgi_launcher_id (l_id) then
+ create {WSF_CGI_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
+{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
+ elseif is_nino_launcher_id (l_id) then
+ create {WSF_NINO_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
+{literal}
+ else
+ io.error.put_string ("Application launcher not found!%N")
+ (create {EXCEPTIONS}).die (-1)
+ end
+ end
+
+ launcher_id: detachable READABLE_STRING_GENERAL
+ -- Launcher id based on the executable extension name if any.
+ -- This can be redefine to customize for your application.
+ --| ex: nino, cgi, libfcgi or Void.
+ local
+ sh_exec: SHARED_EXECUTION_ENVIRONMENT
+ do
+ create sh_exec
+ if attached (create {PATH}.make_from_string (sh_exec.execution_environment.arguments.command_name)).extension as ext then
+ Result := ext
+ end
+ end
+
+feature -- Status report
+{/literal}
+{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}
+ is_nino_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
+ do
+ Result := a_id.is_case_insensitive ("nino")
+ or a_id.is_case_insensitive ("standalone")
+ end{/if}
+
+{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}
+ is_cgi_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
+ do
+ Result := a_id.is_case_insensitive ("cgi")
+ end{/if}
+
+{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}
+ is_libfcgi_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
+ do
+ Result := a_id.is_case_insensitive ("libfcgi")
+ or a_id.is_case_insensitive ("fcgi")
+ end{/if}
+
+
+end
+
diff --git a/tools/ise_wizard/rootdir/resources/launcher/application_launcher.e b/tools/ise_wizard/rootdir/resources/launcher/application_launcher.e
new file mode 100644
index 00000000..7754546d
--- /dev/null
+++ b/tools/ise_wizard/rootdir/resources/launcher/application_launcher.e
@@ -0,0 +1,18 @@
+note
+ description: "[
+ Effective class for APPLICATION_LAUNCHER_I
+
+ You can put modification in this class
+ ]"
+ date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
+ revision: "$Revision: 36 $"
+
+class
+ APPLICATION_LAUNCHER
+
+inherit
+ APPLICATION_LAUNCHER_I
+
+feature -- Custom
+
+end
diff --git a/tools/ise_wizard/rootdir/resources/launcher/default/application_launcher_i.e b/tools/ise_wizard/rootdir/resources/launcher/default/application_launcher_i.e
new file mode 100644
index 00000000..03bd497b
--- /dev/null
+++ b/tools/ise_wizard/rootdir/resources/launcher/default/application_launcher_i.e
@@ -0,0 +1,32 @@
+note
+ description: "[
+ Specific application launcher
+
+ DO NOT EDIT THIS CLASS
+
+ you can customize APPLICATION_LAUNCHER
+ ]"
+ date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
+ revision: "$Revision: 36 $"
+
+deferred class
+ APPLICATION_LAUNCHER_I
+
+feature -- Execution
+
+ launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
+ -- Launch Web Server Application using `a_service' and optionals `opts'.
+ local
+ launcher: WSF_SERVICE_LAUNCHER
+ do
+{literal}
+ create {WSF_DEFAULT_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}
+ end
+
+ launcher_id: detachable READABLE_STRING_GENERAL
+ do
+ -- Not used for default connector selection.
+ end
+
+end
+
diff --git a/tools/ise_wizard/rootdir/resources/src/${APP_ROOT}.e b/tools/ise_wizard/rootdir/resources/src/${APP_ROOT}.e
new file mode 100644
index 00000000..75792d57
--- /dev/null
+++ b/tools/ise_wizard/rootdir/resources/src/${APP_ROOT}.e
@@ -0,0 +1,55 @@
+note
+ description: "[
+ application service
+ ]"
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ {if isset="$APP_ROOT"}{$APP_ROOT/}{/if}
+ {unless isset="$APP_ROOT"}APPLICATION{/unless}
+
+inherit
+ WSF_LAUNCHABLE_SERVICE
+ redefine
+ initialize
+ end
+{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}
+ WSF_ROUTED_SERVICE{/if}
+
+ APPLICATION_LAUNCHER
+
+{literal}create
+ make_and_launch
+
+feature {NONE} -- Initialization
+{/literal}
+ initialize
+ -- Initialize current service.
+ do
+ Precursor
+ set_service_option ("port", {$WIZ.standalone_connector.port/})
+{unless condition="$WIZ.routers.use_router ~ $WIZ_YES"}
+ end
+
+feature -- Execution
+
+ execute (req: WSF_REQUEST; res: WSF_RESPONSE)
+ do
+ end{/unless}
+{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}{literal}
+ initialize_router
+ end
+
+ setup_router
+ -- Setup `router'
+ local
+ fhdl: WSF_FILE_SYSTEM_HANDLER
+ do
+ router.handle_with_request_methods ("/doc", create {WSF_ROUTER_SELF_DOCUMENTATION_HANDLER}.make (router), router.methods_GET)
+ create fhdl.make_hidden ("www")
+ fhdl.set_directory_index (<<"index.html">>)
+ router.handle_with_request_methods ("", fhdl, router.methods_GET)
+ end{/literal}{/if}
+
+end
diff --git a/tools/ise_wizard/rootdir/resources/www/index.html b/tools/ise_wizard/rootdir/resources/www/index.html
new file mode 100644
index 00000000..a3a7019e
--- /dev/null
+++ b/tools/ise_wizard/rootdir/resources/www/index.html
@@ -0,0 +1 @@
+Hello Eiffel Web Application!
diff --git a/tools/ise_wizard/custom/ewf.dsc b/tools/ise_wizard/rootdir_custom/ewf.dsc
similarity index 100%
rename from tools/ise_wizard/custom/ewf.dsc
rename to tools/ise_wizard/rootdir_custom/ewf.dsc
diff --git a/tools/ise_wizard/custom/resources/template.ecf b/tools/ise_wizard/rootdir_custom/resources/template.ecf
similarity index 100%
rename from tools/ise_wizard/custom/resources/template.ecf
rename to tools/ise_wizard/rootdir_custom/resources/template.ecf
diff --git a/tools/ise_wizard/src/console/ewf_console_wizard_application.e b/tools/ise_wizard/src/console/ewf_console_wizard_application.e
new file mode 100644
index 00000000..ce77e19b
--- /dev/null
+++ b/tools/ise_wizard/src/console/ewf_console_wizard_application.e
@@ -0,0 +1,34 @@
+note
+ description : "Objects that ..."
+ author : "$Author$"
+ date : "$Date$"
+ revision : "$Revision$"
+
+class
+ EWF_CONSOLE_WIZARD_APPLICATION
+
+inherit
+ CONSOLE_WIZARD_APPLICATION
+
+ SHARED_EXECUTION_ENVIRONMENT
+
+create
+ make
+
+feature {NONE} -- Initialization
+
+ make
+ -- Initialize `Current'.
+ do
+ initialize
+ on_start
+ end
+
+feature {NONE} -- Initialization
+
+ new_wizard: EWF_WIZARD
+ do
+ create Result.make (Current)
+ end
+
+end
diff --git a/tools/ise_wizard/src/ewf_custom_wizard.e b/tools/ise_wizard/src/ewf_custom_wizard.e
deleted file mode 100644
index 4141da07..00000000
--- a/tools/ise_wizard/src/ewf_custom_wizard.e
+++ /dev/null
@@ -1,55 +0,0 @@
-note
- description : "Objects that ..."
- author : "$Author$"
- date : "$Date$"
- revision : "$Revision$"
-
-class
- EWF_CUSTOM_WIZARD
-
-inherit
- EWF_WIZARD
- redefine
- get_information,
- generate_project
- end
-
-create
- make
-
-feature -- Form
-
- get_information
- do
- if attached string_question ("Location of EWF source code (by default $EWF_DIR)?", Void, Void, False) as pn then
- ewf_dir := pn.string
- else
- ewf_dir := "$EWF_DIR"
- end
- Precursor
- end
-
-feature -- Generation
-
- generate_project (a_layout: WIZARD_LAYOUT)
- do
- if attached ewf_dir as d then
- variables.force (d, "EWF_DIR")
- Precursor (a_layout)
- else
- die (-1)
- end
- end
-
-feature -- Access
-
- ewf_dir: detachable READABLE_STRING_8
-
-feature -- Change
-
-feature {NONE} -- Implementation
-
-invariant
--- invariant_clause: True
-
-end
diff --git a/tools/ise_wizard/src/ewf_wizard.e b/tools/ise_wizard/src/ewf_wizard.e
index 09bcdd21..670207b2 100644
--- a/tools/ise_wizard/src/ewf_wizard.e
+++ b/tools/ise_wizard/src/ewf_wizard.e
@@ -1,8 +1,8 @@
note
- description : "Objects that ..."
- author : "$Author$"
- date : "$Date$"
- revision : "$Revision$"
+ description: "Summary description for {EWF_WIZARD}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
class
EWF_WIZARD
@@ -13,150 +13,198 @@ inherit
create
make
-feature {NONE} -- Initialization
-
- make
- -- Initialize `Current'.
- do
- initialize
- get_information
- if is_valid and attached layout as lay then
- generate_project (lay)
- end
- end
-
feature -- Access
- project_directory_name: detachable READABLE_STRING_8
+ title: STRING_32 = "Web Application Wizard"
- projet_name: detachable READABLE_STRING_8
+feature -- Factory
- use_router: BOOLEAN
-
- router_type: detachable READABLE_STRING_8
-
- connector: detachable READABLE_STRING_8
-
-feature -- Form
-
- get_information
- local
- e: EXECUTION_ENVIRONMENT
+ wizard_generator : EWF_WIZARD_GENERATOR
do
- create e
- project_directory_name := e.get ("ISE_PROJECTS")
- if
- attached project_directory_name as pdn and then
- attached string_question ("Project directory (default=" + pdn + ")? ", <<["q", Void]>>, pdn, False) as r_pdn
- then
- project_directory_name := r_pdn.string
- elseif attached string_question ("Project directory ? ", <<["q", Void]>>, Void, False) as r_pdn then
- project_directory_name := r_pdn.string
- end
- if project_directory_name = Void then
- die (-1)
- end
-
- if attached string_question ("Project name ? ", Void, Void, False) as pn then
- projet_name := pn.string
- else
- projet_name := "ewf"
- end
-
- if boolean_question ("Do you want to use WSF_ROUTER (Y|n) ? ", <<["y", True], ["Y", True]>>, "Y") then
- use_router := True
- router_type := "uri-template"
- else
- use_router := False
- end
-
- if attached string_question ("[
- Default connector ?
- 1 - Eiffel Web Nino (standalone web server)
- 2 - CGI application (requires to setup httpd server)
- 3 - libFCGI application (requires to setup httpd server)
- Your choice:
- ]", <<["1", "nino"], ["2", "cgi"], ["3", "libfcgi"]>>, "1", True) as conn
- then
- connector := conn
- else
- connector := "nino"
- end
+ create Result.make (Current)
end
- is_valid: BOOLEAN
- do
- Result := project_directory_name /= Void and projet_name /= Void
+feature -- Pages
+
+ first_page: WIZARD_PAGE
+ once
+ Result := new_page ("first")
+ Result.set_title ("Web Application Wizard")
+ Result.set_subtitle ("Based on the EWF libraries...")
+ Result.add_section_text ("Create Web server application with EWF.")
+ Result.add_text ("[
+
+Using the Eiffel Web Framework (EWF), the generated application
+will run on any platforms.
+Depending on the connector(s), you may need to use a
+third-party httpd server (such as apache, nginx, ...)
+
+ ]")
end
- generate_project (a_layout: WIZARD_LAYOUT)
- require
- is_valid
+ project_page: WIZARD_PAGE
+ once
+ Result := new_page ("project")
+ Result.set_title ("Project Name and Project Location")
+ Result.set_subtitle ("You can choose the name of the project and%Nthe directory where the project will be generated.")
+ Result.add_text ("[
+Please fill in:
+ The name of the project (without space).
+ The directory where you want the eiffel classes to be generated.
+ ]")
+ Result.extend (Result.new_string_question ("Project name:", "name", "ASCII name, without space"))
+ Result.add_directory_question ("Project location:", "location", "Valid directory path, it will be created if missing")
+
+ Result.data.force ("ewf_app", "name")
+ Result.data.force (application.available_directory_path ("ewf_app", application.layout.default_projects_location.extended ("ewf")).name, "location")
+
+ Result.set_validation (agent (a_page: WIZARD_PAGE)
+ do
+ if
+ not attached a_page.data.item ("name") as l_name
+ or else l_name.is_whitespace
+ then
+ a_page.report_error ("Invalid value for `name'!")
+ end
+ if not a_page.data.has ("location") then
+ a_page.report_error ("Missing value for `location'!")
+ end
+ end)
+ end
+
+ connectors_page: WIZARD_PAGE
+ once
+ Result := new_page ("connectors")
+ Result.set_title ("Connectors selection")
+ Result.set_subtitle ("You can choose one or multiple connectors%Nto use as the same time.")
+ Result.add_text ("[
+Web application runs on top of connectors
+(i.e layer handling httpd incoming connections)
+
+Select connectors you want to support:
+ ]")
+ Result.add_boolean_question ("Standalone", "use_standalone", "Using the Eiffel Web nino server")
+ Result.add_boolean_question ("CGI", "use_cgi", "Require a httpd server")
+ Result.add_boolean_question ("libFCGI", "use_libfcgi", "Require a httpd server")
+
+ Result.data.force ("yes", "use_standalone")
+ Result.data.force ("yes", "use_cgi")
+ Result.data.force ("yes", "use_libfcgi")
+ end
+
+ standalone_connector_page: WIZARD_PAGE
+ once
+ Result := new_page ("standalone_connector")
+ Result.set_title ("Standalone (nino) connector")
+ Result.set_subtitle ("Set options .")
+ Result.add_integer_question ("Port number", "port", "It happens port 80 is already taken, thus choose another one.")
+ Result.add_boolean_question ("Verbose", "verbose", "Verbose output")
+
+ Result.data.force ("80", "port")
+ Result.data.force ("no", "verbose")
+ end
+
+ routers_page: WIZARD_PAGE
+ once
+ Result := new_page ("routers")
+ Result.set_title ("Use Router (URL dispatching)")
+ Result.set_subtitle ("Use the router component to easily map url patterns to handlers.")
+ Result.add_text ("[
+Use the router component to easily map URL patterns to handlers:
+ ]")
+ Result.add_boolean_question ("use the router component", "use_router", "Check generated code to see how to configure it.")
+
+ Result.data.force ("yes", "use_router")
+ end
+
+ final_page: WIZARD_PAGE
local
- d: DIRECTORY
- dn: DIRECTORY_NAME
- tfn: FILE_NAME
- res: WIZARD_SUCCEED_RESPONSE
+-- s,sv: STRING_32
+-- l_settings: ARRAYED_LIST [TUPLE [title: READABLE_STRING_GENERAL; value: READABLE_STRING_GENERAL]]
+-- l_project_settings: STRING_32
+-- l_ewf_settings: STRING_32
+ txt1, txt2: WIZARD_PAGE_TEXT_ITEM
+ once
+ Result := new_page ("final")
+ Result.set_title ("Completing the New Web Application Wizard")
+ Result.add_text ("You have specified the following settings:%N%N")
+ txt1 := Result.new_fixed_size_text_item ("...")
+-- Result.add_fixed_size_text ("...", "projects_settings")
+ Result.extend (txt1)
+
+ txt2 := Result.new_fixed_size_text_item ("...")
+-- Result.add_fixed_size_text ("...", "ewf_settings")
+ Result.extend (txt2)
+
+ Result.update_actions.extend (agent (a_page: WIZARD_PAGE; a_txt1, a_txt2: WIZARD_PAGE_TEXT_ITEM)
+ local
+ sv: STRING_32
+ l_settings: ARRAYED_LIST [TUPLE [title: READABLE_STRING_GENERAL; value: READABLE_STRING_GENERAL]]
+ do
+ -- Project
+ create l_settings.make (10)
+ if attached project_page.field_value ("name") as l_project_name then
+ l_settings.force (["Project name", l_project_name])
+ end
+ if attached project_page.field_value ("location") as l_project_location then
+ l_settings.force (["Location", l_project_location])
+ end
+ a_txt1.set_text (formatted_title_value_items (l_settings))
+
+ -- EWF
+ create l_settings.make (5)
+ create sv.make_empty
+ if connectors_page.boolean_field_value ("use_standalone") then
+ if not sv.is_empty then
+ sv.append (", ")
+ end
+ sv.append ("standalone")
+ end
+ if connectors_page.boolean_field_value ("use_cgi") then
+ if not sv.is_empty then
+ sv.append (", ")
+ end
+ sv.append ("cgi")
+ end
+ if connectors_page.boolean_field_value ("use_libfcgi") then
+ if not sv.is_empty then
+ sv.append (", ")
+ end
+ sv.append ("libfcgi")
+ end
+
+ l_settings.force (["Connectors", sv])
+
+ if routers_page.boolean_field_value ("use_router") then
+ l_settings.force (["Use Router", "yes"])
+ end
+
+ a_txt2.set_text (formatted_title_value_items (l_settings))
+ end(Result, txt1, txt2))
+ end
+
+feature -- Events
+
+ next_page (a_current_page: detachable WIZARD_PAGE): WIZARD_PAGE
do
- if attached project_directory_name as pdn then
- if attached projet_name as pn then
- variables.force (pn, "TARGET_NAME")
- variables.force (new_uuid, "UUID")
- variables.force ("none", "CONCURRENCY")
- if attached connector as conn then
- variables.force (conn, "EWF_CONNECTOR")
- end
- variables.force ("9999", "EWF_NINO_PORT")
-
- create dn.make_from_string (pdn)
- dn.extend (pn)
- create d.make (dn.string)
- if not d.exists then
- d.recursive_create_dir
- end
- create tfn.make_from_string (dn.string)
- tfn.set_file_name (pn)
- tfn.add_extension ("ecf")
- copy_resource_template ("template.ecf", tfn.string)
-
- create res.make (tfn.string, d.name)
-
- create tfn.make_from_string (dn.string)
-
- tfn.set_file_name ("ewf")
- tfn.add_extension ("ini")
- copy_resource_template ("ewf.ini", tfn.string)
-
- create dn.make_from_string (pdn)
- dn.extend (pn)
- dn.extend ("src")
- create d.make (dn.string)
- if not d.exists then
- d.recursive_create_dir
- end
- create tfn.make_from_string (dn.string)
- tfn.set_file_name ("ewf_application")
- tfn.add_extension ("e")
- if attached router_type as rt then
- check rt.same_string ("uri-template") end
- copy_resource_template ("ewf_application-"+ rt +".e", tfn.string)
- else
- copy_resource_template ("ewf_application.e", tfn.string)
- end
-
-
- send_response (res)
+ Result := notfound_page
+ if a_current_page = Void then
+ Result := first_page
+ elseif a_current_page = first_page then
+ Result := project_page
+ elseif a_current_page = project_page then
+ Result := connectors_page
+ elseif a_current_page = connectors_page then
+ if connectors_page.boolean_field_value ("use_standalone") then
+ Result := standalone_connector_page
+ else
+ Result := routers_page
end
+ elseif a_current_page = standalone_connector_page then
+ Result := routers_page
+ elseif a_current_page = routers_page then
+ Result := final_page
end
end
-feature -- Output
-
-
-
-feature {NONE} -- Implementation
-
-invariant
--- invariant_clause: True
-
end
diff --git a/tools/ise_wizard/src/ewf_wizard_generator.e b/tools/ise_wizard/src/ewf_wizard_generator.e
new file mode 100644
index 00000000..2f20d0cb
--- /dev/null
+++ b/tools/ise_wizard/src/ewf_wizard_generator.e
@@ -0,0 +1,136 @@
+note
+ description: "Summary description for {EWF_WIZARD_GENERATOR}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ EWF_WIZARD_GENERATOR
+
+inherit
+ WIZARD_GENERATOR
+ redefine
+ copy_template
+ end
+
+ SHARED_TEMPLATE_CONTEXT
+
+create
+ make
+
+feature -- Query
+
+ collection: detachable WIZARD_DATA
+
+feature -- Execution
+
+ execute (a_collection: WIZARD_DATA)
+ local
+ d: DIRECTORY
+ pdn, dn: PATH
+ tfn: PATH
+ res: WIZARD_SUCCEED_RESPONSE
+-- k: STRING_32
+ do
+ collection := a_collection
+ if
+ attached a_collection.item ("project:name") as pn and
+ attached a_collection.item ("project:location") as l_loc
+ then
+ create pdn.make_from_string (l_loc)
+
+ variables.force (pn.as_lower, "APP_NAME")
+ variables.force (pn.as_upper, "APP_ROOT")
+ variables.force (new_uuid, "UUID")
+ variables.force ("none", "CONCURRENCY")
+
+ variables.force ("yes", "WIZ_YES")
+ variables.force ("no", "WIZ_NO")
+
+ dn := pdn
+ create d.make_with_path (dn)
+ if not d.exists then
+ d.recursive_create_dir
+ end
+
+ recursive_copy_templates (application.layout.resources_location, dn)
+
+ tfn := dn.extended (pn).appended_with_extension ("ecf")
+ create res.make (tfn, d.path)
+
+ send_response (res)
+ else
+ send_response (create {WIZARD_FAILED_RESPONSE})
+ end
+ end
+
+feature -- Templates
+
+ smarty_template_extensions: ARRAY [READABLE_STRING_32]
+ once
+ Result := <<"e", "ecf", "ini">>
+ end
+
+ is_smarty_template_file (f: PATH): BOOLEAN
+ do
+ if attached f.extension as ext then
+ Result := across smarty_template_extensions as ext_ic some ext_ic.item.is_case_insensitive_equal_general (ext) end
+ end
+ end
+
+ is_template_file (f: PATH): BOOLEAN
+ do
+ Result := is_smarty_template_file (f)
+ end
+
+ copy_template (a_src: PATH; a_target: PATH)
+ do
+ if is_smarty_template_file (a_src) then
+ copy_smarty_template (a_src, a_target)
+ else
+ Precursor (a_src, a_target)
+ end
+ end
+
+ copy_smarty_template (a_res: PATH; a_target: PATH)
+ local
+ tpl: TEMPLATE_FILE
+ f,t: PLAIN_TEXT_FILE
+ inspectors: ARRAYED_LIST [TEMPLATE_INSPECTOR]
+ do
+ create f.make_with_path (a_res)
+ if f.exists and f.is_readable then
+ create tpl.make_from_file (f.path.name)
+ if attached collection as l_collection then
+ tpl.add_value (l_collection, "WIZ")
+ end
+ across
+ variables as ic
+ loop
+ tpl.add_value (ic.item, ic.key)
+ end
+ template_context.set_template_folder (application.layout.templates_location)
+ create inspectors.make (2)
+ inspectors.force (create {WIZARD_DATA_TEMPLATE_INSPECTOR}.register ({detachable WIZARD_DATA}))
+ inspectors.force (create {WIZARD_PAGE_DATA_TEMPLATE_INSPECTOR}.register ({detachable WIZARD_PAGE_DATA}))
+ tpl.analyze
+ tpl.get_output
+ across
+ inspectors as ic
+ loop
+ ic.item.unregister
+ end
+ if attached tpl.output as l_output then
+ create t.make_with_path (a_target)
+ if not t.exists or else t.is_writable then
+ t.create_read_write
+ t.put_string (l_output)
+ t.close
+ end
+ else
+ copy_file (a_res, a_target)
+ end
+ end
+ end
+
+end
diff --git a/tools/ise_wizard/src/gui/ewf_graphical_wizard.e b/tools/ise_wizard/src/gui/ewf_graphical_wizard.e
new file mode 100644
index 00000000..4c801002
--- /dev/null
+++ b/tools/ise_wizard/src/gui/ewf_graphical_wizard.e
@@ -0,0 +1,46 @@
+note
+ description: "[
+ Objects that ...
+ ]"
+ author: "$Author$"
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ EWF_GRAPHICAL_WIZARD
+
+inherit
+ EV_APPLICATION
+
+ SHARED_EXECUTION_ENVIRONMENT
+ undefine
+ default_create, copy
+ end
+
+create
+ make_and_launch
+
+feature {NONE} -- Initialization
+
+ make_and_launch
+ local
+ w: like main_window
+ cons: EWF_CONSOLE_WIZARD_APPLICATION
+ do
+ default_create
+ if execution_environment.arguments.index_of_word_option ("-console") > 0 then
+ create cons.make
+ else
+ create w
+ main_window := w
+
+ w.show
+ launch
+ end
+ end
+
+feature {NONE} -- Implementation
+
+ main_window: detachable EWF_WIZARD_WINDOW
+
+end
diff --git a/tools/ise_wizard/src/gui/ewf_wizard_window.e b/tools/ise_wizard/src/gui/ewf_wizard_window.e
new file mode 100644
index 00000000..a8f965e1
--- /dev/null
+++ b/tools/ise_wizard/src/gui/ewf_wizard_window.e
@@ -0,0 +1,38 @@
+note
+ description: "Summary description for {EWF_WIZARD_WINDOW}."
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ EWF_WIZARD_WINDOW
+
+inherit
+ GRAPHICAL_WIZARD_WINDOW
+ redefine
+ side_bar_items
+ end
+
+feature {NONE} -- Initialization
+
+ new_wizard: EWF_WIZARD
+ do
+ create Result.make (Current)
+ end
+
+feature -- Access
+
+ side_bar_items (a_page: WIZARD_PAGE): ARRAYED_LIST [WIZARD_PAGE_ITEM]
+ local
+ lab: EV_LABEL
+ do
+ Result := Precursor (a_page)
+ if a_page.page_id.is_case_insensitive_equal_general ("first")
+ or a_page.page_id.is_case_insensitive_equal_general ("final")
+ then
+ create lab.make_with_text ("EWF")
+ lab.set_foreground_color (colors.white)
+ Result.extend (create {GRAPHICAL_WIZARD_PAGE_WIDGET}.make_with_widget (lab))
+ end
+ end
+
+end
diff --git a/tools/ise_wizard/src/lib/wizard.e b/tools/ise_wizard/src/lib/wizard.e
deleted file mode 100644
index cfc31333..00000000
--- a/tools/ise_wizard/src/lib/wizard.e
+++ /dev/null
@@ -1,265 +0,0 @@
-note
- description : "Objects that ..."
- author : "$Author$"
- date : "$Date$"
- revision : "$Revision$"
-
-deferred class
- WIZARD
-
-inherit
- ARGUMENTS
-
-feature {NONE} -- Initialization
-
- initialize
- -- Initialize `Current'.
- local
- i,n: INTEGER
- s: READABLE_STRING_8
- wizard_directory_name: detachable READABLE_STRING_8
- callback_file_name: detachable READABLE_STRING_8
- do
- create variables.make (5)
- n := argument_count
- if n > 0 then
- from
- i := 1
- until
- i > n
- loop
- s := argument (i)
- if s.same_string ("-callback") or s.same_string ("--callback") then
- i := i + 1
- if i <= n then
- callback_file_name := argument (i)
- end
- elseif wizard_directory_name = Void then
- wizard_directory_name := s
- else
- debug
- io.error.put_string ("Ignoring argument %"" + s + "%"%N")
- end
- end
- i := i + 1
- end
- end
- if wizard_directory_name = Void then
- display_usage (io.error)
- quit ("ERROR: Missing wizard directory name.")
- elseif callback_file_name = Void then
- display_usage (io.error)
- quit ("ERROR: Missing Eiffel Studio callback file name.")
- else
- create layout.make (wizard_directory_name, callback_file_name)
- end
- end
-
-feature -- Status
-
- display_usage (f: FILE)
- do
- f.put_string ("Usage: wizard {dirname} -callback {filename}%N")
- f.put_string (" -callback filename: file used to communicate back with Eiffel Studio%N")
- f.put_string (" dirname: folder containing the wizard resources, pixmaps, ...%N")
- end
-
- quit (m: detachable READABLE_STRING_8)
- do
- if m /= Void then
- io.error.put_string (m)
- end
- send_response (create {WIZARD_FAILED_RESPONSE})
- ensure
- False -- never reached
- end
-
- die (code: INTEGER)
- do
- (create {EXCEPTIONS}).die (code)
- end
-
-feature -- Access
-
- variables: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8]
-
- layout: detachable WIZARD_LAYOUT
-
-feature -- Response
-
- send_response (res: WIZARD_RESPONSE)
- local
- f: RAW_FILE
- do
- if attached layout as lay then
- create f.make (lay.callback_file_name)
- if not f.exists or else f.is_writable then
- f.open_write
- res.send (f)
- f.close
- else
- die (0)
- end
- else
- die (0)
- end
- end
-
-feature {NONE} -- Implementation
-
- boolean_question (m: READABLE_STRING_8; a_options: detachable ITERABLE [TUPLE [key: READABLE_STRING_8; value: BOOLEAN]]; def: detachable STRING_8): BOOLEAN
- local
- s: STRING_8
- l_answered: BOOLEAN
- l_options: detachable ITERABLE [TUPLE [key: READABLE_STRING_8; value: BOOLEAN]]
- do
- from
- until
- l_answered
- loop
- io.put_string (m)
- if l_options = Void then
- l_options := a_options
- end
- if l_options = Void then
- l_options := <<["y", True], ["Y", True]>>
- end
- io.read_line
- s := io.last_string
- s.left_adjust
- s.right_adjust
- if s.is_empty and def /= Void then
- s := def
- end
- if not s.is_empty then
- across
- l_options as o
- until
- l_answered
- loop
- if o.item.key.same_string (s) then
- l_answered := True
- Result := o.item.value
- end
- end
- if not l_answered then
- l_answered := True
- Result := False
- end
- end
- end
- end
-
- string_question (m: READABLE_STRING_8; a_options: detachable ITERABLE [TUPLE [key: READABLE_STRING_8; value: detachable READABLE_STRING_8]]; def: detachable READABLE_STRING_8; a_required_valid_option: BOOLEAN): detachable READABLE_STRING_8
- local
- s: STRING_8
- l_answered: BOOLEAN
- do
- from
- until
- l_answered
- loop
- io.put_string (m)
- io.read_line
- s := io.last_string
- s.left_adjust
- s.right_adjust
- if s.is_empty and def /= Void then
- s := def
- end
- if not s.is_empty then
- if a_options /= Void then
- across
- a_options as o
- until
- l_answered
- loop
- if o.item.key.same_string (s) then
- l_answered := True
- Result := o.item.value
- end
- end
- end
- if not l_answered then
- l_answered := True
- Result := s
- if
- a_required_valid_option and then
- a_options /= Void and then
- not across a_options as o some attached o.item.value as v and then Result.same_string (v) end
- then
- l_answered := False
- Result := Void
- end
- end
- end
- end
- end
-
- copy_file (a_src, a_target: READABLE_STRING_8)
- local
- f,t: RAW_FILE
- do
- create f.make (a_src)
- if f.exists and f.is_readable then
- create t.make (a_target)
- if not t.exists or else t.is_writable then
- f.open_read
- t.open_write
- f.copy_to (t)
- t.close
- f.close
- end
- end
- end
-
- new_uuid: STRING_8
- local
- gen: UUID_GENERATOR
- do
- create gen
- Result := gen.generate_uuid.out
- end
-
-feature -- Resources
-
- copy_resource (a_res: READABLE_STRING_8; a_target: READABLE_STRING_8)
- do
- if attached layout as lay then
- copy_file (lay.resource (a_res), a_target)
- end
- end
-
- copy_resource_template (a_res: READABLE_STRING_8; a_target: READABLE_STRING_8)
- local
- f,t: RAW_FILE
- do
- if attached layout as lay then
- create f.make (lay.resource (a_res))
- if f.exists and f.is_readable then
- create t.make (a_target)
- if not t.exists or else t.is_writable then
- f.open_read
- t.create_read_write
- from
- f.read_line
- until
- f.exhausted
- loop
- across
- variables as v
- loop
- f.last_string.replace_substring_all ("${WIZ:" + v.key + "}", v.item)
- end
- t.put_string (f.last_string)
- t.put_new_line
- f.read_line
- end
- t.close
- f.close
- end
- end
- end
- end
-
-end
diff --git a/tools/ise_wizard/src/lib/wizard_layout.e b/tools/ise_wizard/src/lib/wizard_layout.e
deleted file mode 100644
index 98ae0193..00000000
--- a/tools/ise_wizard/src/lib/wizard_layout.e
+++ /dev/null
@@ -1,49 +0,0 @@
-note
- description: "Summary description for {WIZARD_LAYOUT}."
- author: ""
- date: "$Date$"
- revision: "$Revision$"
-
-class
- WIZARD_LAYOUT
-
-create
- make
-
-feature {NONE} -- Initialization
-
- make (d: like wizard_directory_name; cb: like callback_file_name)
- do
- wizard_directory_name := d
- callback_file_name := cb
- end
-
-feature -- Access
-
- wizard_directory_name: READABLE_STRING_8
-
- resource (a_name: READABLE_STRING_8): STRING_8
- local
- fn: FILE_NAME
- do
- create fn.make_from_string (wizard_directory_name)
- fn.extend ("resources")
- fn.set_file_name (a_name)
- Result := fn.string
- end
-
- pixmap_png_filename (a_name: READABLE_STRING_8): STRING_8
- local
- fn: FILE_NAME
- do
- create fn.make_from_string (wizard_directory_name)
- fn.extend ("pixmaps")
- fn.set_file_name (a_name)
- fn.add_extension ("png")
- Result := fn.string
- end
-
- callback_file_name: READABLE_STRING_8
-
-invariant
-end
diff --git a/tools/ise_wizard/src/support/wizard_data_template_inspector.e b/tools/ise_wizard/src/support/wizard_data_template_inspector.e
new file mode 100644
index 00000000..7edb5287
--- /dev/null
+++ b/tools/ise_wizard/src/support/wizard_data_template_inspector.e
@@ -0,0 +1,46 @@
+note
+ description: "Summary description for {WIZARD_DATA_TEMPLATE_INSPECTOR}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ WIZARD_DATA_TEMPLATE_INSPECTOR
+
+inherit
+ TEMPLATE_INSPECTOR
+ redefine
+ internal_data
+ end
+
+create
+ register
+
+feature {TEMPLATE_ROUTINES}
+
+ internal_data (field_name: STRING; obj: detachable ANY): detachable CELL [detachable ANY]
+ -- Return object in a cell
+ -- If not handled by this inspector, return Void
+ local
+ l_fn: STRING
+ utf: UTF_CONVERTER
+ do
+ if attached {WIZARD_DATA} obj as wiz then
+ l_fn := field_name.as_lower
+ if attached wiz.page_data (l_fn) as v then
+ Result := cell_of (v)
+ end
+ end
+ 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
diff --git a/tools/ise_wizard/src/support/wizard_page_data_template_inspector.e b/tools/ise_wizard/src/support/wizard_page_data_template_inspector.e
new file mode 100644
index 00000000..d594b43c
--- /dev/null
+++ b/tools/ise_wizard/src/support/wizard_page_data_template_inspector.e
@@ -0,0 +1,45 @@
+note
+ description: "Summary description for {WIZARD_PAGE_DATA_TEMPLATE_INSPECTOR}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ WIZARD_PAGE_DATA_TEMPLATE_INSPECTOR
+
+inherit
+ TEMPLATE_INSPECTOR
+ redefine
+ internal_data
+ end
+
+create
+ register
+
+feature {TEMPLATE_ROUTINES}
+
+ internal_data (field_name: STRING; obj: detachable ANY): detachable CELL [detachable ANY]
+ -- Return object in a cell
+ -- If not handled by this inspector, return Void
+ local
+ l_fn: STRING
+ do
+ if attached {WIZARD_PAGE_DATA} obj as pg then
+ l_fn := field_name.as_lower
+ if attached pg.item (l_fn) as v then
+ Result := cell_of (v)
+ end
+ end
+ 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