Transcript Session

Migrating from Emacs to MDT®
Migrating Smallworld™ session
© 2011 ASTEC Sp. z o.o.
1
TOPICS
•
•
•
•
•
Essential concepts
Understanding Smallworld session
Running session in Emacs
Running session in MDT
Key to successful migration
© 2011 ASTEC Sp. z o.o.
2
ESSENTIAL CONCEPTS
•
•
•
•
•
Environment variables
Runtime
Session
IDE
Execution flow
© 2011 ASTEC Sp. z o.o.
3
Environment variables
• Set of dynamic named values that can affect the way
running process will behave
• Can be inherited and overriden while running another
process from its parent process
• It is important to know that variables can be set for
Runtime, Session and IDE level in different order and
therefore inheritance manner
© 2011 ASTEC Sp. z o.o.
4
Runtime
• Specifies common environment and behavior for running
dedicated processes (i.e. Session, IDE)
• Indicates location of Smallworld Core product installation
and its configuration files
• Generally speaking – Smallworld GIS installation
© 2011 ASTEC Sp. z o.o.
5
Session
• Process of running Smallworld image with the use of
dedicated executable appropriate for host operating
system (sw_magik_win32 or sw_magik_motif)
• Uses runtime and its environment to run an image
• Session executable can be run by other process and
therefore inherits its environment variables
• Generally speaking – sw_magik_win32.exe + image
© 2011 ASTEC Sp. z o.o.
6
IDE
• Development environment for running sessions
• Needs ”co-operation” with runtime to start the session
• Important thing to understand is how runtime is related to
IDE before starting session
© 2011 ASTEC Sp. z o.o.
7
Execution flow
• Possible order for setting up and using runtime, IDE and
session processes
• There are two general orders, which can be described as
follows:
o Setting up runtime, starting IDE on it and therefore
running chosen session (Emacs default)
o Starting IDE, setting up runtime and therefore running
chosen session on it (MDT default)
© 2011 ASTEC Sp. z o.o.
8
Execution flow
RUNTIME
Environment
Variables
IDE
Environment
Variables
SESSION
Environment
Variables
OR
© 2011 ASTEC Sp. z o.o.
IDE
Environment
Variables
RUNTIME
Environment
Variables
SESSION
Environment
Variables
9
UNDERSTANDING SMALLWORLD SESSION
• Most common configurations for starting session:
 Direct – sw_magik_win32.exe + image
 Alias – gis.exe + alias + environment.bat
 Complex – *.bat, *.cmd batch files
• As we can imagine, there is a lot of possible ways to set up
and run a session
• Let’s focus on the aforementioned…
© 2011 ASTEC Sp. z o.o.
10
UNDERSTANDING SMALLWORLD SESSION
Direct
 Runs image with the use of sw_magik_win32
executable and additional switches if necessary
 Easy to understand and maintain
 Example command line for starting session:
> sw_magik_win32.exe –image <image_file> [switches]
© 2011 ASTEC Sp. z o.o.
11
UNDERSTANDING SMALLWORLD SESSION
Alias
 Runs gis.exe application launcher, sets up additional
data (environment variables, switches , etc.) and at the
end runs image with sw_magik_win32 executable
 More complex and flexible than direct way
 Example command line for starting session:
> gis.exe –e <environment_file> -a <gis_aliases> alias
© 2011 ASTEC Sp. z o.o.
12
UNDERSTANDING SMALLWORLD SESSION
Complex
 Runs *.bat or *.cmd batch file which sets up a complex
environment and at the end runs Smallworld session
with the use of gis.exe or sw_magik_win32.exe
 Most flexible in comparison to previous ones
 Example command line for starting session:
> start_session.bat [switches]
© 2011 ASTEC Sp. z o.o.
13
RUNNING SESSION IN EMACS
• As it was mentioned before, gis.exe is an application
launcher so it can run any application
• After installing Smallworld, Emacs environment can be
started with the use of a shortcut that runs gis.exe and an
emacs alias
• What is important to know is that gis.exe uses
environment.bat file from Smallworld installation
configuration to set up RUNTIME before starting Emacs
© 2011 ASTEC Sp. z o.o.
14
RUNNING SESSION IN EMACS
• Sessions are being started in Emacs with the use of
console command line
• Let’s take a look how to run direct, alias and complex type
of session in Emacs and what is the simplified execution
flow…
© 2011 ASTEC Sp. z o.o.
15
RUNNING SESSION IN EMACS
Direct
 Emacs runs sw_magik_win32.exe and passes its
environment variables (so the RUNTIME data as well)
 Example command line for starting session:
> sw_magik_win32.exe –image <image_file> [switches]
© 2011 ASTEC Sp. z o.o.
16
RUNTIME
IDE
Run gis.exe
Run
sw_magik_win32.exe
SESSION
Interpret switches
and run image
Resolve environment
variables from
environment.bat
Run emacs.exe from
related alias
© 2011 ASTEC Sp. z o.o.
17
RUNNING SESSION IN EMACS
Alias
 Emacs runs gis.exe with alias for running session and
passes environment variables to it (so the RUNTIME
data as well)
 Example command line for starting session:
> gis.exe –e <environment_file> -a <gis_aliases> alias
© 2011 ASTEC Sp. z o.o.
18
RUNTIME
IDE
Run gis.exe
Run gis.exe
Resolve environment
variables from
environment.bat
SESSION
Resolve environment
variables from
environment.bat
Run
sw_magik_win32.exe
from related alias
Run emacs.exe from
related alias
Interpret switches
and run image
© 2011 ASTEC Sp. z o.o.
19
RUNNING SESSION IN EMACS
Complex
 Emacs runs *.bat or *.cmd batch file with some set of
switches for running session and passes environment
variables to it (so the RUNTIME data as well)
 Example command line for starting session:
> start_session.bat [switches]
© 2011 ASTEC Sp. z o.o.
20
RUNTIME
IDE
Run gis.exe
Run *.bat, *.cmd
Resolve environment
variables from
environment.bat
SESSION
Do all complex
processing (set
environment,
interpret switches,
commands, etc.)
Run
sw_magik_win32.exe
Run emacs.exe from
related alias
Interpret switches
and run image
© 2011 ASTEC Sp. z o.o.
21
RUNNING SESSION IN MDT
• MDT use sophisticated elements that describe and store
data about runtimes and sessions
 RUNTIME – specifies Smallworld installation,
configuration and environment variables
 SESSION – corresponds to “Direct” kind of session
 SESSION LINK – corresponds to “Alias” kind of session
 COMMAND LINE SESSION – corresponds to “Complex”
kind of session
© 2011 ASTEC Sp. z o.o.
22
RUNNING SESSION IN MDT
• As we probably noticed, RUNTIME is being created and
used after running MDT
• Having additional elements describing runtimes and
session in MDT gives user possibility to set up additional
levels of environment variables and easy way to change
connection between runtime and session
• Let’s take a look how to run direct, alias and complex type
of session in MDT and what is the simplified execution
flow…
© 2011 ASTEC Sp. z o.o.
23
RUNNING SESSION IN MDT
Direct
 MDT runs SESSION on associated RUNTIME what
corresponds to command line for starting session:
> sw_magik_win32.exe –image <image_file> [switches]
© 2011 ASTEC Sp. z o.o.
24
IDE
RUNTIME
SESSION
Run SESSION
component
Run cmd.exe
Interpret switches
and run image
Resolve environment
variables from
environment.bat
Run
sw_magik_win32.exe
© 2011 ASTEC Sp. z o.o.
25
RUNNING SESSION IN MDT
Alias
 MDT runs SESSION LINK on associated RUNTIME what
corresponds to command line for starting session:
> gis.exe –e <environment_file> -a <gis_aliases> alias
© 2011 ASTEC Sp. z o.o.
26
IDE
RUNTIME
Run SESSION LINK
component
Run cmd.exe
Resolve environment
variables from
environment.bat
Run gis.exe
© 2011 ASTEC Sp. z o.o.
SESSION
Resolve environment
variables from
environment.bat
Run
sw_magik_win32.exe
from related alias
Interpret switches
and run image
27
RUNNING SESSION IN MDT
Complex
 MDT runs COMMAND LINE SESSION on associated
RUNTIME what corresponds to command line for
starting session:
> start_session.bat [switches]
© 2011 ASTEC Sp. z o.o.
28
IDE
Run COMMAND LINE
SESSION component
RUNTIME
Run cmd.exe
Resolve environment
variables from
environment.bat
Run *.bat,*.cmd or
any *.exe
© 2011 ASTEC Sp. z o.o.
SESSION
Do all complex
processing (set
environment,
interpret switches,
commands, etc.)
Run
sw_magik_win32.exe
Interpret switches
and run image
29
RUNNING SESSION IN MDT
• There is also possibility to run MDT after setting up
RUNTIME, like it is for Emacs
• To do so, we have to create an alias for starting MDT
(reflect alias for starting Emacs)
• In this case we can start MDT with the use of dedicated
shortcut in the same way as it is for Emacs
• While running MDT in this way, we have to assign so called
DEFAULT runtime to a SESSION that we want to start
© 2011 ASTEC Sp. z o.o.
30
KEY TO SUCCESFUL MIGRATION
• After all, most important thing while migrating your
session configurations from Emacs is to know where you
have Runtime, IDE and Session parts
• Second thing is to know how all of the environment
variables are being resolved before starting session and to
which parts are they related
• At the end we have to establish which kind of session
(direct, alias or complex) we use and then create the
corresponding runtime and session in MDT
© 2011 ASTEC Sp. z o.o.
31
The End
© 2011 ASTEC Sp. z o.o.
32